urlmon: Fix buffer overflow in parse_canonicalize.
[wine.git] / dlls / urlmon / tests / uri.c
blobda5a739c4965a07b33d13058b155974e70f611e5
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 } uri_str_property;
120 typedef struct _uri_dword_property {
121 DWORD value;
122 HRESULT expected;
123 BOOL todo;
124 BOOL broken_combine_hres;
125 } uri_dword_property;
127 typedef struct _uri_properties {
128 const char* uri;
129 DWORD create_flags;
130 HRESULT create_expected;
131 BOOL create_todo;
133 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
134 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
135 } uri_properties;
137 static const uri_properties uri_tests[] = {
138 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
140 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
141 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
142 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
143 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
144 {"",S_FALSE,FALSE}, /* EXTENSION */
145 {"",S_FALSE,FALSE}, /* FRAGMENT */
146 {"www.winehq.org",S_OK,FALSE}, /* HOST */
147 {"",S_FALSE,FALSE}, /* PASSWORD */
148 {"/",S_OK,FALSE}, /* PATH */
149 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
150 {"",S_FALSE,FALSE}, /* QUERY */
151 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
152 {"http",S_OK,FALSE}, /* SCHEME_NAME */
153 {"",S_FALSE,FALSE}, /* USER_INFO */
154 {"",S_FALSE,FALSE} /* USER_NAME */
157 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
158 {80,S_OK,FALSE}, /* PORT */
159 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
160 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
163 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
165 {"http://winehq.org/tests",S_OK,FALSE},
166 {"winehq.org",S_OK,FALSE},
167 {"http://winehq.org/tests",S_OK,FALSE},
168 {"winehq.org",S_OK,FALSE},
169 {"",S_FALSE,FALSE},
170 {"",S_FALSE,FALSE},
171 {"winehq.org",S_OK,FALSE},
172 {"",S_FALSE,FALSE},
173 {"/tests",S_OK,FALSE},
174 {"/tests",S_OK,FALSE},
175 {"",S_FALSE,FALSE},
176 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
177 {"http",S_OK,FALSE},
178 {"",S_FALSE,FALSE},
179 {"",S_FALSE,FALSE}
182 {Uri_HOST_DNS,S_OK,FALSE},
183 {80,S_OK,FALSE},
184 {URL_SCHEME_HTTP,S_OK,FALSE},
185 {URLZONE_INVALID,E_NOTIMPL,FALSE}
188 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
190 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
191 {"www.winehq.org",S_OK,FALSE},
192 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
193 {"winehq.org",S_OK,FALSE},
194 {"",S_FALSE,FALSE},
195 {"",S_FALSE,FALSE},
196 {"www.winehq.org",S_OK,FALSE},
197 {"",S_FALSE,FALSE},
198 {"/",S_OK,FALSE},
199 {"/?query=x&return=y",S_OK,FALSE},
200 {"?query=x&return=y",S_OK,FALSE},
201 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
202 {"http",S_OK,FALSE},
203 {"",S_FALSE,FALSE},
204 {"",S_FALSE,FALSE}
207 {Uri_HOST_DNS,S_OK,FALSE},
208 {80,S_OK,FALSE},
209 {URL_SCHEME_HTTP,S_OK,FALSE},
210 {URLZONE_INVALID,E_NOTIMPL,FALSE},
213 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
215 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
216 {"www.winehq.org",S_OK,FALSE},
217 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
218 {"winehq.org",S_OK,FALSE},
219 {"",S_FALSE,FALSE},
220 {"",S_FALSE,FALSE},
221 {"www.winehq.org",S_OK,FALSE},
222 {"",S_FALSE,FALSE},
223 {"/",S_OK,FALSE},
224 {"/?query=x&return=y",S_OK,FALSE},
225 {"?query=x&return=y",S_OK,FALSE},
226 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
227 {"https",S_OK,FALSE},
228 {"",S_FALSE,FALSE},
229 {"",S_FALSE,FALSE}
232 {Uri_HOST_DNS,S_OK,FALSE},
233 {443,S_OK,FALSE},
234 {URL_SCHEME_HTTPS,S_OK,FALSE},
235 {URLZONE_INVALID,E_NOTIMPL,FALSE},
238 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
240 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
241 {"usEr%3Ainfo@example.com",S_OK,FALSE},
242 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
243 {"example.com",S_OK,FALSE},
244 {"",S_FALSE,FALSE},
245 {"",S_FALSE,FALSE},
246 {"example.com",S_OK,FALSE},
247 {"",S_FALSE,FALSE},
248 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
249 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
250 {"",S_FALSE,FALSE},
251 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
252 {"http",S_OK,FALSE},
253 {"usEr%3Ainfo",S_OK,FALSE},
254 {"usEr%3Ainfo",S_OK,FALSE}
257 {Uri_HOST_DNS,S_OK,FALSE},
258 {80,S_OK,FALSE},
259 {URL_SCHEME_HTTP,S_OK,FALSE},
260 {URLZONE_INVALID,E_NOTIMPL,FALSE},
263 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
265 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
266 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
267 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
268 {"winehq.org",S_OK,FALSE},
269 {".txt",S_OK,FALSE},
270 {"",S_FALSE,FALSE},
271 {"ftp.winehq.org",S_OK,FALSE},
272 {"wine",S_OK,FALSE},
273 {"/dir/foo%20bar.txt",S_OK,FALSE},
274 {"/dir/foo%20bar.txt",S_OK,FALSE},
275 {"",S_FALSE,FALSE},
276 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
277 {"ftp",S_OK,FALSE},
278 {"winepass:wine",S_OK,FALSE},
279 {"winepass",S_OK,FALSE}
282 {Uri_HOST_DNS,S_OK,FALSE},
283 {9999,S_OK,FALSE},
284 {URL_SCHEME_FTP,S_OK,FALSE},
285 {URLZONE_INVALID,E_NOTIMPL,FALSE}
288 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
290 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
291 {"",S_FALSE,FALSE},
292 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
293 {"",S_FALSE,FALSE},
294 {".mp3",S_OK,FALSE},
295 {"",S_FALSE,FALSE},
296 {"",S_FALSE,FALSE},
297 {"",S_FALSE,FALSE},
298 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
299 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
300 {"",S_FALSE,FALSE},
301 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
302 {"file",S_OK,FALSE},
303 {"",S_FALSE,FALSE},
304 {"",S_FALSE,FALSE}
307 {Uri_HOST_UNKNOWN,S_OK,FALSE},
308 {0,S_FALSE,FALSE},
309 {URL_SCHEME_FILE,S_OK,FALSE},
310 {URLZONE_INVALID,E_NOTIMPL,FALSE}
313 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
315 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
316 {"",S_FALSE,FALSE},
317 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
318 {"",S_FALSE,FALSE},
319 {".mp3",S_OK,FALSE},
320 {"",S_FALSE,FALSE},
321 {"",S_FALSE,FALSE},
322 {"",S_FALSE,FALSE},
323 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
324 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
325 {"",S_FALSE,FALSE},
326 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
327 {"file",S_OK,FALSE},
328 {"",S_FALSE,FALSE},
329 {"",S_FALSE,FALSE}
332 {Uri_HOST_UNKNOWN,S_OK,FALSE},
333 {0,S_FALSE,FALSE},
334 {URL_SCHEME_FILE,S_OK,FALSE},
335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
338 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
340 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
341 {"",S_FALSE,FALSE},
342 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
343 {"",S_FALSE,FALSE},
344 {".txt",S_OK,FALSE},
345 {"",S_FALSE,FALSE},
346 {"",S_FALSE,FALSE},
347 {"",S_FALSE,FALSE},
348 {"/tests/test%20file.README.txt",S_OK,FALSE},
349 {"/tests/test%20file.README.txt",S_OK,FALSE},
350 {"",S_FALSE,FALSE},
351 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
352 {"file",S_OK,FALSE},
353 {"",S_FALSE,FALSE},
354 {"",S_FALSE,FALSE}
357 {Uri_HOST_UNKNOWN,S_OK,FALSE},
358 {0,S_FALSE,FALSE},
359 {URL_SCHEME_FILE,S_OK,FALSE},
360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
363 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
365 {"file:///z:/test%20dir/README.txt",S_OK},
366 {"",S_FALSE},
367 {"file:///z:/test%20dir/README.txt",S_OK},
368 {"",S_FALSE},
369 {".txt",S_OK},
370 {"",S_FALSE},
371 {"",S_FALSE},
372 {"",S_FALSE},
373 {"/z:/test%20dir/README.txt",S_OK},
374 {"/z:/test%20dir/README.txt",S_OK},
375 {"",S_FALSE},
376 {"file:///z:/test dir/README.txt",S_OK},
377 {"file",S_OK},
378 {"",S_FALSE},
379 {"",S_FALSE}
382 {Uri_HOST_UNKNOWN,S_OK,FALSE},
383 {0,S_FALSE,FALSE},
384 {URL_SCHEME_FILE,S_OK,FALSE},
385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
388 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
390 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
391 {"",S_FALSE},
392 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
393 {"",S_FALSE},
394 {".txt#hash%20part",S_OK},
395 {"",S_FALSE},
396 {"",S_FALSE},
397 {"",S_FALSE},
398 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
399 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
400 {"",S_FALSE},
401 {"file:///z:/test dir/README.txt#hash part",S_OK},
402 {"file",S_OK},
403 {"",S_FALSE},
404 {"",S_FALSE}
407 {Uri_HOST_UNKNOWN,S_OK,FALSE},
408 {0,S_FALSE,FALSE},
409 {URL_SCHEME_FILE,S_OK,FALSE},
410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
413 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
415 {"urn:nothing:should:happen here",S_OK,FALSE},
416 {"",S_FALSE,FALSE},
417 {"urn:nothing:should:happen here",S_OK,FALSE},
418 {"",S_FALSE,FALSE},
419 {"",S_FALSE,FALSE},
420 {"",S_FALSE,FALSE},
421 {"",S_FALSE,FALSE},
422 {"",S_FALSE,FALSE},
423 {"nothing:should:happen here",S_OK,FALSE},
424 {"nothing:should:happen here",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {"urn:nothing:should:happen here",S_OK,FALSE},
427 {"urn",S_OK,FALSE},
428 {"",S_FALSE,FALSE},
429 {"",S_FALSE,FALSE}
432 {Uri_HOST_UNKNOWN,S_OK,FALSE},
433 {0,S_FALSE,FALSE},
434 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
438 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
440 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
441 {"127.0.0.1",S_OK,FALSE},
442 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
443 {"",S_FALSE,FALSE},
444 {".txt",S_OK,FALSE},
445 {"",S_FALSE,FALSE},
446 {"127.0.0.1",S_OK,FALSE},
447 {"",S_FALSE,FALSE},
448 {"/test%20dir/test.txt",S_OK,FALSE},
449 {"/test%20dir/test.txt",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
452 {"http",S_OK,FALSE},
453 {"",S_FALSE,FALSE},
454 {"",S_FALSE,FALSE}
457 {Uri_HOST_IPV4,S_OK,FALSE},
458 {80,S_OK,FALSE},
459 {URL_SCHEME_HTTP,S_OK,FALSE},
460 {URLZONE_INVALID,E_NOTIMPL,FALSE}
463 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
465 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
466 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
467 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
468 {"",S_FALSE,FALSE},
469 {"",S_FALSE,FALSE},
470 {"",S_FALSE,FALSE},
471 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
472 {"",S_FALSE,FALSE},
473 {"/",S_OK,FALSE},
474 {"/",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
477 {"http",S_OK,FALSE},
478 {"",S_FALSE,FALSE},
479 {"",S_FALSE,FALSE}
482 {Uri_HOST_IPV6,S_OK,FALSE},
483 {80,S_OK,FALSE},
484 {URL_SCHEME_HTTP,S_OK,FALSE},
485 {URLZONE_INVALID,E_NOTIMPL,FALSE}
488 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
490 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
491 {"[::13.1.68.3]",S_OK,FALSE},
492 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
493 {"",S_FALSE,FALSE},
494 {"",S_FALSE,FALSE},
495 {"",S_FALSE,FALSE},
496 {"::13.1.68.3",S_OK,FALSE},
497 {"",S_FALSE,FALSE},
498 {"/",S_OK,FALSE},
499 {"/",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"ftp://[::13.1.68.3]",S_OK,FALSE},
502 {"ftp",S_OK,FALSE},
503 {"",S_FALSE,FALSE},
504 {"",S_FALSE,FALSE}
507 {Uri_HOST_IPV6,S_OK,FALSE},
508 {21,S_OK,FALSE},
509 {URL_SCHEME_FTP,S_OK,FALSE},
510 {URLZONE_INVALID,E_NOTIMPL,FALSE}
513 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
515 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
516 {"[fedc:ba98::3210]",S_OK,FALSE},
517 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
518 {"",S_FALSE,FALSE},
519 {"",S_FALSE,FALSE},
520 {"",S_FALSE,FALSE},
521 {"fedc:ba98::3210",S_OK,FALSE},
522 {"",S_FALSE,FALSE},
523 {"/",S_OK,FALSE},
524 {"/",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
527 {"http",S_OK,FALSE},
528 {"",S_FALSE,FALSE},
529 {"",S_FALSE,FALSE},
532 {Uri_HOST_IPV6,S_OK,FALSE},
533 {80,S_OK,FALSE},
534 {URL_SCHEME_HTTP,S_OK,FALSE},
535 {URLZONE_INVALID,E_NOTIMPL,FALSE}
538 { "1234://www.winehq.org", 0, S_OK, FALSE,
540 {"1234://www.winehq.org/",S_OK,FALSE},
541 {"www.winehq.org",S_OK,FALSE},
542 {"1234://www.winehq.org/",S_OK,FALSE},
543 {"winehq.org",S_OK,FALSE},
544 {"",S_FALSE,FALSE},
545 {"",S_FALSE,FALSE},
546 {"www.winehq.org",S_OK,FALSE},
547 {"",S_FALSE,FALSE},
548 {"/",S_OK,FALSE},
549 {"/",S_OK,FALSE},
550 {"",S_FALSE,FALSE},
551 {"1234://www.winehq.org",S_OK,FALSE},
552 {"1234",S_OK,FALSE},
553 {"",S_FALSE,FALSE},
554 {"",S_FALSE,FALSE}
557 {Uri_HOST_DNS,S_OK,FALSE},
558 {0,S_FALSE,FALSE},
559 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
560 {URLZONE_INVALID,E_NOTIMPL,FALSE}
563 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
564 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
566 {"file:///C:/test/test.mp3",S_OK,FALSE},
567 {"",S_FALSE,FALSE},
568 {"file:///C:/test/test.mp3",S_OK,FALSE},
569 {"",S_FALSE,FALSE},
570 {".mp3",S_OK,FALSE},
571 {"",S_FALSE,FALSE},
572 {"",S_FALSE,FALSE},
573 {"",S_FALSE,FALSE},
574 {"/C:/test/test.mp3",S_OK,FALSE},
575 {"/C:/test/test.mp3",S_OK,FALSE},
576 {"",S_FALSE,FALSE},
577 {"C:/test/test.mp3",S_OK,FALSE},
578 {"file",S_OK,FALSE},
579 {"",S_FALSE,FALSE},
580 {"",S_FALSE,FALSE}
583 {Uri_HOST_UNKNOWN,S_OK,FALSE},
584 {0,S_FALSE,FALSE},
585 {URL_SCHEME_FILE,S_OK,FALSE},
586 {URLZONE_INVALID,E_NOTIMPL,FALSE}
589 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
590 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
592 {"file://server/test.mp3",S_OK,FALSE},
593 {"server",S_OK,FALSE},
594 {"file://server/test.mp3",S_OK,FALSE},
595 {"",S_FALSE,FALSE},
596 {".mp3",S_OK,FALSE},
597 {"",S_FALSE,FALSE},
598 {"server",S_OK,FALSE},
599 {"",S_FALSE,FALSE},
600 {"/test.mp3",S_OK,FALSE},
601 {"/test.mp3",S_OK,FALSE},
602 {"",S_FALSE,FALSE},
603 {"\\\\Server/test.mp3",S_OK,FALSE},
604 {"file",S_OK,FALSE},
605 {"",S_FALSE,FALSE},
606 {"",S_FALSE,FALSE}
609 {Uri_HOST_DNS,S_OK,FALSE},
610 {0,S_FALSE,FALSE},
611 {URL_SCHEME_FILE,S_OK,FALSE},
612 {URLZONE_INVALID,E_NOTIMPL,FALSE}
615 { "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,
617 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
618 {"",S_FALSE,FALSE},
619 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
620 {"",S_FALSE,FALSE},
621 {".mp3#fragment|part",S_OK,FALSE},
622 {"",S_FALSE,FALSE},
623 {"",S_FALSE,FALSE},
624 {"",S_FALSE,FALSE},
625 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
626 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
627 {"",S_FALSE,FALSE},
628 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
629 {"file",S_OK,FALSE},
630 {"",S_FALSE,FALSE},
631 {"",S_FALSE,FALSE}
634 {Uri_HOST_UNKNOWN,S_OK,FALSE},
635 {0,S_FALSE,FALSE},
636 {URL_SCHEME_FILE,S_OK,FALSE},
637 {URLZONE_INVALID,E_NOTIMPL,FALSE}
640 { "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,
642 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
643 {"",S_FALSE,FALSE},
644 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
645 {"",S_FALSE,FALSE},
646 {".mp3",S_OK,FALSE},
647 {"",S_FALSE,FALSE},
648 {"",S_FALSE,FALSE},
649 {"",S_FALSE,FALSE},
650 {"C:\\test\\test.mp3",S_OK,FALSE},
651 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
652 {"?query|part",S_OK,FALSE},
653 {"C:/test/test.mp3?query|part",S_OK,FALSE},
654 {"file",S_OK,FALSE},
655 {"",S_FALSE,FALSE},
656 {"",S_FALSE,FALSE}
659 {Uri_HOST_UNKNOWN,S_OK,FALSE},
660 {0,S_FALSE,FALSE},
661 {URL_SCHEME_FILE,S_OK,FALSE},
662 {URLZONE_INVALID,E_NOTIMPL,FALSE}
665 { "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,
667 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
668 {"",S_FALSE,FALSE},
669 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
670 {"",S_FALSE,FALSE},
671 {".mp3",S_OK,FALSE},
672 {"#hash|part",S_OK,FALSE},
673 {"",S_FALSE,FALSE},
674 {"",S_FALSE,FALSE},
675 {"C:\\test\\test.mp3",S_OK,FALSE},
676 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
677 {"?query|part",S_OK,FALSE},
678 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
679 {"file",S_OK,FALSE},
680 {"",S_FALSE,FALSE},
681 {"",S_FALSE,FALSE}
684 {Uri_HOST_UNKNOWN,S_OK,FALSE},
685 {0,S_FALSE,FALSE},
686 {URL_SCHEME_FILE,S_OK,FALSE},
687 {URLZONE_INVALID,E_NOTIMPL,FALSE}
690 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
692 {"*:www.winehq.org/test",S_OK,FALSE},
693 {"www.winehq.org",S_OK,FALSE},
694 {"*:www.winehq.org/test",S_OK,FALSE},
695 {"winehq.org",S_OK,FALSE},
696 {"",S_FALSE,FALSE},
697 {"",S_FALSE,FALSE},
698 {"www.winehq.org",S_OK,FALSE},
699 {"",S_FALSE,FALSE},
700 {"/test",S_OK,FALSE},
701 {"/test",S_OK,FALSE},
702 {"",S_FALSE,FALSE},
703 {"www.winehq.org/test",S_OK,FALSE},
704 {"*",S_OK,FALSE},
705 {"",S_FALSE,FALSE},
706 {"",S_FALSE,FALSE}
709 {Uri_HOST_DNS,S_OK,FALSE},
710 {0,S_FALSE,FALSE},
711 {URL_SCHEME_WILDCARD,S_OK,FALSE},
712 {URLZONE_INVALID,E_NOTIMPL,FALSE}
715 /* Valid since the '*' is the only character in the scheme name. */
716 { "*:www.winehq.org/test", 0, S_OK, FALSE,
718 {"*:www.winehq.org/test",S_OK,FALSE},
719 {"www.winehq.org",S_OK,FALSE},
720 {"*:www.winehq.org/test",S_OK,FALSE},
721 {"winehq.org",S_OK,FALSE},
722 {"",S_FALSE,FALSE},
723 {"",S_FALSE,FALSE},
724 {"www.winehq.org",S_OK,FALSE},
725 {"",S_FALSE,FALSE},
726 {"/test",S_OK,FALSE},
727 {"/test",S_OK,FALSE},
728 {"",S_FALSE,FALSE},
729 {"*:www.winehq.org/test",S_OK,FALSE},
730 {"*",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"",S_FALSE,FALSE}
735 {Uri_HOST_DNS,S_OK,FALSE},
736 {0,S_FALSE,FALSE},
737 {URL_SCHEME_WILDCARD,S_OK,FALSE},
738 {URLZONE_INVALID,E_NOTIMPL,FALSE}
741 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
743 {"/../some dir/test.ext",S_OK,FALSE},
744 {"",S_FALSE,FALSE},
745 {"/../some dir/test.ext",S_OK,FALSE},
746 {"",S_FALSE,FALSE},
747 {".ext",S_OK,FALSE},
748 {"",S_FALSE,FALSE},
749 {"",S_FALSE,FALSE},
750 {"",S_FALSE,FALSE},
751 {"/../some dir/test.ext",S_OK,FALSE},
752 {"/../some dir/test.ext",S_OK,FALSE},
753 {"",S_FALSE,FALSE},
754 {"/../some dir/test.ext",S_OK,FALSE},
755 {"",S_FALSE,FALSE},
756 {"",S_FALSE,FALSE},
757 {"",S_FALSE,FALSE}
760 {Uri_HOST_UNKNOWN,S_OK,FALSE},
761 {0,S_FALSE,FALSE},
762 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
763 {URLZONE_INVALID,E_NOTIMPL,FALSE}
766 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
768 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
769 {"",S_OK,FALSE},
770 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
771 {"",S_FALSE,FALSE},
772 {"",S_FALSE,FALSE},
773 {"",S_FALSE,FALSE},
774 {"",S_OK,FALSE},
775 {"",S_FALSE,FALSE},
776 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
777 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
778 {"",S_FALSE,FALSE},
779 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
780 {"*",S_OK,FALSE},
781 {"",S_FALSE,FALSE},
782 {"",S_FALSE,FALSE},
785 {Uri_HOST_UNKNOWN,S_OK,FALSE},
786 {0,S_FALSE,FALSE},
787 {URL_SCHEME_WILDCARD,S_OK,FALSE},
788 {URLZONE_INVALID,E_NOTIMPL,FALSE}
791 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
792 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
794 {"zip:/.//google.com",S_OK,FALSE},
795 {"",S_FALSE,FALSE},
796 {"zip:/.//google.com",S_OK,FALSE},
797 {"",S_FALSE,FALSE},
798 {".com",S_OK,FALSE},
799 {"",S_FALSE,FALSE},
800 {"",S_FALSE,FALSE},
801 {"",S_FALSE,FALSE},
802 {"/.//google.com",S_OK,FALSE},
803 {"/.//google.com",S_OK,FALSE},
804 {"",S_FALSE,FALSE},
805 {"zip://google.com",S_OK,FALSE},
806 {"zip",S_OK,FALSE},
807 {"",S_FALSE,FALSE},
808 {"",S_FALSE,FALSE}
811 {Uri_HOST_UNKNOWN,S_OK,FALSE},
812 {0,S_FALSE,FALSE},
813 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
814 {URLZONE_INVALID,E_NOTIMPL,FALSE}
817 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
818 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
820 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
821 {"user:pass:word@winehq.org",S_OK,FALSE},
822 {"ftp://winehq.org/",S_OK,FALSE},
823 {"winehq.org",S_OK,FALSE},
824 {"",S_FALSE,FALSE},
825 {"",S_FALSE,FALSE},
826 {"winehq.org",S_OK,FALSE},
827 {"pass:word",S_OK,FALSE},
828 {"/",S_OK,FALSE},
829 {"/",S_OK,FALSE},
830 {"",S_FALSE,FALSE},
831 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
832 {"ftp",S_OK,FALSE},
833 {"user:pass:word",S_OK,FALSE},
834 {"user",S_OK,FALSE}
837 {Uri_HOST_DNS,S_OK,FALSE},
838 {21,S_OK,FALSE},
839 {URL_SCHEME_FTP,S_OK,FALSE},
840 {URLZONE_INVALID,E_NOTIMPL,FALSE}
843 /* Make sure % encoded unreserved characters are decoded. */
844 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
846 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
847 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
848 {"ftp://ftp.google.com/",S_OK,FALSE},
849 {"google.com",S_OK,FALSE},
850 {"",S_FALSE,FALSE},
851 {"",S_FALSE,FALSE},
852 {"ftp.google.com",S_OK,FALSE},
853 {"PASS",S_OK,FALSE},
854 {"/",S_OK,FALSE},
855 {"/",S_OK,FALSE},
856 {"",S_FALSE,FALSE},
857 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
858 {"ftp",S_OK,FALSE},
859 {"wINe:PASS",S_OK,FALSE},
860 {"wINe",S_OK,FALSE}
863 {Uri_HOST_DNS,S_OK,FALSE},
864 {21,S_OK,FALSE},
865 {URL_SCHEME_FTP,S_OK,FALSE},
866 {URLZONE_INVALID,E_NOTIMPL,FALSE}
869 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
870 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
872 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
873 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
874 {"ftp://ftp.google.com/",S_OK,FALSE},
875 {"google.com",S_OK,FALSE},
876 {"",S_FALSE,FALSE},
877 {"",S_FALSE,FALSE},
878 {"ftp.google.com",S_OK,FALSE},
879 {"PA%7B%7D",S_OK,FALSE},
880 {"/",S_OK,FALSE},
881 {"/",S_OK,FALSE},
882 {"",S_FALSE,FALSE},
883 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
884 {"ftp",S_OK,FALSE},
885 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
886 {"w%5D%5Be",S_OK,FALSE}
889 {Uri_HOST_DNS,S_OK,FALSE},
890 {21,S_OK,FALSE},
891 {URL_SCHEME_FTP,S_OK,FALSE},
892 {URLZONE_INVALID,E_NOTIMPL,FALSE}
895 /* You're allowed to have an empty password portion in the userinfo section. */
896 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
898 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
899 {"empty:@ftp.google.com",S_OK,FALSE},
900 {"ftp://ftp.google.com/",S_OK,FALSE},
901 {"google.com",S_OK,FALSE},
902 {"",S_FALSE,FALSE},
903 {"",S_FALSE,FALSE},
904 {"ftp.google.com",S_OK,FALSE},
905 {"",S_OK,FALSE},
906 {"/",S_OK,FALSE},
907 {"/",S_OK,FALSE},
908 {"",S_FALSE,FALSE},
909 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
910 {"ftp",S_OK,FALSE},
911 {"empty:",S_OK,FALSE},
912 {"empty",S_OK,FALSE}
915 {Uri_HOST_DNS,S_OK,FALSE},
916 {21,S_OK,FALSE},
917 {URL_SCHEME_FTP,S_OK,FALSE},
918 {URLZONE_INVALID,E_NOTIMPL,FALSE}
921 /* Make sure forbidden characters in "userinfo" get encoded. */
922 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
924 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
925 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
926 {"ftp://ftp.google.com/",S_OK,FALSE},
927 {"google.com",S_OK,FALSE},
928 {"",S_FALSE,FALSE},
929 {"",S_FALSE,FALSE},
930 {"ftp.google.com",S_OK,FALSE},
931 {"",S_FALSE,FALSE},
932 {"/",S_OK,FALSE},
933 {"/",S_OK,FALSE},
934 {"",S_FALSE,FALSE},
935 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
936 {"ftp",S_OK,FALSE},
937 {"%22%20%22weird",S_OK,FALSE},
938 {"%22%20%22weird",S_OK,FALSE}
941 {Uri_HOST_DNS,S_OK,FALSE},
942 {21,S_OK,FALSE},
943 {URL_SCHEME_FTP,S_OK,FALSE},
944 {URLZONE_INVALID,E_NOTIMPL,FALSE}
947 /* Make sure the forbidden characters don't get percent encoded. */
948 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
950 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
951 {"\" \"weird@ftp.google.com",S_OK,FALSE},
952 {"ftp://ftp.google.com/",S_OK,FALSE},
953 {"google.com",S_OK,FALSE},
954 {"",S_FALSE,FALSE},
955 {"",S_FALSE,FALSE},
956 {"ftp.google.com",S_OK,FALSE},
957 {"",S_FALSE,FALSE},
958 {"/",S_OK,FALSE},
959 {"/",S_OK,FALSE},
960 {"",S_FALSE,FALSE},
961 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
962 {"ftp",S_OK,FALSE},
963 {"\" \"weird",S_OK,FALSE},
964 {"\" \"weird",S_OK,FALSE}
967 {Uri_HOST_DNS,S_OK,FALSE},
968 {21,S_OK,FALSE},
969 {URL_SCHEME_FTP,S_OK,FALSE},
970 {URLZONE_INVALID,E_NOTIMPL,FALSE}
973 /* Make sure already percent encoded characters don't get unencoded. */
974 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
976 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
977 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
978 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
979 {"google.com",S_OK,FALSE},
980 {"",S_FALSE,FALSE},
981 {"",S_FALSE,FALSE},
982 {"ftp.google.com",S_OK,FALSE},
983 {"",S_FALSE,FALSE},
984 {"/\"%20\"weird",S_OK,FALSE},
985 {"/\"%20\"weird",S_OK,FALSE},
986 {"",S_FALSE,FALSE},
987 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
988 {"ftp",S_OK,FALSE},
989 {"\"%20\"weird",S_OK,FALSE},
990 {"\"%20\"weird",S_OK,FALSE}
993 {Uri_HOST_DNS,S_OK,FALSE},
994 {21,S_OK,FALSE},
995 {URL_SCHEME_FTP,S_OK,FALSE},
996 {URLZONE_INVALID,E_NOTIMPL,FALSE}
999 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1000 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1002 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1003 {"%xy:word@winehq.org",S_OK,FALSE},
1004 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1005 {"winehq.org",S_OK,FALSE},
1006 {"",S_FALSE,FALSE},
1007 {"",S_FALSE,FALSE},
1008 {"winehq.org",S_OK,FALSE},
1009 {"word",S_OK,FALSE},
1010 {"/",S_OK,FALSE},
1011 {"/",S_OK,FALSE},
1012 {"",S_FALSE,FALSE},
1013 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1014 {"zip",S_OK,FALSE},
1015 {"%xy:word",S_OK,FALSE},
1016 {"%xy",S_OK,FALSE}
1019 {Uri_HOST_DNS,S_OK,FALSE},
1020 {0,S_FALSE,FALSE},
1021 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1022 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1025 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1026 * isn't known.
1028 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1030 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1031 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1032 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1033 {"winehq.org",S_OK,FALSE},
1034 {"",S_FALSE,FALSE},
1035 {"",S_FALSE,FALSE},
1036 {"winehq.org",S_OK,FALSE},
1037 {"%52%53ord",S_OK,FALSE},
1038 {"/",S_OK,FALSE},
1039 {"/",S_OK,FALSE},
1040 {"",S_FALSE,FALSE},
1041 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1042 {"zip",S_OK,FALSE},
1043 {"%2E:%52%53ord",S_OK,FALSE},
1044 {"%2E",S_OK,FALSE}
1047 {Uri_HOST_DNS,S_OK,FALSE},
1048 {0,S_FALSE,FALSE},
1049 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1050 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1053 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1055 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1056 {"[](),'test':word@winehq.org",S_OK,FALSE},
1057 {"ftp://winehq.org/",S_OK,FALSE},
1058 {"winehq.org",S_OK,FALSE},
1059 {"",S_FALSE,FALSE},
1060 {"",S_FALSE,FALSE},
1061 {"winehq.org",S_OK,FALSE},
1062 {"word",S_OK,FALSE},
1063 {"/",S_OK,FALSE},
1064 {"/",S_OK,FALSE},
1065 {"",S_FALSE,FALSE},
1066 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1067 {"ftp",S_OK,FALSE},
1068 {"[](),'test':word",S_OK,FALSE},
1069 {"[](),'test'",S_OK,FALSE}
1072 {Uri_HOST_DNS,S_OK,FALSE},
1073 {21,S_OK,FALSE},
1074 {URL_SCHEME_FTP,S_OK,FALSE},
1075 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1078 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1080 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1081 {"test",S_OK,FALSE},
1082 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1083 {"",S_FALSE,FALSE},
1084 {"",S_FALSE,FALSE},
1085 {"",S_FALSE,FALSE},
1086 {"test",S_OK,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"/",S_OK,FALSE},
1089 {"/?:word@winehq.org/",S_OK,FALSE},
1090 {"?:word@winehq.org/",S_OK,FALSE},
1091 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1092 {"ftp",S_OK,FALSE},
1093 {"",S_FALSE,FALSE},
1094 {"",S_FALSE,FALSE}
1097 {Uri_HOST_DNS,S_OK,FALSE},
1098 {21,S_OK,FALSE},
1099 {URL_SCHEME_FTP,S_OK,FALSE},
1100 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1103 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1105 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1106 {"test",S_OK,FALSE},
1107 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1108 {"",S_FALSE,FALSE},
1109 {"",S_FALSE,FALSE},
1110 {"#:word@winehq.org/",S_OK,FALSE},
1111 {"test",S_OK,FALSE},
1112 {"",S_FALSE,FALSE},
1113 {"/",S_OK,FALSE},
1114 {"/",S_OK,FALSE},
1115 {"",S_FALSE,FALSE},
1116 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1117 {"ftp",S_OK,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"",S_FALSE,FALSE}
1122 {Uri_HOST_DNS,S_OK,FALSE},
1123 {21,S_OK,FALSE},
1124 {URL_SCHEME_FTP,S_OK,FALSE},
1125 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1128 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1129 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1131 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1132 {"test\\:word@winehq.org",S_OK,FALSE},
1133 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1134 {"winehq.org",S_OK,FALSE},
1135 {"",S_FALSE,FALSE},
1136 {"",S_FALSE,FALSE},
1137 {"winehq.org",S_OK,FALSE},
1138 {"word",S_OK,FALSE},
1139 {"/",S_OK,FALSE},
1140 {"/",S_OK,FALSE},
1141 {"",S_FALSE,FALSE},
1142 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1143 {"zip",S_OK,FALSE},
1144 {"test\\:word",S_OK,FALSE},
1145 {"test\\",S_OK,FALSE}
1148 {Uri_HOST_DNS,S_OK,FALSE},
1149 {0,S_FALSE,FALSE},
1150 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1151 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1154 /* It normalizes IPv4 addresses correctly. */
1155 { "http://127.000.000.100/", 0, S_OK, FALSE,
1157 {"http://127.0.0.100/",S_OK,FALSE},
1158 {"127.0.0.100",S_OK,FALSE},
1159 {"http://127.0.0.100/",S_OK,FALSE},
1160 {"",S_FALSE,FALSE},
1161 {"",S_FALSE,FALSE},
1162 {"",S_FALSE,FALSE},
1163 {"127.0.0.100",S_OK,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"/",S_OK,FALSE},
1166 {"/",S_OK,FALSE},
1167 {"",S_FALSE,FALSE},
1168 {"http://127.000.000.100/",S_OK,FALSE},
1169 {"http",S_OK,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"",S_FALSE,FALSE}
1174 {Uri_HOST_IPV4,S_OK,FALSE},
1175 {80,S_OK,FALSE},
1176 {URL_SCHEME_HTTP,S_OK,FALSE},
1177 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1180 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1182 {"http://127.0.0.1:8000/",S_OK},
1183 {"127.0.0.1:8000",S_OK},
1184 {"http://127.0.0.1:8000/",S_OK},
1185 {"",S_FALSE},
1186 {"",S_FALSE},
1187 {"",S_FALSE},
1188 {"127.0.0.1",S_OK},
1189 {"",S_FALSE},
1190 {"/",S_OK},
1191 {"/",S_OK},
1192 {"",S_FALSE},
1193 {"http://127.0.0.1:8000",S_OK},
1194 {"http",S_OK},
1195 {"",S_FALSE},
1196 {"",S_FALSE}
1199 {Uri_HOST_IPV4,S_OK,FALSE},
1200 {8000,S_OK,FALSE},
1201 {URL_SCHEME_HTTP,S_OK,FALSE},
1202 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1205 /* Make sure it normalizes partial IPv4 addresses correctly. */
1206 { "http://127.0/", 0, S_OK, FALSE,
1208 {"http://127.0.0.0/",S_OK,FALSE},
1209 {"127.0.0.0",S_OK,FALSE},
1210 {"http://127.0.0.0/",S_OK,FALSE},
1211 {"",S_FALSE,FALSE},
1212 {"",S_FALSE,FALSE},
1213 {"",S_FALSE,FALSE},
1214 {"127.0.0.0",S_OK,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"/",S_OK,FALSE},
1217 {"/",S_OK,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"http://127.0/",S_OK,FALSE},
1220 {"http",S_OK,FALSE},
1221 {"",S_FALSE,FALSE},
1222 {"",S_FALSE,FALSE}
1225 {Uri_HOST_IPV4,S_OK,FALSE},
1226 {80,S_OK,FALSE},
1227 {URL_SCHEME_HTTP,S_OK,FALSE},
1228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1231 /* Make sure it converts implicit IPv4's correctly. */
1232 { "http://123456/", 0, S_OK, FALSE,
1234 {"http://0.1.226.64/",S_OK,FALSE},
1235 {"0.1.226.64",S_OK,FALSE},
1236 {"http://0.1.226.64/",S_OK,FALSE},
1237 {"",S_FALSE,FALSE},
1238 {"",S_FALSE,FALSE},
1239 {"",S_FALSE,FALSE},
1240 {"0.1.226.64",S_OK,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"/",S_OK,FALSE},
1243 {"/",S_OK,FALSE},
1244 {"",S_FALSE,FALSE},
1245 {"http://123456/",S_OK,FALSE},
1246 {"http",S_OK,FALSE},
1247 {"",S_FALSE,FALSE},
1248 {"",S_FALSE,FALSE}
1251 {Uri_HOST_IPV4,S_OK,FALSE},
1252 {80,S_OK,FALSE},
1253 {URL_SCHEME_HTTP,S_OK,FALSE},
1254 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1257 /* UINT_MAX */
1258 { "http://4294967295/", 0, S_OK, FALSE,
1260 {"http://255.255.255.255/",S_OK,FALSE},
1261 {"255.255.255.255",S_OK,FALSE},
1262 {"http://255.255.255.255/",S_OK,FALSE},
1263 {"",S_FALSE,FALSE},
1264 {"",S_FALSE,FALSE},
1265 {"",S_FALSE,FALSE},
1266 {"255.255.255.255",S_OK,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"/",S_OK,FALSE},
1269 {"/",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"http://4294967295/",S_OK,FALSE},
1272 {"http",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"",S_FALSE,FALSE}
1277 {Uri_HOST_IPV4,S_OK,FALSE},
1278 {80,S_OK,FALSE},
1279 {URL_SCHEME_HTTP,S_OK,FALSE},
1280 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1283 /* UINT_MAX+1 */
1284 { "http://4294967296/", 0, S_OK, FALSE,
1286 {"http://4294967296/",S_OK,FALSE},
1287 {"4294967296",S_OK,FALSE},
1288 {"http://4294967296/",S_OK,FALSE},
1289 {"",S_FALSE,FALSE},
1290 {"",S_FALSE,FALSE},
1291 {"",S_FALSE,FALSE},
1292 {"4294967296",S_OK,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"/",S_OK,FALSE},
1295 {"/",S_OK,FALSE},
1296 {"",S_FALSE,FALSE},
1297 {"http://4294967296/",S_OK,FALSE},
1298 {"http",S_OK,FALSE},
1299 {"",S_FALSE,FALSE},
1300 {"",S_FALSE,FALSE}
1303 {Uri_HOST_DNS,S_OK,FALSE},
1304 {80,S_OK,FALSE},
1305 {URL_SCHEME_HTTP,S_OK,FALSE},
1306 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1309 /* Window's doesn't normalize IP address for unknown schemes. */
1310 { "1234://4294967295/", 0, S_OK, FALSE,
1312 {"1234://4294967295/",S_OK,FALSE},
1313 {"4294967295",S_OK,FALSE},
1314 {"1234://4294967295/",S_OK,FALSE},
1315 {"",S_FALSE,FALSE},
1316 {"",S_FALSE,FALSE},
1317 {"",S_FALSE,FALSE},
1318 {"4294967295",S_OK,FALSE},
1319 {"",S_FALSE,FALSE},
1320 {"/",S_OK,FALSE},
1321 {"/",S_OK,FALSE},
1322 {"",S_FALSE,FALSE},
1323 {"1234://4294967295/",S_OK,FALSE},
1324 {"1234",S_OK,FALSE},
1325 {"",S_FALSE,FALSE},
1326 {"",S_FALSE,FALSE}
1329 {Uri_HOST_IPV4,S_OK,FALSE},
1330 {0,S_FALSE,FALSE},
1331 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1332 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1335 /* Window's doesn't normalize IP address for unknown schemes. */
1336 { "1234://127.001/", 0, S_OK, FALSE,
1338 {"1234://127.001/",S_OK,FALSE},
1339 {"127.001",S_OK,FALSE},
1340 {"1234://127.001/",S_OK,FALSE},
1341 {"",S_FALSE,FALSE},
1342 {"",S_FALSE,FALSE},
1343 {"",S_FALSE,FALSE},
1344 {"127.001",S_OK,FALSE},
1345 {"",S_FALSE,FALSE},
1346 {"/",S_OK,FALSE},
1347 {"/",S_OK,FALSE},
1348 {"",S_FALSE,FALSE},
1349 {"1234://127.001/",S_OK,FALSE},
1350 {"1234",S_OK,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"",S_FALSE,FALSE}
1355 {Uri_HOST_IPV4,S_OK,FALSE},
1356 {0,S_FALSE,FALSE},
1357 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1361 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1363 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1364 {"[fedc:ba98::3210]",S_OK,FALSE},
1365 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1366 {"",S_FALSE,FALSE},
1367 {"",S_FALSE,FALSE},
1368 {"",S_FALSE,FALSE},
1369 {"fedc:ba98::3210",S_OK,FALSE},
1370 {"",S_FALSE,FALSE},
1371 {"/",S_OK,FALSE},
1372 {"/",S_OK,FALSE},
1373 {"",S_FALSE,FALSE},
1374 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1375 {"http",S_OK,FALSE},
1376 {"",S_FALSE,FALSE},
1377 {"",S_FALSE,FALSE},
1380 {Uri_HOST_IPV6,S_OK,FALSE},
1381 {80,S_OK,FALSE},
1382 {URL_SCHEME_HTTP,S_OK,FALSE},
1383 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1386 { "http://[::]", 0, S_OK, FALSE,
1388 {"http://[::]/",S_OK,FALSE},
1389 {"[::]",S_OK,FALSE},
1390 {"http://[::]/",S_OK,FALSE},
1391 {"",S_FALSE,FALSE},
1392 {"",S_FALSE,FALSE},
1393 {"",S_FALSE,FALSE},
1394 {"::",S_OK,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"/",S_OK,FALSE},
1397 {"/",S_OK,FALSE},
1398 {"",S_FALSE,FALSE},
1399 {"http://[::]",S_OK,FALSE},
1400 {"http",S_OK,FALSE},
1401 {"",S_FALSE,FALSE},
1402 {"",S_FALSE,FALSE},
1405 {Uri_HOST_IPV6,S_OK,FALSE},
1406 {80,S_OK,FALSE},
1407 {URL_SCHEME_HTTP,S_OK,FALSE},
1408 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1411 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1413 {"http://[fedc:ba98::]/",S_OK,FALSE},
1414 {"[fedc:ba98::]",S_OK,FALSE},
1415 {"http://[fedc:ba98::]/",S_OK,FALSE},
1416 {"",S_FALSE,FALSE},
1417 {"",S_FALSE,FALSE},
1418 {"",S_FALSE,FALSE},
1419 {"fedc:ba98::",S_OK,FALSE},
1420 {"",S_FALSE,FALSE},
1421 {"/",S_OK,FALSE},
1422 {"/",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"http://[FEDC:BA98::]",S_OK,FALSE},
1425 {"http",S_OK,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"",S_FALSE,FALSE},
1430 {Uri_HOST_IPV6,S_OK,FALSE},
1431 {80,S_OK,FALSE},
1432 {URL_SCHEME_HTTP,S_OK,FALSE},
1433 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1436 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1437 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1439 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1440 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1441 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1442 {"",S_FALSE,FALSE},
1443 {"",S_FALSE,FALSE},
1444 {"",S_FALSE,FALSE},
1445 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1446 {"",S_FALSE,FALSE},
1447 {"/",S_OK,FALSE},
1448 {"/",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1451 {"http",S_OK,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"",S_FALSE,FALSE},
1456 {Uri_HOST_IPV6,S_OK,FALSE},
1457 {80,S_OK,FALSE},
1458 {URL_SCHEME_HTTP,S_OK,FALSE},
1459 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1462 { "http://[v2.34]/", 0, S_OK, FALSE,
1464 {"http://[v2.34]/",S_OK,FALSE},
1465 {"[v2.34]",S_OK,FALSE},
1466 {"http://[v2.34]/",S_OK,FALSE},
1467 {"",S_FALSE,FALSE},
1468 {"",S_FALSE,FALSE},
1469 {"",S_FALSE,FALSE},
1470 {"[v2.34]",S_OK,FALSE},
1471 {"",S_FALSE,FALSE},
1472 {"/",S_OK,FALSE},
1473 {"/",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"http://[v2.34]/",S_OK,FALSE},
1476 {"http",S_OK,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"",S_FALSE,FALSE}
1481 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1482 {80,S_OK,FALSE},
1483 {URL_SCHEME_HTTP,S_OK,FALSE},
1484 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1487 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1488 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1490 {"http://[xyz:12345.com/test",S_OK,FALSE},
1491 {"[xyz:12345.com",S_OK,FALSE},
1492 {"http://[xyz:12345.com/test",S_OK,FALSE},
1493 {"[xyz:12345.com",S_OK,FALSE},
1494 {"",S_FALSE,FALSE},
1495 {"",S_FALSE,FALSE},
1496 {"[xyz:12345.com",S_OK,FALSE},
1497 {"",S_FALSE,FALSE},
1498 {"/test",S_OK,FALSE},
1499 {"/test",S_OK,FALSE},
1500 {"",S_FALSE,FALSE},
1501 {"http://[xyz:12345.com/test",S_OK,FALSE},
1502 {"http",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"",S_FALSE,FALSE}
1507 {Uri_HOST_DNS,S_OK,FALSE},
1508 {80,S_OK,FALSE},
1509 {URL_SCHEME_HTTP,S_OK,FALSE},
1510 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1513 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1514 * of the host name (respectively).
1516 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1518 {"ftp://www.[works].com/",S_OK,FALSE},
1519 {"www.[works].com",S_OK,FALSE},
1520 {"ftp://www.[works].com/",S_OK,FALSE},
1521 {"[works].com",S_OK,FALSE},
1522 {"",S_FALSE,FALSE},
1523 {"",S_FALSE,FALSE},
1524 {"www.[works].com",S_OK,FALSE},
1525 {"",S_FALSE,FALSE},
1526 {"/",S_OK,FALSE},
1527 {"/",S_OK,FALSE},
1528 {"",S_FALSE,FALSE},
1529 {"ftp://www.[works].com/",S_OK,FALSE},
1530 {"ftp",S_OK,FALSE},
1531 {"",S_FALSE,FALSE},
1532 {"",S_FALSE,FALSE}
1535 {Uri_HOST_DNS,S_OK,FALSE},
1536 {21,S_OK,FALSE},
1537 {URL_SCHEME_FTP,S_OK,FALSE},
1538 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1541 /* Considers ':' a delimiter since it appears after the ']'. */
1542 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1544 {"http://www.google.com]:12345/",S_OK,FALSE},
1545 {"www.google.com]:12345",S_OK,FALSE},
1546 {"http://www.google.com]:12345/",S_OK,FALSE},
1547 {"google.com]",S_OK,FALSE},
1548 {"",S_FALSE,FALSE},
1549 {"",S_FALSE,FALSE},
1550 {"www.google.com]",S_OK,FALSE},
1551 {"",S_FALSE,FALSE},
1552 {"/",S_OK,FALSE},
1553 {"/",S_OK,FALSE},
1554 {"",S_FALSE,FALSE},
1555 {"http://www.google.com]:12345/",S_OK,FALSE},
1556 {"http",S_OK,FALSE},
1557 {"",S_FALSE,FALSE},
1558 {"",S_FALSE,FALSE}
1561 {Uri_HOST_DNS,S_OK,FALSE},
1562 {12345,S_OK,FALSE},
1563 {URL_SCHEME_HTTP,S_OK,FALSE},
1564 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1567 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1568 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1570 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1571 {"w%XXw%GEw.google.com",S_OK,FALSE},
1572 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1573 {"google.com",S_OK,FALSE},
1574 {"",S_FALSE,FALSE},
1575 {"",S_FALSE,FALSE},
1576 {"w%XXw%GEw.google.com",S_OK,FALSE},
1577 {"",S_FALSE,FALSE},
1578 {"/",S_OK,FALSE},
1579 {"/",S_OK,FALSE},
1580 {"",S_FALSE,FALSE},
1581 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1582 {"zip",S_OK,FALSE},
1583 {"",S_FALSE,FALSE},
1584 {"",S_FALSE,FALSE}
1587 {Uri_HOST_DNS,S_OK,FALSE},
1588 {0,S_FALSE,FALSE},
1589 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1590 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1593 /* Unknown scheme types hostname doesn't get lower cased. */
1594 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1596 {"zip://GOOGLE.com/",S_OK,FALSE},
1597 {"GOOGLE.com",S_OK,FALSE},
1598 {"zip://GOOGLE.com/",S_OK,FALSE},
1599 {"GOOGLE.com",S_OK,FALSE},
1600 {"",S_FALSE,FALSE},
1601 {"",S_FALSE,FALSE},
1602 {"GOOGLE.com",S_OK,FALSE},
1603 {"",S_FALSE,FALSE},
1604 {"/",S_OK,FALSE},
1605 {"/",S_OK,FALSE},
1606 {"",S_FALSE,FALSE},
1607 {"zip://GOOGLE.com/",S_OK,FALSE},
1608 {"zip",S_OK,FALSE},
1609 {"",S_FALSE,FALSE},
1610 {"",S_FALSE,FALSE}
1613 {Uri_HOST_DNS,S_OK,FALSE},
1614 {0,S_FALSE,FALSE},
1615 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1616 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1619 /* Hostname gets lower-cased for known scheme types. */
1620 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1622 {"http://www.google.com/",S_OK,FALSE},
1623 {"www.google.com",S_OK,FALSE},
1624 {"http://www.google.com/",S_OK,FALSE},
1625 {"google.com",S_OK,FALSE},
1626 {"",S_FALSE,FALSE},
1627 {"",S_FALSE,FALSE},
1628 {"www.google.com",S_OK,FALSE},
1629 {"",S_FALSE,FALSE},
1630 {"/",S_OK,FALSE},
1631 {"/",S_OK,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1634 {"http",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"",S_FALSE,FALSE}
1639 {Uri_HOST_DNS,S_OK,FALSE},
1640 {80,S_OK,FALSE},
1641 {URL_SCHEME_HTTP,S_OK,FALSE},
1642 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1645 /* Characters that get % encoded in the hostname also have their percent
1646 * encoded forms lower cased.
1648 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1650 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1651 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1652 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1653 {"%7cgoogle%7c.com",S_OK,FALSE},
1654 {"",S_FALSE,FALSE},
1655 {"",S_FALSE,FALSE},
1656 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"/",S_OK,FALSE},
1659 {"/",S_OK,FALSE},
1660 {"",S_FALSE,FALSE},
1661 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1662 {"http",S_OK,FALSE},
1663 {"",S_FALSE,FALSE},
1664 {"",S_FALSE,FALSE}
1667 {Uri_HOST_DNS,S_OK,FALSE},
1668 {80,S_OK,FALSE},
1669 {URL_SCHEME_HTTP,S_OK,FALSE},
1670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1673 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1674 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1676 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1677 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1678 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1679 {"",S_FALSE,FALSE},
1680 {"",S_FALSE,FALSE},
1681 {"",S_FALSE,FALSE},
1682 {"1:2:3:4:5:6::",S_OK,FALSE},
1683 {"",S_FALSE,FALSE},
1684 {"/",S_OK,FALSE},
1685 {"/",S_OK,FALSE},
1686 {"",S_FALSE,FALSE},
1687 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1688 {"http",S_OK,FALSE},
1689 {"",S_FALSE,FALSE},
1690 {"",S_FALSE,FALSE},
1693 {Uri_HOST_IPV6,S_OK,FALSE},
1694 {80,S_OK,FALSE},
1695 {URL_SCHEME_HTTP,S_OK,FALSE},
1696 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1699 /* IPv4 addresses get normalized. */
1700 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1702 {"http://[::1.2.3.0]/",S_OK,FALSE},
1703 {"[::1.2.3.0]",S_OK,FALSE},
1704 {"http://[::1.2.3.0]/",S_OK,FALSE},
1705 {"",S_FALSE,FALSE},
1706 {"",S_FALSE,FALSE},
1707 {"",S_FALSE,FALSE},
1708 {"::1.2.3.0",S_OK,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"/",S_OK,FALSE},
1711 {"/",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"http://[::001.002.003.000]",S_OK,FALSE},
1714 {"http",S_OK,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"",S_FALSE,FALSE},
1719 {Uri_HOST_IPV6,S_OK,FALSE},
1720 {80,S_OK,FALSE},
1721 {URL_SCHEME_HTTP,S_OK,FALSE},
1722 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1725 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1726 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1728 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1729 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1730 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1731 {"",S_FALSE,FALSE},
1732 {"",S_FALSE,FALSE},
1733 {"",S_FALSE,FALSE},
1734 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"/",S_OK,FALSE},
1737 {"/",S_OK,FALSE},
1738 {"",S_FALSE,FALSE},
1739 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1740 {"zip",S_OK,FALSE},
1741 {"",S_FALSE,FALSE},
1742 {"",S_FALSE,FALSE},
1745 {Uri_HOST_IPV6,S_OK,FALSE},
1746 {0,S_FALSE,FALSE},
1747 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1748 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1751 /* IPv4 address is converted into 2 h16 components. */
1752 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1754 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1755 {"[ffff::c0de:6f20]",S_OK,FALSE},
1756 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1757 {"",S_FALSE,FALSE},
1758 {"",S_FALSE,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"ffff::c0de:6f20",S_OK,FALSE},
1761 {"",S_FALSE,FALSE},
1762 {"/",S_OK,FALSE},
1763 {"/",S_OK,FALSE},
1764 {"",S_FALSE,FALSE},
1765 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1766 {"http",S_OK,FALSE},
1767 {"",S_FALSE,FALSE},
1768 {"",S_FALSE,FALSE},
1771 {Uri_HOST_IPV6,S_OK,FALSE},
1772 {80,S_OK,FALSE},
1773 {URL_SCHEME_HTTP,S_OK,FALSE},
1774 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1777 /* Max value for a port. */
1778 { "http://google.com:65535", 0, S_OK, FALSE,
1780 {"http://google.com:65535/",S_OK,FALSE},
1781 {"google.com:65535",S_OK,FALSE},
1782 {"http://google.com:65535/",S_OK,FALSE},
1783 {"google.com",S_OK,FALSE},
1784 {"",S_FALSE,FALSE},
1785 {"",S_FALSE,FALSE},
1786 {"google.com",S_OK,FALSE},
1787 {"",S_FALSE,FALSE},
1788 {"/",S_OK,FALSE},
1789 {"/",S_OK,FALSE},
1790 {"",S_FALSE,FALSE},
1791 {"http://google.com:65535",S_OK,FALSE},
1792 {"http",S_OK,FALSE},
1793 {"",S_FALSE,FALSE},
1794 {"",S_FALSE,FALSE}
1797 {Uri_HOST_DNS,S_OK,FALSE},
1798 {65535,S_OK,FALSE},
1799 {URL_SCHEME_HTTP,S_OK,FALSE},
1800 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1803 { "zip://google.com:65536", 0, S_OK, FALSE,
1805 {"zip://google.com:65536/",S_OK,FALSE},
1806 {"google.com:65536",S_OK,FALSE},
1807 {"zip://google.com:65536/",S_OK,FALSE},
1808 {"google.com:65536",S_OK,FALSE},
1809 {"",S_FALSE,FALSE},
1810 {"",S_FALSE,FALSE},
1811 {"google.com:65536",S_OK,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"/",S_OK,FALSE},
1814 {"/",S_OK,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"zip://google.com:65536",S_OK,FALSE},
1817 {"zip",S_OK,FALSE},
1818 {"",S_FALSE,FALSE},
1819 {"",S_FALSE,FALSE}
1822 {Uri_HOST_DNS,S_OK,FALSE},
1823 {0,S_FALSE,FALSE},
1824 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1825 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1828 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1830 {"zip://google.com:65536:25/",S_OK,FALSE},
1831 {"google.com:65536:25",S_OK,FALSE},
1832 {"zip://google.com:65536:25/",S_OK,FALSE},
1833 {"google.com:65536:25",S_OK,FALSE},
1834 {"",S_FALSE,FALSE},
1835 {"",S_FALSE,FALSE},
1836 {"google.com:65536:25",S_OK,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"/",S_OK,FALSE},
1839 {"/",S_OK,FALSE},
1840 {"",S_FALSE,FALSE},
1841 {"zip://google.com:65536:25",S_OK,FALSE},
1842 {"zip",S_OK,FALSE},
1843 {"",S_FALSE,FALSE},
1844 {"",S_FALSE,FALSE}
1847 {Uri_HOST_DNS,S_OK,FALSE},
1848 {0,S_FALSE,FALSE},
1849 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1850 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1853 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1855 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1856 {"[::ffff]:abcd",S_OK,FALSE},
1857 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1858 {"",S_FALSE,FALSE},
1859 {"",S_FALSE,FALSE},
1860 {"",S_FALSE,FALSE},
1861 {"[::ffff]:abcd",S_OK,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"/",S_OK,FALSE},
1864 {"/",S_OK,FALSE},
1865 {"",S_FALSE,FALSE},
1866 {"zip://[::ffff]:abcd",S_OK,FALSE},
1867 {"zip",S_OK,FALSE},
1868 {"",S_FALSE,FALSE},
1869 {"",S_FALSE,FALSE}
1872 {Uri_HOST_DNS,S_OK,FALSE},
1873 {0,S_FALSE,FALSE},
1874 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1875 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1878 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1880 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1881 {"127.0.0.1:abcd",S_OK,FALSE},
1882 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1883 {"0.1:abcd",S_OK,FALSE},
1884 {"",S_FALSE,FALSE},
1885 {"",S_FALSE,FALSE},
1886 {"127.0.0.1:abcd",S_OK,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"/",S_OK,FALSE},
1889 {"/",S_OK,FALSE},
1890 {"",S_FALSE,FALSE},
1891 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1892 {"zip",S_OK,FALSE},
1893 {"",S_FALSE,FALSE},
1894 {"",S_FALSE,FALSE}
1897 {Uri_HOST_DNS,S_OK,FALSE},
1898 {0,S_FALSE,FALSE},
1899 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1900 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1903 /* Port is just copied over. */
1904 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1906 {"http://google.com:00035",S_OK,FALSE},
1907 {"google.com:00035",S_OK,FALSE},
1908 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1909 {"google.com",S_OK,FALSE},
1910 {"",S_FALSE,FALSE},
1911 {"",S_FALSE,FALSE},
1912 {"google.com",S_OK,FALSE},
1913 {"",S_FALSE,FALSE},
1914 {"",S_FALSE,FALSE},
1915 {"",S_FALSE,FALSE},
1916 {"",S_FALSE,FALSE},
1917 {"http://google.com:00035",S_OK,FALSE},
1918 {"http",S_OK,FALSE},
1919 {"",S_FALSE,FALSE},
1920 {"",S_FALSE,FALSE}
1923 {Uri_HOST_DNS,S_OK,FALSE},
1924 {35,S_OK,FALSE},
1925 {URL_SCHEME_HTTP,S_OK,FALSE},
1926 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1929 /* Default port is copied over. */
1930 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1932 {"http://google.com:80",S_OK,FALSE},
1933 {"google.com:80",S_OK,FALSE},
1934 {"http://google.com:80",S_OK,FALSE},
1935 {"google.com",S_OK,FALSE},
1936 {"",S_FALSE,FALSE},
1937 {"",S_FALSE,FALSE},
1938 {"google.com",S_OK,FALSE},
1939 {"",S_FALSE,FALSE},
1940 {"",S_FALSE,FALSE},
1941 {"",S_FALSE,FALSE},
1942 {"",S_FALSE,FALSE},
1943 {"http://google.com:80",S_OK,FALSE},
1944 {"http",S_OK,FALSE},
1945 {"",S_FALSE,FALSE},
1946 {"",S_FALSE,FALSE}
1949 {Uri_HOST_DNS,S_OK,FALSE},
1950 {80,S_OK,FALSE},
1951 {URL_SCHEME_HTTP,S_OK,FALSE},
1952 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1955 { "http://google.com.uk", 0, S_OK, FALSE,
1957 {"http://google.com.uk/",S_OK,FALSE},
1958 {"google.com.uk",S_OK,FALSE},
1959 {"http://google.com.uk/",S_OK,FALSE},
1960 {"google.com.uk",S_OK,FALSE},
1961 {"",S_FALSE,FALSE},
1962 {"",S_FALSE,FALSE},
1963 {"google.com.uk",S_OK,FALSE},
1964 {"",S_FALSE,FALSE},
1965 {"/",S_OK,FALSE},
1966 {"/",S_OK,FALSE},
1967 {"",S_FALSE,FALSE},
1968 {"http://google.com.uk",S_OK,FALSE},
1969 {"http",S_OK,FALSE},
1970 {"",S_FALSE,FALSE},
1971 {"",S_FALSE,FALSE}
1974 {Uri_HOST_DNS,S_OK,FALSE},
1975 {80,S_OK,FALSE},
1976 {URL_SCHEME_HTTP,S_OK,FALSE},
1977 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1980 { "http://google.com.com", 0, S_OK, FALSE,
1982 {"http://google.com.com/",S_OK,FALSE},
1983 {"google.com.com",S_OK,FALSE},
1984 {"http://google.com.com/",S_OK,FALSE},
1985 {"com.com",S_OK,FALSE},
1986 {"",S_FALSE,FALSE},
1987 {"",S_FALSE,FALSE},
1988 {"google.com.com",S_OK,FALSE},
1989 {"",S_FALSE,FALSE},
1990 {"/",S_OK,FALSE},
1991 {"/",S_OK,FALSE},
1992 {"",S_FALSE,FALSE},
1993 {"http://google.com.com",S_OK,FALSE},
1994 {"http",S_OK,FALSE},
1995 {"",S_FALSE,FALSE},
1996 {"",S_FALSE,FALSE}
1999 {Uri_HOST_DNS,S_OK,FALSE},
2000 {80,S_OK,FALSE},
2001 {URL_SCHEME_HTTP,S_OK,FALSE},
2002 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2005 { "http://google.uk.1", 0, S_OK, FALSE,
2007 {"http://google.uk.1/",S_OK,FALSE},
2008 {"google.uk.1",S_OK,FALSE},
2009 {"http://google.uk.1/",S_OK,FALSE},
2010 {"google.uk.1",S_OK,FALSE},
2011 {"",S_FALSE,FALSE},
2012 {"",S_FALSE,FALSE},
2013 {"google.uk.1",S_OK,FALSE},
2014 {"",S_FALSE,FALSE},
2015 {"/",S_OK,FALSE},
2016 {"/",S_OK,FALSE},
2017 {"",S_FALSE,FALSE},
2018 {"http://google.uk.1",S_OK,FALSE},
2019 {"http",S_OK,FALSE},
2020 {"",S_FALSE,FALSE},
2021 {"",S_FALSE,FALSE}
2024 {Uri_HOST_DNS,S_OK,FALSE},
2025 {80,S_OK,FALSE},
2026 {URL_SCHEME_HTTP,S_OK,FALSE},
2027 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2030 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2031 { "http://google.foo.uk", 0, S_OK, FALSE,
2033 {"http://google.foo.uk/",S_OK,FALSE},
2034 {"google.foo.uk",S_OK,FALSE},
2035 {"http://google.foo.uk/",S_OK,FALSE},
2036 {"foo.uk",S_OK,FALSE},
2037 {"",S_FALSE,FALSE},
2038 {"",S_FALSE,FALSE},
2039 {"google.foo.uk",S_OK,FALSE},
2040 {"",S_FALSE,FALSE},
2041 {"/",S_OK,FALSE},
2042 {"/",S_OK,FALSE},
2043 {"",S_FALSE,FALSE},
2044 {"http://google.foo.uk",S_OK,FALSE},
2045 {"http",S_OK,FALSE},
2046 {"",S_FALSE,FALSE},
2047 {"",S_FALSE,FALSE}
2050 {Uri_HOST_DNS,S_OK,FALSE},
2051 {80,S_OK,FALSE},
2052 {URL_SCHEME_HTTP,S_OK,FALSE},
2053 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2056 { "http://.com", 0, S_OK, FALSE,
2058 {"http://.com/",S_OK,FALSE},
2059 {".com",S_OK,FALSE},
2060 {"http://.com/",S_OK,FALSE},
2061 {".com",S_OK,FALSE},
2062 {"",S_FALSE,FALSE},
2063 {"",S_FALSE,FALSE},
2064 {".com",S_OK,FALSE},
2065 {"",S_FALSE,FALSE},
2066 {"/",S_OK,FALSE},
2067 {"/",S_OK,FALSE},
2068 {"",S_FALSE,FALSE},
2069 {"http://.com",S_OK,FALSE},
2070 {"http",S_OK,FALSE},
2071 {"",S_FALSE,FALSE},
2072 {"",S_FALSE,FALSE}
2075 {Uri_HOST_DNS,S_OK,FALSE},
2076 {80,S_OK,FALSE},
2077 {URL_SCHEME_HTTP,S_OK,FALSE},
2078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2081 { "http://.uk", 0, S_OK, FALSE,
2083 {"http://.uk/",S_OK,FALSE},
2084 {".uk",S_OK,FALSE},
2085 {"http://.uk/",S_OK,FALSE},
2086 {"",S_FALSE,FALSE},
2087 {"",S_FALSE,FALSE},
2088 {"",S_FALSE,FALSE},
2089 {".uk",S_OK,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"/",S_OK,FALSE},
2092 {"/",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"http://.uk",S_OK,FALSE},
2095 {"http",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"",S_FALSE,FALSE}
2100 {Uri_HOST_DNS,S_OK,FALSE},
2101 {80,S_OK,FALSE},
2102 {URL_SCHEME_HTTP,S_OK,FALSE},
2103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2106 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2108 {"http://www.co.google.com.[]/",S_OK,FALSE},
2109 {"www.co.google.com.[]",S_OK,FALSE},
2110 {"http://www.co.google.com.[]/",S_OK,FALSE},
2111 {"google.com.[]",S_OK,FALSE},
2112 {"",S_FALSE,FALSE},
2113 {"",S_FALSE,FALSE},
2114 {"www.co.google.com.[]",S_OK,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {"/",S_OK,FALSE},
2117 {"/",S_OK,FALSE},
2118 {"",S_FALSE,FALSE},
2119 {"http://www.co.google.com.[]",S_OK,FALSE},
2120 {"http",S_OK,FALSE},
2121 {"",S_FALSE,FALSE},
2122 {"",S_FALSE,FALSE}
2125 {Uri_HOST_DNS,S_OK,FALSE},
2126 {80,S_OK,FALSE},
2127 {URL_SCHEME_HTTP,S_OK,FALSE},
2128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2131 { "http://co.uk", 0, S_OK, FALSE,
2133 {"http://co.uk/",S_OK,FALSE},
2134 {"co.uk",S_OK,FALSE},
2135 {"http://co.uk/",S_OK,FALSE},
2136 {"",S_FALSE,FALSE},
2137 {"",S_FALSE,FALSE},
2138 {"",S_FALSE,FALSE},
2139 {"co.uk",S_OK,FALSE},
2140 {"",S_FALSE,FALSE},
2141 {"/",S_OK,FALSE},
2142 {"/",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"http://co.uk",S_OK,FALSE},
2145 {"http",S_OK,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"",S_FALSE,FALSE}
2150 {Uri_HOST_DNS,S_OK,FALSE},
2151 {80,S_OK,FALSE},
2152 {URL_SCHEME_HTTP,S_OK,FALSE},
2153 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2156 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2158 {"http://www.co.google.us.test/",S_OK,FALSE},
2159 {"www.co.google.us.test",S_OK,FALSE},
2160 {"http://www.co.google.us.test/",S_OK,FALSE},
2161 {"us.test",S_OK,FALSE},
2162 {"",S_FALSE,FALSE},
2163 {"",S_FALSE,FALSE},
2164 {"www.co.google.us.test",S_OK,FALSE},
2165 {"",S_FALSE,FALSE},
2166 {"/",S_OK,FALSE},
2167 {"/",S_OK,FALSE},
2168 {"",S_FALSE,FALSE},
2169 {"http://www.co.google.us.test",S_OK,FALSE},
2170 {"http",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"",S_FALSE,FALSE}
2175 {Uri_HOST_DNS,S_OK,FALSE},
2176 {80,S_OK,FALSE},
2177 {URL_SCHEME_HTTP,S_OK,FALSE},
2178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2181 { "http://gov.uk", 0, S_OK, FALSE,
2183 {"http://gov.uk/",S_OK,FALSE},
2184 {"gov.uk",S_OK,FALSE},
2185 {"http://gov.uk/",S_OK,FALSE},
2186 {"",S_FALSE,FALSE},
2187 {"",S_FALSE,FALSE},
2188 {"",S_FALSE,FALSE},
2189 {"gov.uk",S_OK,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"/",S_OK,FALSE},
2192 {"/",S_OK,FALSE},
2193 {"",S_FALSE,FALSE},
2194 {"http://gov.uk",S_OK,FALSE},
2195 {"http",S_OK,FALSE},
2196 {"",S_FALSE,FALSE},
2197 {"",S_FALSE,FALSE}
2200 {Uri_HOST_DNS,S_OK,FALSE},
2201 {80,S_OK,FALSE},
2202 {URL_SCHEME_HTTP,S_OK,FALSE},
2203 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2206 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2208 {"zip://www.google.com\\test",S_OK,FALSE},
2209 {"www.google.com\\test",S_OK,FALSE},
2210 {"zip://www.google.com\\test",S_OK,FALSE},
2211 {"google.com\\test",S_OK,FALSE},
2212 {"",S_FALSE,FALSE},
2213 {"",S_FALSE,FALSE},
2214 {"www.google.com\\test",S_OK,FALSE},
2215 {"",S_FALSE,FALSE},
2216 {"",S_FALSE,FALSE},
2217 {"",S_FALSE,FALSE},
2218 {"",S_FALSE,FALSE},
2219 {"zip://www.google.com\\test",S_OK,FALSE},
2220 {"zip",S_OK,FALSE},
2221 {"",S_FALSE,FALSE},
2222 {"",S_FALSE,FALSE}
2225 {Uri_HOST_DNS,S_OK,FALSE},
2226 {0,S_FALSE,FALSE},
2227 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2231 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2233 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2234 {"",S_FALSE,FALSE},
2235 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2236 {"",S_FALSE,FALSE},
2237 {"",S_FALSE,FALSE},
2238 {"",S_FALSE,FALSE},
2239 {"",S_FALSE,FALSE},
2240 {"",S_FALSE,FALSE},
2241 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2242 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2243 {"",S_FALSE,FALSE},
2244 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2245 {"urn",S_OK,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"",S_FALSE,FALSE}
2250 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2251 {0,S_FALSE,FALSE},
2252 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2256 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2257 * are decoded and all '%' are encoded.
2259 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2261 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2262 {"",S_FALSE,FALSE},
2263 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2264 {"",S_FALSE,FALSE},
2265 {".mp3",S_OK,FALSE},
2266 {"",S_FALSE,FALSE},
2267 {"",S_FALSE,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2270 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2273 {"file",S_OK,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"",S_FALSE,FALSE}
2278 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2279 {0,S_FALSE,FALSE},
2280 {URL_SCHEME_FILE,S_OK,FALSE},
2281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2284 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2285 * is decoded and only %'s in front of invalid hex digits are encoded.
2287 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2289 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2290 {"",S_FALSE,FALSE},
2291 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2292 {"",S_FALSE,FALSE},
2293 {".mp3",S_OK,FALSE},
2294 {"",S_FALSE,FALSE},
2295 {"",S_FALSE,FALSE},
2296 {"",S_FALSE,FALSE},
2297 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2298 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2299 {"",S_FALSE,FALSE},
2300 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2301 {"file",S_OK,FALSE},
2302 {"",S_FALSE,FALSE},
2303 {"",S_FALSE,FALSE}
2306 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2307 {0,S_FALSE,FALSE},
2308 {URL_SCHEME_FILE,S_OK,FALSE},
2309 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2312 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2313 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2315 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2316 {"[::1.2.3.0]",S_OK,FALSE},
2317 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2318 {"",S_FALSE,FALSE},
2319 {"",S_FALSE,FALSE},
2320 {"",S_FALSE,FALSE},
2321 {"::1.2.3.0",S_OK,FALSE},
2322 {"",S_FALSE,FALSE},
2323 {"/%3F%23.T/test",S_OK,FALSE},
2324 {"/%3F%23.T/test",S_OK,FALSE},
2325 {"",S_FALSE,FALSE},
2326 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2327 {"http",S_OK,FALSE},
2328 {"",S_FALSE,FALSE},
2329 {"",S_FALSE,FALSE},
2332 {Uri_HOST_IPV6,S_OK,FALSE},
2333 {80,S_OK,FALSE},
2334 {URL_SCHEME_HTTP,S_OK,FALSE},
2335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2338 /* Forbidden characters are always encoded for file URIs. */
2339 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2341 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2342 {"",S_FALSE,FALSE},
2343 {"file:///C:/%22test%22/test.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:/%22test%22/test.mp3",S_OK,FALSE},
2350 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2351 {"",S_FALSE,FALSE},
2352 {"file:///C:/\"test\"/test.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 /* Forbidden characters are never encoded for unknown scheme types. */
2365 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2367 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2368 {"4294967295",S_OK,FALSE},
2369 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2370 {"",S_FALSE,FALSE},
2371 {"",S_FALSE,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {"4294967295",S_OK,FALSE},
2374 {"",S_FALSE,FALSE},
2375 {"/<|>\" test<|>",S_OK,FALSE},
2376 {"/<|>\" test<|>",S_OK,FALSE},
2377 {"",S_FALSE,FALSE},
2378 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2379 {"1234",S_OK,FALSE},
2380 {"",S_FALSE,FALSE},
2381 {"",S_FALSE,FALSE}
2384 {Uri_HOST_IPV4,S_OK,FALSE},
2385 {0,S_FALSE,FALSE},
2386 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2387 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2390 /* Make sure forbidden characters are percent encoded. */
2391 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2393 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2394 {"gov.uk",S_OK,FALSE},
2395 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2396 {"",S_FALSE,FALSE},
2397 {"",S_FALSE,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"gov.uk",S_OK,FALSE},
2400 {"",S_FALSE,FALSE},
2401 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2402 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2403 {"",S_FALSE,FALSE},
2404 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2405 {"http",S_OK,FALSE},
2406 {"",S_FALSE,FALSE},
2407 {"",S_FALSE,FALSE}
2410 {Uri_HOST_DNS,S_OK,FALSE},
2411 {80,S_OK,FALSE},
2412 {URL_SCHEME_HTTP,S_OK,FALSE},
2413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2416 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2418 {"http://gov.uk/",S_OK,FALSE},
2419 {"gov.uk",S_OK,FALSE},
2420 {"http://gov.uk/",S_OK,FALSE},
2421 {"",S_FALSE,FALSE},
2422 {"",S_FALSE,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {"gov.uk",S_OK,FALSE},
2425 {"",S_FALSE,FALSE},
2426 {"/",S_OK,FALSE},
2427 {"/",S_OK,FALSE},
2428 {"",S_FALSE,FALSE},
2429 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2430 {"http",S_OK,FALSE},
2431 {"",S_FALSE,FALSE},
2432 {"",S_FALSE,FALSE}
2435 {Uri_HOST_DNS,S_OK,FALSE},
2436 {80,S_OK,FALSE},
2437 {URL_SCHEME_HTTP,S_OK,FALSE},
2438 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2441 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2443 {"http://gov.uk/",S_OK,FALSE},
2444 {"gov.uk",S_OK,FALSE},
2445 {"http://gov.uk/",S_OK,FALSE},
2446 {"",S_FALSE,FALSE},
2447 {"",S_FALSE,FALSE},
2448 {"",S_FALSE,FALSE},
2449 {"gov.uk",S_OK,FALSE},
2450 {"",S_FALSE,FALSE},
2451 {"/",S_OK,FALSE},
2452 {"/",S_OK,FALSE},
2453 {"",S_FALSE,FALSE},
2454 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2455 {"http",S_OK,FALSE},
2456 {"",S_FALSE,FALSE},
2457 {"",S_FALSE,FALSE}
2460 {Uri_HOST_DNS,S_OK,FALSE},
2461 {80,S_OK,FALSE},
2462 {URL_SCHEME_HTTP,S_OK,FALSE},
2463 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2466 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2468 {"http://gov.uk/",S_OK,FALSE},
2469 {"gov.uk",S_OK,FALSE},
2470 {"http://gov.uk/",S_OK,FALSE},
2471 {"",S_FALSE,FALSE},
2472 {"",S_FALSE,FALSE},
2473 {"",S_FALSE,FALSE},
2474 {"gov.uk",S_OK,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {"/",S_OK,FALSE},
2477 {"/",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2480 {"http",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"",S_FALSE,FALSE}
2485 {Uri_HOST_DNS,S_OK,FALSE},
2486 {80,S_OK,FALSE},
2487 {URL_SCHEME_HTTP,S_OK,FALSE},
2488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2491 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2493 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2494 {"",S_FALSE,FALSE},
2495 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2496 {"",S_FALSE,FALSE},
2497 {".mp3",S_OK,FALSE},
2498 {"",S_FALSE,FALSE},
2499 {"",S_FALSE,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2502 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2505 {"file",S_OK,FALSE},
2506 {"",S_FALSE,FALSE},
2507 {"",S_FALSE,FALSE}
2510 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2511 {0,S_FALSE,FALSE},
2512 {URL_SCHEME_FILE,S_OK,FALSE},
2513 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2516 /* Dot removal happens for unknown scheme types. */
2517 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2519 {"zip://gov.uk/",S_OK,FALSE},
2520 {"gov.uk",S_OK,FALSE},
2521 {"zip://gov.uk/",S_OK,FALSE},
2522 {"",S_FALSE,FALSE},
2523 {"",S_FALSE,FALSE},
2524 {"",S_FALSE,FALSE},
2525 {"gov.uk",S_OK,FALSE},
2526 {"",S_FALSE,FALSE},
2527 {"/",S_OK,FALSE},
2528 {"/",S_OK,FALSE},
2529 {"",S_FALSE,FALSE},
2530 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2531 {"zip",S_OK,FALSE},
2532 {"",S_FALSE,FALSE},
2533 {"",S_FALSE,FALSE}
2536 {Uri_HOST_DNS,S_OK,FALSE},
2537 {0,S_FALSE,FALSE},
2538 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2539 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2542 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2543 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2545 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2546 {"gov.uk",S_OK,FALSE},
2547 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2548 {"",S_FALSE,FALSE},
2549 {".",S_OK,FALSE},
2550 {"",S_FALSE,FALSE},
2551 {"gov.uk",S_OK,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {"/test/test2/../../.",S_OK,FALSE},
2554 {"/test/test2/../../.",S_OK,FALSE},
2555 {"",S_FALSE,FALSE},
2556 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2557 {"http",S_OK,FALSE},
2558 {"",S_FALSE,FALSE},
2559 {"",S_FALSE,FALSE}
2562 {Uri_HOST_DNS,S_OK,FALSE},
2563 {80,S_OK,FALSE},
2564 {URL_SCHEME_HTTP,S_OK,FALSE},
2565 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2568 /* Dot removal doesn't happen for wildcard scheme types. */
2569 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2571 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2572 {"gov.uk",S_OK,FALSE},
2573 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2574 {"",S_FALSE,FALSE},
2575 {".",S_OK,FALSE},
2576 {"",S_FALSE,FALSE},
2577 {"gov.uk",S_OK,FALSE},
2578 {"",S_FALSE,FALSE},
2579 {"/test/test2/../../.",S_OK,FALSE},
2580 {"/test/test2/../../.",S_OK,FALSE},
2581 {"",S_FALSE,FALSE},
2582 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2583 {"*",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_WILDCARD,S_OK,FALSE},
2591 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2594 /* Forbidden characters are encoded for opaque known scheme types. */
2595 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2597 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2598 {"",S_FALSE,FALSE},
2599 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2600 {"",S_FALSE,FALSE},
2601 {".com%22",S_OK,FALSE},
2602 {"",S_FALSE,FALSE},
2603 {"",S_FALSE,FALSE},
2604 {"",S_FALSE,FALSE},
2605 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2606 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2607 {"",S_FALSE,FALSE},
2608 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2609 {"mailto",S_OK,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {"",S_FALSE,FALSE}
2614 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2615 {0,S_FALSE,FALSE},
2616 {URL_SCHEME_MAILTO,S_OK,FALSE},
2617 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2620 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2622 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2623 {"",S_FALSE,FALSE},
2624 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2625 {"",S_FALSE,FALSE},
2626 {".com",S_OK,FALSE},
2627 {"",S_FALSE,FALSE},
2628 {"",S_FALSE,FALSE},
2629 {"",S_FALSE,FALSE},
2630 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2631 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {"news:test.tes<|>t.com",S_OK,FALSE},
2634 {"news",S_OK,FALSE},
2635 {"",S_FALSE,FALSE},
2636 {"",S_FALSE,FALSE}
2639 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2640 {0,S_FALSE,FALSE},
2641 {URL_SCHEME_NEWS,S_OK,FALSE},
2642 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2645 /* Don't encode forbidden characters. */
2646 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2648 {"news:test.tes<|>t.com",S_OK,FALSE},
2649 {"",S_FALSE,FALSE},
2650 {"news:test.tes<|>t.com",S_OK,FALSE},
2651 {"",S_FALSE,FALSE},
2652 {".com",S_OK,FALSE},
2653 {"",S_FALSE,FALSE},
2654 {"",S_FALSE,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {"test.tes<|>t.com",S_OK,FALSE},
2657 {"test.tes<|>t.com",S_OK,FALSE},
2658 {"",S_FALSE,FALSE},
2659 {"news:test.tes<|>t.com",S_OK,FALSE},
2660 {"news",S_OK,FALSE},
2661 {"",S_FALSE,FALSE},
2662 {"",S_FALSE,FALSE}
2665 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2666 {0,S_FALSE,FALSE},
2667 {URL_SCHEME_NEWS,S_OK,FALSE},
2668 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2671 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2672 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2674 {"urn:test.tes<|>t.com",S_OK,FALSE},
2675 {"",S_FALSE,FALSE},
2676 {"urn:test.tes<|>t.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<|>t.com",S_OK,FALSE},
2683 {"test.tes<|>t.com",S_OK,FALSE},
2684 {"",S_FALSE,FALSE},
2685 {"urn:test.tes<|>t.com",S_OK,FALSE},
2686 {"urn",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_UNKNOWN,S_OK,FALSE},
2694 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2697 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2698 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2700 {"news:test.test.com",S_OK,FALSE},
2701 {"",S_FALSE,FALSE},
2702 {"news:test.test.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.test.com",S_OK,FALSE},
2709 {"test.test.com",S_OK,FALSE},
2710 {"",S_FALSE,FALSE},
2711 {"news:test.%74%65%73%74.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 /* Percent encoded characters are still decoded for known scheme types. */
2724 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2726 {"news:test.test.com",S_OK,FALSE},
2727 {"",S_FALSE,FALSE},
2728 {"news:test.test.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.test.com",S_OK,FALSE},
2735 {"test.test.com",S_OK,FALSE},
2736 {"",S_FALSE,FALSE},
2737 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2738 {"news",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_NEWS,S_OK,FALSE},
2746 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2749 /* Percent encoded characters aren't decoded for unknown scheme types. */
2750 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2752 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2753 {"",S_FALSE,FALSE},
2754 {"urn:test.%74%65%73%74.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.%74%65%73%74.com",S_OK,FALSE},
2761 {"test.%74%65%73%74.com",S_OK,FALSE},
2762 {"",S_FALSE,FALSE},
2763 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2764 {"urn",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_UNKNOWN,S_OK,FALSE},
2772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2775 /* Unknown scheme types can have invalid % encoded data in query string. */
2776 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2778 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2779 {"www.winehq.org",S_OK,FALSE},
2780 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2781 {"winehq.org",S_OK,FALSE},
2782 {"",S_FALSE,FALSE},
2783 {"",S_FALSE,FALSE},
2784 {"www.winehq.org",S_OK,FALSE},
2785 {"",S_FALSE,FALSE},
2786 {"/",S_OK,FALSE},
2787 {"/?query=%xx&return=y",S_OK,FALSE},
2788 {"?query=%xx&return=y",S_OK,FALSE},
2789 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2790 {"zip",S_OK,FALSE},
2791 {"",S_FALSE,FALSE},
2792 {"",S_FALSE,FALSE}
2795 {Uri_HOST_DNS,S_OK,FALSE},
2796 {0,S_FALSE,FALSE},
2797 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2798 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2801 /* Known scheme types can have invalid % encoded data with the right flags. */
2802 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2804 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2805 {"www.winehq.org",S_OK,FALSE},
2806 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2807 {"winehq.org",S_OK,FALSE},
2808 {"",S_FALSE,FALSE},
2809 {"",S_FALSE,FALSE},
2810 {"www.winehq.org",S_OK,FALSE},
2811 {"",S_FALSE,FALSE},
2812 {"/",S_OK,FALSE},
2813 {"/?query=%xx&return=y",S_OK,FALSE},
2814 {"?query=%xx&return=y",S_OK,FALSE},
2815 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2816 {"http",S_OK,FALSE},
2817 {"",S_FALSE,FALSE},
2818 {"",S_FALSE,FALSE}
2821 {Uri_HOST_DNS,S_OK,FALSE},
2822 {80,S_OK,FALSE},
2823 {URL_SCHEME_HTTP,S_OK,FALSE},
2824 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2827 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2828 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2830 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2831 {"www.winehq.org",S_OK,FALSE},
2832 {"http://www.winehq.org/?query=<|>&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=<|>&return=y",S_OK,FALSE},
2840 {"?query=<|>&return=y",S_OK,FALSE},
2841 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2842 {"http",S_OK,FALSE},
2843 {"",S_FALSE,FALSE},
2844 {"",S_FALSE,FALSE}
2847 {Uri_HOST_DNS,S_OK,FALSE},
2848 {80,S_OK,FALSE},
2849 {URL_SCHEME_HTTP,S_OK,FALSE},
2850 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2853 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2854 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2856 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2857 {"www.winehq.org",S_OK,FALSE},
2858 {"http://www.winehq.org/?query=<|>&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=<|>&return=y",S_OK,FALSE},
2866 {"?query=<|>&return=y",S_OK,FALSE},
2867 {"http://www.winehq.org/tests/..?query=<|>&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 are encoded for known scheme types. */
2880 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2882 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2883 {"www.winehq.org",S_OK,FALSE},
2884 {"http://www.winehq.org/?query=%3C%7C%3E&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=%3C%7C%3E&return=y",S_OK,FALSE},
2892 {"?query=%3C%7C%3E&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 are not encoded for unknown scheme types. */
2906 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2908 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2909 {"www.winehq.org",S_OK,FALSE},
2910 {"zip://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 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2920 {"zip",S_OK,FALSE},
2921 {"",S_FALSE,FALSE},
2922 {"",S_FALSE,FALSE}
2925 {Uri_HOST_DNS,S_OK,FALSE},
2926 {0,S_FALSE,FALSE},
2927 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2928 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2931 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2932 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2934 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2935 {"www.winehq.org",S_OK,FALSE},
2936 {"http://www.winehq.org/?query=01&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=01&return=y",S_OK,FALSE},
2944 {"?query=01&return=y",S_OK,FALSE},
2945 {"http://www.winehq.org/tests/..?query=%30%31&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 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2958 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2960 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2961 {"www.winehq.org",S_OK,FALSE},
2962 {"zip://www.winehq.org/?query=%30%31&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=%30%31&return=y",S_OK,FALSE},
2970 {"?query=%30%31&return=y",S_OK,FALSE},
2971 {"zip://www.winehq.org/tests/..?query=%30%31&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 characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2984 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2986 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2987 {"www.winehq.org",S_OK,FALSE},
2988 {"http://www.winehq.org/?query=%30%31&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=%30%31&return=y",S_OK,FALSE},
2996 {"?query=%30%31&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 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3011 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3012 {"www.winehq.org",S_OK,FALSE},
3013 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3014 {"winehq.org",S_OK,FALSE},
3015 {"",S_FALSE,FALSE},
3016 {"",S_FALSE,FALSE},
3017 {"www.winehq.org",S_OK,FALSE},
3018 {"",S_FALSE,FALSE},
3019 {"",S_FALSE,FALSE},
3020 {"?query=12&return=y",S_OK,FALSE},
3021 {"?query=12&return=y",S_OK,FALSE},
3022 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3023 {"http",S_OK,FALSE},
3024 {"",S_FALSE,FALSE},
3025 {"",S_FALSE,FALSE}
3028 {Uri_HOST_DNS,S_OK,FALSE},
3029 {80,S_OK,FALSE},
3030 {URL_SCHEME_HTTP,S_OK,FALSE},
3031 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3034 /* Unknown scheme types can have invalid % encoded data in fragments. */
3035 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
3037 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3038 {"www.winehq.org",S_OK,FALSE},
3039 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3040 {"winehq.org",S_OK,FALSE},
3041 {"",S_FALSE,FALSE},
3042 {"#Te%xx",S_OK,FALSE},
3043 {"www.winehq.org",S_OK,FALSE},
3044 {"",S_FALSE,FALSE},
3045 {"/tests/",S_OK,FALSE},
3046 {"/tests/",S_OK,FALSE},
3047 {"",S_FALSE,FALSE},
3048 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3049 {"zip",S_OK,FALSE},
3050 {"",S_FALSE,FALSE},
3051 {"",S_FALSE,FALSE}
3054 {Uri_HOST_DNS,S_OK,FALSE},
3055 {0,S_FALSE,FALSE},
3056 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3057 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3060 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3061 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3063 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3064 {"www.winehq.org",S_OK,FALSE},
3065 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3066 {"winehq.org",S_OK,FALSE},
3067 {"",S_FALSE,FALSE},
3068 {"#Te<|>",S_OK,FALSE},
3069 {"www.winehq.org",S_OK,FALSE},
3070 {"",S_FALSE,FALSE},
3071 {"/tests/",S_OK,FALSE},
3072 {"/tests/",S_OK,FALSE},
3073 {"",S_FALSE,FALSE},
3074 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3075 {"zip",S_OK,FALSE},
3076 {"",S_FALSE,FALSE},
3077 {"",S_FALSE,FALSE}
3080 {Uri_HOST_DNS,S_OK,FALSE},
3081 {0,S_FALSE,FALSE},
3082 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3083 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3086 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3087 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3089 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3090 {"www.winehq.org",S_OK,FALSE},
3091 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3092 {"winehq.org",S_OK,FALSE},
3093 {"",S_FALSE,FALSE},
3094 {"#Te%3C%7C%3E",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 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3101 {"http",S_OK,FALSE},
3102 {"",S_FALSE,FALSE},
3103 {"",S_FALSE,FALSE}
3106 {Uri_HOST_DNS,S_OK,FALSE},
3107 {80,S_OK,FALSE},
3108 {URL_SCHEME_HTTP,S_OK,FALSE},
3109 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3112 /* Forbidden characters aren't encoded in the fragment with this flag. */
3113 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3115 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3116 {"www.winehq.org",S_OK,FALSE},
3117 {"http://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 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3127 {"http",S_OK,FALSE},
3128 {"",S_FALSE,FALSE},
3129 {"",S_FALSE,FALSE}
3132 {Uri_HOST_DNS,S_OK,FALSE},
3133 {80,S_OK,FALSE},
3134 {URL_SCHEME_HTTP,S_OK,FALSE},
3135 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3138 /* Forbidden characters aren't encoded in the fragment with this flag. */
3139 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3141 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3142 {"www.winehq.org",S_OK,FALSE},
3143 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3144 {"winehq.org",S_OK,FALSE},
3145 {"",S_FALSE,FALSE},
3146 {"#Te<|>",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 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3165 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3167 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3168 {"www.winehq.org",S_OK,FALSE},
3169 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3170 {"winehq.org",S_OK,FALSE},
3171 {"",S_FALSE,FALSE},
3172 {"#Te%30%31%32",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 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3179 {"zip",S_OK,FALSE},
3180 {"",S_FALSE,FALSE},
3181 {"",S_FALSE,FALSE}
3184 {Uri_HOST_DNS,S_OK,FALSE},
3185 {0,S_FALSE,FALSE},
3186 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3187 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3190 /* Percent encoded, unreserved characters are decoded for known schemes. */
3191 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3193 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3194 {"www.winehq.org",S_OK,FALSE},
3195 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3196 {"winehq.org",S_OK,FALSE},
3197 {"",S_FALSE,FALSE},
3198 {"#Te012",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%30%31%32",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 are decoded even if NO_CANONICALIZE is set. */
3217 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3219 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3220 {"www.winehq.org",S_OK,FALSE},
3221 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3222 {"winehq.org",S_OK,FALSE},
3223 {"",S_FALSE,FALSE},
3224 {"#Te012",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 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3231 {"http",S_OK,FALSE},
3232 {"",S_FALSE,FALSE},
3233 {"",S_FALSE,FALSE}
3236 {Uri_HOST_DNS,S_OK,FALSE},
3237 {80,S_OK,FALSE},
3238 {URL_SCHEME_HTTP,S_OK,FALSE},
3239 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3242 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3243 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3245 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3246 {"www.winehq.org",S_OK,FALSE},
3247 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3248 {"winehq.org",S_OK,FALSE},
3249 {"",S_FALSE,FALSE},
3250 {"#Te%30%31%32",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 /* Leading/Trailing whitespace is removed. */
3269 { " http://google.com/ ", 0, S_OK, FALSE,
3271 {"http://google.com/",S_OK,FALSE},
3272 {"google.com",S_OK,FALSE},
3273 {"http://google.com/",S_OK,FALSE},
3274 {"google.com",S_OK,FALSE},
3275 {"",S_FALSE,FALSE},
3276 {"",S_FALSE,FALSE},
3277 {"google.com",S_OK,FALSE},
3278 {"",S_FALSE,FALSE},
3279 {"/",S_OK,FALSE},
3280 {"/",S_OK,FALSE},
3281 {"",S_FALSE,FALSE},
3282 {"http://google.com/",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 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3296 {"http://google.com/",S_OK,FALSE},
3297 {"google.com",S_OK,FALSE},
3298 {"http://google.com/",S_OK,FALSE},
3299 {"google.com",S_OK,FALSE},
3300 {"",S_FALSE,FALSE},
3301 {"",S_FALSE,FALSE},
3302 {"google.com",S_OK,FALSE},
3303 {"",S_FALSE,FALSE},
3304 {"/",S_OK,FALSE},
3305 {"/",S_OK,FALSE},
3306 {"",S_FALSE,FALSE},
3307 {"http://google.com/",S_OK,FALSE},
3308 {"http",S_OK,FALSE},
3309 {"",S_FALSE,FALSE},
3310 {"",S_FALSE,FALSE}
3313 {Uri_HOST_DNS,S_OK,FALSE},
3314 {80,S_OK,FALSE},
3315 {URL_SCHEME_HTTP,S_OK,FALSE},
3316 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3319 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3321 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3322 {"g%0aoogle.co%0dm",S_OK,FALSE},
3323 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3324 {"g%0aoogle.co%0dm",S_OK,FALSE},
3325 {"",S_FALSE,FALSE},
3326 {"",S_FALSE,FALSE},
3327 {"g%0aoogle.co%0dm",S_OK,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {"/%0A%0A%0A",S_OK,FALSE},
3330 {"/%0A%0A%0A",S_OK,FALSE},
3331 {"",S_FALSE,FALSE},
3332 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3333 {"http",S_OK,FALSE},
3334 {"",S_FALSE,FALSE},
3335 {"",S_FALSE,FALSE}
3338 {Uri_HOST_DNS,S_OK,FALSE},
3339 {80,S_OK,FALSE},
3340 {URL_SCHEME_HTTP,S_OK,FALSE},
3341 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3344 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3346 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3347 {"g\noogle.co\rm",S_OK,FALSE},
3348 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3349 {"g\noogle.co\rm",S_OK,FALSE},
3350 {"",S_FALSE,FALSE},
3351 {"",S_FALSE,FALSE},
3352 {"g\noogle.co\rm",S_OK,FALSE},
3353 {"",S_FALSE,FALSE},
3354 {"/\n\n\n",S_OK,FALSE},
3355 {"/\n\n\n",S_OK,FALSE},
3356 {"",S_FALSE,FALSE},
3357 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3358 {"zip",S_OK,FALSE},
3359 {"",S_FALSE,FALSE},
3360 {"",S_FALSE,FALSE}
3363 {Uri_HOST_DNS,S_OK,FALSE},
3364 {0,S_FALSE,FALSE},
3365 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3366 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3369 /* Since file URLs are usually hierarchical, it returns an empty string
3370 * for the absolute URI property since it was declared as an opaque URI.
3372 { "file:index.html", 0, S_OK, FALSE,
3374 {"",S_FALSE,FALSE},
3375 {"",S_FALSE,FALSE},
3376 {"file:index.html",S_OK,FALSE},
3377 {"",S_FALSE,FALSE},
3378 {".html",S_OK,FALSE},
3379 {"",S_FALSE,FALSE},
3380 {"",S_FALSE,FALSE},
3381 {"",S_FALSE,FALSE},
3382 {"index.html",S_OK,FALSE},
3383 {"index.html",S_OK,FALSE},
3384 {"",S_FALSE,FALSE},
3385 {"file:index.html",S_OK,FALSE},
3386 {"file",S_OK,FALSE},
3387 {"",S_FALSE,FALSE},
3388 {"",S_FALSE,FALSE}
3391 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3392 {0,S_FALSE,FALSE},
3393 {URL_SCHEME_FILE,S_OK,FALSE},
3394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3397 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3398 { "http:test.com/index.html", 0, S_OK, FALSE,
3400 {"",S_FALSE,FALSE},
3401 {"",S_FALSE,FALSE},
3402 {"http:test.com/index.html",S_OK,FALSE},
3403 {"",S_FALSE,FALSE},
3404 {".html",S_OK,FALSE},
3405 {"",S_FALSE,FALSE},
3406 {"",S_FALSE,FALSE},
3407 {"",S_FALSE,FALSE},
3408 {"test.com/index.html",S_OK,FALSE},
3409 {"test.com/index.html",S_OK,FALSE},
3410 {"",S_FALSE,FALSE},
3411 {"http:test.com/index.html",S_OK,FALSE},
3412 {"http",S_OK,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {"",S_FALSE,FALSE}
3417 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3418 {80,S_OK,FALSE},
3419 {URL_SCHEME_HTTP,S_OK,FALSE},
3420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3423 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3425 {"",S_FALSE,FALSE},
3426 {"",S_FALSE,FALSE},
3427 {"ftp:test.com/index.html",S_OK,FALSE},
3428 {"",S_FALSE,FALSE},
3429 {".html",S_OK,FALSE},
3430 {"",S_FALSE,FALSE},
3431 {"",S_FALSE,FALSE},
3432 {"",S_FALSE,FALSE},
3433 {"test.com/index.html",S_OK,FALSE},
3434 {"test.com/index.html",S_OK,FALSE},
3435 {"",S_FALSE,FALSE},
3436 {"ftp:test.com/index.html",S_OK,FALSE},
3437 {"ftp",S_OK,FALSE},
3438 {"",S_FALSE,FALSE},
3439 {"",S_FALSE,FALSE}
3442 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3443 {21,S_OK,FALSE},
3444 {URL_SCHEME_FTP,S_OK,FALSE},
3445 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3448 { "file://C|/test.mp3", 0, S_OK, FALSE,
3450 {"file:///C:/test.mp3",S_OK,FALSE},
3451 {"",S_FALSE,FALSE},
3452 {"file:///C:/test.mp3",S_OK,FALSE},
3453 {"",S_FALSE,FALSE},
3454 {".mp3",S_OK,FALSE},
3455 {"",S_FALSE,FALSE},
3456 {"",S_FALSE,FALSE},
3457 {"",S_FALSE,FALSE},
3458 {"/C:/test.mp3",S_OK,FALSE},
3459 {"/C:/test.mp3",S_OK,FALSE},
3460 {"",S_FALSE,FALSE},
3461 {"file://C|/test.mp3",S_OK,FALSE},
3462 {"file",S_OK,FALSE},
3463 {"",S_FALSE,FALSE},
3464 {"",S_FALSE,FALSE}
3467 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3468 {0,S_FALSE,FALSE},
3469 {URL_SCHEME_FILE,S_OK,FALSE},
3470 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3473 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3475 {"file:///C:/test.mp3",S_OK,FALSE},
3476 {"",S_FALSE,FALSE},
3477 {"file:///C:/test.mp3",S_OK,FALSE},
3478 {"",S_FALSE,FALSE},
3479 {".mp3",S_OK,FALSE},
3480 {"",S_FALSE,FALSE},
3481 {"",S_FALSE,FALSE},
3482 {"",S_FALSE,FALSE},
3483 {"/C:/test.mp3",S_OK,FALSE},
3484 {"/C:/test.mp3",S_OK,FALSE},
3485 {"",S_FALSE,FALSE},
3486 {"file:///C|/test.mp3",S_OK,FALSE},
3487 {"file",S_OK,FALSE},
3488 {"",S_FALSE,FALSE},
3489 {"",S_FALSE,FALSE}
3492 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3493 {0,S_FALSE,FALSE},
3494 {URL_SCHEME_FILE,S_OK,FALSE},
3495 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3498 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3499 * to '\\'.
3501 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3503 {"file://c:\\dir\\index.html",S_OK,FALSE},
3504 {"",S_FALSE,FALSE},
3505 {"file://c:\\dir\\index.html",S_OK,FALSE},
3506 {"",S_FALSE,FALSE},
3507 {".html",S_OK,FALSE},
3508 {"",S_FALSE,FALSE},
3509 {"",S_FALSE,FALSE},
3510 {"",S_FALSE,FALSE},
3511 {"c:\\dir\\index.html",S_OK,FALSE},
3512 {"c:\\dir\\index.html",S_OK,FALSE},
3513 {"",S_FALSE,FALSE},
3514 {"file://c:/dir/index.html",S_OK,FALSE},
3515 {"file",S_OK,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {"",S_FALSE,FALSE}
3520 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3521 {0,S_FALSE,FALSE},
3522 {URL_SCHEME_FILE,S_OK,FALSE},
3523 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3526 /* Extra '/' after "file://" is removed. */
3527 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3529 {"file://c:\\dir\\index.html",S_OK,FALSE},
3530 {"",S_FALSE,FALSE},
3531 {"file://c:\\dir\\index.html",S_OK,FALSE},
3532 {"",S_FALSE,FALSE},
3533 {".html",S_OK,FALSE},
3534 {"",S_FALSE,FALSE},
3535 {"",S_FALSE,FALSE},
3536 {"",S_FALSE,FALSE},
3537 {"c:\\dir\\index.html",S_OK,FALSE},
3538 {"c:\\dir\\index.html",S_OK,FALSE},
3539 {"",S_FALSE,FALSE},
3540 {"file:///c:/dir/index.html",S_OK,FALSE},
3541 {"file",S_OK,FALSE},
3542 {"",S_FALSE,FALSE},
3543 {"",S_FALSE,FALSE}
3546 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3547 {0,S_FALSE,FALSE},
3548 {URL_SCHEME_FILE,S_OK,FALSE},
3549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3552 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3553 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3555 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3556 {"",S_FALSE,FALSE},
3557 {"file://c:\\dir\\%a _name\\file*.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\\%a _name\\file*.html",S_OK,FALSE},
3564 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3565 {"",S_FALSE,FALSE},
3566 {"file:///c:/dir\\%%61%20%5Fname/file%2A.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 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3580 {"file://c:\\dir\\index.html",S_OK,FALSE},
3581 {"",S_FALSE,FALSE},
3582 {"file://c:\\dir\\index.html",S_OK,FALSE},
3583 {"",S_FALSE,FALSE},
3584 {".html",S_OK,FALSE},
3585 {"",S_FALSE,FALSE},
3586 {"",S_FALSE,FALSE},
3587 {"",S_FALSE,FALSE},
3588 {"c:\\dir\\index.html",S_OK,FALSE},
3589 {"c:\\dir\\index.html",S_OK,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {"file://c|/dir\\index.html",S_OK,FALSE},
3592 {"file",S_OK,FALSE},
3593 {"",S_FALSE,FALSE},
3594 {"",S_FALSE,FALSE}
3597 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3598 {0,S_FALSE,FALSE},
3599 {URL_SCHEME_FILE,S_OK,FALSE},
3600 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3603 /* The backslashes after the scheme name are converted to forward slashes. */
3604 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3606 {"file://c:\\dir\\index.html",S_OK,FALSE},
3607 {"",S_FALSE,FALSE},
3608 {"file://c:\\dir\\index.html",S_OK,FALSE},
3609 {"",S_FALSE,FALSE},
3610 {".html",S_OK,FALSE},
3611 {"",S_FALSE,FALSE},
3612 {"",S_FALSE,FALSE},
3613 {"",S_FALSE,FALSE},
3614 {"c:\\dir\\index.html",S_OK,FALSE},
3615 {"c:\\dir\\index.html",S_OK,FALSE},
3616 {"",S_FALSE,FALSE},
3617 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3618 {"file",S_OK,FALSE},
3619 {"",S_FALSE,FALSE},
3620 {"",S_FALSE,FALSE}
3623 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3624 {0,S_FALSE,FALSE},
3625 {URL_SCHEME_FILE,S_OK,FALSE},
3626 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3629 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3631 {"file:///c:/dir/index.html",S_OK,FALSE},
3632 {"",S_FALSE,FALSE},
3633 {"file:///c:/dir/index.html",S_OK,FALSE},
3634 {"",S_FALSE,FALSE},
3635 {".html",S_OK,FALSE},
3636 {"",S_FALSE,FALSE},
3637 {"",S_FALSE,FALSE},
3638 {"",S_FALSE,FALSE},
3639 {"/c:/dir/index.html",S_OK,FALSE},
3640 {"/c:/dir/index.html",S_OK,FALSE},
3641 {"",S_FALSE,FALSE},
3642 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3643 {"file",S_OK,FALSE},
3644 {"",S_FALSE,FALSE},
3645 {"",S_FALSE,FALSE}
3648 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3649 {0,S_FALSE,FALSE},
3650 {URL_SCHEME_FILE,S_OK,FALSE},
3651 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3654 { "http:\\\\google.com", 0, S_OK, FALSE,
3656 {"http://google.com/",S_OK,FALSE},
3657 {"google.com",S_OK,FALSE},
3658 {"http://google.com/",S_OK,FALSE},
3659 {"google.com",S_OK,FALSE},
3660 {"",S_FALSE,FALSE},
3661 {"",S_FALSE,FALSE},
3662 {"google.com",S_OK,FALSE},
3663 {"",S_FALSE,FALSE},
3664 {"/",S_OK,FALSE},
3665 {"/",S_OK,FALSE},
3666 {"",S_FALSE,FALSE},
3667 {"http:\\\\google.com",S_OK,FALSE},
3668 {"http",S_OK,FALSE},
3669 {"",S_FALSE,FALSE},
3670 {"",S_FALSE,FALSE}
3673 {Uri_HOST_DNS,S_OK,FALSE},
3674 {80,S_OK,FALSE},
3675 {URL_SCHEME_HTTP,S_OK,FALSE},
3676 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3679 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3680 { "zip:\\\\google.com", 0, S_OK, FALSE,
3682 {"zip:\\\\google.com",S_OK,FALSE},
3683 {"",S_FALSE,FALSE},
3684 {"zip:\\\\google.com",S_OK,FALSE},
3685 {"",S_FALSE,FALSE},
3686 {".com",S_OK,FALSE},
3687 {"",S_FALSE,FALSE},
3688 {"",S_FALSE,FALSE},
3689 {"",S_FALSE,FALSE},
3690 {"\\\\google.com",S_OK,FALSE},
3691 {"\\\\google.com",S_OK,FALSE},
3692 {"",S_FALSE,FALSE},
3693 {"zip:\\\\google.com",S_OK,FALSE},
3694 {"zip",S_OK,FALSE},
3695 {"",S_FALSE,FALSE},
3696 {"",S_FALSE,FALSE}
3699 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3700 {0,S_FALSE,FALSE},
3701 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3702 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3705 /* Dot segments aren't removed. */
3706 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3708 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3709 {"",S_FALSE,FALSE},
3710 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3711 {"",S_FALSE,FALSE},
3712 {".html",S_OK,FALSE},
3713 {"",S_FALSE,FALSE},
3714 {"",S_FALSE,FALSE},
3715 {"",S_FALSE,FALSE},
3716 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3717 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3718 {"",S_FALSE,FALSE},
3719 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3720 {"file",S_OK,FALSE},
3721 {"",S_FALSE,FALSE},
3722 {"",S_FALSE,FALSE}
3725 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3726 {0,S_FALSE,FALSE},
3727 {URL_SCHEME_FILE,S_OK,FALSE},
3728 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3731 /* Forbidden characters aren't percent encoded. */
3732 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3734 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3735 {"",S_FALSE,FALSE},
3736 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3737 {"",S_FALSE,FALSE},
3738 {".html",S_OK,FALSE},
3739 {"",S_FALSE,FALSE},
3740 {"",S_FALSE,FALSE},
3741 {"",S_FALSE,FALSE},
3742 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3743 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3744 {"",S_FALSE,FALSE},
3745 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3746 {"file",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_FILE,S_OK,FALSE},
3754 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3757 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3758 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3760 {"",S_FALSE,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 /* '/' are still converted to '\' even though it's an opaque URI. */
3784 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3786 {"",S_FALSE,FALSE},
3787 {"",S_FALSE,FALSE},
3788 {"file:c:\\dir\\..\\..\\index.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\\..\\..\\index.html",S_OK,FALSE},
3795 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {"file:c:/dir\\../..\\index.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 /* Forbidden characters aren't percent encoded. */
3810 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3812 {"",S_FALSE,FALSE},
3813 {"",S_FALSE,FALSE},
3814 {"file:c:\\in^|dex.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:\\in^|dex.html",S_OK,FALSE},
3821 {"c:\\in^|dex.html",S_OK,FALSE},
3822 {"",S_FALSE,FALSE},
3823 {"file:c:\\in^|dex.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 /* Doesn't have a UserName since the ':' appears at the beginning of the
3836 * userinfo section.
3838 { "http://:password@gov.uk", 0, S_OK, FALSE,
3840 {"http://:password@gov.uk/",S_OK,FALSE},
3841 {":password@gov.uk",S_OK,FALSE},
3842 {"http://gov.uk/",S_OK,FALSE},
3843 {"",S_FALSE,FALSE},
3844 {"",S_FALSE,FALSE},
3845 {"",S_FALSE,FALSE},
3846 {"gov.uk",S_OK,FALSE},
3847 {"password",S_OK,FALSE},
3848 {"/",S_OK,FALSE},
3849 {"/",S_OK,FALSE},
3850 {"",S_FALSE,FALSE},
3851 {"http://:password@gov.uk",S_OK,FALSE},
3852 {"http",S_OK,FALSE},
3853 {":password",S_OK,FALSE},
3854 {"",S_FALSE,FALSE}
3857 {Uri_HOST_DNS,S_OK,FALSE},
3858 {80,S_OK,FALSE},
3859 {URL_SCHEME_HTTP,S_OK,FALSE},
3860 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3863 /* Has a UserName since the userinfo section doesn't contain a password. */
3864 { "http://@gov.uk", 0, S_OK, FALSE,
3866 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3867 {"@gov.uk",S_OK,FALSE},
3868 {"http://gov.uk/",S_OK,FALSE},
3869 {"",S_FALSE,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"",S_FALSE,FALSE},
3872 {"gov.uk",S_OK,FALSE},
3873 {"",S_FALSE,FALSE},
3874 {"/",S_OK,FALSE},
3875 {"/",S_OK,FALSE},
3876 {"",S_FALSE,FALSE},
3877 {"http://@gov.uk",S_OK,FALSE},
3878 {"http",S_OK,FALSE},
3879 {"",S_OK,FALSE},
3880 {"",S_OK,FALSE}
3883 {Uri_HOST_DNS,S_OK,FALSE},
3884 {80,S_OK,FALSE},
3885 {URL_SCHEME_HTTP,S_OK,FALSE},
3886 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3889 /* ":@" not included in the absolute URI. */
3890 { "http://:@gov.uk", 0, S_OK, FALSE,
3892 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3893 {":@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 {"",S_OK,FALSE},
3900 {"/",S_OK,FALSE},
3901 {"/",S_OK,FALSE},
3902 {"",S_FALSE,FALSE},
3903 {"http://:@gov.uk",S_OK,FALSE},
3904 {"http",S_OK,FALSE},
3905 {":",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 /* '@' is included because it's an unknown scheme type. */
3916 { "zip://@gov.uk", 0, S_OK, FALSE,
3918 {"zip://@gov.uk/",S_OK,FALSE},
3919 {"@gov.uk",S_OK,FALSE},
3920 {"zip://@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 {"zip://@gov.uk",S_OK,FALSE},
3930 {"zip",S_OK,FALSE},
3931 {"",S_OK,FALSE},
3932 {"",S_OK,FALSE}
3935 {Uri_HOST_DNS,S_OK,FALSE},
3936 {0,S_FALSE,FALSE},
3937 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3938 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3941 /* ":@" are included because it's an unknown scheme type. */
3942 { "zip://:@gov.uk", 0, S_OK, FALSE,
3944 {"zip://:@gov.uk/",S_OK,FALSE},
3945 {":@gov.uk",S_OK,FALSE},
3946 {"zip://:@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 {"zip://:@gov.uk",S_OK,FALSE},
3956 {"zip",S_OK,FALSE},
3957 {":",S_OK,FALSE},
3958 {"",S_FALSE,FALSE}
3961 {Uri_HOST_DNS,S_OK,FALSE},
3962 {0,S_FALSE,FALSE},
3963 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3964 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3967 { "about:blank", 0, S_OK, FALSE,
3969 {"about:blank",S_OK,FALSE},
3970 {"",S_FALSE,FALSE},
3971 {"about:blank",S_OK,FALSE},
3972 {"",S_FALSE,FALSE},
3973 {"",S_FALSE,FALSE},
3974 {"",S_FALSE,FALSE},
3975 {"",S_FALSE,FALSE},
3976 {"",S_FALSE,FALSE},
3977 {"blank",S_OK,FALSE},
3978 {"blank",S_OK,FALSE},
3979 {"",S_FALSE,FALSE},
3980 {"about:blank",S_OK,FALSE},
3981 {"about",S_OK,FALSE},
3982 {"",S_FALSE,FALSE},
3983 {"",S_FALSE,FALSE}
3986 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3987 {0,S_FALSE,FALSE},
3988 {URL_SCHEME_ABOUT,S_OK,FALSE},
3989 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3992 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3994 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3995 {"",S_FALSE,FALSE},
3996 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3997 {"",S_FALSE,FALSE},
3998 {".htm",S_OK,FALSE},
3999 {"",S_FALSE,FALSE},
4000 {"",S_FALSE,FALSE},
4001 {"",S_FALSE,FALSE},
4002 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4003 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4006 {"mk",S_OK,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"",S_FALSE,FALSE}
4011 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4012 {0,S_FALSE,FALSE},
4013 {URL_SCHEME_MK,S_OK,FALSE},
4014 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4017 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
4019 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4020 {"",S_FALSE,FALSE},
4021 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4022 {"",S_FALSE,FALSE},
4023 {".htm",S_OK,FALSE},
4024 {"",S_FALSE,FALSE},
4025 {"",S_FALSE,FALSE},
4026 {"",S_FALSE,FALSE},
4027 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4028 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4031 {"mk",S_OK,FALSE},
4032 {"",S_FALSE,FALSE},
4033 {"",S_FALSE,FALSE}
4036 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4037 {0,S_FALSE,FALSE},
4038 {URL_SCHEME_MK,S_OK,FALSE},
4039 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4042 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4043 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
4045 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4046 {"server",S_OK,FALSE},
4047 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4048 {"",S_FALSE,FALSE},
4049 {".html",S_OK,FALSE},
4050 {"",S_FALSE,FALSE},
4051 {"server",S_OK,FALSE},
4052 {"",S_FALSE,FALSE},
4053 {"\\dir\\index.html",S_OK,FALSE},
4054 {"\\dir\\index.html",S_OK,FALSE},
4055 {"",S_FALSE,FALSE},
4056 {"file://server/dir/index.html",S_OK,FALSE},
4057 {"file",S_OK,FALSE},
4058 {"",S_FALSE,FALSE},
4059 {"",S_FALSE,FALSE}
4062 {Uri_HOST_DNS,S_OK,FALSE},
4063 {0,S_FALSE,FALSE},
4064 {URL_SCHEME_FILE,S_OK,FALSE},
4065 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4068 /* When CreateUri generates an IUri, it still displays the default port in the
4069 * authority.
4071 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4073 {"http://google.com:80/",S_OK,FALSE},
4074 {"google.com:80",S_OK,FALSE},
4075 {"http://google.com:80/",S_OK,FALSE},
4076 {"google.com",S_OK,FALSE},
4077 {"",S_FALSE,FALSE},
4078 {"",S_FALSE,FALSE},
4079 {"google.com",S_OK,FALSE},
4080 {"",S_FALSE,FALSE},
4081 {"/",S_OK,FALSE},
4082 {"/",S_OK,FALSE},
4083 {"",S_FALSE,FALSE},
4084 {"http://google.com:80/",S_OK,FALSE},
4085 {"http",S_OK,FALSE},
4086 {"",S_FALSE,FALSE},
4087 {"",S_FALSE,FALSE}
4090 {Uri_HOST_DNS,S_OK,FALSE},
4091 {80,S_OK,FALSE},
4092 {URL_SCHEME_HTTP,S_OK,FALSE},
4093 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4096 /* For res URIs the host is everything up until the first '/'. */
4097 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4099 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4100 {"C:\\dir\\file.exe",S_OK,FALSE},
4101 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4102 {"",S_FALSE,FALSE},
4103 {".html",S_OK,FALSE},
4104 {"",S_FALSE,FALSE},
4105 {"C:\\dir\\file.exe",S_OK,FALSE},
4106 {"",S_FALSE,FALSE},
4107 {"/DATA/test.html",S_OK,FALSE},
4108 {"/DATA/test.html",S_OK,FALSE},
4109 {"",S_FALSE,FALSE},
4110 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4111 {"res",S_OK,FALSE},
4112 {"",S_FALSE,FALSE},
4113 {"",S_FALSE,FALSE}
4116 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4117 {0,S_FALSE,FALSE},
4118 {URL_SCHEME_RES,S_OK,FALSE},
4119 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4122 /* Res URI can contain a '|' in the host name. */
4123 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4125 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4126 {"c:\\di|r\\file.exe",S_OK,FALSE},
4127 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4128 {"",S_FALSE,FALSE},
4129 {"",S_FALSE,FALSE},
4130 {"",S_FALSE,FALSE},
4131 {"c:\\di|r\\file.exe",S_OK,FALSE},
4132 {"",S_FALSE,FALSE},
4133 {"/test",S_OK,FALSE},
4134 {"/test",S_OK,FALSE},
4135 {"",S_FALSE,FALSE},
4136 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4137 {"res",S_OK,FALSE},
4138 {"",S_FALSE,FALSE},
4139 {"",S_FALSE,FALSE}
4142 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4143 {0,S_FALSE,FALSE},
4144 {URL_SCHEME_RES,S_OK,FALSE},
4145 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4148 /* Res URIs can have invalid percent encoded values. */
4149 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4151 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4152 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4153 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4154 {"",S_FALSE,FALSE},
4155 {"",S_FALSE,FALSE},
4156 {"",S_FALSE,FALSE},
4157 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4158 {"",S_FALSE,FALSE},
4159 {"/test",S_OK,FALSE},
4160 {"/test",S_OK,FALSE},
4161 {"",S_FALSE,FALSE},
4162 {"res://c:\\dir%xx\\file.exe/test",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 doesn't get forbidden characters percent encoded in its path. */
4175 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4177 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4178 {"c:\\test",S_OK,FALSE},
4179 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4180 {"",S_FALSE,FALSE},
4181 {"",S_FALSE,FALSE},
4182 {"",S_FALSE,FALSE},
4183 {"c:\\test",S_OK,FALSE},
4184 {"",S_FALSE,FALSE},
4185 {"/tes<|>t",S_OK,FALSE},
4186 {"/tes<|>t",S_OK,FALSE},
4187 {"",S_FALSE,FALSE},
4188 {"res://c:\\test/tes<|>t",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 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4202 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4203 {"",S_FALSE,FALSE},
4204 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4205 {"",S_FALSE,FALSE},
4206 {".jpg",S_OK,FALSE},
4207 {"",S_FALSE,FALSE},
4208 {"",S_FALSE,FALSE},
4209 {"",S_FALSE,FALSE},
4210 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4211 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4212 {"",S_FALSE,FALSE},
4213 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4214 {"mk",S_OK,FALSE},
4215 {"",S_FALSE,FALSE},
4216 {"",S_FALSE,FALSE}
4219 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4220 {0,S_FALSE,FALSE},
4221 {URL_SCHEME_MK,S_OK,FALSE},
4222 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4225 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4227 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4228 {"",S_FALSE,FALSE},
4229 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4230 {"",S_FALSE,FALSE},
4231 {".jpg",S_OK,FALSE},
4232 {"",S_FALSE,FALSE},
4233 {"",S_FALSE,FALSE},
4234 {"",S_FALSE,FALSE},
4235 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4236 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4239 {"mk",S_OK,FALSE},
4240 {"",S_FALSE,FALSE},
4241 {"",S_FALSE,FALSE}
4244 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4245 {0,S_FALSE,FALSE},
4246 {URL_SCHEME_MK,S_OK,FALSE},
4247 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4250 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4252 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4253 {"",S_FALSE,FALSE},
4254 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4255 {"",S_FALSE,FALSE},
4256 {".jpg",S_OK,FALSE},
4257 {"",S_FALSE,FALSE},
4258 {"",S_FALSE,FALSE},
4259 {"",S_FALSE,FALSE},
4260 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4261 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4264 {"xx",S_OK,FALSE},
4265 {"",S_FALSE,FALSE},
4266 {"",S_FALSE,FALSE}
4269 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4270 {0,S_FALSE,FALSE},
4271 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4272 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4275 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4277 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4278 {"",S_FALSE,FALSE},
4279 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4280 {"",S_FALSE,FALSE},
4281 {".jpg",S_OK,FALSE},
4282 {"",S_FALSE,FALSE},
4283 {"",S_FALSE,FALSE},
4284 {"",S_FALSE,FALSE},
4285 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4286 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4289 {"mk",S_OK,FALSE},
4290 {"",S_FALSE,FALSE},
4291 {"",S_FALSE,FALSE}
4294 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4295 {0,S_FALSE,FALSE},
4296 {URL_SCHEME_MK,S_OK,FALSE},
4297 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4300 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4302 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4303 {"",S_FALSE,FALSE},
4304 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4305 {"",S_FALSE,FALSE},
4306 {".jpg",S_OK,FALSE},
4307 {"",S_FALSE,FALSE},
4308 {"",S_FALSE,FALSE},
4309 {"",S_FALSE,FALSE},
4310 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4311 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4312 {"",S_FALSE,FALSE},
4313 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4314 {"mk",S_OK,FALSE},
4315 {"",S_FALSE,FALSE},
4316 {"",S_FALSE,FALSE}
4319 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4320 {0,S_FALSE,FALSE},
4321 {URL_SCHEME_MK,S_OK,FALSE},
4322 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4325 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4327 {"mk:images/xxx.jpg",S_OK,FALSE},
4328 {"",S_FALSE,FALSE},
4329 {"mk:images/xxx.jpg",S_OK,FALSE},
4330 {"",S_FALSE,FALSE},
4331 {".jpg",S_OK,FALSE},
4332 {"",S_FALSE,FALSE},
4333 {"",S_FALSE,FALSE},
4334 {"",S_FALSE,FALSE},
4335 {"images/xxx.jpg",S_OK,FALSE},
4336 {"images/xxx.jpg",S_OK,FALSE},
4337 {"",S_FALSE,FALSE},
4338 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4339 {"mk",S_OK,FALSE},
4340 {"",S_FALSE,FALSE},
4341 {"",S_FALSE,FALSE}
4344 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4345 {0,S_FALSE,FALSE},
4346 {URL_SCHEME_MK,S_OK,FALSE},
4347 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4350 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4352 {"",S_OK,FALSE},
4353 {"",S_FALSE,FALSE},
4354 {"",S_OK,FALSE},
4355 {"",S_FALSE,FALSE},
4356 {"",S_FALSE,FALSE},
4357 {"",S_FALSE,FALSE},
4358 {"",S_FALSE,FALSE},
4359 {"",S_FALSE,FALSE},
4360 {"",S_OK,FALSE},
4361 {"",S_OK,FALSE},
4362 {"",S_FALSE,FALSE},
4363 {"",S_OK,FALSE},
4364 {"",S_FALSE,FALSE},
4365 {"",S_FALSE,FALSE},
4366 {"",S_FALSE,FALSE}
4369 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4370 {0,S_FALSE,FALSE},
4371 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4372 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4375 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4377 {"",S_OK,FALSE},
4378 {"",S_FALSE,FALSE},
4379 {"",S_OK,FALSE},
4380 {"",S_FALSE,FALSE},
4381 {"",S_FALSE,FALSE},
4382 {"",S_FALSE,FALSE},
4383 {"",S_FALSE,FALSE},
4384 {"",S_FALSE,FALSE},
4385 {"",S_OK,FALSE},
4386 {"",S_OK,FALSE},
4387 {"",S_FALSE,FALSE},
4388 {"",S_OK,FALSE},
4389 {"",S_FALSE,FALSE},
4390 {"",S_FALSE,FALSE},
4391 {"",S_FALSE,FALSE}
4394 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4395 {0,S_FALSE,FALSE},
4396 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4397 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4400 { "javascript:void", 0, S_OK, FALSE,
4402 {"javascript:void",S_OK},
4403 {"",S_FALSE},
4404 {"javascript:void",S_OK},
4405 {"",S_FALSE},
4406 {"",S_FALSE},
4407 {"",S_FALSE},
4408 {"",S_FALSE},
4409 {"",S_FALSE},
4410 {"void",S_OK},
4411 {"void",S_OK},
4412 {"",S_FALSE},
4413 {"javascript:void",S_OK},
4414 {"javascript",S_OK},
4415 {"",S_FALSE},
4416 {"",S_FALSE}
4419 {Uri_HOST_UNKNOWN,S_OK},
4420 {0,S_FALSE},
4421 {URL_SCHEME_JAVASCRIPT,S_OK},
4422 {URLZONE_INVALID,E_NOTIMPL}
4425 { "javascript://undefined", 0, S_OK, FALSE,
4427 {"javascript://undefined",S_OK},
4428 {"",S_FALSE},
4429 {"javascript://undefined",S_OK},
4430 {"",S_FALSE},
4431 {"",S_FALSE},
4432 {"",S_FALSE},
4433 {"",S_FALSE},
4434 {"",S_FALSE},
4435 {"//undefined",S_OK},
4436 {"//undefined",S_OK},
4437 {"",S_FALSE},
4438 {"javascript://undefined",S_OK},
4439 {"javascript",S_OK},
4440 {"",S_FALSE},
4441 {"",S_FALSE}
4444 {Uri_HOST_UNKNOWN,S_OK},
4445 {0,S_FALSE},
4446 {URL_SCHEME_JAVASCRIPT,S_OK},
4447 {URLZONE_INVALID,E_NOTIMPL}
4450 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4452 {"javascript:escape('/\\?#?')",S_OK},
4453 {"",S_FALSE},
4454 {"javascript:escape('/\\?#?')",S_OK},
4455 {"",S_FALSE},
4456 {"",S_FALSE},
4457 {"",S_FALSE},
4458 {"",S_FALSE},
4459 {"",S_FALSE},
4460 {"escape('/\\?#?')",S_OK},
4461 {"escape('/\\?#?')",S_OK},
4462 {"",S_FALSE},
4463 {"JavaSCript:escape('/\\?#?')",S_OK},
4464 {"javascript",S_OK},
4465 {"",S_FALSE},
4466 {"",S_FALSE}
4469 {Uri_HOST_UNKNOWN,S_OK},
4470 {0,S_FALSE},
4471 {URL_SCHEME_JAVASCRIPT,S_OK},
4472 {URLZONE_INVALID,E_NOTIMPL}
4475 { "*://google.com", 0, S_OK, FALSE,
4477 {"*:google.com/",S_OK,FALSE},
4478 {"google.com",S_OK},
4479 {"*:google.com/",S_OK,FALSE},
4480 {"google.com",S_OK,FALSE},
4481 {"",S_FALSE,FALSE},
4482 {"",S_FALSE,FALSE},
4483 {"google.com",S_OK,FALSE},
4484 {"",S_FALSE,FALSE},
4485 {"/",S_OK,FALSE},
4486 {"/",S_OK,FALSE},
4487 {"",S_FALSE,FALSE},
4488 {"*://google.com",S_OK,FALSE},
4489 {"*",S_OK,FALSE},
4490 {"",S_FALSE,FALSE},
4491 {"",S_FALSE,FALSE}
4494 {Uri_HOST_DNS,S_OK,FALSE},
4495 {0,S_FALSE,FALSE},
4496 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4500 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4502 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4503 {"",S_FALSE},
4504 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4505 {"",S_FALSE},
4506 {".txt",S_OK},
4507 {"",S_FALSE},
4508 {"",S_FALSE},
4509 {"",S_FALSE},
4510 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4511 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4512 {"",S_FALSE},
4513 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4514 {"mk",S_OK},
4515 {"",S_FALSE},
4516 {"",S_FALSE}
4519 {Uri_HOST_UNKNOWN,S_OK},
4520 {0,S_FALSE},
4521 {URL_SCHEME_MK,S_OK},
4522 {URLZONE_INVALID,E_NOTIMPL}
4525 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4527 {"gopher://test.winehq.org:151/file.txt",S_OK},
4528 {"test.winehq.org:151",S_OK},
4529 {"gopher://test.winehq.org:151/file.txt",S_OK},
4530 {"winehq.org",S_OK},
4531 {".txt",S_OK},
4532 {"",S_FALSE},
4533 {"test.winehq.org",S_OK},
4534 {"",S_FALSE},
4535 {"/file.txt",S_OK},
4536 {"/file.txt",S_OK},
4537 {"",S_FALSE},
4538 {"gopher://test.winehq.org:151/file.txt",S_OK},
4539 {"gopher",S_OK},
4540 {"",S_FALSE},
4541 {"",S_FALSE}
4544 {Uri_HOST_DNS,S_OK},
4545 {151,S_OK},
4546 {URL_SCHEME_GOPHER,S_OK},
4547 {URLZONE_INVALID,E_NOTIMPL}
4550 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4552 {"//host.com/path/file.txt?query",S_OK},
4553 {"host.com",S_OK},
4554 {"//host.com/path/file.txt?query",S_OK},
4555 {"host.com",S_OK},
4556 {".txt",S_OK},
4557 {"",S_FALSE},
4558 {"host.com",S_OK},
4559 {"",S_FALSE},
4560 {"/path/file.txt",S_OK},
4561 {"/path/file.txt?query",S_OK},
4562 {"?query",S_OK},
4563 {"//host.com/path/file.txt?query",S_OK},
4564 {"",S_FALSE},
4565 {"",S_FALSE},
4566 {"",S_FALSE},
4569 {Uri_HOST_DNS,S_OK},
4570 {0,S_FALSE},
4571 {URL_SCHEME_UNKNOWN,S_OK},
4572 {URLZONE_INVALID,E_NOTIMPL}
4575 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4577 {"//host/path/file.txt?query",S_OK},
4578 {"host",S_OK},
4579 {"//host/path/file.txt?query",S_OK},
4580 {"",S_FALSE},
4581 {".txt",S_OK},
4582 {"",S_FALSE},
4583 {"host",S_OK},
4584 {"",S_FALSE},
4585 {"/path/file.txt",S_OK},
4586 {"/path/file.txt?query",S_OK},
4587 {"?query",S_OK},
4588 {"//host/path/file.txt?query",S_OK},
4589 {"",S_FALSE},
4590 {"",S_FALSE},
4591 {"",S_FALSE},
4594 {Uri_HOST_DNS,S_OK},
4595 {0,S_FALSE},
4596 {URL_SCHEME_UNKNOWN,S_OK},
4597 {URLZONE_INVALID,E_NOTIMPL}
4600 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4602 {"//host/",S_OK},
4603 {"host",S_OK},
4604 {"//host/",S_OK},
4605 {"",S_FALSE},
4606 {"",S_FALSE},
4607 {"",S_FALSE},
4608 {"host",S_OK},
4609 {"",S_FALSE},
4610 {"/",S_OK},
4611 {"/",S_OK},
4612 {"",S_FALSE},
4613 {"//host",S_OK},
4614 {"",S_FALSE},
4615 {"",S_FALSE},
4616 {"",S_FALSE},
4619 {Uri_HOST_DNS,S_OK},
4620 {0,S_FALSE},
4621 {URL_SCHEME_UNKNOWN,S_OK},
4622 {URLZONE_INVALID,E_NOTIMPL}
4625 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4627 {"mailto:",S_OK},
4628 {"",S_FALSE},
4629 {"mailto:",S_OK},
4630 {"",S_FALSE},
4631 {"",S_FALSE},
4632 {"",S_FALSE},
4633 {"",S_FALSE},
4634 {"",S_FALSE},
4635 {"",S_FALSE},
4636 {"",S_FALSE},
4637 {"",S_FALSE},
4638 {"mailto://",S_OK,FALSE,"mailto:"},
4639 {"mailto",S_OK},
4640 {"",S_FALSE},
4641 {"",S_FALSE}
4644 {Uri_HOST_UNKNOWN,S_OK},
4645 {0,S_FALSE},
4646 {URL_SCHEME_MAILTO,S_OK},
4647 {URLZONE_INVALID,E_NOTIMPL}
4650 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4652 {"mailto:a@b.com",S_OK},
4653 {"",S_FALSE},
4654 {"mailto:a@b.com",S_OK},
4655 {"",S_FALSE},
4656 {".com",S_OK},
4657 {"",S_FALSE},
4658 {"",S_FALSE},
4659 {"",S_FALSE},
4660 {"a@b.com",S_OK},
4661 {"a@b.com",S_OK},
4662 {"",S_FALSE},
4663 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4664 {"mailto",S_OK},
4665 {"",S_FALSE},
4666 {"",S_FALSE}
4669 {Uri_HOST_UNKNOWN,S_OK},
4670 {0,S_FALSE},
4671 {URL_SCHEME_MAILTO,S_OK},
4672 {URLZONE_INVALID,E_NOTIMPL}
4675 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4677 {"file://c:\\test file.html",S_OK,FALSE},
4678 {"",S_FALSE,FALSE},
4679 {"file://c:\\test file.html",S_OK,FALSE},
4680 {"",S_FALSE,FALSE},
4681 {".html",S_OK,FALSE},
4682 {"",S_FALSE,FALSE},
4683 {"",S_FALSE,FALSE},
4684 {"",S_FALSE,FALSE},
4685 {"c:\\test file.html",S_OK,FALSE},
4686 {"c:\\test file.html",S_OK,FALSE},
4687 {"",S_FALSE,FALSE},
4688 {"c:\\test file.html",S_OK,FALSE},
4689 {"file",S_OK,FALSE},
4690 {"",S_FALSE,FALSE},
4691 {"",S_FALSE,FALSE}
4694 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4695 {0,S_FALSE,FALSE},
4696 {URL_SCHEME_FILE,S_OK,FALSE},
4697 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4700 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4702 {"file://c:\\test%20file.html",S_OK,FALSE},
4703 {"",S_FALSE,FALSE},
4704 {"file://c:\\test%20file.html",S_OK,FALSE},
4705 {"",S_FALSE,FALSE},
4706 {".html",S_OK,FALSE},
4707 {"",S_FALSE,FALSE},
4708 {"",S_FALSE,FALSE},
4709 {"",S_FALSE,FALSE},
4710 {"c:\\test%20file.html",S_OK,FALSE},
4711 {"c:\\test%20file.html",S_OK,FALSE},
4712 {"",S_FALSE,FALSE},
4713 {"c:\\test%20file.html",S_OK,FALSE},
4714 {"file",S_OK,FALSE},
4715 {"",S_FALSE,FALSE},
4716 {"",S_FALSE,FALSE}
4719 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4720 {0,S_FALSE,FALSE},
4721 {URL_SCHEME_FILE,S_OK,FALSE},
4722 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4725 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4727 {"file:///c:/test%20file.html",S_OK,FALSE},
4728 {"",S_FALSE,FALSE},
4729 {"file:///c:/test%20file.html",S_OK,FALSE},
4730 {"",S_FALSE,FALSE},
4731 {".html",S_OK,FALSE},
4732 {"",S_FALSE,FALSE},
4733 {"",S_FALSE,FALSE},
4734 {"",S_FALSE,FALSE},
4735 {"/c:/test%20file.html",S_OK,FALSE},
4736 {"/c:/test%20file.html",S_OK,FALSE},
4737 {"",S_FALSE,FALSE},
4738 {"c:\\test file.html",S_OK,FALSE},
4739 {"file",S_OK,FALSE},
4740 {"",S_FALSE,FALSE},
4741 {"",S_FALSE,FALSE}
4744 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4745 {0,S_FALSE,FALSE},
4746 {URL_SCHEME_FILE,S_OK,FALSE},
4747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4750 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4752 {"file:///c:/test%2520file.html",S_OK,FALSE},
4753 {"",S_FALSE,FALSE},
4754 {"file:///c:/test%2520file.html",S_OK,FALSE},
4755 {"",S_FALSE,FALSE},
4756 {".html",S_OK,FALSE},
4757 {"",S_FALSE,FALSE},
4758 {"",S_FALSE,FALSE},
4759 {"",S_FALSE,FALSE},
4760 {"/c:/test%2520file.html",S_OK,FALSE},
4761 {"/c:/test%2520file.html",S_OK,FALSE},
4762 {"",S_FALSE,FALSE},
4763 {"c:\\test%20file.html",S_OK,FALSE},
4764 {"file",S_OK,FALSE},
4765 {"",S_FALSE,FALSE},
4766 {"",S_FALSE,FALSE}
4769 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4770 {0,S_FALSE,FALSE},
4771 {URL_SCHEME_FILE,S_OK,FALSE},
4772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4777 typedef struct _invalid_uri {
4778 const char* uri;
4779 DWORD flags;
4780 BOOL todo;
4781 } invalid_uri;
4783 static const invalid_uri invalid_uri_tests[] = {
4784 /* Has to have a scheme name. */
4785 {"://www.winehq.org",0,FALSE},
4786 /* Windows doesn't like URIs which are implicitly file paths without the
4787 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4789 {"C:/test/test.mp3",0,FALSE},
4790 {"\\\\Server/test/test.mp3",0,FALSE},
4791 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4792 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4793 /* Invalid schemes. */
4794 {"*abcd://not.valid.com",0,FALSE},
4795 {"*a*b*c*d://not.valid.com",0,FALSE},
4796 /* Not allowed to have invalid % encoded data. */
4797 {"ftp://google.co%XX/",0,FALSE},
4798 /* Too many h16 components. */
4799 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4800 /* Not enough room for IPv4 address. */
4801 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4802 /* Not enough h16 components. */
4803 {"http://[1:2:3:4]",0,FALSE},
4804 /* Not enough components including IPv4. */
4805 {"http://[1:192.0.1.0]",0,FALSE},
4806 /* Not allowed to have partial IPv4 in IPv6. */
4807 {"http://[::192.0]",0,FALSE},
4808 /* Can't have elision of 1 h16 at beginning of address. */
4809 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4810 /* Expects a valid IP Literal. */
4811 {"ftp://[not.valid.uri]/",0,FALSE},
4812 /* Expects valid port for a known scheme type. */
4813 {"ftp://www.winehq.org:123fgh",0,FALSE},
4814 /* Port exceeds USHORT_MAX for known scheme type. */
4815 {"ftp://www.winehq.org:65536",0,FALSE},
4816 /* Invalid port with IPv4 address. */
4817 {"http://www.winehq.org:1abcd",0,FALSE},
4818 /* Invalid port with IPv6 address. */
4819 {"http://[::ffff]:32xy",0,FALSE},
4820 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4821 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4822 /* Not allowed to have invalid % encoded data in opaque URI path. */
4823 {"news:test%XX",0,FALSE},
4824 {"mailto:wine@winehq%G8.com",0,FALSE},
4825 /* Known scheme types can't have invalid % encoded data in query string. */
4826 {"http://google.com/?query=te%xx",0,FALSE},
4827 /* Invalid % encoded data in fragment of know scheme type. */
4828 {"ftp://google.com/#Test%xx",0,FALSE},
4829 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4830 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4831 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4832 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4833 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4834 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4835 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4836 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4837 /* res URIs aren't allowed to have forbidden dos path characters in the
4838 * hostname.
4840 {"res://c:\\te<st\\test/test",0,FALSE},
4841 {"res://c:\\te>st\\test/test",0,FALSE},
4842 {"res://c:\\te\"st\\test/test",0,FALSE},
4843 {"res://c:\\test/te%xxst",0,FALSE}
4846 typedef struct _uri_equality {
4847 const char* a;
4848 DWORD create_flags_a;
4849 const char* b;
4850 DWORD create_flags_b;
4851 BOOL equal;
4852 BOOL todo;
4853 } uri_equality;
4855 static const uri_equality equality_tests[] = {
4857 "HTTP://www.winehq.org/test dir/./",0,
4858 "http://www.winehq.org/test dir/../test dir/",0,
4859 TRUE
4862 /* http://www.winehq.org/test%20dir */
4863 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4864 "http://www.winehq.org/test dir",0,
4865 TRUE
4868 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4869 "file:///c:/test.mp3",0,
4870 TRUE
4873 "ftp://ftp.winehq.org/",0,
4874 "ftp://ftp.winehq.org",0,
4875 TRUE
4878 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4879 "ftp://ftp.winehq.org/t%45stB/",0,
4880 FALSE
4883 "http://google.com/TEST",0,
4884 "http://google.com/test",0,
4885 FALSE
4888 "http://GOOGLE.com/",0,
4889 "http://google.com/",0,
4890 TRUE
4892 /* Performs case insensitive compare of host names (for known scheme types). */
4894 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4895 "ftp://google.com/",0,
4896 TRUE
4899 "zip://GOOGLE.com/",0,
4900 "zip://google.com/",0,
4901 FALSE
4904 "file:///c:/TEST/TeST/",0,
4905 "file:///c:/test/test/",0,
4906 TRUE
4909 "file:///server/TEST",0,
4910 "file:///SERVER/TEST",0,
4911 TRUE
4914 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4915 "http://google.com/",0,
4916 TRUE
4919 "ftp://google.com:21/",0,
4920 "ftp://google.com/",0,
4921 TRUE
4924 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4925 "http://google.com/",0,
4926 TRUE
4929 "http://google.com:70/",0,
4930 "http://google.com:71/",0,
4931 FALSE
4934 "file:///c:/dir/file.txt", 0,
4935 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4936 TRUE
4939 "file:///c:/dir/file.txt", 0,
4940 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4941 TRUE
4944 "file:///c:/dir/file.txt", 0,
4945 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4946 TRUE
4949 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4950 "file:///c:/%20dir/file.txt", 0,
4951 TRUE
4954 "file:///c:/Dir/file.txt", 0,
4955 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4956 TRUE
4959 "file:///c:/dir/file.txt", 0,
4960 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4961 TRUE
4964 "file:///c:/dir/file.txt#a", 0,
4965 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4966 FALSE
4968 /* Tests of an empty hash/fragment part */
4970 "http://google.com/test",0,
4971 "http://google.com/test#",0,
4972 FALSE
4975 "ftp://ftp.winehq.org/",0,
4976 "ftp://ftp.winehq.org/#",0,
4977 FALSE
4980 "file:///c:/dir/file.txt#", 0,
4981 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4982 FALSE
4986 typedef struct _uri_with_fragment {
4987 const char* uri;
4988 const char* fragment;
4989 DWORD create_flags;
4990 HRESULT create_expected;
4991 BOOL create_todo;
4993 const char* expected_uri;
4994 BOOL expected_todo;
4995 } uri_with_fragment;
4997 static const uri_with_fragment uri_fragment_tests[] = {
4999 "http://google.com/","#fragment",0,S_OK,FALSE,
5000 "http://google.com/#fragment",FALSE
5003 "http://google.com/","fragment",0,S_OK,FALSE,
5004 "http://google.com/#fragment",FALSE
5007 "zip://test.com/","?test",0,S_OK,FALSE,
5008 "zip://test.com/#?test",FALSE
5010 /* The fragment can be empty. */
5012 "ftp://ftp.google.com/","",0,S_OK,FALSE,
5013 "ftp://ftp.google.com/#",FALSE
5017 typedef struct _uri_builder_property {
5018 BOOL change;
5019 const char *value;
5020 const char *expected_value;
5021 Uri_PROPERTY property;
5022 HRESULT expected;
5023 BOOL todo;
5024 } uri_builder_property;
5026 typedef struct _uri_builder_port {
5027 BOOL change;
5028 BOOL set;
5029 DWORD value;
5030 HRESULT expected;
5031 BOOL todo;
5032 } uri_builder_port;
5034 typedef struct _uri_builder_str_property {
5035 const char* expected;
5036 HRESULT result;
5037 BOOL todo;
5038 } uri_builder_str_property;
5040 typedef struct _uri_builder_dword_property {
5041 DWORD expected;
5042 HRESULT result;
5043 BOOL todo;
5044 } uri_builder_dword_property;
5046 typedef struct _uri_builder_test {
5047 const char *uri;
5048 DWORD create_flags;
5049 HRESULT create_builder_expected;
5050 BOOL create_builder_todo;
5052 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
5054 uri_builder_port port_prop;
5056 DWORD uri_flags;
5057 HRESULT uri_hres;
5058 BOOL uri_todo;
5060 DWORD uri_simple_encode_flags;
5061 HRESULT uri_simple_hres;
5062 BOOL uri_simple_todo;
5064 DWORD uri_with_flags;
5065 DWORD uri_with_builder_flags;
5066 DWORD uri_with_encode_flags;
5067 HRESULT uri_with_hres;
5068 BOOL uri_with_todo;
5070 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
5071 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
5072 } uri_builder_test;
5074 static const uri_builder_test uri_builder_tests[] = {
5075 { "http://google.com/",0,S_OK,FALSE,
5077 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5078 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
5079 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
5080 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5082 {FALSE},
5083 0,S_OK,FALSE,
5084 0,S_OK,FALSE,
5085 0,0,0,S_OK,FALSE,
5087 {"http://username:password@google.com/?query=x#fragment",S_OK},
5088 {"username:password@google.com",S_OK},
5089 {"http://google.com/?query=x#fragment",S_OK},
5090 {"google.com",S_OK},
5091 {"",S_FALSE},
5092 {"#fragment",S_OK},
5093 {"google.com",S_OK},
5094 {"password",S_OK},
5095 {"/",S_OK},
5096 {"/?query=x",S_OK},
5097 {"?query=x",S_OK},
5098 {"http://username:password@google.com/?query=x#fragment",S_OK},
5099 {"http",S_OK},
5100 {"username:password",S_OK},
5101 {"username",S_OK}
5104 {Uri_HOST_DNS,S_OK},
5105 {80,S_OK},
5106 {URL_SCHEME_HTTP,S_OK},
5107 {URLZONE_INVALID,E_NOTIMPL}
5110 { "http://google.com/",0,S_OK,FALSE,
5112 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5114 {TRUE,TRUE,120,S_OK,FALSE},
5115 0,S_OK,FALSE,
5116 0,S_OK,FALSE,
5117 0,0,0,S_OK,FALSE,
5119 {"test://google.com:120/",S_OK},
5120 {"google.com:120",S_OK},
5121 {"test://google.com:120/",S_OK},
5122 {"google.com",S_OK},
5123 {"",S_FALSE},
5124 {"",S_FALSE},
5125 {"google.com",S_OK},
5126 {"",S_FALSE},
5127 {"/",S_OK},
5128 {"/",S_OK},
5129 {"",S_FALSE},
5130 {"test://google.com:120/",S_OK},
5131 {"test",S_OK},
5132 {"",S_FALSE},
5133 {"",S_FALSE}
5136 {Uri_HOST_DNS,S_OK},
5137 {120,S_OK},
5138 {URL_SCHEME_UNKNOWN,S_OK},
5139 {URLZONE_INVALID,E_NOTIMPL}
5142 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5144 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5145 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5146 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5148 {FALSE},
5149 0,S_OK,FALSE,
5150 0,S_OK,FALSE,
5151 0,0,0,S_OK,FALSE,
5153 {"http://[::192.2.3.4]/",S_OK},
5154 {"[::192.2.3.4]",S_OK},
5155 {"http://[::192.2.3.4]/",S_OK},
5156 {"",S_FALSE},
5157 {"",S_FALSE},
5158 {"",S_FALSE},
5159 {"::192.2.3.4",S_OK},
5160 {"",S_FALSE},
5161 {"/",S_OK},
5162 {"/",S_OK},
5163 {"",S_FALSE},
5164 {"http://[::192.2.3.4]/",S_OK},
5165 {"http",S_OK},
5166 {"",S_FALSE},
5167 {"",S_FALSE}
5170 {Uri_HOST_IPV6,S_OK},
5171 {80,S_OK},
5172 {URL_SCHEME_HTTP,S_OK},
5173 {URLZONE_INVALID,E_NOTIMPL}
5176 { "http://google.com/",0,S_OK,FALSE,
5178 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5180 {FALSE},
5181 0,S_OK,FALSE,
5182 0,S_OK,FALSE,
5183 0,0,0,S_OK,FALSE,
5185 {"http://google.com/#Frag",S_OK},
5186 {"google.com",S_OK},
5187 {"http://google.com/#Frag",S_OK},
5188 {"google.com",S_OK},
5189 {"",S_FALSE},
5190 {"#Frag",S_OK},
5191 {"google.com",S_OK},
5192 {"",S_FALSE},
5193 {"/",S_OK},
5194 {"/",S_OK},
5195 {"",S_FALSE},
5196 {"http://google.com/#Frag",S_OK},
5197 {"http",S_OK},
5198 {"",S_FALSE},
5199 {"",S_FALSE}
5202 {Uri_HOST_DNS,S_OK},
5203 {80,S_OK},
5204 {URL_SCHEME_HTTP,S_OK},
5205 {URLZONE_INVALID,E_NOTIMPL}
5208 { "http://google.com/",0,S_OK,FALSE,
5210 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5212 {FALSE},
5213 0,S_OK,FALSE,
5214 0,S_OK,FALSE,
5215 0,0,0,S_OK,FALSE,
5217 {"http://google.com/#",S_OK},
5218 {"google.com",S_OK},
5219 {"http://google.com/#",S_OK},
5220 {"google.com",S_OK},
5221 {"",S_FALSE},
5222 {"#",S_OK},
5223 {"google.com",S_OK},
5224 {"",S_FALSE},
5225 {"/",S_OK},
5226 {"/",S_OK},
5227 {"",S_FALSE},
5228 {"http://google.com/#",S_OK},
5229 {"http",S_OK},
5230 {"",S_FALSE},
5231 {"",S_FALSE}
5234 {Uri_HOST_DNS,S_OK},
5235 {80,S_OK},
5236 {URL_SCHEME_HTTP,S_OK},
5237 {URLZONE_INVALID,E_NOTIMPL}
5240 { "http://google.com/",0,S_OK,FALSE,
5242 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5244 {FALSE},
5245 0,S_OK,FALSE,
5246 0,S_OK,FALSE,
5247 0,0,0,S_OK,FALSE,
5249 {"http://::password@google.com/",S_OK},
5250 {"::password@google.com",S_OK},
5251 {"http://google.com/",S_OK},
5252 {"google.com",S_OK},
5253 {"",S_FALSE},
5254 {"",S_FALSE},
5255 {"google.com",S_OK},
5256 {":password",S_OK},
5257 {"/",S_OK},
5258 {"/",S_OK},
5259 {"",S_FALSE},
5260 {"http://::password@google.com/",S_OK},
5261 {"http",S_OK},
5262 {"::password",S_OK},
5263 {"",S_FALSE}
5266 {Uri_HOST_DNS,S_OK},
5267 {80,S_OK},
5268 {URL_SCHEME_HTTP,S_OK},
5269 {URLZONE_INVALID,E_NOTIMPL}
5272 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5274 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5276 {FALSE},
5277 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5278 0,S_OK,FALSE,
5279 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5281 {":password@test/test",S_OK},
5282 {":password@",S_OK},
5283 {":password@test/test",S_OK},
5284 {"",S_FALSE},
5285 {"",S_FALSE},
5286 {"",S_FALSE},
5287 {"",S_FALSE},
5288 {"password",S_OK},
5289 {"test/test",S_OK},
5290 {"test/test",S_OK},
5291 {"",S_FALSE},
5292 {":password@test/test",S_OK},
5293 {"",S_FALSE},
5294 {":password",S_OK},
5295 {"",S_FALSE}
5298 {Uri_HOST_UNKNOWN,S_OK},
5299 {0,S_FALSE},
5300 {URL_SCHEME_UNKNOWN,S_OK},
5301 {URLZONE_INVALID,E_NOTIMPL}
5304 { "http://google.com/",0,S_OK,FALSE,
5306 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5308 {FALSE},
5309 0,S_OK,FALSE,
5310 0,S_OK,FALSE,
5311 0,0,0,S_OK,FALSE,
5313 {"http://google.com/test/test",S_OK},
5314 {"google.com",S_OK},
5315 {"http://google.com/test/test",S_OK},
5316 {"google.com",S_OK},
5317 {"",S_FALSE},
5318 {"",S_FALSE},
5319 {"google.com",S_OK},
5320 {"",S_FALSE},
5321 {"/test/test",S_OK},
5322 {"/test/test",S_OK},
5323 {"",S_FALSE},
5324 {"http://google.com/test/test",S_OK},
5325 {"http",S_OK},
5326 {"",S_FALSE},
5327 {"",S_FALSE}
5330 {Uri_HOST_DNS,S_OK},
5331 {80,S_OK},
5332 {URL_SCHEME_HTTP,S_OK},
5333 {URLZONE_INVALID,E_NOTIMPL}
5336 { "zip:testing/test",0,S_OK,FALSE,
5338 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5340 {FALSE},
5341 0,S_OK,FALSE,
5342 0,S_OK,FALSE,
5343 0,0,0,S_OK,FALSE,
5345 {"zip:test",S_OK},
5346 {"",S_FALSE},
5347 {"zip:test",S_OK},
5348 {"",S_FALSE},
5349 {"",S_FALSE},
5350 {"",S_FALSE},
5351 {"",S_FALSE},
5352 {"",S_FALSE},
5353 {"test",S_OK},
5354 {"test",S_OK},
5355 {"",S_FALSE},
5356 {"zip:test",S_OK},
5357 {"zip",S_OK},
5358 {"",S_FALSE},
5359 {"",S_FALSE}
5362 {Uri_HOST_UNKNOWN,S_OK},
5363 {0,S_FALSE},
5364 {URL_SCHEME_UNKNOWN,S_OK},
5365 {URLZONE_INVALID,E_NOTIMPL}
5368 { "http://google.com/",0,S_OK,FALSE,
5370 {FALSE},
5372 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5373 {TRUE,FALSE,555,S_OK,FALSE},
5374 0,S_OK,FALSE,
5375 0,S_OK,FALSE,
5376 0,0,0,S_OK,FALSE,
5378 {"http://google.com/",S_OK},
5379 {"google.com",S_OK},
5380 {"http://google.com/",S_OK},
5381 {"google.com",S_OK},
5382 {"",S_FALSE},
5383 {"",S_FALSE},
5384 {"google.com",S_OK},
5385 {"",S_FALSE},
5386 {"/",S_OK},
5387 {"/",S_OK},
5388 {"",S_FALSE},
5389 {"http://google.com/",S_OK},
5390 {"http",S_OK},
5391 {"",S_FALSE},
5392 {"",S_FALSE}
5395 {Uri_HOST_DNS,S_OK},
5396 /* Still returns 80, even though earlier the port was disabled. */
5397 {80,S_OK},
5398 {URL_SCHEME_HTTP,S_OK},
5399 {URLZONE_INVALID,E_NOTIMPL}
5402 { "http://google.com/",0,S_OK,FALSE,
5404 {FALSE},
5406 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5407 * you'll get 122345 instead.
5409 {TRUE,122345,222,S_OK,FALSE},
5410 0,S_OK,FALSE,
5411 0,S_OK,FALSE,
5412 0,0,0,S_OK,FALSE,
5414 {"http://google.com:222/",S_OK},
5415 {"google.com:222",S_OK},
5416 {"http://google.com:222/",S_OK},
5417 {"google.com",S_OK},
5418 {"",S_FALSE},
5419 {"",S_FALSE},
5420 {"google.com",S_OK},
5421 {"",S_FALSE},
5422 {"/",S_OK},
5423 {"/",S_OK},
5424 {"",S_FALSE},
5425 {"http://google.com:222/",S_OK},
5426 {"http",S_OK},
5427 {"",S_FALSE},
5428 {"",S_FALSE}
5431 {Uri_HOST_DNS,S_OK},
5432 {222,S_OK},
5433 {URL_SCHEME_HTTP,S_OK},
5434 {URLZONE_INVALID,E_NOTIMPL}
5437 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5438 { "http://google.com/",0,S_OK,FALSE,
5440 {FALSE},
5442 {TRUE,TRUE,999999,S_OK,FALSE},
5443 0,S_OK,FALSE,
5444 0,S_OK,FALSE,
5445 0,0,0,S_OK,FALSE,
5447 {"http://google.com:999999/",S_OK},
5448 {"google.com:999999",S_OK},
5449 {"http://google.com:999999/",S_OK},
5450 {"google.com",S_OK},
5451 {"",S_FALSE},
5452 {"",S_FALSE},
5453 {"google.com",S_OK},
5454 {"",S_FALSE},
5455 {"/",S_OK},
5456 {"/",S_OK},
5457 {"",S_FALSE},
5458 {"http://google.com:999999/",S_OK},
5459 {"http",S_OK},
5460 {"",S_FALSE},
5461 {"",S_FALSE}
5464 {Uri_HOST_DNS,S_OK},
5465 {999999,S_OK},
5466 {URL_SCHEME_HTTP,S_OK},
5467 {URLZONE_INVALID,E_NOTIMPL}
5470 { "http://google.com/",0,S_OK,FALSE,
5472 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5475 {FALSE},
5476 0,S_OK,FALSE,
5477 0,S_OK,FALSE,
5478 0,0,0,S_OK,FALSE,
5480 {"http://google.com/?test",S_OK},
5481 {"google.com",S_OK},
5482 {"http://google.com/?test",S_OK},
5483 {"google.com",S_OK},
5484 {"",S_FALSE},
5485 {"",S_FALSE},
5486 {"google.com",S_OK},
5487 {"",S_FALSE},
5488 {"/",S_OK},
5489 {"/?test",S_OK},
5490 {"?test",S_OK},
5491 {"http://google.com/?test",S_OK},
5492 {"http",S_OK},
5493 {"",S_FALSE},
5494 {"",S_FALSE}
5497 {Uri_HOST_DNS,S_OK},
5498 {80,S_OK},
5499 {URL_SCHEME_HTTP,S_OK},
5500 {URLZONE_INVALID,E_NOTIMPL}
5503 { "http://:password@google.com/",0,S_OK,FALSE,
5505 {FALSE},
5507 {FALSE},
5508 0,S_OK,FALSE,
5509 0,S_OK,FALSE,
5510 0,0,0,S_OK,FALSE,
5512 {"http://:password@google.com/",S_OK},
5513 {":password@google.com",S_OK},
5514 {"http://google.com/",S_OK},
5515 {"google.com",S_OK},
5516 {"",S_FALSE},
5517 {"",S_FALSE},
5518 {"google.com",S_OK},
5519 {"password",S_OK},
5520 {"/",S_OK},
5521 {"/",S_OK},
5522 {"",S_FALSE},
5523 {"http://:password@google.com/",S_OK},
5524 {"http",S_OK},
5525 {":password",S_OK},
5526 {"",S_FALSE}
5529 {Uri_HOST_DNS,S_OK},
5530 {80,S_OK},
5531 {URL_SCHEME_HTTP,S_OK},
5532 {URLZONE_INVALID,E_NOTIMPL}
5535 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5536 { NULL,0,S_OK,FALSE,
5538 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5539 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5541 {FALSE},
5542 0,S_OK,FALSE,
5543 0,S_OK,FALSE,
5544 0,0,0,S_OK,FALSE,
5546 {"http://google.com/",S_OK},
5547 {"google.com",S_OK},
5548 {"http://google.com/",S_OK},
5549 {"google.com",S_OK},
5550 {"",S_FALSE},
5551 {"",S_FALSE},
5552 {"google.com",S_OK},
5553 {"",S_FALSE},
5554 {"/",S_OK},
5555 {"/",S_OK},
5556 {"",S_FALSE},
5557 {"http://google.com/",S_OK},
5558 {"http",S_OK},
5559 {"",S_FALSE},
5560 {"",S_FALSE}
5563 {Uri_HOST_DNS,S_OK},
5564 {80,S_OK},
5565 {URL_SCHEME_HTTP,S_OK},
5566 {URLZONE_INVALID,E_NOTIMPL}
5569 /* Can't set the scheme name to NULL. */
5570 { "zip://google.com/",0,S_OK,FALSE,
5572 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5574 {FALSE},
5575 0,S_OK,FALSE,
5576 0,S_OK,FALSE,
5577 0,0,0,S_OK,FALSE,
5579 {"zip://google.com/",S_OK},
5580 {"google.com",S_OK},
5581 {"zip://google.com/",S_OK},
5582 {"google.com",S_OK},
5583 {"",S_FALSE},
5584 {"",S_FALSE},
5585 {"google.com",S_OK},
5586 {"",S_FALSE},
5587 {"/",S_OK},
5588 {"/",S_OK},
5589 {"",S_FALSE},
5590 {"zip://google.com/",S_OK},
5591 {"zip",S_OK},
5592 {"",S_FALSE},
5593 {"",S_FALSE}
5596 {Uri_HOST_DNS,S_OK},
5597 {0,S_FALSE},
5598 {URL_SCHEME_UNKNOWN,S_OK},
5599 {URLZONE_INVALID,E_NOTIMPL}
5602 /* Can't set the scheme name to an empty string. */
5603 { "zip://google.com/",0,S_OK,FALSE,
5605 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5607 {FALSE},
5608 0,S_OK,FALSE,
5609 0,S_OK,FALSE,
5610 0,0,0,S_OK,FALSE,
5612 {"zip://google.com/",S_OK},
5613 {"google.com",S_OK},
5614 {"zip://google.com/",S_OK},
5615 {"google.com",S_OK},
5616 {"",S_FALSE},
5617 {"",S_FALSE},
5618 {"google.com",S_OK},
5619 {"",S_FALSE},
5620 {"/",S_OK},
5621 {"/",S_OK},
5622 {"",S_FALSE},
5623 {"zip://google.com/",S_OK},
5624 {"zip",S_OK},
5625 {"",S_FALSE},
5626 {"",S_FALSE}
5629 {Uri_HOST_DNS,S_OK},
5630 {0,S_FALSE},
5631 {URL_SCHEME_UNKNOWN,S_OK},
5632 {URLZONE_INVALID,E_NOTIMPL}
5635 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5636 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5638 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5639 {{FALSE}},
5640 {FALSE},
5641 -1,S_OK,FALSE,
5642 0,S_OK,FALSE,
5643 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5645 {"http://google.com/../../",S_OK},
5646 {"google.com",S_OK},
5647 {"http://google.com/../../",S_OK},
5648 {"google.com",S_OK},
5649 {"",S_FALSE},
5650 {"",S_FALSE},
5651 {"google.com",S_OK},
5652 {"",S_FALSE},
5653 {"/../../",S_OK},
5654 {"/../../",S_OK},
5655 {"",S_FALSE},
5656 {"http://google.com/../../",S_OK},
5657 {"http",S_OK},
5658 {"",S_FALSE},
5659 {"",S_FALSE}
5662 {Uri_HOST_DNS,S_OK},
5663 {80,S_OK},
5664 {URL_SCHEME_HTTP,S_OK},
5665 {URLZONE_INVALID,E_NOTIMPL}
5668 { "http://google.com/",0,S_OK,FALSE,
5670 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5672 {FALSE},
5673 -1,S_OK,FALSE,
5674 0,S_OK,FALSE,
5675 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5677 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5678 {"google.com",S_OK},
5679 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5680 {"google.com",S_OK},
5681 {"",S_FALSE},
5682 {"#Fr%3C%7C%3Eg",S_OK},
5683 {"google.com",S_OK},
5684 {"",S_FALSE},
5685 {"/",S_OK},
5686 {"/",S_OK},
5687 {"",S_FALSE},
5688 {"http://google.com/#Fr<|>g",S_OK},
5689 {"http",S_OK},
5690 {"",S_FALSE},
5691 {"",S_FALSE}
5694 {Uri_HOST_DNS,S_OK},
5695 {80,S_OK},
5696 {URL_SCHEME_HTTP,S_OK},
5697 {URLZONE_INVALID,E_NOTIMPL}
5700 { "http://google.com/",0,S_OK,FALSE,
5702 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5704 {FALSE},
5705 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5706 0,S_OK,FALSE,
5707 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5709 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5710 {"google.com",S_OK},
5711 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5712 {"google.com",S_OK},
5713 {"",S_FALSE},
5714 {"#Fr%3C%7C%3Eg",S_OK},
5715 {"google.com",S_OK},
5716 {"",S_FALSE},
5717 {"/",S_OK},
5718 {"/",S_OK},
5719 {"",S_FALSE},
5720 {"http://google.com/#Fr<|>g",S_OK},
5721 {"http",S_OK},
5722 {"",S_FALSE},
5723 {"",S_FALSE}
5726 {Uri_HOST_DNS,S_OK},
5727 {80,S_OK},
5728 {URL_SCHEME_HTTP,S_OK},
5729 {URLZONE_INVALID,E_NOTIMPL}
5732 { NULL,0,S_OK,FALSE,
5734 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5735 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5737 {FALSE},
5738 0,INET_E_INVALID_URL,FALSE,
5739 0,INET_E_INVALID_URL,FALSE,
5740 0,0,0,INET_E_INVALID_URL,FALSE
5742 { "http://google.com/",0,S_OK,FALSE,
5744 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5746 {FALSE},
5747 0,INET_E_INVALID_URL,FALSE,
5748 0,INET_E_INVALID_URL,FALSE,
5749 0,0,0,INET_E_INVALID_URL,FALSE
5751 /* File scheme's can't have a username set. */
5752 { "file://google.com/",0,S_OK,FALSE,
5754 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5756 {FALSE},
5757 0,INET_E_INVALID_URL,FALSE,
5758 0,INET_E_INVALID_URL,FALSE,
5759 0,0,0,INET_E_INVALID_URL,FALSE
5761 /* File schemes can't have a password set. */
5762 { "file://google.com/",0,S_OK,FALSE,
5764 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5766 {FALSE},
5767 0,INET_E_INVALID_URL,FALSE,
5768 0,INET_E_INVALID_URL,FALSE,
5769 0,0,0,INET_E_INVALID_URL,FALSE
5771 /* UserName can't contain any character that is a delimiter for another
5772 * component that appears after it in a normal URI.
5774 { "http://google.com/",0,S_OK,FALSE,
5776 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5778 {FALSE},
5779 0,INET_E_INVALID_URL,FALSE,
5780 0,INET_E_INVALID_URL,FALSE,
5781 0,0,0,INET_E_INVALID_URL,FALSE
5783 { "http://google.com/",0,S_OK,FALSE,
5785 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5787 {FALSE},
5788 0,INET_E_INVALID_URL,FALSE,
5789 0,INET_E_INVALID_URL,FALSE,
5790 0,0,0,INET_E_INVALID_URL,FALSE
5792 { "http://google.com/",0,S_OK,FALSE,
5794 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5796 {FALSE},
5797 0,INET_E_INVALID_URL,FALSE,
5798 0,INET_E_INVALID_URL,FALSE,
5799 0,0,0,INET_E_INVALID_URL,FALSE
5801 { "http://google.com/",0,S_OK,FALSE,
5803 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5805 {FALSE},
5806 0,INET_E_INVALID_URL,FALSE,
5807 0,INET_E_INVALID_URL,FALSE,
5808 0,0,0,INET_E_INVALID_URL,FALSE
5810 { "http://google.com/",0,S_OK,FALSE,
5812 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5814 {FALSE},
5815 0,INET_E_INVALID_URL,FALSE,
5816 0,INET_E_INVALID_URL,FALSE,
5817 0,0,0,INET_E_INVALID_URL,FALSE
5819 { "http://google.com/",0,S_OK,FALSE,
5821 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5823 {FALSE},
5824 0,INET_E_INVALID_URL,FALSE,
5825 0,INET_E_INVALID_URL,FALSE,
5826 0,0,0,INET_E_INVALID_URL,FALSE
5828 { "http://google.com/",0,S_OK,FALSE,
5830 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5832 {FALSE},
5833 0,INET_E_INVALID_URL,FALSE,
5834 0,INET_E_INVALID_URL,FALSE,
5835 0,0,0,INET_E_INVALID_URL,FALSE
5837 { "http://google.com/",0,S_OK,FALSE,
5839 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5841 {FALSE},
5842 0,INET_E_INVALID_URL,FALSE,
5843 0,INET_E_INVALID_URL,FALSE,
5844 0,0,0,INET_E_INVALID_URL,FALSE
5846 { "http://google.com/",0,S_OK,FALSE,
5848 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5850 {FALSE},
5851 0,INET_E_INVALID_URL,FALSE,
5852 0,INET_E_INVALID_URL,FALSE,
5853 0,0,0,INET_E_INVALID_URL,FALSE
5855 { "http://google.com/",0,S_OK,FALSE,
5857 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5859 {FALSE},
5860 0,INET_E_INVALID_URL,FALSE,
5861 0,INET_E_INVALID_URL,FALSE,
5862 0,0,0,INET_E_INVALID_URL,FALSE
5864 { "http://google.com/",0,S_OK,FALSE,
5866 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5868 {FALSE},
5869 0,INET_E_INVALID_URL,FALSE,
5870 0,INET_E_INVALID_URL,FALSE,
5871 0,0,0,INET_E_INVALID_URL,FALSE
5873 { "http://google.com/",0,S_OK,FALSE,
5875 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5877 {FALSE},
5878 0,INET_E_INVALID_URL,FALSE,
5879 0,INET_E_INVALID_URL,FALSE,
5880 0,0,0,INET_E_INVALID_URL,FALSE
5882 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5883 { "http://google.com/",0,S_OK,FALSE,
5885 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5887 {FALSE},
5888 0,S_OK,FALSE,
5889 0,S_OK,FALSE,
5890 0,0,0,S_OK,FALSE,
5892 {"http://winehq.org:test/",S_OK},
5893 {"winehq.org:test",S_OK},
5894 {"http://winehq.org:test/",S_OK},
5895 {"winehq.org:test",S_OK},
5896 {"",S_FALSE},
5897 {"",S_FALSE},
5898 {"winehq.org:test",S_OK},
5899 {"",S_FALSE},
5900 {"/",S_OK},
5901 {"/",S_OK},
5902 {"",S_FALSE},
5903 {"http://winehq.org:test/",S_OK},
5904 {"http",S_OK},
5905 {"",S_FALSE},
5906 {"",S_FALSE}
5909 {Uri_HOST_DNS,S_OK},
5910 {80,S_OK},
5911 {URL_SCHEME_HTTP,S_OK},
5912 {URLZONE_INVALID,E_NOTIMPL}
5915 /* Can't set the host name to NULL. */
5916 { "http://google.com/",0,S_OK,FALSE,
5918 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5920 {FALSE},
5921 0,S_OK,FALSE,
5922 0,S_OK,FALSE,
5923 0,0,0,S_OK,FALSE,
5925 {"http://google.com/",S_OK},
5926 {"google.com",S_OK},
5927 {"http://google.com/",S_OK},
5928 {"google.com",S_OK},
5929 {"",S_FALSE},
5930 {"",S_FALSE},
5931 {"google.com",S_OK},
5932 {"",S_FALSE},
5933 {"/",S_OK},
5934 {"/",S_OK},
5935 {"",S_FALSE},
5936 {"http://google.com/",S_OK},
5937 {"http",S_OK},
5938 {"",S_FALSE},
5939 {"",S_FALSE}
5942 {Uri_HOST_DNS,S_OK},
5943 {80,S_OK},
5944 {URL_SCHEME_HTTP,S_OK},
5945 {URLZONE_INVALID,E_NOTIMPL}
5948 /* Can set the host name to an empty string. */
5949 { "http://google.com/",0,S_OK,FALSE,
5951 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5953 {FALSE},
5954 0,S_OK,FALSE,
5955 0,S_OK,FALSE,
5956 0,0,0,S_OK,FALSE,
5958 {"http:///",S_OK},
5959 {"",S_OK},
5960 {"http:///",S_OK},
5961 {"",S_FALSE},
5962 {"",S_FALSE},
5963 {"",S_FALSE},
5964 {"",S_OK},
5965 {"",S_FALSE},
5966 {"/",S_OK},
5967 {"/",S_OK},
5968 {"",S_FALSE},
5969 {"http:///",S_OK},
5970 {"http",S_OK},
5971 {"",S_FALSE},
5972 {"",S_FALSE}
5975 {Uri_HOST_UNKNOWN,S_OK},
5976 {80,S_OK},
5977 {URL_SCHEME_HTTP,S_OK},
5978 {URLZONE_INVALID,E_NOTIMPL}
5981 { "http://google.com/",0,S_OK,FALSE,
5983 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5985 {FALSE},
5986 0,INET_E_INVALID_URL,FALSE,
5987 0,INET_E_INVALID_URL,FALSE,
5988 0,0,0,INET_E_INVALID_URL,FALSE
5990 { "http://google.com/",0,S_OK,FALSE,
5992 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5994 {FALSE},
5995 0,INET_E_INVALID_URL,FALSE,
5996 0,INET_E_INVALID_URL,FALSE,
5997 0,0,0,INET_E_INVALID_URL,FALSE
5999 { "http://google.com/",0,S_OK,FALSE,
6001 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
6003 {FALSE},
6004 0,INET_E_INVALID_URL,FALSE,
6005 0,INET_E_INVALID_URL,FALSE,
6006 0,0,0,INET_E_INVALID_URL,FALSE
6008 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6010 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6012 {FALSE},
6013 0,S_OK,FALSE,
6014 0,S_OK,FALSE,
6015 0,0,0,S_OK,FALSE,
6017 {"file:///c:/dir/file.html",S_OK},
6018 {"",S_FALSE},
6019 {"file:///c:/dir/file.html",S_OK},
6020 {"",S_FALSE},
6021 {".html",S_OK},
6022 {"",S_FALSE},
6023 {"",S_FALSE},
6024 {"",S_FALSE},
6025 {"/c:/dir/file.html",S_OK},
6026 {"/c:/dir/file.html",S_OK},
6027 {"",S_FALSE},
6028 {"file:///c:/dir/file.html",S_OK},
6029 {"file",S_OK},
6030 {"",S_FALSE},
6031 {"",S_FALSE}
6034 {Uri_HOST_UNKNOWN,S_OK},
6035 {0,S_FALSE},
6036 {URL_SCHEME_FILE,S_OK},
6037 {URLZONE_INVALID,E_NOTIMPL}
6040 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6042 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6044 {FALSE},
6045 0,S_OK,FALSE,
6046 0,S_OK,FALSE,
6047 0,0,0,S_OK,FALSE,
6049 {"file:///c:/dir/file.html#",S_OK},
6050 {"",S_FALSE},
6051 {"file:///c:/dir/file.html#",S_OK},
6052 {"",S_FALSE},
6053 {".html",S_OK},
6054 {"#",S_OK},
6055 {"",S_FALSE},
6056 {"",S_FALSE},
6057 {"/c:/dir/file.html",S_OK},
6058 {"/c:/dir/file.html",S_OK},
6059 {"",S_FALSE},
6060 {"file:///c:/dir/file.html#",S_OK},
6061 {"file",S_OK},
6062 {"",S_FALSE},
6063 {"",S_FALSE}
6066 {Uri_HOST_UNKNOWN,S_OK},
6067 {0,S_FALSE},
6068 {URL_SCHEME_FILE,S_OK},
6069 {URLZONE_INVALID,E_NOTIMPL}
6074 typedef struct _uri_builder_remove_test {
6075 const char *uri;
6076 DWORD create_flags;
6077 HRESULT create_builder_expected;
6078 BOOL create_builder_todo;
6080 DWORD remove_properties;
6081 HRESULT remove_expected;
6082 BOOL remove_todo;
6084 const char *expected_uri;
6085 DWORD expected_flags;
6086 HRESULT expected_hres;
6087 BOOL expected_todo;
6088 } uri_builder_remove_test;
6090 static const uri_builder_remove_test uri_builder_remove_tests[] = {
6091 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
6092 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
6093 "http://google.com/",0,S_OK,FALSE
6095 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
6096 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
6097 "http://winehq.org/",0,S_OK,FALSE
6099 { "zip://google.com?Test=x",0,S_OK,FALSE,
6100 Uri_HAS_HOST,S_OK,FALSE,
6101 "zip:/?Test=x",0,S_OK,FALSE
6103 /* Doesn't remove the whole userinfo component. */
6104 { "http://username:pass@google.com/",0,S_OK,FALSE,
6105 Uri_HAS_USER_INFO,S_OK,FALSE,
6106 "http://username:pass@google.com/",0,S_OK,FALSE
6108 /* Doesn't remove the domain. */
6109 { "http://google.com/",0,S_OK,FALSE,
6110 Uri_HAS_DOMAIN,S_OK,FALSE,
6111 "http://google.com/",0,S_OK,FALSE
6113 { "http://google.com:120/",0,S_OK,FALSE,
6114 Uri_HAS_AUTHORITY,S_OK,FALSE,
6115 "http://google.com:120/",0,S_OK,FALSE
6117 { "http://google.com/test.com/",0,S_OK,FALSE,
6118 Uri_HAS_EXTENSION,S_OK,FALSE,
6119 "http://google.com/test.com/",0,S_OK,FALSE
6121 { "http://google.com/?test=x",0,S_OK,FALSE,
6122 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6123 "http://google.com/?test=x",0,S_OK,FALSE
6125 /* Can't remove the scheme name. */
6126 { "http://google.com/?test=x",0,S_OK,FALSE,
6127 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6128 "http://google.com/?test=x",0,S_OK,FALSE
6132 typedef struct _uri_combine_str_property {
6133 const char *value;
6134 HRESULT expected;
6135 BOOL todo;
6136 const char *broken_value;
6137 const char *value_ex;
6138 } uri_combine_str_property;
6140 typedef struct _uri_combine_test {
6141 const char *base_uri;
6142 DWORD base_create_flags;
6143 const char *relative_uri;
6144 DWORD relative_create_flags;
6145 DWORD combine_flags;
6146 HRESULT expected;
6147 BOOL todo;
6149 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6150 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6151 } uri_combine_test;
6153 static const uri_combine_test uri_combine_tests[] = {
6154 { "http://google.com/fun/stuff",0,
6155 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6156 0,S_OK,FALSE,
6158 {"http://google.com/not/fun/stuff",S_OK},
6159 {"google.com",S_OK},
6160 {"http://google.com/not/fun/stuff",S_OK},
6161 {"google.com",S_OK},
6162 {"",S_FALSE},
6163 {"",S_FALSE},
6164 {"google.com",S_OK},
6165 {"",S_FALSE},
6166 {"/not/fun/stuff",S_OK},
6167 {"/not/fun/stuff",S_OK},
6168 {"",S_FALSE},
6169 {"http://google.com/not/fun/stuff",S_OK},
6170 {"http",S_OK},
6171 {"",S_FALSE},
6172 {"",S_FALSE}
6175 {Uri_HOST_DNS,S_OK},
6176 {80,S_OK},
6177 {URL_SCHEME_HTTP,S_OK},
6178 {URLZONE_INVALID,E_NOTIMPL}
6181 { "http://google.com/test",0,
6182 "zip://test.com/cool",0,
6183 0,S_OK,FALSE,
6185 {"zip://test.com/cool",S_OK},
6186 {"test.com",S_OK},
6187 {"zip://test.com/cool",S_OK},
6188 {"test.com",S_OK},
6189 {"",S_FALSE},
6190 {"",S_FALSE},
6191 {"test.com",S_OK},
6192 {"",S_FALSE},
6193 {"/cool",S_OK},
6194 {"/cool",S_OK},
6195 {"",S_FALSE},
6196 {"zip://test.com/cool",S_OK},
6197 {"zip",S_OK},
6198 {"",S_FALSE},
6199 {"",S_FALSE}
6202 {Uri_HOST_DNS,S_OK},
6203 {0,S_FALSE},
6204 {URL_SCHEME_UNKNOWN,S_OK},
6205 {URLZONE_INVALID,E_NOTIMPL}
6208 { "http://google.com/use/base/path",0,
6209 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6210 0,S_OK,FALSE,
6212 {"http://google.com/use/base/path?relative",S_OK},
6213 {"google.com",S_OK},
6214 {"http://google.com/use/base/path?relative",S_OK},
6215 {"google.com",S_OK},
6216 {"",S_FALSE},
6217 {"",S_FALSE},
6218 {"google.com",S_OK},
6219 {"",S_FALSE},
6220 {"/use/base/path",S_OK},
6221 {"/use/base/path?relative",S_OK},
6222 {"?relative",S_OK},
6223 {"http://google.com/use/base/path?relative",S_OK},
6224 {"http",S_OK},
6225 {"",S_FALSE},
6226 {"",S_FALSE}
6229 {Uri_HOST_DNS,S_OK},
6230 {80,S_OK},
6231 {URL_SCHEME_HTTP,S_OK},
6232 {URLZONE_INVALID,E_NOTIMPL}
6235 { "http://google.com/path",0,
6236 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6237 0,S_OK,FALSE,
6239 {"http://google.com/testing",S_OK},
6240 {"google.com",S_OK},
6241 {"http://google.com/testing",S_OK},
6242 {"google.com",S_OK},
6243 {"",S_FALSE},
6244 {"",S_FALSE},
6245 {"google.com",S_OK},
6246 {"",S_FALSE},
6247 {"/testing",S_OK},
6248 {"/testing",S_OK},
6249 {"",S_FALSE},
6250 {"http://google.com/testing",S_OK},
6251 {"http",S_OK},
6252 {"",S_FALSE},
6253 {"",S_FALSE}
6256 {Uri_HOST_DNS,S_OK},
6257 {80,S_OK},
6258 {URL_SCHEME_HTTP,S_OK},
6259 {URLZONE_INVALID,E_NOTIMPL}
6262 { "http://google.com/path",0,
6263 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6264 URL_DONT_SIMPLIFY,S_OK,FALSE,
6266 {"http://google.com:80/test/../test/.././testing",S_OK},
6267 {"google.com",S_OK},
6268 {"http://google.com:80/test/../test/.././testing",S_OK},
6269 {"google.com",S_OK},
6270 {"",S_FALSE},
6271 {"",S_FALSE},
6272 {"google.com",S_OK},
6273 {"",S_FALSE},
6274 {"/test/../test/.././testing",S_OK},
6275 {"/test/../test/.././testing",S_OK},
6276 {"",S_FALSE},
6277 {"http://google.com:80/test/../test/.././testing",S_OK},
6278 {"http",S_OK},
6279 {"",S_FALSE},
6280 {"",S_FALSE}
6283 {Uri_HOST_DNS,S_OK},
6284 {80,S_OK},
6285 {URL_SCHEME_HTTP,S_OK},
6286 {URLZONE_INVALID,E_NOTIMPL}
6289 { "http://winehq.org/test/abc",0,
6290 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6291 0,S_OK,FALSE,
6293 {"http://winehq.org/test/testing/test",S_OK},
6294 {"winehq.org",S_OK},
6295 {"http://winehq.org/test/testing/test",S_OK},
6296 {"winehq.org",S_OK},
6297 {"",S_FALSE},
6298 {"",S_FALSE},
6299 {"winehq.org",S_OK},
6300 {"",S_FALSE},
6301 {"/test/testing/test",S_OK},
6302 {"/test/testing/test",S_OK},
6303 {"",S_FALSE},
6304 {"http://winehq.org/test/testing/test",S_OK},
6305 {"http",S_OK},
6306 {"",S_FALSE},
6307 {"",S_FALSE}
6310 {Uri_HOST_DNS,S_OK},
6311 {80,S_OK},
6312 {URL_SCHEME_HTTP,S_OK},
6313 {URLZONE_INVALID,E_NOTIMPL}
6316 { "http://winehq.org/test/abc",0,
6317 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6318 URL_DONT_SIMPLIFY,S_OK,FALSE,
6320 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6321 /* Default port is hidden in the authority. */
6322 {"winehq.org",S_OK},
6323 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6324 {"winehq.org",S_OK},
6325 {"",S_FALSE},
6326 {"",S_FALSE},
6327 {"winehq.org",S_OK},
6328 {"",S_FALSE},
6329 {"/test/testing/abc/../test",S_OK},
6330 {"/test/testing/abc/../test",S_OK},
6331 {"",S_FALSE},
6332 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6333 {"http",S_OK},
6334 {"",S_FALSE},
6335 {"",S_FALSE}
6338 {Uri_HOST_DNS,S_OK},
6339 {80,S_OK},
6340 {URL_SCHEME_HTTP,S_OK},
6341 {URLZONE_INVALID,E_NOTIMPL}
6344 { "http://winehq.org/test?query",0,
6345 "testing",Uri_CREATE_ALLOW_RELATIVE,
6346 0,S_OK,FALSE,
6348 {"http://winehq.org/testing",S_OK},
6349 {"winehq.org",S_OK},
6350 {"http://winehq.org/testing",S_OK},
6351 {"winehq.org",S_OK},
6352 {"",S_FALSE},
6353 {"",S_FALSE},
6354 {"winehq.org",S_OK},
6355 {"",S_FALSE},
6356 {"/testing",S_OK},
6357 {"/testing",S_OK},
6358 {"",S_FALSE},
6359 {"http://winehq.org/testing",S_OK},
6360 {"http",S_OK},
6361 {"",S_FALSE},
6362 {"",S_FALSE}
6365 {Uri_HOST_DNS,S_OK},
6366 {80,S_OK},
6367 {URL_SCHEME_HTTP,S_OK},
6368 {URLZONE_INVALID,E_NOTIMPL}
6371 { "http://winehq.org/test#frag",0,
6372 "testing",Uri_CREATE_ALLOW_RELATIVE,
6373 0,S_OK,FALSE,
6375 {"http://winehq.org/testing",S_OK},
6376 {"winehq.org",S_OK},
6377 {"http://winehq.org/testing",S_OK},
6378 {"winehq.org",S_OK},
6379 {"",S_FALSE},
6380 {"",S_FALSE},
6381 {"winehq.org",S_OK},
6382 {"",S_FALSE},
6383 {"/testing",S_OK},
6384 {"/testing",S_OK},
6385 {"",S_FALSE},
6386 {"http://winehq.org/testing",S_OK},
6387 {"http",S_OK},
6388 {"",S_FALSE},
6389 {"",S_FALSE}
6392 {Uri_HOST_DNS,S_OK},
6393 {80,S_OK},
6394 {URL_SCHEME_HTTP,S_OK},
6395 {URLZONE_INVALID,E_NOTIMPL}
6398 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6399 "test",Uri_CREATE_ALLOW_RELATIVE,
6400 0,S_OK,FALSE,
6402 {"test",S_OK},
6403 {"",S_FALSE},
6404 {"test",S_OK},
6405 {"",S_FALSE},
6406 {"",S_FALSE},
6407 {"",S_FALSE},
6408 {"",S_FALSE},
6409 {"",S_FALSE},
6410 {"test",S_OK},
6411 {"test",S_OK},
6412 {"",S_FALSE},
6413 {"test",S_OK},
6414 {"",S_FALSE},
6415 {"",S_FALSE},
6416 {"",S_FALSE}
6419 {Uri_HOST_UNKNOWN,S_OK},
6420 {0,S_FALSE},
6421 {URL_SCHEME_UNKNOWN,S_OK},
6422 {URLZONE_INVALID,E_NOTIMPL}
6425 { "file:///c:/test/test",0,
6426 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6427 URL_FILE_USE_PATHURL,S_OK,FALSE,
6429 {"file://c:\\testing.mp3",S_OK},
6430 {"",S_FALSE},
6431 {"file://c:\\testing.mp3",S_OK},
6432 {"",S_FALSE},
6433 {".mp3",S_OK},
6434 {"",S_FALSE},
6435 {"",S_FALSE},
6436 {"",S_FALSE},
6437 {"c:\\testing.mp3",S_OK},
6438 {"c:\\testing.mp3",S_OK},
6439 {"",S_FALSE},
6440 {"file://c:\\testing.mp3",S_OK},
6441 {"file",S_OK},
6442 {"",S_FALSE},
6443 {"",S_FALSE}
6446 {Uri_HOST_UNKNOWN,S_OK},
6447 {0,S_FALSE},
6448 {URL_SCHEME_FILE,S_OK},
6449 {URLZONE_INVALID,E_NOTIMPL}
6452 { "file:///c:/test/test",0,
6453 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6454 0,S_OK,FALSE,
6456 {"file:///c:/testing.mp3",S_OK},
6457 {"",S_FALSE},
6458 {"file:///c:/testing.mp3",S_OK},
6459 {"",S_FALSE},
6460 {".mp3",S_OK},
6461 {"",S_FALSE},
6462 {"",S_FALSE},
6463 {"",S_FALSE},
6464 {"/c:/testing.mp3",S_OK},
6465 {"/c:/testing.mp3",S_OK},
6466 {"",S_FALSE},
6467 {"file:///c:/testing.mp3",S_OK},
6468 {"file",S_OK},
6469 {"",S_FALSE},
6470 {"",S_FALSE}
6473 {Uri_HOST_UNKNOWN,S_OK},
6474 {0,S_FALSE},
6475 {URL_SCHEME_FILE,S_OK},
6476 {URLZONE_INVALID,E_NOTIMPL}
6479 { "file://test.com/test/test",0,
6480 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6481 URL_FILE_USE_PATHURL,S_OK,FALSE,
6483 {"file://\\\\test.com\\testing.mp3",S_OK},
6484 {"test.com",S_OK},
6485 {"file://\\\\test.com\\testing.mp3",S_OK},
6486 {"test.com",S_OK},
6487 {".mp3",S_OK},
6488 {"",S_FALSE},
6489 {"test.com",S_OK},
6490 {"",S_FALSE},
6491 {"\\testing.mp3",S_OK},
6492 {"\\testing.mp3",S_OK},
6493 {"",S_FALSE},
6494 {"file://\\\\test.com\\testing.mp3",S_OK},
6495 {"file",S_OK},
6496 {"",S_FALSE},
6497 {"",S_FALSE}
6500 {Uri_HOST_DNS,S_OK},
6501 {0,S_FALSE},
6502 {URL_SCHEME_FILE,S_OK},
6503 {URLZONE_INVALID,E_NOTIMPL}
6506 /* URL_DONT_SIMPLIFY has no effect. */
6507 { "http://google.com/test",0,
6508 "zip://test.com/cool/../cool/test",0,
6509 URL_DONT_SIMPLIFY,S_OK,FALSE,
6511 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6512 {"test.com",S_OK},
6513 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6514 {"test.com",S_OK},
6515 {"",S_FALSE},
6516 {"",S_FALSE},
6517 {"test.com",S_OK},
6518 {"",S_FALSE},
6519 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6520 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6521 {"",S_FALSE},
6522 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6523 * On IE 7 it reduces the path in the Raw URI.
6525 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6526 {"zip",S_OK},
6527 {"",S_FALSE},
6528 {"",S_FALSE}
6531 {Uri_HOST_DNS,S_OK},
6532 {0,S_FALSE},
6533 {URL_SCHEME_UNKNOWN,S_OK},
6534 {URLZONE_INVALID,E_NOTIMPL}
6537 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6538 * resulting URI is converted into a dos path.
6540 { "http://google.com/test",0,
6541 "file:///c:/test/",0,
6542 URL_FILE_USE_PATHURL,S_OK,FALSE,
6544 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6545 {"",S_FALSE},
6546 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6547 {"",S_FALSE},
6548 {"",S_FALSE},
6549 {"",S_FALSE},
6550 {"",S_FALSE},
6551 {"",S_FALSE},
6552 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6553 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6554 {"",S_FALSE},
6555 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6556 {"file",S_OK},
6557 {"",S_FALSE},
6558 {"",S_FALSE}
6561 {Uri_HOST_UNKNOWN,S_OK},
6562 {0,S_FALSE},
6563 {URL_SCHEME_FILE,S_OK},
6564 {URLZONE_INVALID,E_NOTIMPL}
6567 { "http://google.com/test",0,
6568 "http://test.com/test#%30test",0,
6569 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6571 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6572 {"test.com",S_OK},
6573 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6574 {"test.com",S_OK},
6575 {"",S_FALSE},
6576 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6577 {"test.com",S_OK},
6578 {"",S_FALSE},
6579 {"/test",S_OK},
6580 {"/test",S_OK},
6581 {"",S_FALSE},
6582 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6583 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6584 {"http",S_OK},
6585 {"",S_FALSE},
6586 {"",S_FALSE}
6589 {Uri_HOST_DNS,S_OK},
6590 {80,S_OK},
6591 {URL_SCHEME_HTTP,S_OK},
6592 {URLZONE_INVALID,E_NOTIMPL}
6595 /* Windows validates the path component from the relative Uri. */
6596 { "http://google.com/test",0,
6597 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6598 0,E_INVALIDARG,FALSE
6600 /* Windows doesn't validate the query from the relative Uri. */
6601 { "http://google.com/test",0,
6602 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6603 0,S_OK,FALSE,
6605 {"http://google.com/test?Tes%XXt",S_OK},
6606 {"google.com",S_OK},
6607 {"http://google.com/test?Tes%XXt",S_OK},
6608 {"google.com",S_OK},
6609 {"",S_FALSE},
6610 {"",S_FALSE},
6611 {"google.com",S_OK},
6612 {"",S_FALSE},
6613 {"/test",S_OK},
6614 {"/test?Tes%XXt",S_OK},
6615 {"?Tes%XXt",S_OK},
6616 {"http://google.com/test?Tes%XXt",S_OK},
6617 {"http",S_OK},
6618 {"",S_FALSE},
6619 {"",S_FALSE}
6622 {Uri_HOST_DNS,S_OK},
6623 {80,S_OK},
6624 {URL_SCHEME_HTTP,S_OK},
6625 {URLZONE_INVALID,E_NOTIMPL}
6628 /* Windows doesn't validate the fragment from the relative Uri. */
6629 { "http://google.com/test",0,
6630 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6631 0,S_OK,FALSE,
6633 {"http://google.com/test#Tes%XXt",S_OK},
6634 {"google.com",S_OK},
6635 {"http://google.com/test#Tes%XXt",S_OK},
6636 {"google.com",S_OK},
6637 {"",S_FALSE},
6638 {"#Tes%XXt",S_OK},
6639 {"google.com",S_OK},
6640 {"",S_FALSE},
6641 {"/test",S_OK},
6642 {"/test",S_OK},
6643 {"",S_FALSE},
6644 {"http://google.com/test#Tes%XXt",S_OK},
6645 {"http",S_OK},
6646 {"",S_FALSE},
6647 {"",S_FALSE}
6650 {Uri_HOST_DNS,S_OK},
6651 {80,S_OK},
6652 {URL_SCHEME_HTTP,S_OK},
6653 {URLZONE_INVALID,E_NOTIMPL}
6656 /* Creates an IUri which contains an invalid dos path char. */
6657 { "file:///c:/test",0,
6658 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6659 URL_FILE_USE_PATHURL,S_OK,FALSE,
6661 {"file://c:\\test<ing",S_OK},
6662 {"",S_FALSE},
6663 {"file://c:\\test<ing",S_OK},
6664 {"",S_FALSE},
6665 {"",S_FALSE},
6666 {"",S_FALSE},
6667 {"",S_FALSE},
6668 {"",S_FALSE},
6669 {"c:\\test<ing",S_OK},
6670 {"c:\\test<ing",S_OK},
6671 {"",S_FALSE},
6672 {"file://c:\\test<ing",S_OK},
6673 {"file",S_OK},
6674 {"",S_FALSE},
6675 {"",S_FALSE}
6678 {Uri_HOST_UNKNOWN,S_OK},
6679 {0,S_FALSE},
6680 {URL_SCHEME_FILE,S_OK},
6681 {URLZONE_INVALID,E_NOTIMPL}
6684 /* Appends the path after the drive letter (if any). */
6685 { "file:///c:/test",0,
6686 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6687 0,S_OK,FALSE,
6689 {"file:///c:/c:/testing",S_OK},
6690 {"",S_FALSE},
6691 {"file:///c:/c:/testing",S_OK},
6692 {"",S_FALSE},
6693 {"",S_FALSE},
6694 {"",S_FALSE},
6695 {"",S_FALSE},
6696 {"",S_FALSE},
6697 {"/c:/c:/testing",S_OK},
6698 {"/c:/c:/testing",S_OK},
6699 {"",S_FALSE},
6700 {"file:///c:/c:/testing",S_OK},
6701 {"file",S_OK},
6702 {"",S_FALSE},
6703 {"",S_FALSE}
6706 {Uri_HOST_UNKNOWN,S_OK},
6707 {0,S_FALSE},
6708 {URL_SCHEME_FILE,S_OK},
6709 {URLZONE_INVALID,E_NOTIMPL}
6712 /* A '/' is added if the base URI doesn't have a path and the
6713 * relative URI doesn't contain a path (since the base URI is
6714 * hierarchical.
6716 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6717 "?test",Uri_CREATE_ALLOW_RELATIVE,
6718 0,S_OK,FALSE,
6720 {"http://google.com/?test",S_OK},
6721 {"google.com",S_OK},
6722 {"http://google.com/?test",S_OK},
6723 {"google.com",S_OK},
6724 {"",S_FALSE},
6725 {"",S_FALSE},
6726 {"google.com",S_OK},
6727 {"",S_FALSE},
6728 {"/",S_OK},
6729 {"/?test",S_OK},
6730 {"?test",S_OK},
6731 {"http://google.com/?test",S_OK},
6732 {"http",S_OK},
6733 {"",S_FALSE},
6734 {"",S_FALSE}
6737 {Uri_HOST_DNS,S_OK},
6738 {80,S_OK},
6739 {URL_SCHEME_HTTP,S_OK},
6740 {URLZONE_INVALID,E_NOTIMPL}
6743 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6744 "?test",Uri_CREATE_ALLOW_RELATIVE,
6745 0,S_OK,FALSE,
6747 {"zip://google.com/?test",S_OK},
6748 {"google.com",S_OK},
6749 {"zip://google.com/?test",S_OK},
6750 {"google.com",S_OK},
6751 {"",S_FALSE},
6752 {"",S_FALSE},
6753 {"google.com",S_OK},
6754 {"",S_FALSE},
6755 {"/",S_OK},
6756 {"/?test",S_OK},
6757 {"?test",S_OK},
6758 {"zip://google.com/?test",S_OK},
6759 {"zip",S_OK},
6760 {"",S_FALSE},
6761 {"",S_FALSE}
6764 {Uri_HOST_DNS,S_OK},
6765 {0,S_FALSE},
6766 {URL_SCHEME_UNKNOWN,S_OK},
6767 {URLZONE_INVALID,E_NOTIMPL}
6770 /* No path is appended since the base URI is opaque. */
6771 { "zip:?testing",0,
6772 "?test",Uri_CREATE_ALLOW_RELATIVE,
6773 0,S_OK,FALSE,
6775 {"zip:?test",S_OK},
6776 {"",S_FALSE},
6777 {"zip:?test",S_OK},
6778 {"",S_FALSE},
6779 {"",S_FALSE},
6780 {"",S_FALSE},
6781 {"",S_FALSE},
6782 {"",S_FALSE},
6783 {"",S_OK},
6784 {"?test",S_OK},
6785 {"?test",S_OK},
6786 {"zip:?test",S_OK},
6787 {"zip",S_OK},
6788 {"",S_FALSE},
6789 {"",S_FALSE}
6792 {Uri_HOST_UNKNOWN,S_OK},
6793 {0,S_FALSE},
6794 {URL_SCHEME_UNKNOWN,S_OK},
6795 {URLZONE_INVALID,E_NOTIMPL}
6798 { "file:///c:/",0,
6799 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6800 0,S_OK,FALSE,
6802 {"file:///c:/testing/test",S_OK},
6803 {"",S_FALSE},
6804 {"file:///c:/testing/test",S_OK},
6805 {"",S_FALSE},
6806 {"",S_FALSE},
6807 {"",S_FALSE},
6808 {"",S_FALSE},
6809 {"",S_FALSE},
6810 {"/c:/testing/test",S_OK},
6811 {"/c:/testing/test",S_OK},
6812 {"",S_FALSE},
6813 {"file:///c:/testing/test",S_OK},
6814 {"file",S_OK},
6815 {"",S_FALSE},
6816 {"",S_FALSE}
6819 {Uri_HOST_UNKNOWN,S_OK},
6820 {0,S_FALSE},
6821 {URL_SCHEME_FILE,S_OK},
6822 {URLZONE_INVALID,E_NOTIMPL}
6825 { "http://winehq.org/dir/testfile",0,
6826 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6827 0,S_OK,FALSE,
6829 {"http://winehq.org/dir/test?querystring",S_OK},
6830 {"winehq.org",S_OK},
6831 {"http://winehq.org/dir/test?querystring",S_OK},
6832 {"winehq.org",S_OK},
6833 {"",S_FALSE},
6834 {"",S_FALSE},
6835 {"winehq.org",S_OK},
6836 {"",S_FALSE},
6837 {"/dir/test",S_OK},
6838 {"/dir/test?querystring",S_OK},
6839 {"?querystring",S_OK},
6840 {"http://winehq.org/dir/test?querystring",S_OK},
6841 {"http",S_OK},
6842 {"",S_FALSE},
6843 {"",S_FALSE}
6846 {Uri_HOST_DNS,S_OK},
6847 {80,S_OK},
6848 {URL_SCHEME_HTTP,S_OK},
6849 {URLZONE_INVALID,E_NOTIMPL}
6852 { "http://winehq.org/dir/test",0,
6853 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6854 0,S_OK,FALSE,
6856 {"http://winehq.org/dir/test?querystring",S_OK},
6857 {"winehq.org",S_OK},
6858 {"http://winehq.org/dir/test?querystring",S_OK},
6859 {"winehq.org",S_OK},
6860 {"",S_FALSE},
6861 {"",S_FALSE},
6862 {"winehq.org",S_OK},
6863 {"",S_FALSE},
6864 {"/dir/test",S_OK},
6865 {"/dir/test?querystring",S_OK},
6866 {"?querystring",S_OK},
6867 {"http://winehq.org/dir/test?querystring",S_OK},
6868 {"http",S_OK},
6869 {"",S_FALSE},
6870 {"",S_FALSE}
6873 {Uri_HOST_DNS,S_OK},
6874 {80,S_OK},
6875 {URL_SCHEME_HTTP,S_OK},
6876 {URLZONE_INVALID,E_NOTIMPL}
6879 { "http://winehq.org/dir/test?querystring",0,
6880 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6881 0,S_OK,FALSE,
6883 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6884 {"winehq.org",S_OK},
6885 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6886 {"winehq.org",S_OK},
6887 {"",S_FALSE},
6888 {"#hash",S_OK},
6889 {"winehq.org",S_OK},
6890 {"",S_FALSE},
6891 {"/dir/test",S_OK},
6892 {"/dir/test?querystring",S_OK},
6893 {"?querystring",S_OK},
6894 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6895 {"http",S_OK},
6896 {"",S_FALSE},
6897 {"",S_FALSE}
6900 {Uri_HOST_DNS,S_OK},
6901 {80,S_OK},
6902 {URL_SCHEME_HTTP,S_OK},
6903 {URLZONE_INVALID,E_NOTIMPL}
6906 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6907 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6908 0,S_OK,FALSE,
6910 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6911 {"",S_FALSE},
6912 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6913 {"",S_FALSE},
6914 {".txt",S_OK},
6915 {"",S_FALSE},
6916 {"",S_FALSE},
6917 {"",S_FALSE},
6918 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6919 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6920 {"",S_FALSE},
6921 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6922 {"mk",S_OK},
6923 {"",S_FALSE},
6924 {"",S_FALSE}
6927 {Uri_HOST_UNKNOWN,S_OK},
6928 {0,S_FALSE},
6929 {URL_SCHEME_MK,S_OK},
6930 {URLZONE_INVALID,E_NOTIMPL}
6933 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6934 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6935 0,S_OK,FALSE,
6937 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6938 {"",S_FALSE},
6939 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6940 {"",S_FALSE},
6941 {".txt",S_OK},
6942 {"",S_FALSE},
6943 {"",S_FALSE},
6944 {"",S_FALSE},
6945 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6946 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6947 {"",S_FALSE},
6948 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6949 {"mk",S_OK},
6950 {"",S_FALSE},
6951 {"",S_FALSE}
6954 {Uri_HOST_UNKNOWN,S_OK},
6955 {0,S_FALSE},
6956 {URL_SCHEME_MK,S_OK},
6957 {URLZONE_INVALID,E_NOTIMPL}
6960 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6961 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6962 0,S_OK,FALSE,
6964 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6965 {"",S_FALSE},
6966 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6967 {"",S_FALSE},
6968 {".txt",S_OK},
6969 {"",S_FALSE},
6970 {"",S_FALSE},
6971 {"",S_FALSE},
6972 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6973 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6974 {"",S_FALSE},
6975 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6976 {"mk",S_OK},
6977 {"",S_FALSE},
6978 {"",S_FALSE}
6981 {Uri_HOST_UNKNOWN,S_OK},
6982 {0,S_FALSE},
6983 {URL_SCHEME_MK,S_OK},
6984 {URLZONE_INVALID,E_NOTIMPL}
6987 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6988 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6989 0,S_OK,FALSE,
6991 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6992 {"",S_FALSE},
6993 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6994 {"",S_FALSE},
6995 {".txt",S_OK},
6996 {"",S_FALSE},
6997 {"",S_FALSE},
6998 {"",S_FALSE},
6999 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7000 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7001 {"",S_FALSE},
7002 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7003 {"mk",S_OK},
7004 {"",S_FALSE},
7005 {"",S_FALSE}
7008 {Uri_HOST_UNKNOWN,S_OK},
7009 {0,S_FALSE},
7010 {URL_SCHEME_MK,S_OK},
7011 {URLZONE_INVALID,E_NOTIMPL}
7014 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7015 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7016 0,S_OK,FALSE,
7018 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7019 {"",S_FALSE},
7020 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7021 {"",S_FALSE},
7022 {".txt",S_OK},
7023 {"",S_FALSE},
7024 {"",S_FALSE},
7025 {"",S_FALSE},
7026 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7027 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7028 {"",S_FALSE},
7029 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7030 {"mk",S_OK},
7031 {"",S_FALSE},
7032 {"",S_FALSE}
7035 {Uri_HOST_UNKNOWN,S_OK},
7036 {0,S_FALSE},
7037 {URL_SCHEME_MK,S_OK},
7038 {URLZONE_INVALID,E_NOTIMPL}
7041 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7042 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7043 0,S_OK,FALSE,
7045 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7046 {"",S_FALSE},
7047 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7048 {"",S_FALSE},
7049 {".txt",S_OK},
7050 {"",S_FALSE},
7051 {"",S_FALSE},
7052 {"",S_FALSE},
7053 {"@MSITSTORE:/relative/path.txt",S_OK},
7054 {"@MSITSTORE:/relative/path.txt",S_OK},
7055 {"",S_FALSE},
7056 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7057 {"mk",S_OK},
7058 {"",S_FALSE},
7059 {"",S_FALSE}
7062 {Uri_HOST_UNKNOWN,S_OK},
7063 {0,S_FALSE},
7064 {URL_SCHEME_MK,S_OK},
7065 {URLZONE_INVALID,E_NOTIMPL}
7068 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7069 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7070 0,S_OK,FALSE,
7072 {"mk:@xxx:/relative/path.txt",S_OK},
7073 {"",S_FALSE},
7074 {"mk:@xxx:/relative/path.txt",S_OK},
7075 {"",S_FALSE},
7076 {".txt",S_OK},
7077 {"",S_FALSE},
7078 {"",S_FALSE},
7079 {"",S_FALSE},
7080 {"@xxx:/relative/path.txt",S_OK},
7081 {"@xxx:/relative/path.txt",S_OK},
7082 {"",S_FALSE},
7083 {"mk:@xxx:/relative/path.txt",S_OK},
7084 {"mk",S_OK},
7085 {"",S_FALSE},
7086 {"",S_FALSE}
7089 {Uri_HOST_UNKNOWN,S_OK},
7090 {0,S_FALSE},
7091 {URL_SCHEME_MK,S_OK},
7092 {URLZONE_INVALID,E_NOTIMPL}
7095 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7096 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7097 0,S_OK,FALSE,
7099 {"mk:/relative/path.txt",S_OK},
7100 {"",S_FALSE},
7101 {"mk:/relative/path.txt",S_OK},
7102 {"",S_FALSE},
7103 {".txt",S_OK},
7104 {"",S_FALSE},
7105 {"",S_FALSE},
7106 {"",S_FALSE},
7107 {"/relative/path.txt",S_OK},
7108 {"/relative/path.txt",S_OK},
7109 {"",S_FALSE},
7110 {"mk:/relative/path.txt",S_OK},
7111 {"mk",S_OK},
7112 {"",S_FALSE},
7113 {"",S_FALSE}
7116 {Uri_HOST_UNKNOWN,S_OK},
7117 {0,S_FALSE},
7118 {URL_SCHEME_MK,S_OK},
7119 {URLZONE_INVALID,E_NOTIMPL}
7122 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7123 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7124 0,S_OK,FALSE,
7126 {"ml:/relative/path.txt",S_OK},
7127 {"",S_FALSE},
7128 {"ml:/relative/path.txt",S_OK},
7129 {"",S_FALSE},
7130 {".txt",S_OK},
7131 {"",S_FALSE},
7132 {"",S_FALSE},
7133 {"",S_FALSE},
7134 {"/relative/path.txt",S_OK},
7135 {"/relative/path.txt",S_OK},
7136 {"",S_FALSE},
7137 {"ml:/relative/path.txt",S_OK},
7138 {"ml",S_OK},
7139 {"",S_FALSE},
7140 {"",S_FALSE}
7143 {Uri_HOST_UNKNOWN,S_OK},
7144 {0,S_FALSE},
7145 {URL_SCHEME_UNKNOWN,S_OK},
7146 {URLZONE_INVALID,E_NOTIMPL}
7149 { "http://winehq.org/dir/test?querystring",0,
7150 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7151 0,S_OK,FALSE,
7153 {"http://winehq.com/#hash",S_OK},
7154 {"winehq.com",S_OK},
7155 {"http://winehq.com/#hash",S_OK},
7156 {"winehq.com",S_OK},
7157 {"",S_FALSE},
7158 {"#hash",S_OK},
7159 {"winehq.com",S_OK},
7160 {"",S_FALSE},
7161 {"/",S_OK},
7162 {"/",S_OK},
7163 {"",S_FALSE},
7164 {"http://winehq.com/#hash",S_OK},
7165 {"http",S_OK},
7166 {"",S_FALSE},
7167 {"",S_FALSE}
7170 {Uri_HOST_DNS,S_OK},
7171 {80,S_OK,FALSE,TRUE},
7172 {URL_SCHEME_HTTP,S_OK},
7173 {URLZONE_INVALID,E_NOTIMPL}
7176 { "http://winehq.org/dir/test?querystring",0,
7177 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7178 0,S_OK,FALSE,
7180 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7181 {"winehq.com",S_OK},
7182 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7183 {"winehq.com",S_OK},
7184 {".txt",S_OK},
7185 {"#hash",S_OK},
7186 {"winehq.com",S_OK},
7187 {"",S_FALSE},
7188 {"/dir/file.txt",S_OK},
7189 {"/dir/file.txt?query",S_OK},
7190 {"?query",S_OK},
7191 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7192 {"http",S_OK},
7193 {"",S_FALSE},
7194 {"",S_FALSE}
7197 {Uri_HOST_DNS,S_OK},
7198 {80,S_OK,FALSE,TRUE},
7199 {URL_SCHEME_HTTP,S_OK},
7200 {URLZONE_INVALID,E_NOTIMPL}
7203 { "http://google.com/test",0,
7204 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7205 0,S_OK,FALSE,
7207 {"file:///c:/test/",S_OK},
7208 {"",S_FALSE},
7209 {"file:///c:/test/",S_OK},
7210 {"",S_FALSE},
7211 {"",S_FALSE},
7212 {"",S_FALSE},
7213 {"",S_FALSE},
7214 {"",S_FALSE},
7215 {"/c:/test/",S_OK},
7216 {"/c:/test/",S_OK},
7217 {"",S_FALSE},
7218 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7219 {"file",S_OK},
7220 {"",S_FALSE},
7221 {"",S_FALSE}
7224 {Uri_HOST_UNKNOWN,S_OK},
7225 {0,S_FALSE},
7226 {URL_SCHEME_FILE,S_OK},
7227 {URLZONE_INVALID,E_NOTIMPL}
7230 { "http://google.com/test",0,
7231 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7232 0,S_OK,FALSE,
7234 {"file:///c:/test/",S_OK},
7235 {"",S_FALSE},
7236 {"file:///c:/test/",S_OK},
7237 {"",S_FALSE},
7238 {"",S_FALSE},
7239 {"",S_FALSE},
7240 {"",S_FALSE},
7241 {"",S_FALSE},
7242 {"/c:/test/",S_OK},
7243 {"/c:/test/",S_OK},
7244 {"",S_FALSE},
7245 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7246 {"file",S_OK},
7247 {"",S_FALSE},
7248 {"",S_FALSE}
7251 {Uri_HOST_UNKNOWN,S_OK},
7252 {0,S_FALSE},
7253 {URL_SCHEME_FILE,S_OK},
7254 {URLZONE_INVALID,E_NOTIMPL}
7257 { "http://winehq.org",0,
7258 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7259 0,S_OK,FALSE,
7261 {"mailto:",S_OK},
7262 {"",S_FALSE},
7263 {"mailto:",S_OK},
7264 {"",S_FALSE},
7265 {"",S_FALSE},
7266 {"",S_FALSE},
7267 {"",S_FALSE},
7268 {"",S_FALSE},
7269 {"",S_FALSE},
7270 {"",S_FALSE},
7271 {"",S_FALSE},
7272 {"mailto://",S_OK,FALSE,"mailto:"},
7273 {"mailto",S_OK},
7274 {"",S_FALSE},
7275 {"",S_FALSE}
7278 {Uri_HOST_UNKNOWN,S_OK},
7279 {0,S_FALSE},
7280 {URL_SCHEME_MAILTO,S_OK},
7281 {URLZONE_INVALID,E_NOTIMPL}
7284 { "http://winehq.org",0,
7285 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7286 0,S_OK,FALSE,
7288 {"mailto:a@b.com",S_OK},
7289 {"",S_FALSE},
7290 {"mailto:a@b.com",S_OK},
7291 {"",S_FALSE},
7292 {".com",S_OK},
7293 {"",S_FALSE},
7294 {"",S_FALSE},
7295 {"",S_FALSE},
7296 {"a@b.com",S_OK},
7297 {"a@b.com",S_OK},
7298 {"",S_FALSE},
7299 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7300 {"mailto",S_OK},
7301 {"",S_FALSE},
7302 {"",S_FALSE}
7305 {Uri_HOST_UNKNOWN,S_OK},
7306 {0,S_FALSE},
7307 {URL_SCHEME_MAILTO,S_OK},
7308 {URLZONE_INVALID,E_NOTIMPL}
7313 typedef struct _uri_parse_test {
7314 const char *uri;
7315 DWORD uri_flags;
7316 PARSEACTION action;
7317 DWORD flags;
7318 const char *property;
7319 HRESULT expected;
7320 BOOL todo;
7321 } uri_parse_test;
7323 static const uri_parse_test uri_parse_tests[] = {
7324 /* PARSE_CANONICALIZE tests. */
7325 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7326 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7327 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7328 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7329 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7330 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7331 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7332 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7333 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7334 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7335 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7336 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7338 /* PARSE_FRIENDLY tests. */
7339 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7340 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7342 /* PARSE_ROOTDOCUMENT tests. */
7343 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7344 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7345 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7346 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7347 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7348 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7350 /* PARSE_DOCUMENT tests. */
7351 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7352 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7353 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7354 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7355 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7356 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7358 /* PARSE_PATH_FROM_URL tests. */
7359 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7360 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7361 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7362 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7363 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7365 /* PARSE_URL_FROM_PATH tests. */
7366 /* This function almost seems to useless (just returns the absolute uri). */
7367 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7368 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7369 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7370 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7371 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7373 /* PARSE_SCHEMA tests. */
7374 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7375 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7377 /* PARSE_SITE tests. */
7378 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7379 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7380 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7381 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7383 /* PARSE_DOMAIN tests. */
7384 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7385 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7386 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7387 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7389 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7390 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7391 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7392 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7393 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7396 static inline LPWSTR a2w(LPCSTR str) {
7397 LPWSTR ret = NULL;
7399 if(str) {
7400 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7401 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7402 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7405 return ret;
7408 static inline void *heap_alloc(size_t len)
7410 return HeapAlloc(GetProcessHeap(), 0, len);
7413 static inline BOOL heap_free(void* mem) {
7414 return HeapFree(GetProcessHeap(), 0, mem);
7417 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7418 LPWSTR strAW = a2w(strA);
7419 DWORD ret = lstrcmpW(strAW, strB);
7420 heap_free(strAW);
7421 return ret;
7424 static inline ULONG get_refcnt(IUri *uri) {
7425 IUri_AddRef(uri);
7426 return IUri_Release(uri);
7429 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7430 DWORD test_index) {
7431 HRESULT hr;
7432 LPWSTR valueW;
7434 valueW = a2w(prop->value);
7435 switch(prop->property) {
7436 case Uri_PROPERTY_FRAGMENT:
7437 hr = IUriBuilder_SetFragment(builder, valueW);
7438 todo_wine_if(prop->todo) {
7439 ok(hr == prop->expected,
7440 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7441 hr, prop->expected, test_index);
7443 break;
7444 case Uri_PROPERTY_HOST:
7445 hr = IUriBuilder_SetHost(builder, valueW);
7446 todo_wine_if(prop->todo) {
7447 ok(hr == prop->expected,
7448 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7449 hr, prop->expected, test_index);
7451 break;
7452 case Uri_PROPERTY_PASSWORD:
7453 hr = IUriBuilder_SetPassword(builder, valueW);
7454 todo_wine_if(prop->todo) {
7455 ok(hr == prop->expected,
7456 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7457 hr, prop->expected, test_index);
7459 break;
7460 case Uri_PROPERTY_PATH:
7461 hr = IUriBuilder_SetPath(builder, valueW);
7462 todo_wine_if(prop->todo) {
7463 ok(hr == prop->expected,
7464 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7465 hr, prop->expected, test_index);
7467 break;
7468 case Uri_PROPERTY_QUERY:
7469 hr = IUriBuilder_SetQuery(builder, valueW);
7470 todo_wine_if(prop->todo) {
7471 ok(hr == prop->expected,
7472 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7473 hr, prop->expected, test_index);
7475 break;
7476 case Uri_PROPERTY_SCHEME_NAME:
7477 hr = IUriBuilder_SetSchemeName(builder, valueW);
7478 todo_wine_if(prop->todo) {
7479 ok(hr == prop->expected,
7480 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7481 hr, prop->expected, test_index);
7483 break;
7484 case Uri_PROPERTY_USER_NAME:
7485 hr = IUriBuilder_SetUserName(builder, valueW);
7486 todo_wine_if(prop->todo) {
7487 ok(hr == prop->expected,
7488 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7489 hr, prop->expected, test_index);
7491 break;
7492 default:
7493 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7496 heap_free(valueW);
7500 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7501 * correctly.
7503 static void test_CreateUri_InvalidFlags(void) {
7504 DWORD i;
7506 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7507 HRESULT hr;
7508 IUri *uri = (void*) 0xdeadbeef;
7510 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7511 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7512 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7513 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7517 static void test_CreateUri_InvalidArgs(void) {
7518 HRESULT hr;
7519 IUri *uri = (void*) 0xdeadbeef;
7521 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7522 static const WCHAR emptyW[] = {0};
7524 hr = pCreateUri(http_urlW, 0, 0, NULL);
7525 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7527 hr = pCreateUri(NULL, 0, 0, &uri);
7528 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7529 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7531 uri = (void*) 0xdeadbeef;
7532 hr = pCreateUri(invalidW, 0, 0, &uri);
7533 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7534 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7536 uri = (void*) 0xdeadbeef;
7537 hr = pCreateUri(emptyW, 0, 0, &uri);
7538 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7539 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7542 static void test_CreateUri_InvalidUri(void) {
7543 DWORD i;
7545 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7546 invalid_uri test = invalid_uri_tests[i];
7547 IUri *uri = NULL;
7548 LPWSTR uriW;
7549 HRESULT hr;
7551 uriW = a2w(test.uri);
7552 hr = pCreateUri(uriW, test.flags, 0, &uri);
7553 todo_wine_if(test.todo)
7554 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7555 hr, E_INVALIDARG, i);
7556 if(uri) IUri_Release(uri);
7558 heap_free(uriW);
7562 static void test_IUri_GetPropertyBSTR(void) {
7563 IUri *uri = NULL;
7564 HRESULT hr;
7565 DWORD i;
7567 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7568 hr = pCreateUri(http_urlW, 0, 0, &uri);
7569 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7570 if(SUCCEEDED(hr)) {
7571 BSTR received = NULL;
7573 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7574 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7576 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7577 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7578 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7579 if(SUCCEEDED(hr)) {
7580 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7581 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7582 SysFreeString(received);
7583 }else {
7584 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7587 /* Make sure it handles the ZONE property correctly. */
7588 received = NULL;
7589 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7590 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7591 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7592 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7593 SysFreeString(received);
7595 if(uri) IUri_Release(uri);
7597 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7598 uri_properties test = uri_tests[i];
7599 LPWSTR uriW;
7600 uri = NULL;
7602 uriW = a2w(test.uri);
7603 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7604 todo_wine_if(test.create_todo)
7605 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7606 hr, test.create_expected, i);
7608 if(SUCCEEDED(hr)) {
7609 DWORD j;
7611 /* Checks all the string properties of the uri. */
7612 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7613 BSTR received = NULL;
7614 uri_str_property prop = test.str_props[j];
7616 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7617 todo_wine_if(prop.todo) {
7618 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7619 hr, prop.expected, i, j);
7620 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7621 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7622 prop.value, wine_dbgstr_w(received), i, j);
7625 SysFreeString(received);
7629 if(uri) IUri_Release(uri);
7631 heap_free(uriW);
7635 static void test_IUri_GetPropertyDWORD(void) {
7636 IUri *uri = NULL;
7637 HRESULT hr;
7638 DWORD i;
7640 hr = pCreateUri(http_urlW, 0, 0, &uri);
7641 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7642 if(SUCCEEDED(hr)) {
7643 DWORD received = 0xdeadbeef;
7645 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7646 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7648 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7649 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7650 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7652 if(uri) IUri_Release(uri);
7654 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7655 uri_properties test = uri_tests[i];
7656 LPWSTR uriW;
7657 uri = NULL;
7659 uriW = a2w(test.uri);
7660 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7661 todo_wine_if(test.create_todo)
7662 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7663 hr, test.create_expected, i);
7665 if(SUCCEEDED(hr)) {
7666 DWORD j;
7668 /* Checks all the DWORD properties of the uri. */
7669 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7670 DWORD received;
7671 uri_dword_property prop = test.dword_props[j];
7673 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7674 todo_wine_if(prop.todo) {
7675 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7676 hr, prop.expected, i, j);
7677 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7678 prop.value, received, i, j);
7683 if(uri) IUri_Release(uri);
7685 heap_free(uriW);
7689 /* Tests all the 'Get*' property functions which deal with strings. */
7690 static void test_IUri_GetStrProperties(void) {
7691 IUri *uri = NULL;
7692 HRESULT hr;
7693 DWORD i;
7695 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7696 hr = pCreateUri(http_urlW, 0, 0, &uri);
7697 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7698 if(SUCCEEDED(hr)) {
7699 hr = IUri_GetAbsoluteUri(uri, NULL);
7700 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7702 hr = IUri_GetAuthority(uri, NULL);
7703 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7705 hr = IUri_GetDisplayUri(uri, NULL);
7706 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7708 hr = IUri_GetDomain(uri, NULL);
7709 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7711 hr = IUri_GetExtension(uri, NULL);
7712 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7714 hr = IUri_GetFragment(uri, NULL);
7715 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7717 hr = IUri_GetHost(uri, NULL);
7718 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7720 hr = IUri_GetPassword(uri, NULL);
7721 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7723 hr = IUri_GetPath(uri, NULL);
7724 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7726 hr = IUri_GetPathAndQuery(uri, NULL);
7727 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7729 hr = IUri_GetQuery(uri, NULL);
7730 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7732 hr = IUri_GetRawUri(uri, NULL);
7733 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7735 hr = IUri_GetSchemeName(uri, NULL);
7736 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7738 hr = IUri_GetUserInfo(uri, NULL);
7739 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7741 hr = IUri_GetUserName(uri, NULL);
7742 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7744 if(uri) IUri_Release(uri);
7746 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7747 uri_properties test = uri_tests[i];
7748 LPWSTR uriW;
7749 uri = NULL;
7751 uriW = a2w(test.uri);
7752 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7753 todo_wine_if(test.create_todo)
7754 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7755 hr, test.create_expected, i);
7757 if(SUCCEEDED(hr)) {
7758 uri_str_property prop;
7759 BSTR received = NULL;
7761 /* GetAbsoluteUri() tests. */
7762 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7763 hr = IUri_GetAbsoluteUri(uri, &received);
7764 todo_wine_if(prop.todo) {
7765 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7766 hr, prop.expected, i);
7767 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7768 "Error: Expected %s but got %s on uri_tests[%d].\n",
7769 prop.value, wine_dbgstr_w(received), i);
7771 SysFreeString(received);
7772 received = NULL;
7774 /* GetAuthority() tests. */
7775 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7776 hr = IUri_GetAuthority(uri, &received);
7777 todo_wine_if(prop.todo) {
7778 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7779 hr, prop.expected, i);
7780 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7781 prop.value, wine_dbgstr_w(received), i);
7783 SysFreeString(received);
7784 received = NULL;
7786 /* GetDisplayUri() tests. */
7787 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7788 hr = IUri_GetDisplayUri(uri, &received);
7789 todo_wine_if(prop.todo) {
7790 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7791 hr, prop.expected, i);
7792 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7793 "Error: Expected %s but got %s on uri_tests[%d].\n",
7794 prop.value, wine_dbgstr_w(received), i);
7796 SysFreeString(received);
7797 received = NULL;
7799 /* GetDomain() tests. */
7800 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7801 hr = IUri_GetDomain(uri, &received);
7802 todo_wine_if(prop.todo) {
7803 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7804 hr, prop.expected, i);
7805 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7806 prop.value, wine_dbgstr_w(received), i);
7808 SysFreeString(received);
7809 received = NULL;
7811 /* GetExtension() tests. */
7812 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7813 hr = IUri_GetExtension(uri, &received);
7814 todo_wine_if(prop.todo) {
7815 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7816 hr, prop.expected, i);
7817 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7818 prop.value, wine_dbgstr_w(received), i);
7820 SysFreeString(received);
7821 received = NULL;
7823 /* GetFragment() tests. */
7824 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7825 hr = IUri_GetFragment(uri, &received);
7826 todo_wine_if(prop.todo) {
7827 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7828 hr, prop.expected, i);
7829 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7830 prop.value, wine_dbgstr_w(received), i);
7832 SysFreeString(received);
7833 received = NULL;
7835 /* GetHost() tests. */
7836 prop = test.str_props[Uri_PROPERTY_HOST];
7837 hr = IUri_GetHost(uri, &received);
7838 todo_wine_if(prop.todo) {
7839 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7840 hr, prop.expected, i);
7841 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7842 prop.value, wine_dbgstr_w(received), i);
7844 SysFreeString(received);
7845 received = NULL;
7847 /* GetPassword() tests. */
7848 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7849 hr = IUri_GetPassword(uri, &received);
7850 todo_wine_if(prop.todo) {
7851 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7852 hr, prop.expected, i);
7853 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7854 prop.value, wine_dbgstr_w(received), i);
7856 SysFreeString(received);
7857 received = NULL;
7859 /* GetPath() tests. */
7860 prop = test.str_props[Uri_PROPERTY_PATH];
7861 hr = IUri_GetPath(uri, &received);
7862 todo_wine_if(prop.todo) {
7863 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7864 hr, prop.expected, i);
7865 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7866 prop.value, wine_dbgstr_w(received), i);
7868 SysFreeString(received);
7869 received = NULL;
7871 /* GetPathAndQuery() tests. */
7872 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7873 hr = IUri_GetPathAndQuery(uri, &received);
7874 todo_wine_if(prop.todo) {
7875 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7876 hr, prop.expected, i);
7877 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7878 prop.value, wine_dbgstr_w(received), i);
7880 SysFreeString(received);
7881 received = NULL;
7883 /* GetQuery() tests. */
7884 prop = test.str_props[Uri_PROPERTY_QUERY];
7885 hr = IUri_GetQuery(uri, &received);
7886 todo_wine_if(prop.todo) {
7887 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7888 hr, prop.expected, i);
7889 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7890 prop.value, wine_dbgstr_w(received), i);
7892 SysFreeString(received);
7893 received = NULL;
7895 /* GetRawUri() tests. */
7896 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7897 hr = IUri_GetRawUri(uri, &received);
7898 todo_wine_if(prop.todo) {
7899 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7900 hr, prop.expected, i);
7901 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7902 prop.value, wine_dbgstr_w(received), i);
7904 SysFreeString(received);
7905 received = NULL;
7907 /* GetSchemeName() tests. */
7908 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7909 hr = IUri_GetSchemeName(uri, &received);
7910 todo_wine_if(prop.todo) {
7911 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7912 hr, prop.expected, i);
7913 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7914 prop.value, wine_dbgstr_w(received), i);
7916 SysFreeString(received);
7917 received = NULL;
7919 /* GetUserInfo() tests. */
7920 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7921 hr = IUri_GetUserInfo(uri, &received);
7922 todo_wine_if(prop.todo) {
7923 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7924 hr, prop.expected, i);
7925 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7926 prop.value, wine_dbgstr_w(received), i);
7928 SysFreeString(received);
7929 received = NULL;
7931 /* GetUserName() tests. */
7932 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7933 hr = IUri_GetUserName(uri, &received);
7934 todo_wine_if(prop.todo) {
7935 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7936 hr, prop.expected, i);
7937 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7938 prop.value, wine_dbgstr_w(received), i);
7940 SysFreeString(received);
7943 if(uri) IUri_Release(uri);
7945 heap_free(uriW);
7949 static void test_IUri_GetDwordProperties(void) {
7950 IUri *uri = NULL;
7951 HRESULT hr;
7952 DWORD i;
7954 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7955 hr = pCreateUri(http_urlW, 0, 0, &uri);
7956 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7957 if(SUCCEEDED(hr)) {
7958 hr = IUri_GetHostType(uri, NULL);
7959 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7961 hr = IUri_GetPort(uri, NULL);
7962 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7964 hr = IUri_GetScheme(uri, NULL);
7965 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7967 hr = IUri_GetZone(uri, NULL);
7968 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7970 if(uri) IUri_Release(uri);
7972 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7973 uri_properties test = uri_tests[i];
7974 LPWSTR uriW;
7975 uri = NULL;
7977 uriW = a2w(test.uri);
7978 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7979 todo_wine_if(test.create_todo)
7980 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7981 hr, test.create_expected, i);
7983 if(SUCCEEDED(hr)) {
7984 uri_dword_property prop;
7985 DWORD received;
7987 /* Assign an insane value so tests don't accidentally pass when
7988 * they shouldn't!
7990 received = -9999999;
7992 /* GetHostType() tests. */
7993 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7994 hr = IUri_GetHostType(uri, &received);
7995 todo_wine_if(prop.todo) {
7996 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7997 hr, prop.expected, i);
7998 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8000 received = -9999999;
8002 /* GetPort() tests. */
8003 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8004 hr = IUri_GetPort(uri, &received);
8005 todo_wine_if(prop.todo) {
8006 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8007 hr, prop.expected, i);
8008 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8010 received = -9999999;
8012 /* GetScheme() tests. */
8013 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8014 hr = IUri_GetScheme(uri, &received);
8015 todo_wine_if(prop.todo) {
8016 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8017 hr, prop.expected, i);
8018 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8020 received = -9999999;
8022 /* GetZone() tests. */
8023 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8024 hr = IUri_GetZone(uri, &received);
8025 todo_wine_if(prop.todo) {
8026 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8027 hr, prop.expected, i);
8028 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8032 if(uri) IUri_Release(uri);
8034 heap_free(uriW);
8038 static void test_IUri_GetPropertyLength(void) {
8039 IUri *uri = NULL;
8040 HRESULT hr;
8041 DWORD i;
8043 /* Make sure it handles invalid args correctly. */
8044 hr = pCreateUri(http_urlW, 0, 0, &uri);
8045 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8046 if(SUCCEEDED(hr)) {
8047 DWORD received = 0xdeadbeef;
8049 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8050 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8052 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8053 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8054 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8056 if(uri) IUri_Release(uri);
8058 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8059 uri_properties test = uri_tests[i];
8060 LPWSTR uriW;
8061 uri = NULL;
8063 uriW = a2w(test.uri);
8064 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8065 todo_wine_if(test.create_todo)
8066 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8067 hr, test.create_expected, i);
8069 if(SUCCEEDED(hr)) {
8070 DWORD j;
8072 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8073 DWORD expectedLen, receivedLen;
8074 uri_str_property prop = test.str_props[j];
8076 expectedLen = lstrlenA(prop.value);
8078 /* This won't be necessary once GetPropertyLength is implemented. */
8079 receivedLen = -1;
8081 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8082 todo_wine_if(prop.todo) {
8083 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8084 hr, prop.expected, i, j);
8085 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8086 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8087 expectedLen, receivedLen, i, j);
8092 if(uri) IUri_Release(uri);
8094 heap_free(uriW);
8098 static DWORD compute_expected_props(uri_properties *test)
8100 DWORD ret = 0, i;
8102 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8103 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8104 ret |= 1<<i;
8107 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8108 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8109 ret |= 1<<i;
8112 return ret;
8115 static void test_IUri_GetProperties(void) {
8116 IUri *uri = NULL;
8117 HRESULT hr;
8118 DWORD i;
8120 hr = pCreateUri(http_urlW, 0, 0, &uri);
8121 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8122 if(SUCCEEDED(hr)) {
8123 hr = IUri_GetProperties(uri, NULL);
8124 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8126 if(uri) IUri_Release(uri);
8128 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8129 uri_properties test = uri_tests[i];
8130 LPWSTR uriW;
8131 uri = NULL;
8133 uriW = a2w(test.uri);
8134 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8135 todo_wine_if(test.create_todo)
8136 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8138 if(SUCCEEDED(hr)) {
8139 DWORD received = 0, expected_props;
8140 DWORD j;
8142 hr = IUri_GetProperties(uri, &received);
8143 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8145 expected_props = compute_expected_props(&test);
8147 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8148 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8149 if(expected_props & (1 << j))
8150 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8151 else
8152 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8156 if(uri) IUri_Release(uri);
8158 heap_free(uriW);
8162 static void test_IUri_HasProperty(void) {
8163 IUri *uri = NULL;
8164 HRESULT hr;
8165 DWORD i;
8167 hr = pCreateUri(http_urlW, 0, 0, &uri);
8168 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8169 if(SUCCEEDED(hr)) {
8170 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8171 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8173 if(uri) IUri_Release(uri);
8175 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8176 uri_properties test = uri_tests[i];
8177 LPWSTR uriW;
8178 uri = NULL;
8180 uriW = a2w(test.uri);
8182 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8183 todo_wine_if(test.create_todo)
8184 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8186 if(SUCCEEDED(hr)) {
8187 DWORD expected_props, j;
8189 expected_props = compute_expected_props(&test);
8191 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8192 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8193 BOOL received = -1;
8195 hr = IUri_HasProperty(uri, j, &received);
8196 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8197 hr, S_OK, j, i);
8199 if(expected_props & (1 << j)) {
8200 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8201 } else {
8202 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8207 if(uri) IUri_Release(uri);
8209 heap_free(uriW);
8213 static void test_IUri_IsEqual(void) {
8214 IUri *uriA, *uriB;
8215 BOOL equal;
8216 HRESULT hres;
8217 DWORD i;
8219 uriA = uriB = NULL;
8221 /* Make sure IsEqual handles invalid args correctly. */
8222 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8223 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8224 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8225 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8227 equal = -1;
8228 hres = IUri_IsEqual(uriA, NULL, &equal);
8229 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8230 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8232 hres = IUri_IsEqual(uriA, uriB, NULL);
8233 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8235 IUri_Release(uriA);
8236 IUri_Release(uriB);
8238 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8239 uri_equality test = equality_tests[i];
8240 LPWSTR uriA_W, uriB_W;
8242 uriA = uriB = NULL;
8244 uriA_W = a2w(test.a);
8245 uriB_W = a2w(test.b);
8247 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8248 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8250 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8251 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8253 equal = -1;
8254 hres = IUri_IsEqual(uriA, uriB, &equal);
8255 todo_wine_if(test.todo) {
8256 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8257 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8259 if(uriA) IUri_Release(uriA);
8260 if(uriB) IUri_Release(uriB);
8262 heap_free(uriA_W);
8263 heap_free(uriB_W);
8267 static void test_CreateUriWithFragment_InvalidArgs(void) {
8268 HRESULT hr;
8269 IUri *uri = (void*) 0xdeadbeef;
8270 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8272 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8273 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8274 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8276 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8277 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8279 /* Original URI can't already contain a fragment component. */
8280 uri = (void*) 0xdeadbeef;
8281 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8282 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8283 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8286 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8287 static void test_CreateUriWithFragment_InvalidFlags(void) {
8288 DWORD i;
8290 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8291 HRESULT hr;
8292 IUri *uri = (void*) 0xdeadbeef;
8294 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8295 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8296 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8297 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8301 static void test_CreateUriWithFragment(void) {
8302 DWORD i;
8304 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8305 HRESULT hr;
8306 IUri *uri = NULL;
8307 LPWSTR uriW, fragW;
8308 uri_with_fragment test = uri_fragment_tests[i];
8310 uriW = a2w(test.uri);
8311 fragW = a2w(test.fragment);
8313 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8314 todo_wine_if(test.expected_todo)
8315 ok(hr == test.create_expected,
8316 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8317 hr, test.create_expected, i);
8319 if(SUCCEEDED(hr)) {
8320 BSTR received = NULL;
8322 hr = IUri_GetAbsoluteUri(uri, &received);
8323 todo_wine_if(test.expected_todo) {
8324 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8325 hr, S_OK, i);
8326 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8327 test.expected_uri, wine_dbgstr_w(received), i);
8330 SysFreeString(received);
8333 if(uri) IUri_Release(uri);
8334 heap_free(uriW);
8335 heap_free(fragW);
8339 static void test_CreateIUriBuilder(void) {
8340 HRESULT hr;
8341 IUriBuilder *builder = NULL;
8342 IUri *uri;
8344 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8345 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8346 hr, E_POINTER);
8348 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8349 hr = pCreateUri(http_urlW, 0, 0, &uri);
8350 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8351 if(SUCCEEDED(hr)) {
8352 ULONG cur_count, orig_count;
8354 orig_count = get_refcnt(uri);
8355 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8356 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8357 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8359 cur_count = get_refcnt(uri);
8360 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8362 if(builder) IUriBuilder_Release(builder);
8363 cur_count = get_refcnt(uri);
8364 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8366 if(uri) IUri_Release(uri);
8369 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8370 DWORD test_index) {
8371 HRESULT hr;
8372 IUri *uri = NULL;
8374 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8375 todo_wine_if(test->uri_todo)
8376 ok(hr == test->uri_hres,
8377 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8378 hr, test->uri_hres, test_index);
8380 if(SUCCEEDED(hr)) {
8381 DWORD i;
8383 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8384 uri_builder_str_property prop = test->expected_str_props[i];
8385 BSTR received = NULL;
8387 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8388 todo_wine_if(prop.todo)
8389 ok(hr == prop.result,
8390 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8391 hr, prop.result, test_index, i);
8392 if(SUCCEEDED(hr)) {
8393 todo_wine_if(prop.todo)
8394 ok(!strcmp_aw(prop.expected, received),
8395 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8396 prop.expected, wine_dbgstr_w(received), test_index, i);
8398 SysFreeString(received);
8401 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8402 uri_builder_dword_property prop = test->expected_dword_props[i];
8403 DWORD received = -2;
8405 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8406 todo_wine_if(prop.todo)
8407 ok(hr == prop.result,
8408 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8409 hr, prop.result, test_index, i);
8410 if(SUCCEEDED(hr)) {
8411 todo_wine_if(prop.todo)
8412 ok(received == prop.expected,
8413 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8414 prop.expected, received, test_index, i);
8418 if(uri) IUri_Release(uri);
8421 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8422 DWORD test_index) {
8423 HRESULT hr;
8424 IUri *uri = NULL;
8426 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8427 todo_wine_if(test->uri_simple_todo)
8428 ok(hr == test->uri_simple_hres,
8429 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8430 hr, test->uri_simple_hres, test_index);
8432 if(SUCCEEDED(hr)) {
8433 DWORD i;
8435 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8436 uri_builder_str_property prop = test->expected_str_props[i];
8437 BSTR received = NULL;
8439 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8440 todo_wine_if(prop.todo)
8441 ok(hr == prop.result,
8442 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8443 hr, prop.result, test_index, i);
8444 if(SUCCEEDED(hr)) {
8445 todo_wine_if(prop.todo)
8446 ok(!strcmp_aw(prop.expected, received),
8447 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8448 prop.expected, wine_dbgstr_w(received), test_index, i);
8450 SysFreeString(received);
8453 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8454 uri_builder_dword_property prop = test->expected_dword_props[i];
8455 DWORD received = -2;
8457 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8458 todo_wine_if(prop.todo)
8459 ok(hr == prop.result,
8460 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8461 hr, prop.result, test_index, i);
8462 if(SUCCEEDED(hr)) {
8463 todo_wine_if(prop.todo)
8464 ok(received == prop.expected,
8465 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8466 prop.expected, received, test_index, i);
8470 if(uri) IUri_Release(uri);
8473 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8474 DWORD test_index) {
8475 HRESULT hr;
8476 IUri *uri = NULL;
8478 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8479 test->uri_with_encode_flags, 0, &uri);
8480 todo_wine_if(test->uri_with_todo)
8481 ok(hr == test->uri_with_hres,
8482 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8483 hr, test->uri_with_hres, test_index);
8485 if(SUCCEEDED(hr)) {
8486 DWORD i;
8488 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8489 uri_builder_str_property prop = test->expected_str_props[i];
8490 BSTR received = NULL;
8492 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8493 todo_wine_if(prop.todo)
8494 ok(hr == prop.result,
8495 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8496 hr, prop.result, test_index, i);
8497 if(SUCCEEDED(hr)) {
8498 todo_wine_if(prop.todo)
8499 ok(!strcmp_aw(prop.expected, received),
8500 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8501 prop.expected, wine_dbgstr_w(received), test_index, i);
8503 SysFreeString(received);
8506 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8507 uri_builder_dword_property prop = test->expected_dword_props[i];
8508 DWORD received = -2;
8510 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8511 todo_wine_if(prop.todo)
8512 ok(hr == prop.result,
8513 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8514 hr, prop.result, test_index, i);
8515 if(SUCCEEDED(hr)) {
8516 todo_wine_if(prop.todo)
8517 ok(received == prop.expected,
8518 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8519 prop.expected, received, test_index, i);
8523 if(uri) IUri_Release(uri);
8526 static void test_IUriBuilder_CreateInvalidArgs(void) {
8527 IUriBuilder *builder;
8528 HRESULT hr;
8530 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8531 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8532 if(SUCCEEDED(hr)) {
8533 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8535 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8536 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8537 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8539 uri = (void*) 0xdeadbeef;
8540 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8541 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8542 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8544 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8545 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8546 hr, E_POINTER);
8548 uri = (void*) 0xdeadbeef;
8549 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8550 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8551 hr, E_NOTIMPL);
8552 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8554 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8555 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8556 hr, E_POINTER);
8558 uri = (void*) 0xdeadbeef;
8559 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8560 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8561 hr, E_NOTIMPL);
8562 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8564 hr = pCreateUri(http_urlW, 0, 0, &test);
8565 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8566 if(SUCCEEDED(hr)) {
8567 hr = IUriBuilder_SetIUri(builder, test);
8568 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8570 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8571 uri = NULL;
8572 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8573 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8574 ok(uri != NULL, "Error: The uri was NULL.\n");
8575 if(uri) IUri_Release(uri);
8577 uri = NULL;
8578 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8579 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8580 hr, S_OK);
8581 ok(uri != NULL, "Error: uri was NULL.\n");
8582 if(uri) IUri_Release(uri);
8584 uri = NULL;
8585 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8586 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8587 hr, S_OK);
8588 ok(uri != NULL, "Error: uri was NULL.\n");
8589 if(uri) IUri_Release(uri);
8591 hr = IUriBuilder_SetFragment(builder, NULL);
8592 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8594 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8595 uri = (void*) 0xdeadbeef;
8596 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8597 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8598 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8600 uri = (void*) 0xdeadbeef;
8601 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8602 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8603 hr, S_OK);
8604 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8606 uri = (void*) 0xdeadbeef;
8607 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8608 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8609 hr, E_NOTIMPL);
8610 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8612 if(test) IUri_Release(test);
8614 if(builder) IUriBuilder_Release(builder);
8617 /* Tests invalid args to the "Get*" functions. */
8618 static void test_IUriBuilder_GetInvalidArgs(void) {
8619 IUriBuilder *builder = NULL;
8620 HRESULT hr;
8622 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8623 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8624 if(SUCCEEDED(hr)) {
8625 LPCWSTR received = (void*) 0xdeadbeef;
8626 DWORD len = -1, port = -1;
8627 BOOL set = -1;
8629 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8630 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8631 hr, E_POINTER);
8632 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8633 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8634 hr, E_POINTER);
8635 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8636 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8637 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8638 hr, E_POINTER);
8639 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8641 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8642 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8643 hr, E_POINTER);
8644 received = (void*) 0xdeadbeef;
8645 hr = IUriBuilder_GetHost(builder, NULL, &received);
8646 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8647 hr, E_POINTER);
8648 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8649 len = -1;
8650 hr = IUriBuilder_GetHost(builder, &len, NULL);
8651 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8652 hr, E_POINTER);
8653 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8655 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8656 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8657 hr, E_POINTER);
8658 received = (void*) 0xdeadbeef;
8659 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8660 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8661 hr, E_POINTER);
8662 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8663 len = -1;
8664 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8665 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8666 hr, E_POINTER);
8667 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8669 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8670 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8671 hr, E_POINTER);
8672 received = (void*) 0xdeadbeef;
8673 hr = IUriBuilder_GetPath(builder, NULL, &received);
8674 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8675 hr, E_POINTER);
8676 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8677 len = -1;
8678 hr = IUriBuilder_GetPath(builder, &len, NULL);
8679 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8680 hr, E_POINTER);
8681 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8683 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8684 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8685 hr, E_POINTER);
8686 hr = IUriBuilder_GetPort(builder, NULL, &port);
8687 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8688 hr, E_POINTER);
8689 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8690 hr = IUriBuilder_GetPort(builder, &set, NULL);
8691 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8692 hr, E_POINTER);
8693 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8695 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8696 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8697 hr, E_POINTER);
8698 received = (void*) 0xdeadbeef;
8699 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8700 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8701 hr, E_POINTER);
8702 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8703 len = -1;
8704 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8705 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8706 hr, E_POINTER);
8707 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8709 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8710 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8711 hr, E_POINTER);
8712 received = (void*) 0xdeadbeef;
8713 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8714 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8715 hr, E_POINTER);
8716 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8717 len = -1;
8718 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8719 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8720 hr, E_POINTER);
8721 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8723 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8724 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8725 hr, E_POINTER);
8726 received = (void*) 0xdeadbeef;
8727 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8728 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8729 hr, E_POINTER);
8730 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8731 len = -1;
8732 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8733 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8734 hr, E_POINTER);
8735 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8737 if(builder) IUriBuilder_Release(builder);
8740 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8741 DWORD test_index) {
8742 HRESULT hr;
8743 DWORD i;
8744 LPCWSTR received = NULL;
8745 DWORD len = -1;
8746 const uri_builder_property *prop = NULL;
8748 /* Check if the property was set earlier. */
8749 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8750 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8751 prop = &(test->properties[i]);
8754 if(prop) {
8755 /* Use expected_value unless it's NULL, then use value. */
8756 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8757 DWORD expected_len = expected ? strlen(expected) : 0;
8758 hr = IUriBuilder_GetFragment(builder, &len, &received);
8759 todo_wine_if(prop->todo) {
8760 ok(hr == (expected ? S_OK : S_FALSE),
8761 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8762 hr, (expected ? S_OK : S_FALSE), test_index);
8763 if(SUCCEEDED(hr)) {
8764 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8765 expected, wine_dbgstr_w(received), test_index);
8766 ok(expected_len == len,
8767 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8768 expected_len, len, test_index);
8771 } else {
8772 /* The property wasn't set earlier, so it should return whatever
8773 * the base IUri contains (if anything).
8775 IUri *uri = NULL;
8776 hr = IUriBuilder_GetIUri(builder, &uri);
8777 ok(hr == S_OK,
8778 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8779 hr, S_OK, test_index);
8780 if(SUCCEEDED(hr)) {
8781 if(!uri) {
8782 received = (void*) 0xdeadbeef;
8783 len = -1;
8785 hr = IUriBuilder_GetFragment(builder, &len, &received);
8786 ok(hr == S_FALSE,
8787 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8788 hr, S_FALSE, test_index);
8789 if(SUCCEEDED(hr)) {
8790 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8791 len, test_index);
8792 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8793 received, test_index);
8795 } else {
8796 BOOL has_prop = FALSE;
8797 BSTR expected = NULL;
8799 hr = IUri_GetFragment(uri, &expected);
8800 ok(SUCCEEDED(hr),
8801 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8802 hr, test_index);
8803 has_prop = hr == S_OK;
8805 hr = IUriBuilder_GetFragment(builder, &len, &received);
8806 if(has_prop) {
8807 ok(hr == S_OK,
8808 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8809 hr, S_OK, test_index);
8810 if(SUCCEEDED(hr)) {
8811 ok(!lstrcmpW(expected, received),
8812 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8813 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8814 ok(lstrlenW(expected) == len,
8815 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8816 lstrlenW(expected), len, test_index);
8818 } else {
8819 ok(hr == S_FALSE,
8820 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8821 hr, S_FALSE, test_index);
8822 if(SUCCEEDED(hr)) {
8823 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8824 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8825 len, test_index);
8828 SysFreeString(expected);
8831 if(uri) IUri_Release(uri);
8835 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8836 DWORD test_index) {
8837 HRESULT hr;
8838 DWORD i;
8839 LPCWSTR received = NULL;
8840 DWORD len = -1;
8841 const uri_builder_property *prop = NULL;
8843 /* Check if the property was set earlier. */
8844 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8845 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8846 prop = &(test->properties[i]);
8849 if(prop) {
8850 /* Use expected_value unless it's NULL, then use value. */
8851 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8852 DWORD expected_len = expected ? strlen(expected) : 0;
8853 hr = IUriBuilder_GetHost(builder, &len, &received);
8854 todo_wine_if(prop->todo) {
8855 ok(hr == (expected ? S_OK : S_FALSE),
8856 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8857 hr, (expected ? S_OK : S_FALSE), test_index);
8858 if(SUCCEEDED(hr)) {
8859 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8860 expected, wine_dbgstr_w(received), test_index);
8861 ok(expected_len == len,
8862 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8863 expected_len, len, test_index);
8866 } else {
8867 /* The property wasn't set earlier, so it should return whatever
8868 * the base IUri contains (if anything).
8870 IUri *uri = NULL;
8871 hr = IUriBuilder_GetIUri(builder, &uri);
8872 ok(hr == S_OK,
8873 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8874 hr, S_OK, test_index);
8875 if(SUCCEEDED(hr)) {
8876 if(!uri) {
8877 received = (void*) 0xdeadbeef;
8878 len = -1;
8880 hr = IUriBuilder_GetHost(builder, &len, &received);
8881 ok(hr == S_FALSE,
8882 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8883 hr, S_FALSE, test_index);
8884 if(SUCCEEDED(hr)) {
8885 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8886 len, test_index);
8887 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8888 received, test_index);
8890 } else {
8891 BOOL has_prop = FALSE;
8892 BSTR expected = NULL;
8894 hr = IUri_GetHost(uri, &expected);
8895 ok(SUCCEEDED(hr),
8896 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8897 hr, test_index);
8898 has_prop = hr == S_OK;
8900 hr = IUriBuilder_GetHost(builder, &len, &received);
8901 if(has_prop) {
8902 ok(hr == S_OK,
8903 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8904 hr, S_OK, test_index);
8905 if(SUCCEEDED(hr)) {
8906 ok(!lstrcmpW(expected, received),
8907 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8908 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8909 ok(lstrlenW(expected) == len,
8910 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8911 lstrlenW(expected), len, test_index);
8913 } else {
8914 ok(hr == S_FALSE,
8915 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8916 hr, S_FALSE, test_index);
8917 if(SUCCEEDED(hr)) {
8918 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8919 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8920 len, test_index);
8923 SysFreeString(expected);
8926 if(uri) IUri_Release(uri);
8930 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8931 DWORD test_index) {
8932 HRESULT hr;
8933 DWORD i;
8934 LPCWSTR received = NULL;
8935 DWORD len = -1;
8936 const uri_builder_property *prop = NULL;
8938 /* Check if the property was set earlier. */
8939 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8940 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8941 prop = &(test->properties[i]);
8944 if(prop) {
8945 /* Use expected_value unless it's NULL, then use value. */
8946 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8947 DWORD expected_len = expected ? strlen(expected) : 0;
8948 hr = IUriBuilder_GetPassword(builder, &len, &received);
8949 todo_wine_if(prop->todo) {
8950 ok(hr == (expected ? S_OK : S_FALSE),
8951 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8952 hr, (expected ? S_OK : S_FALSE), test_index);
8953 if(SUCCEEDED(hr)) {
8954 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8955 expected, wine_dbgstr_w(received), test_index);
8956 ok(expected_len == len,
8957 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8958 expected_len, len, test_index);
8961 } else {
8962 /* The property wasn't set earlier, so it should return whatever
8963 * the base IUri contains (if anything).
8965 IUri *uri = NULL;
8966 hr = IUriBuilder_GetIUri(builder, &uri);
8967 ok(hr == S_OK,
8968 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8969 hr, S_OK, test_index);
8970 if(SUCCEEDED(hr)) {
8971 if(!uri) {
8972 received = (void*) 0xdeadbeef;
8973 len = -1;
8975 hr = IUriBuilder_GetPassword(builder, &len, &received);
8976 ok(hr == S_FALSE,
8977 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8978 hr, S_FALSE, test_index);
8979 if(SUCCEEDED(hr)) {
8980 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8981 len, test_index);
8982 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8983 received, test_index);
8985 } else {
8986 BOOL has_prop = FALSE;
8987 BSTR expected = NULL;
8989 hr = IUri_GetPassword(uri, &expected);
8990 ok(SUCCEEDED(hr),
8991 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8992 hr, test_index);
8993 has_prop = hr == S_OK;
8995 hr = IUriBuilder_GetPassword(builder, &len, &received);
8996 if(has_prop) {
8997 ok(hr == S_OK,
8998 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8999 hr, S_OK, test_index);
9000 if(SUCCEEDED(hr)) {
9001 ok(!lstrcmpW(expected, received),
9002 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9003 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9004 ok(lstrlenW(expected) == len,
9005 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9006 lstrlenW(expected), len, test_index);
9008 } else {
9009 ok(hr == S_FALSE,
9010 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9011 hr, S_FALSE, test_index);
9012 if(SUCCEEDED(hr)) {
9013 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9014 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9015 len, test_index);
9018 SysFreeString(expected);
9021 if(uri) IUri_Release(uri);
9025 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9026 DWORD test_index) {
9027 HRESULT hr;
9028 DWORD i;
9029 LPCWSTR received = NULL;
9030 DWORD len = -1;
9031 const uri_builder_property *prop = NULL;
9033 /* Check if the property was set earlier. */
9034 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9035 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9036 prop = &(test->properties[i]);
9039 if(prop) {
9040 /* Use expected_value unless it's NULL, then use value. */
9041 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9042 DWORD expected_len = expected ? strlen(expected) : 0;
9043 hr = IUriBuilder_GetPath(builder, &len, &received);
9044 todo_wine_if(prop->todo) {
9045 ok(hr == (expected ? S_OK : S_FALSE),
9046 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9047 hr, (expected ? S_OK : S_FALSE), test_index);
9048 if(SUCCEEDED(hr)) {
9049 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9050 expected, wine_dbgstr_w(received), test_index);
9051 ok(expected_len == len,
9052 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9053 expected_len, len, test_index);
9056 } else {
9057 /* The property wasn't set earlier, so it should return whatever
9058 * the base IUri contains (if anything).
9060 IUri *uri = NULL;
9061 hr = IUriBuilder_GetIUri(builder, &uri);
9062 ok(hr == S_OK,
9063 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9064 hr, S_OK, test_index);
9065 if(SUCCEEDED(hr)) {
9066 if(!uri) {
9067 received = (void*) 0xdeadbeef;
9068 len = -1;
9070 hr = IUriBuilder_GetPath(builder, &len, &received);
9071 ok(hr == S_FALSE,
9072 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9073 hr, S_FALSE, test_index);
9074 if(SUCCEEDED(hr)) {
9075 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9076 len, test_index);
9077 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9078 received, test_index);
9080 } else {
9081 BOOL has_prop = FALSE;
9082 BSTR expected = NULL;
9084 hr = IUri_GetPath(uri, &expected);
9085 ok(SUCCEEDED(hr),
9086 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9087 hr, test_index);
9088 has_prop = hr == S_OK;
9090 hr = IUriBuilder_GetPath(builder, &len, &received);
9091 if(has_prop) {
9092 ok(hr == S_OK,
9093 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9094 hr, S_OK, test_index);
9095 if(SUCCEEDED(hr)) {
9096 ok(!lstrcmpW(expected, received),
9097 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9098 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9099 ok(lstrlenW(expected) == len,
9100 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9101 lstrlenW(expected), len, test_index);
9103 } else {
9104 ok(hr == S_FALSE,
9105 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9106 hr, S_FALSE, test_index);
9107 if(SUCCEEDED(hr)) {
9108 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9109 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9110 len, test_index);
9113 SysFreeString(expected);
9116 if(uri) IUri_Release(uri);
9120 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9121 DWORD test_index) {
9122 HRESULT hr;
9123 BOOL has_port = FALSE;
9124 DWORD received = -1;
9126 if(test->port_prop.change) {
9127 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9128 todo_wine_if(test->port_prop.todo) {
9129 ok(hr == S_OK,
9130 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9131 hr, S_OK, test_index);
9132 if(SUCCEEDED(hr)) {
9133 ok(has_port == test->port_prop.set,
9134 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9135 test->port_prop.set, has_port, test_index);
9136 ok(received == test->port_prop.value,
9137 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9138 test->port_prop.value, received, test_index);
9141 } else {
9142 IUri *uri = NULL;
9144 hr = IUriBuilder_GetIUri(builder, &uri);
9145 ok(hr == S_OK,
9146 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9147 hr, S_OK, test_index);
9148 if(SUCCEEDED(hr)) {
9149 if(!uri) {
9150 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9151 ok(hr == S_OK,
9152 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9153 hr, S_OK, test_index);
9154 if(SUCCEEDED(hr)) {
9155 ok(has_port == FALSE,
9156 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9157 has_port, test_index);
9158 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9159 received, test_index);
9161 } else {
9162 DWORD expected;
9164 hr = IUri_GetPort(uri, &expected);
9165 ok(SUCCEEDED(hr),
9166 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9167 hr, test_index);
9169 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9170 ok(hr == S_OK,
9171 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9172 hr, S_OK, test_index);
9173 if(SUCCEEDED(hr)) {
9174 ok(!has_port,
9175 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9176 test_index);
9177 ok(received == expected,
9178 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9179 expected, received, test_index);
9183 if(uri) IUri_Release(uri);
9187 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9188 DWORD test_index) {
9189 HRESULT hr;
9190 DWORD i;
9191 LPCWSTR received = NULL;
9192 DWORD len = -1;
9193 const uri_builder_property *prop = NULL;
9195 /* Check if the property was set earlier. */
9196 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9197 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9198 prop = &(test->properties[i]);
9201 if(prop) {
9202 /* Use expected_value unless it's NULL, then use value. */
9203 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9204 DWORD expected_len = expected ? strlen(expected) : 0;
9205 hr = IUriBuilder_GetQuery(builder, &len, &received);
9206 todo_wine_if(prop->todo) {
9207 ok(hr == (expected ? S_OK : S_FALSE),
9208 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9209 hr, (expected ? S_OK : S_FALSE), test_index);
9210 if(SUCCEEDED(hr)) {
9211 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9212 expected, wine_dbgstr_w(received), test_index);
9213 ok(expected_len == len,
9214 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9215 expected_len, len, test_index);
9218 } else {
9219 /* The property wasn't set earlier, so it should return whatever
9220 * the base IUri contains (if anything).
9222 IUri *uri = NULL;
9223 hr = IUriBuilder_GetIUri(builder, &uri);
9224 ok(hr == S_OK,
9225 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9226 hr, S_OK, test_index);
9227 if(SUCCEEDED(hr)) {
9228 if(!uri) {
9229 received = (void*) 0xdeadbeef;
9230 len = -1;
9232 hr = IUriBuilder_GetQuery(builder, &len, &received);
9233 ok(hr == S_FALSE,
9234 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9235 hr, S_FALSE, test_index);
9236 if(SUCCEEDED(hr)) {
9237 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9238 len, test_index);
9239 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9240 received, test_index);
9242 } else {
9243 BOOL has_prop = FALSE;
9244 BSTR expected = NULL;
9246 hr = IUri_GetQuery(uri, &expected);
9247 ok(SUCCEEDED(hr),
9248 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9249 hr, test_index);
9250 has_prop = hr == S_OK;
9252 hr = IUriBuilder_GetQuery(builder, &len, &received);
9253 if(has_prop) {
9254 ok(hr == S_OK,
9255 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9256 hr, S_OK, test_index);
9257 if(SUCCEEDED(hr)) {
9258 ok(!lstrcmpW(expected, received),
9259 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9260 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9261 ok(lstrlenW(expected) == len,
9262 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9263 lstrlenW(expected), len, test_index);
9265 } else {
9266 ok(hr == S_FALSE,
9267 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9268 hr, S_FALSE, test_index);
9269 if(SUCCEEDED(hr)) {
9270 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9271 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9272 len, test_index);
9275 SysFreeString(expected);
9278 if(uri) IUri_Release(uri);
9282 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9283 DWORD test_index) {
9284 HRESULT hr;
9285 DWORD i;
9286 LPCWSTR received = NULL;
9287 DWORD len = -1;
9288 const uri_builder_property *prop = NULL;
9290 /* Check if the property was set earlier. */
9291 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9292 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9293 prop = &(test->properties[i]);
9296 if(prop) {
9297 /* Use expected_value unless it's NULL, then use value. */
9298 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9299 DWORD expected_len = expected ? strlen(expected) : 0;
9300 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9301 todo_wine_if(prop->todo) {
9302 ok(hr == (expected ? S_OK : S_FALSE),
9303 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9304 hr, (expected ? S_OK : S_FALSE), test_index);
9305 if(SUCCEEDED(hr)) {
9306 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9307 expected, wine_dbgstr_w(received), test_index);
9308 ok(expected_len == len,
9309 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9310 expected_len, len, test_index);
9313 } else {
9314 /* The property wasn't set earlier, so it should return whatever
9315 * the base IUri contains (if anything).
9317 IUri *uri = NULL;
9318 hr = IUriBuilder_GetIUri(builder, &uri);
9319 ok(hr == S_OK,
9320 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9321 hr, S_OK, test_index);
9322 if(SUCCEEDED(hr)) {
9323 if(!uri) {
9324 received = (void*) 0xdeadbeef;
9325 len = -1;
9327 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9328 ok(hr == S_FALSE,
9329 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9330 hr, S_FALSE, test_index);
9331 if(SUCCEEDED(hr)) {
9332 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9333 len, test_index);
9334 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9335 received, test_index);
9337 } else {
9338 BOOL has_prop = FALSE;
9339 BSTR expected = NULL;
9341 hr = IUri_GetSchemeName(uri, &expected);
9342 ok(SUCCEEDED(hr),
9343 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9344 hr, test_index);
9345 has_prop = hr == S_OK;
9347 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9348 if(has_prop) {
9349 ok(hr == S_OK,
9350 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9351 hr, S_OK, test_index);
9352 if(SUCCEEDED(hr)) {
9353 ok(!lstrcmpW(expected, received),
9354 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9355 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9356 ok(lstrlenW(expected) == len,
9357 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9358 lstrlenW(expected), len, test_index);
9360 } else {
9361 ok(hr == S_FALSE,
9362 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9363 hr, S_FALSE, test_index);
9364 if(SUCCEEDED(hr)) {
9365 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9366 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9367 len, test_index);
9370 SysFreeString(expected);
9373 if(uri) IUri_Release(uri);
9377 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9378 DWORD test_index) {
9379 HRESULT hr;
9380 DWORD i;
9381 LPCWSTR received = NULL;
9382 DWORD len = -1;
9383 const uri_builder_property *prop = NULL;
9385 /* Check if the property was set earlier. */
9386 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9387 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9388 prop = &(test->properties[i]);
9391 if(prop && prop->value && *prop->value) {
9392 /* Use expected_value unless it's NULL, then use value. */
9393 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9394 DWORD expected_len = expected ? strlen(expected) : 0;
9395 hr = IUriBuilder_GetUserName(builder, &len, &received);
9396 todo_wine_if(prop->todo) {
9397 ok(hr == (expected ? S_OK : S_FALSE),
9398 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9399 hr, (expected ? S_OK : S_FALSE), test_index);
9400 if(SUCCEEDED(hr)) {
9401 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9402 expected, wine_dbgstr_w(received), test_index);
9403 ok(expected_len == len,
9404 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9405 expected_len, len, test_index);
9408 } else {
9409 /* The property wasn't set earlier, so it should return whatever
9410 * the base IUri contains (if anything).
9412 IUri *uri = NULL;
9413 hr = IUriBuilder_GetIUri(builder, &uri);
9414 ok(hr == S_OK,
9415 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9416 hr, S_OK, test_index);
9417 if(SUCCEEDED(hr)) {
9418 if(!uri) {
9419 received = (void*) 0xdeadbeef;
9420 len = -1;
9422 hr = IUriBuilder_GetUserName(builder, &len, &received);
9423 ok(hr == S_FALSE,
9424 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9425 hr, S_FALSE, test_index);
9426 if(SUCCEEDED(hr)) {
9427 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9428 len, test_index);
9429 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9430 received, test_index);
9432 } else {
9433 BSTR expected = NULL;
9434 BOOL has_prop = FALSE;
9436 hr = IUri_GetUserName(uri, &expected);
9437 ok(SUCCEEDED(hr),
9438 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9439 hr, test_index);
9440 has_prop = hr == S_OK;
9442 hr = IUriBuilder_GetUserName(builder, &len, &received);
9443 if(has_prop) {
9444 ok(hr == S_OK,
9445 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9446 hr, S_OK, test_index);
9447 if(SUCCEEDED(hr)) {
9448 ok(!lstrcmpW(expected, received),
9449 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9450 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9451 ok(lstrlenW(expected) == len,
9452 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9453 lstrlenW(expected), len, test_index);
9455 } else {
9456 ok(hr == S_FALSE,
9457 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9458 hr, S_FALSE, test_index);
9459 if(SUCCEEDED(hr)) {
9460 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9461 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9462 len, test_index);
9465 SysFreeString(expected);
9468 if(uri) IUri_Release(uri);
9472 /* Tests IUriBuilder functions. */
9473 static void test_IUriBuilder(void) {
9474 HRESULT hr;
9475 IUriBuilder *builder;
9476 DWORD i;
9478 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9479 IUri *uri = NULL;
9480 uri_builder_test test = uri_builder_tests[i];
9481 LPWSTR uriW = NULL;
9483 if(test.uri) {
9484 uriW = a2w(test.uri);
9485 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9486 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9487 hr, S_OK, i);
9488 if(FAILED(hr)) continue;
9490 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9491 todo_wine_if(test.create_builder_todo)
9492 ok(hr == test.create_builder_expected,
9493 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9494 hr, test.create_builder_expected, i);
9495 if(SUCCEEDED(hr)) {
9496 DWORD j;
9497 BOOL modified = FALSE, received = FALSE;
9499 /* Perform all the string property changes. */
9500 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9501 uri_builder_property prop = test.properties[j];
9502 if(prop.change) {
9503 change_property(builder, &prop, i);
9504 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9505 prop.property != Uri_PROPERTY_HOST)
9506 modified = TRUE;
9507 else if(prop.value && *prop.value)
9508 modified = TRUE;
9509 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9510 /* Host name property can't be NULL, but it can be empty. */
9511 modified = TRUE;
9515 if(test.port_prop.change) {
9516 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9517 modified = TRUE;
9518 todo_wine_if(test.port_prop.todo)
9519 ok(hr == test.port_prop.expected,
9520 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9521 hr, test.port_prop.expected, i);
9524 hr = IUriBuilder_HasBeenModified(builder, &received);
9525 ok(hr == S_OK,
9526 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9527 hr, S_OK, i);
9528 if(SUCCEEDED(hr))
9529 ok(received == modified,
9530 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9531 modified, received, i);
9533 /* Test the "Get*" functions. */
9534 test_IUriBuilder_GetFragment(builder, &test, i);
9535 test_IUriBuilder_GetHost(builder, &test, i);
9536 test_IUriBuilder_GetPassword(builder, &test, i);
9537 test_IUriBuilder_GetPath(builder, &test, i);
9538 test_IUriBuilder_GetPort(builder, &test, i);
9539 test_IUriBuilder_GetQuery(builder, &test, i);
9540 test_IUriBuilder_GetSchemeName(builder, &test, i);
9541 test_IUriBuilder_GetUserName(builder, &test, i);
9543 test_IUriBuilder_CreateUri(builder, &test, i);
9544 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9545 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9547 if(builder) IUriBuilder_Release(builder);
9548 if(uri) IUri_Release(uri);
9549 heap_free(uriW);
9553 static void test_IUriBuilder_HasBeenModified(void) {
9554 HRESULT hr;
9555 IUriBuilder *builder = NULL;
9557 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9558 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9559 if(SUCCEEDED(hr)) {
9560 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9561 IUri *uri = NULL;
9562 BOOL received;
9564 hr = IUriBuilder_HasBeenModified(builder, NULL);
9565 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9566 hr, E_POINTER);
9568 hr = IUriBuilder_SetHost(builder, hostW);
9569 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9570 hr, S_OK);
9572 hr = IUriBuilder_HasBeenModified(builder, &received);
9573 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9574 hr, S_OK);
9575 if(SUCCEEDED(hr))
9576 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9578 hr = pCreateUri(http_urlW, 0, 0, &uri);
9579 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9580 if(SUCCEEDED(hr)) {
9581 LPCWSTR prop;
9582 DWORD len = -1;
9584 hr = IUriBuilder_SetIUri(builder, uri);
9585 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9586 hr, S_OK);
9588 hr = IUriBuilder_HasBeenModified(builder, &received);
9589 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9590 hr, S_OK);
9591 if(SUCCEEDED(hr))
9592 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9594 /* Test what happens with you call SetIUri with the same IUri again. */
9595 hr = IUriBuilder_SetHost(builder, hostW);
9596 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9598 hr = IUriBuilder_HasBeenModified(builder, &received);
9599 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9600 hr, S_OK);
9601 if(SUCCEEDED(hr))
9602 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9604 hr = IUriBuilder_SetIUri(builder, uri);
9605 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9607 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
9608 * reset any of the changes that were made to the IUriBuilder.
9610 hr = IUriBuilder_HasBeenModified(builder, &received);
9611 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9612 if(SUCCEEDED(hr))
9613 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9615 hr = IUriBuilder_GetHost(builder, &len, &prop);
9616 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9617 if(SUCCEEDED(hr)) {
9618 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9619 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9620 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9621 lstrlenW(hostW), len);
9624 hr = IUriBuilder_SetIUri(builder, NULL);
9625 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9627 hr = IUriBuilder_SetHost(builder, hostW);
9628 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9629 hr = IUriBuilder_HasBeenModified(builder, &received);
9630 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9631 hr, S_OK);
9632 if(SUCCEEDED(hr))
9633 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9635 hr = IUriBuilder_SetIUri(builder, NULL);
9636 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9638 hr = IUriBuilder_HasBeenModified(builder, &received);
9639 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9640 hr, S_OK);
9641 if(SUCCEEDED(hr))
9642 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9644 hr = IUriBuilder_GetHost(builder, &len, &prop);
9645 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9646 if(SUCCEEDED(hr)) {
9647 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9648 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9649 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9650 lstrlenW(hostW), len);
9653 if(uri) IUri_Release(uri);
9655 if(builder) IUriBuilder_Release(builder);
9658 /* Test IUriBuilder {Get,Set}IUri functions. */
9659 static void test_IUriBuilder_IUriProperty(void) {
9660 IUriBuilder *builder = NULL;
9661 HRESULT hr;
9663 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9664 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9665 if(SUCCEEDED(hr)) {
9666 IUri *uri = NULL;
9668 hr = IUriBuilder_GetIUri(builder, NULL);
9669 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9670 hr, E_POINTER);
9672 hr = pCreateUri(http_urlW, 0, 0, &uri);
9673 if(SUCCEEDED(hr)) {
9674 IUri *test = NULL;
9675 ULONG cur_count, orig_count;
9677 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9678 orig_count = get_refcnt(uri);
9679 hr = IUriBuilder_SetIUri(builder, uri);
9680 cur_count = get_refcnt(uri);
9681 if(SUCCEEDED(hr))
9682 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9683 orig_count+1, cur_count);
9685 hr = IUriBuilder_SetIUri(builder, NULL);
9686 cur_count = get_refcnt(uri);
9687 if(SUCCEEDED(hr))
9688 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9689 orig_count, cur_count);
9691 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9692 hr = IUriBuilder_SetIUri(builder, uri);
9693 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9694 orig_count = get_refcnt(uri);
9696 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9697 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9698 if(SUCCEEDED(hr)) {
9699 cur_count = get_refcnt(uri);
9700 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9701 orig_count+1, cur_count);
9702 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9703 uri, test);
9705 if(test) IUri_Release(test);
9707 test = NULL;
9708 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9709 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9710 if(SUCCEEDED(hr)) {
9711 cur_count = get_refcnt(uri);
9712 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9713 orig_count+1, cur_count);
9714 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9716 if(test) IUri_Release(test);
9718 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9719 * the base IUri.
9721 test = NULL;
9722 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9723 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9724 if(SUCCEEDED(hr))
9725 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9727 if(test) IUri_Release(test);
9729 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9730 * explicitly set (because it's a default flag).
9732 test = NULL;
9733 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9734 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9735 if(SUCCEEDED(hr)) {
9736 cur_count = get_refcnt(uri);
9737 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9738 orig_count+1, cur_count);
9739 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9741 if(test) IUri_Release(test);
9743 test = NULL;
9744 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9745 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9746 if(SUCCEEDED(hr)) {
9747 cur_count = get_refcnt(uri);
9748 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9749 orig_count+1, cur_count);
9750 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9752 if(test) IUri_Release(test);
9754 test = NULL;
9755 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9756 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9757 hr, S_OK);
9758 if(SUCCEEDED(hr)) {
9759 cur_count = get_refcnt(uri);
9760 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9761 orig_count+1, cur_count);
9762 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9764 if(test) IUri_Release(test);
9766 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9767 * the base IUri.
9769 test = NULL;
9770 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9771 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9772 if(SUCCEEDED(hr))
9773 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9775 if(test) IUri_Release(test);
9777 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9778 * explicitly set (because it's a default flag).
9780 test = NULL;
9781 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9782 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9783 if(SUCCEEDED(hr)) {
9784 cur_count = get_refcnt(uri);
9785 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9786 orig_count+1, cur_count);
9787 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9789 if(test) IUri_Release(test);
9791 if(uri) IUri_Release(uri);
9793 if(builder) IUriBuilder_Release(builder);
9796 static void test_IUriBuilder_RemoveProperties(void) {
9797 IUriBuilder *builder = NULL;
9798 HRESULT hr;
9799 DWORD i;
9801 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9802 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9803 if(SUCCEEDED(hr)) {
9804 /* Properties that can't be removed. */
9805 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9806 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9808 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9809 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9810 if((i << 1) & invalid) {
9811 ok(hr == E_INVALIDARG,
9812 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9813 hr, E_INVALIDARG, i);
9814 } else {
9815 ok(hr == S_OK,
9816 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9817 hr, S_OK, i);
9821 /* Also doesn't accept anything that's outside the range of the
9822 * Uri_HAS flags.
9824 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9825 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9826 hr, E_INVALIDARG);
9828 if(builder) IUriBuilder_Release(builder);
9830 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9831 uri_builder_remove_test test = uri_builder_remove_tests[i];
9832 IUri *uri = NULL;
9833 LPWSTR uriW;
9835 uriW = a2w(test.uri);
9836 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9837 if(SUCCEEDED(hr)) {
9838 builder = NULL;
9840 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9841 todo_wine_if(test.create_builder_todo)
9842 ok(hr == test.create_builder_expected,
9843 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9844 hr, test.create_builder_expected, i);
9846 if(SUCCEEDED(hr)) {
9847 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9848 todo_wine_if(test.remove_todo)
9849 ok(hr == test.remove_expected,
9850 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9851 hr, test.remove_expected, i);
9852 if(SUCCEEDED(hr)) {
9853 IUri *result = NULL;
9855 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9856 todo_wine_if(test.expected_todo)
9857 ok(hr == test.expected_hres,
9858 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9859 hr, test.expected_hres, i);
9860 if(SUCCEEDED(hr)) {
9861 BSTR received = NULL;
9863 hr = IUri_GetAbsoluteUri(result, &received);
9864 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9865 ok(!strcmp_aw(test.expected_uri, received),
9866 "Error: Expected %s but got %s instead on test %d.\n",
9867 test.expected_uri, wine_dbgstr_w(received), i);
9868 SysFreeString(received);
9870 if(result) IUri_Release(result);
9873 if(builder) IUriBuilder_Release(builder);
9875 if(uri) IUri_Release(uri);
9876 heap_free(uriW);
9880 static void test_IUriBuilder_Misc(void) {
9881 HRESULT hr;
9882 IUri *uri;
9884 hr = pCreateUri(http_urlW, 0, 0, &uri);
9885 if(SUCCEEDED(hr)) {
9886 IUriBuilder *builder;
9888 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9889 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9890 if(SUCCEEDED(hr)) {
9891 BOOL has = -1;
9892 DWORD port = -1;
9894 hr = IUriBuilder_GetPort(builder, &has, &port);
9895 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9896 if(SUCCEEDED(hr)) {
9897 /* 'has' will be set to FALSE, even though uri had a port. */
9898 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9899 /* Still sets 'port' to 80. */
9900 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9903 if(builder) IUriBuilder_Release(builder);
9905 if(uri) IUri_Release(uri);
9908 static void test_IUriBuilderFactory(void) {
9909 HRESULT hr;
9910 IUri *uri;
9911 IUriBuilderFactory *factory;
9912 IUriBuilder *builder;
9914 hr = pCreateUri(http_urlW, 0, 0, &uri);
9915 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9916 if(SUCCEEDED(hr)) {
9917 factory = NULL;
9918 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9919 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9920 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9922 if(SUCCEEDED(hr)) {
9923 builder = (void*) 0xdeadbeef;
9924 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9925 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9926 hr, E_INVALIDARG);
9927 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9929 builder = (void*) 0xdeadbeef;
9930 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9931 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9932 hr, E_INVALIDARG);
9933 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9935 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9936 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9937 hr, E_POINTER);
9939 builder = NULL;
9940 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9941 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9942 hr, S_OK);
9943 if(SUCCEEDED(hr)) {
9944 IUri *tmp = (void*) 0xdeadbeef;
9945 LPCWSTR result;
9946 DWORD result_len;
9948 hr = IUriBuilder_GetIUri(builder, &tmp);
9949 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9950 hr, S_OK);
9951 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9953 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9954 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9955 hr, S_FALSE);
9957 if(builder) IUriBuilder_Release(builder);
9959 builder = (void*) 0xdeadbeef;
9960 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9961 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9962 hr, E_INVALIDARG);
9963 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9965 builder = (void*) 0xdeadbeef;
9966 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9967 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9968 hr, E_INVALIDARG);
9969 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9971 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9972 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9973 hr, E_POINTER);
9975 builder = NULL;
9976 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9977 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9978 hr, S_OK);
9979 if(SUCCEEDED(hr)) {
9980 IUri *tmp = NULL;
9982 hr = IUriBuilder_GetIUri(builder, &tmp);
9983 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9984 hr, S_OK);
9985 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9986 if(uri) IUri_Release(uri);
9988 if(builder) IUriBuilder_Release(builder);
9990 if(factory) IUriBuilderFactory_Release(factory);
9992 if(uri) IUri_Release(uri);
9995 static void test_CoInternetCombineIUri(void) {
9996 HRESULT hr;
9997 IUri *base, *relative, *result;
9998 DWORD i;
10000 base = NULL;
10001 hr = pCreateUri(http_urlW, 0, 0, &base);
10002 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10003 if(SUCCEEDED(hr)) {
10004 result = (void*) 0xdeadbeef;
10005 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10006 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10007 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10010 relative = NULL;
10011 hr = pCreateUri(http_urlW, 0, 0, &relative);
10012 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10013 if(SUCCEEDED(hr)) {
10014 result = (void*) 0xdeadbeef;
10015 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10016 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10017 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10020 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10021 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10023 if(base) IUri_Release(base);
10024 if(relative) IUri_Release(relative);
10026 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10027 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10029 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10030 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10031 if(SUCCEEDED(hr)) {
10032 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10034 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10035 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10036 if(SUCCEEDED(hr)) {
10037 result = NULL;
10039 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10040 todo_wine_if(uri_combine_tests[i].todo)
10041 ok(hr == uri_combine_tests[i].expected,
10042 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10043 hr, uri_combine_tests[i]. expected, i);
10044 if(SUCCEEDED(hr)) {
10045 DWORD j;
10047 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10048 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10049 BSTR received;
10051 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10052 todo_wine_if(prop.todo) {
10053 ok(hr == prop.expected,
10054 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10055 hr, prop.expected, i, j);
10056 ok(!strcmp_aw(prop.value, received) ||
10057 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10058 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10059 prop.value, wine_dbgstr_w(received), i, j);
10061 SysFreeString(received);
10064 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10065 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10066 DWORD received;
10068 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10069 todo_wine_if(prop.todo) {
10070 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10071 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10072 hr, prop.expected, i, j);
10073 if(!prop.broken_combine_hres || hr != S_FALSE)
10074 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10075 prop.value, received, i, j);
10079 if(result) IUri_Release(result);
10081 if(relative) IUri_Release(relative);
10082 heap_free(relativeW);
10084 if(base) IUri_Release(base);
10085 heap_free(baseW);
10089 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10090 REFIID riid, void **ppv)
10092 ok(0, "unexpected call\n");
10093 return E_NOINTERFACE;
10096 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10098 return 2;
10101 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10103 return 1;
10106 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10107 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10108 DWORD *pcchResult, DWORD dwReserved)
10110 CHECK_EXPECT(ParseUrl);
10111 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10112 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10113 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10114 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10115 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10117 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10118 *pcchResult = lstrlenW(parse_resultW);
10120 return S_OK;
10123 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10124 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10125 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10127 CHECK_EXPECT(CombineUrl);
10128 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10129 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10130 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10131 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10132 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10133 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10134 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10136 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10137 *pcchResult = lstrlenW(combine_resultW);
10139 return S_OK;
10142 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10143 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10145 ok(0, "unexpected call\n");
10146 return E_NOTIMPL;
10149 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10150 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10151 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10153 ok(0, "unexpected call\n");
10154 return E_NOTIMPL;
10157 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10158 InternetProtocolInfo_QueryInterface,
10159 InternetProtocolInfo_AddRef,
10160 InternetProtocolInfo_Release,
10161 InternetProtocolInfo_ParseUrl,
10162 InternetProtocolInfo_CombineUrl,
10163 InternetProtocolInfo_CompareUrl,
10164 InternetProtocolInfo_QueryInfo
10167 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10169 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10171 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10172 *ppv = &protocol_info;
10173 return S_OK;
10176 ok(0, "unexpected call\n");
10177 return E_NOINTERFACE;
10180 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10182 return 2;
10185 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10187 return 1;
10190 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10191 REFIID riid, void **ppv)
10193 ok(0, "unexpected call\n");
10194 return E_NOTIMPL;
10197 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10199 ok(0, "unexpected call\n");
10200 return S_OK;
10203 static const IClassFactoryVtbl ClassFactoryVtbl = {
10204 ClassFactory_QueryInterface,
10205 ClassFactory_AddRef,
10206 ClassFactory_Release,
10207 ClassFactory_CreateInstance,
10208 ClassFactory_LockServer
10211 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10213 static void register_protocols(void)
10215 IInternetSession *session;
10216 HRESULT hres;
10218 hres = pCoInternetGetSession(0, &session, 0);
10219 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10220 if(FAILED(hres))
10221 return;
10223 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10224 winetestW, 0, NULL, 0);
10225 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10227 IInternetSession_Release(session);
10230 static void unregister_protocols(void) {
10231 IInternetSession *session;
10232 HRESULT hr;
10234 hr = pCoInternetGetSession(0, &session, 0);
10235 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10236 if(FAILED(hr))
10237 return;
10239 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10240 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10242 IInternetSession_Release(session);
10245 static void test_CoInternetCombineIUri_Pluggable(void) {
10246 HRESULT hr;
10247 IUri *base = NULL;
10249 hr = pCreateUri(combine_baseW, 0, 0, &base);
10250 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10251 if(SUCCEEDED(hr)) {
10252 IUri *relative = NULL;
10254 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10255 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10256 if(SUCCEEDED(hr)) {
10257 IUri *result = NULL;
10259 SET_EXPECT(CombineUrl);
10261 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10262 &result, 0);
10263 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10265 CHECK_CALLED(CombineUrl);
10267 if(SUCCEEDED(hr)) {
10268 BSTR received = NULL;
10269 hr = IUri_GetAbsoluteUri(result, &received);
10270 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10271 if(SUCCEEDED(hr)) {
10272 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10273 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10275 SysFreeString(received);
10277 if(result) IUri_Release(result);
10279 if(relative) IUri_Release(relative);
10281 if(base) IUri_Release(base);
10284 static void test_CoInternetCombineUrlEx(void) {
10285 HRESULT hr;
10286 IUri *base, *result;
10287 DWORD i;
10289 base = NULL;
10290 hr = pCreateUri(http_urlW, 0, 0, &base);
10291 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10292 if(SUCCEEDED(hr)) {
10293 result = (void*) 0xdeadbeef;
10294 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10295 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10296 hr, E_UNEXPECTED);
10297 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10300 result = (void*) 0xdeadbeef;
10301 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10302 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10303 hr, E_INVALIDARG);
10304 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10306 result = (void*) 0xdeadbeef;
10307 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10308 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10309 hr, E_UNEXPECTED);
10310 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10312 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10313 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10314 hr, E_POINTER);
10315 if(base) IUri_Release(base);
10317 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10318 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10320 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10321 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10322 if(SUCCEEDED(hr)) {
10323 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10325 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10326 &result, 0);
10327 todo_wine_if(uri_combine_tests[i].todo)
10328 ok(hr == uri_combine_tests[i].expected,
10329 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10330 hr, uri_combine_tests[i]. expected, i);
10331 if(SUCCEEDED(hr)) {
10332 DWORD j;
10334 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10335 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10336 BSTR received;
10337 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10339 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10340 todo_wine_if(prop.todo) {
10341 ok(hr == prop.expected,
10342 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10343 hr, prop.expected, i, j);
10344 ok(!strcmp_aw(value, received) ||
10345 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10346 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10347 value, wine_dbgstr_w(received), i, j);
10349 SysFreeString(received);
10352 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10353 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10354 DWORD received;
10356 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10357 todo_wine_if(prop.todo) {
10358 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10359 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10360 hr, prop.expected, i, j);
10361 if(!prop.broken_combine_hres || hr != S_FALSE)
10362 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10363 prop.value, received, i, j);
10367 if(result) IUri_Release(result);
10368 heap_free(relativeW);
10370 if(base) IUri_Release(base);
10371 heap_free(baseW);
10375 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10376 HRESULT hr;
10377 IUri *base = NULL;
10379 hr = pCreateUri(combine_baseW, 0, 0, &base);
10380 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10381 if(SUCCEEDED(hr)) {
10382 IUri *result = NULL;
10384 SET_EXPECT(CombineUrl);
10386 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10387 &result, 0);
10388 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10390 CHECK_CALLED(CombineUrl);
10392 if(SUCCEEDED(hr)) {
10393 BSTR received = NULL;
10394 hr = IUri_GetAbsoluteUri(result, &received);
10395 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10396 if(SUCCEEDED(hr)) {
10397 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10398 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10400 SysFreeString(received);
10402 if(result) IUri_Release(result);
10404 if(base) IUri_Release(base);
10407 static void test_CoInternetParseIUri_InvalidArgs(void) {
10408 HRESULT hr;
10409 IUri *uri = NULL;
10410 WCHAR tmp[3];
10411 WCHAR *longurl, *copy;
10412 DWORD result = -1;
10413 DWORD i, len;
10415 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10416 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10417 hr, E_INVALIDARG);
10418 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10420 hr = pCreateUri(http_urlW, 0, 0, &uri);
10421 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10422 if(SUCCEEDED(hr)) {
10423 DWORD expected_len;
10425 result = -1;
10426 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10427 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10428 hr, E_INVALIDARG);
10429 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10431 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10432 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10433 hr, E_POINTER);
10435 result = -1;
10436 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10437 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10438 hr, E_FAIL);
10439 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10441 result = -1;
10442 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10443 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10444 hr, E_FAIL);
10445 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10447 result = -1;
10448 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10449 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10450 hr, E_FAIL);
10451 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10453 result = -1;
10454 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10455 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10456 hr, E_FAIL);
10457 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10459 expected_len = lstrlenW(http_urlW);
10460 result = -1;
10461 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10462 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10463 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10464 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10465 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10466 expected_len, result);
10468 if(uri) IUri_Release(uri);
10470 /* a long url that causes a crash on Wine */
10471 len = INTERNET_MAX_URL_LENGTH*2;
10472 longurl = heap_alloc((len+1)*sizeof(WCHAR));
10473 memcpy(longurl, http_urlW, sizeof(http_urlW));
10474 for(i = sizeof(http_urlW)/sizeof(WCHAR)-1; i < len; i++)
10475 longurl[i] = 'x';
10476 longurl[len] = 0;
10478 copy = heap_alloc((len+1)*sizeof(WCHAR));
10479 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
10481 hr = pCreateUri(longurl, 0, 0, &uri);
10482 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10483 if(SUCCEEDED(hr)) {
10484 result = -1;
10485 memset(longurl, 0xcc, len*sizeof(WCHAR));
10486 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
10487 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
10488 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
10489 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
10490 ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10491 len, result);
10493 heap_free(longurl);
10494 heap_free(copy);
10495 if(uri) IUri_Release(uri);
10498 static void test_CoInternetParseIUri(void) {
10499 DWORD i;
10501 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10502 HRESULT hr;
10503 IUri *uri;
10504 LPWSTR uriW;
10505 uri_parse_test test = uri_parse_tests[i];
10507 uriW = a2w(test.uri);
10508 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10509 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10510 if(SUCCEEDED(hr)) {
10511 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10512 DWORD result_len = -1;
10514 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10515 todo_wine_if(test.todo)
10516 ok(hr == test.expected,
10517 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10518 hr, test.expected, i);
10519 if(SUCCEEDED(hr)) {
10520 DWORD len = lstrlenA(test.property);
10521 ok(!strcmp_aw(test.property, result),
10522 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10523 test.property, wine_dbgstr_w(result), i);
10524 ok(len == result_len,
10525 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10526 len, result_len, i);
10527 } else {
10528 ok(!result_len,
10529 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10530 result_len, i);
10533 if(uri) IUri_Release(uri);
10534 heap_free(uriW);
10538 static void test_CoInternetParseIUri_Pluggable(void) {
10539 HRESULT hr;
10540 IUri *uri = NULL;
10542 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10543 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10544 if(SUCCEEDED(hr)) {
10545 WCHAR result[200];
10546 DWORD result_len;
10548 SET_EXPECT(ParseUrl);
10550 parse_action = PARSE_CANONICALIZE;
10551 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10553 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10554 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10556 CHECK_CALLED(ParseUrl);
10558 if(SUCCEEDED(hr)) {
10559 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10560 lstrlenW(parse_resultW), result_len);
10561 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10562 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10565 if(uri) IUri_Release(uri);
10568 typedef struct {
10569 const char *url;
10570 DWORD uri_flags;
10571 const char *base_url;
10572 DWORD base_uri_flags;
10573 const char *legacy_url;
10574 const char *uniform_url;
10575 const char *no_canon_url;
10576 const char *uri_url;
10577 } create_urlmon_test_t;
10579 static const create_urlmon_test_t create_urlmon_tests[] = {
10581 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10582 NULL,0,
10583 "http://www.winehq.org/",
10584 "http://www.winehq.org/",
10585 "http://www.winehq.org",
10586 "http://www.winehq.org"
10589 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10590 NULL,0,
10591 "file://c:\\dir\\file.txt",
10592 "file:///c:/dir/file.txt",
10593 "file:///c:/dir/file.txt",
10594 "file:///c:/dir/file.txt"
10597 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10598 NULL,0,
10599 "file://c:\\dir\\file.txt",
10600 "file:///c:/dir/file.txt",
10601 "file:///c:/dir/file.txt",
10602 "file://c:\\dir\\file.txt"
10605 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10606 "http://www.winehq.org",0,
10607 "http://www.winehq.org/data",
10608 "http://www.winehq.org/data",
10609 "http://www.winehq.org:80/data",
10612 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10613 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10614 "file://c:\\dir\\file.txt",
10615 "file:///c:/dir/file.txt",
10616 "file:///c:/dir/file.txt",
10619 "",Uri_CREATE_ALLOW_RELATIVE,
10620 NULL,0,
10627 "test",Uri_CREATE_ALLOW_RELATIVE,
10628 NULL,0,
10629 "test",
10630 "test",
10631 "test",
10632 "test"
10635 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10636 NULL,0,
10637 "file://c:\\dir\\file.txt",
10638 "file:///c:/dir/file.txt",
10639 "file:///c:/dir/file.txt",
10640 "file:///c:/dir/file.txt",
10643 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10644 NULL,0,
10645 "file://c:\\dir\\file.txt#frag|part",
10646 "file:///c:/dir/file.txt#frag%7Cpart",
10647 "file:///c:/dir/file.txt#frag%7Cpart",
10648 "file:///c:/dir/file.txt#frag%7Cpart",
10652 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10653 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10655 WCHAR *display_name;
10656 HRESULT hres;
10658 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10659 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10660 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10661 wine_dbgstr_w(display_name), exurl);
10663 CoTaskMemFree(display_name);
10666 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10667 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10669 IUriContainer *uri_container;
10670 IUri *uri;
10671 BSTR display_uri;
10672 HRESULT hres;
10674 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10675 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10677 uri = NULL;
10678 hres = IUriContainer_GetIUri(uri_container, &uri);
10679 IUriContainer_Release(uri_container);
10680 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10681 ok(uri != NULL, "uri == NULL\n");
10683 hres = IUri_GetDisplayUri(uri, &display_uri);
10684 IUri_Release(uri);
10685 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10686 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10687 wine_dbgstr_w(display_uri), exurl);
10688 SysFreeString(display_uri);
10691 static void test_CreateURLMoniker(void)
10693 const create_urlmon_test_t *test;
10694 IMoniker *mon, *base_mon;
10695 WCHAR *url, *base_url;
10696 IUri *uri, *base_uri;
10697 HRESULT hres;
10699 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10700 url = a2w(test->url);
10701 base_url = a2w(test->base_url);
10703 if(base_url) {
10704 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10705 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10707 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10708 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10709 }else {
10710 base_uri = NULL;
10711 base_mon = NULL;
10714 hres = CreateURLMoniker(base_mon, url, &mon);
10715 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10716 test_urlmon_display_name(mon, test->legacy_url);
10717 test_display_uri(mon, test->legacy_url);
10718 IMoniker_Release(mon);
10720 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10721 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10722 test_urlmon_display_name(mon, test->legacy_url);
10723 test_display_uri(mon, test->legacy_url);
10724 IMoniker_Release(mon);
10726 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10727 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10728 test_urlmon_display_name(mon, test->uniform_url);
10729 test_display_uri(mon, test->uniform_url);
10730 IMoniker_Release(mon);
10732 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10733 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10734 test_urlmon_display_name(mon, test->no_canon_url);
10735 test_display_uri(mon, test->no_canon_url);
10736 IMoniker_Release(mon);
10738 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10739 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10741 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10742 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10743 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10744 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10745 IMoniker_Release(mon);
10747 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10748 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10749 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10750 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10751 IMoniker_Release(mon);
10753 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10754 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10755 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10756 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10757 IMoniker_Release(mon);
10759 IUri_Release(uri);
10760 heap_free(url);
10761 heap_free(base_url);
10762 if(base_uri)
10763 IUri_Release(base_uri);
10764 if(base_mon)
10765 IMoniker_Release(base_mon);
10769 static int add_default_flags(DWORD flags) {
10770 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
10771 flags |= Uri_CREATE_CANONICALIZE;
10772 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
10773 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
10774 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
10775 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
10776 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
10777 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
10778 if(!(flags & Uri_CREATE_IE_SETTINGS))
10779 flags |= Uri_CREATE_NO_IE_SETTINGS;
10781 return flags;
10784 static void test_IPersistStream(void)
10786 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
10788 props_order[Uri_PROPERTY_RAW_URI] = 1;
10789 props_order[Uri_PROPERTY_FRAGMENT] = 2;
10790 props_order[Uri_PROPERTY_HOST] = 3;
10791 props_order[Uri_PROPERTY_PASSWORD] = 4;
10792 props_order[Uri_PROPERTY_PATH] = 5;
10793 props_order[Uri_PROPERTY_PORT] = 6;
10794 props_order[Uri_PROPERTY_QUERY] = 7;
10795 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
10796 props_order[Uri_PROPERTY_USER_NAME] = 9;
10798 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
10799 const uri_properties *test = uri_tests+i;
10800 LPWSTR uriW;
10801 IUri *uri;
10802 IPersistStream *persist_stream;
10803 IStream *stream;
10804 IMarshal *marshal;
10805 DWORD props, props_no, dw_data[6];
10806 WCHAR str_data[1024];
10807 ULARGE_INTEGER size, max_size;
10808 LARGE_INTEGER no_off;
10809 CLSID curi;
10810 BSTR raw_uri;
10811 HRESULT hr;
10813 if(test->create_todo || test->create_expected!=S_OK)
10814 continue;
10816 uriW = a2w(test->uri);
10817 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
10818 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
10820 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10821 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10823 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
10824 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
10825 hr = IPersistStream_IsDirty(persist_stream);
10826 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10827 hr = IPersistStream_Save(persist_stream, stream, FALSE);
10828 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
10829 hr = IPersistStream_IsDirty(persist_stream);
10830 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10831 no_off.QuadPart = 0;
10832 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
10833 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10834 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10835 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10836 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
10837 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
10838 ok(U(size).LowPart+2 == U(max_size).LowPart,
10839 "%d) Written data size is %d, max_size %d.\n",
10840 i, U(size).LowPart, U(max_size).LowPart);
10842 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
10843 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10844 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
10845 i, dw_data[0]-2, U(size).LowPart);
10846 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
10847 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10848 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
10849 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
10850 ok(dw_data[2] == add_default_flags(test->create_flags),
10851 "%d) Incorrect value %x, expected %x (creation flags).\n",
10852 i, dw_data[2], add_default_flags(test->create_flags));
10853 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
10854 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
10855 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
10857 props_no = 0;
10858 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
10859 if(!props_order[props])
10860 continue;
10862 if(props <= Uri_PROPERTY_STRING_LAST) {
10863 if(test->str_props[props].expected == S_OK)
10864 props_no++;
10865 } else {
10866 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
10867 props_no++;
10870 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
10871 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
10872 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
10873 props_no = 1;
10875 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
10876 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10877 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
10879 dw_data[2] = 0;
10880 dw_data[3] = -1;
10881 while(props) {
10882 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
10883 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10884 props--;
10885 ok(dw_data[2]<props_order[dw_data[0]],
10886 "%d) Incorrect properties order (%d, %d)\n",
10887 i, dw_data[0], dw_data[3]);
10888 dw_data[2] = props_order[dw_data[0]];
10889 dw_data[3] = dw_data[0];
10891 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
10892 const uri_str_property *prop = test->str_props+dw_data[0];
10893 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
10894 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10895 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
10896 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
10897 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
10898 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
10899 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
10900 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
10901 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10902 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
10903 } else {
10904 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
10905 break;
10908 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
10909 i, props, dw_data[0]);
10911 IUri_Release(uri);
10913 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10914 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10915 hr = IPersistStream_GetClassID(persist_stream, &curi);
10916 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
10917 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
10918 IPersistStream_Release(persist_stream);
10920 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
10921 &IID_IUri, (void**)&uri);
10922 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
10923 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10924 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10925 hr = IPersistStream_Load(persist_stream, stream);
10926 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
10927 hr = IUri_GetRawUri(uri, &raw_uri);
10928 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
10929 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
10930 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
10931 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
10932 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
10933 wine_dbgstr_w(raw_uri));
10934 SysFreeString(raw_uri);
10935 IPersistStream_Release(persist_stream);
10937 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
10938 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
10939 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10940 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10941 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10942 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
10943 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10944 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10945 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
10946 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10947 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10948 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
10949 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10950 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10951 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
10952 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10953 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10954 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
10955 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10956 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10957 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
10958 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
10959 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
10960 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
10961 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10962 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
10963 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
10964 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
10965 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
10967 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
10968 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10969 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10970 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10971 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
10972 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10973 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
10974 i, dw_data[0]-2, U(size).LowPart);
10975 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
10976 i, dw_data[1]);
10977 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10978 i, dw_data[2], dw_data[0]-8);
10979 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
10980 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
10981 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
10982 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
10983 U(max_size).LowPart += 3*sizeof(DWORD);
10984 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10985 i, dw_data[2], U(max_size).LowPart);
10986 IMarshal_Release(marshal);
10987 IUri_Release(uri);
10989 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10990 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10991 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
10992 &IID_IUri, (void**)&uri);
10993 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
10994 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
10995 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10996 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
10997 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
10998 hr = IUri_GetRawUri(uri, &raw_uri);
10999 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11000 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11001 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11002 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11003 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11004 wine_dbgstr_w(raw_uri));
11005 SysFreeString(raw_uri);
11007 IMarshal_Release(marshal);
11008 IStream_Release(stream);
11009 IUri_Release(uri);
11010 heap_free(uriW);
11014 static void test_UninitializedUri(void)
11016 IUri *uri;
11017 IUriBuilderFactory *ubf;
11018 IPersistStream *ps;
11019 IUriBuilder *ub;
11020 BSTR bstr;
11021 DWORD dword;
11022 BOOL eq;
11023 ULARGE_INTEGER ui;
11024 HRESULT hr;
11026 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11027 &IID_IUri, (void**)&uri);
11028 if(FAILED(hr)) {
11029 win_skip("Skipping uninitialized Uri tests.\n");
11030 return;
11033 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11034 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11035 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11036 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11038 hr = IUri_GetAbsoluteUri(uri, NULL);
11039 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11040 hr = IUri_GetAbsoluteUri(uri, &bstr);
11041 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11042 hr = IUri_GetAuthority(uri, &bstr);
11043 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11044 hr = IUri_GetDisplayUri(uri, &bstr);
11045 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11046 hr = IUri_GetDomain(uri, &bstr);
11047 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11048 hr = IUri_GetExtension(uri, &bstr);
11049 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11050 hr = IUri_GetFragment(uri, &bstr);
11051 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11052 hr = IUri_GetHost(uri, &bstr);
11053 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11054 hr = IUri_GetHostType(uri, &dword);
11055 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11056 hr = IUri_GetPassword(uri, &bstr);
11057 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11058 hr = IUri_GetPassword(uri, &bstr);
11059 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11060 hr = IUri_GetPathAndQuery(uri, &bstr);
11061 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11062 hr = IUri_GetPort(uri, &dword);
11063 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11064 hr = IUri_GetProperties(uri, &dword);
11065 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11066 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11067 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11068 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11069 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11070 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11071 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11072 hr = IUri_GetQuery(uri, &bstr);
11073 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11074 hr = IUri_GetRawUri(uri, &bstr);
11075 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11076 hr = IUri_GetScheme(uri, &dword);
11077 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11078 hr = IUri_GetSchemeName(uri, &bstr);
11079 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11080 hr = IUri_GetUserInfo(uri, &bstr);
11081 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11082 hr = IUri_GetUserName(uri, &bstr);
11083 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11084 hr = IUri_GetZone(uri, &dword);
11085 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11086 hr = IUri_IsEqual(uri, uri, &eq);
11087 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11089 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11090 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11091 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11092 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11093 IUriBuilder_Release(ub);
11095 hr = IPersistStream_GetSizeMax(ps, &ui);
11096 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11097 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11098 hr = IPersistStream_IsDirty(ps);
11099 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11101 IPersistStream_Release(ps);
11102 IUriBuilderFactory_Release(ubf);
11103 IUri_Release(uri);
11106 START_TEST(uri) {
11107 HMODULE hurlmon;
11109 hurlmon = GetModuleHandleA("urlmon.dll");
11110 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11111 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11112 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11113 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11114 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11115 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11116 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11117 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11118 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11120 if(!pCreateUri) {
11121 win_skip("CreateUri is not present, skipping tests.\n");
11122 return;
11125 trace("test CreateUri invalid flags...\n");
11126 test_CreateUri_InvalidFlags();
11128 trace("test CreateUri invalid args...\n");
11129 test_CreateUri_InvalidArgs();
11131 trace("test CreateUri invalid URIs...\n");
11132 test_CreateUri_InvalidUri();
11134 trace("test IUri_GetPropertyBSTR...\n");
11135 test_IUri_GetPropertyBSTR();
11137 trace("test IUri_GetPropertyDWORD...\n");
11138 test_IUri_GetPropertyDWORD();
11140 trace("test IUri_GetStrProperties...\n");
11141 test_IUri_GetStrProperties();
11143 trace("test IUri_GetDwordProperties...\n");
11144 test_IUri_GetDwordProperties();
11146 trace("test IUri_GetPropertyLength...\n");
11147 test_IUri_GetPropertyLength();
11149 trace("test IUri_GetProperties...\n");
11150 test_IUri_GetProperties();
11152 trace("test IUri_HasProperty...\n");
11153 test_IUri_HasProperty();
11155 trace("test IUri_IsEqual...\n");
11156 test_IUri_IsEqual();
11158 trace("test CreateUriWithFragment invalid args...\n");
11159 test_CreateUriWithFragment_InvalidArgs();
11161 trace("test CreateUriWithFragment invalid flags...\n");
11162 test_CreateUriWithFragment_InvalidFlags();
11164 trace("test CreateUriWithFragment...\n");
11165 test_CreateUriWithFragment();
11167 trace("test CreateIUriBuilder...\n");
11168 test_CreateIUriBuilder();
11170 trace("test IUriBuilder_CreateInvalidArgs...\n");
11171 test_IUriBuilder_CreateInvalidArgs();
11173 trace("test IUriBuilder...\n");
11174 test_IUriBuilder();
11176 trace("test IUriBuilder_GetInvalidArgs...\n");
11177 test_IUriBuilder_GetInvalidArgs();
11179 trace("test IUriBuilder_HasBeenModified...\n");
11180 test_IUriBuilder_HasBeenModified();
11182 trace("test IUriBuilder_IUriProperty...\n");
11183 test_IUriBuilder_IUriProperty();
11185 trace("test IUriBuilder_RemoveProperties...\n");
11186 test_IUriBuilder_RemoveProperties();
11188 trace("test IUriBuilder miscellaneous...\n");
11189 test_IUriBuilder_Misc();
11191 trace("test IUriBuilderFactory...\n");
11192 test_IUriBuilderFactory();
11194 trace("test CoInternetCombineIUri...\n");
11195 test_CoInternetCombineIUri();
11197 trace("test CoInternetCombineUrlEx...\n");
11198 test_CoInternetCombineUrlEx();
11200 trace("test CoInternetParseIUri Invalid Args...\n");
11201 test_CoInternetParseIUri_InvalidArgs();
11203 trace("test CoInternetParseIUri...\n");
11204 test_CoInternetParseIUri();
11206 register_protocols();
11208 trace("test CoInternetCombineIUri pluggable...\n");
11209 test_CoInternetCombineIUri_Pluggable();
11211 trace("test CoInternetCombineUrlEx Pluggable...\n");
11212 test_CoInternetCombineUrlEx_Pluggable();
11214 trace("test CoInternetParseIUri pluggable...\n");
11215 test_CoInternetParseIUri_Pluggable();
11217 trace("test CreateURLMoniker...\n");
11218 test_CreateURLMoniker();
11220 CoInitialize(NULL);
11222 trace("test IPersistStream...\n");
11223 test_IPersistStream();
11225 trace("test uninitialized Uri...\n");
11226 test_UninitializedUri();
11228 CoUninitialize();
11229 unregister_protocols();