[URLMON] Sync with Wine Staging 3.3. CORE-14434
[reactos.git] / modules / rostests / winetests / urlmon / uri.c
1 /*
2 * UrlMon IUri tests
3 *
4 * Copyright 2010 Thomas Mullaly
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #define WIN32_NO_STATUS
22 #define _INC_WINDOWS
23 #define COM_NO_WINDOWS_H
24
25 #include <wine/test.h>
26 //#include <stdarg.h>
27 //#include <stddef.h>
28
29 #define COBJMACROS
30 #define CONST_VTABLE
31 #define WIN32_LEAN_AND_MEAN
32
33 //#include "windef.h"
34 //#include "winbase.h"
35 #include <winreg.h>
36 #include <winnls.h>
37 #include <ole2.h>
38 //#include "urlmon.h"
39 #include <shlwapi.h>
40 #include <wininet.h>
41 #include <strsafe.h>
42 #include <initguid.h>
43
44 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
45
46 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
47 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
48 #define URI_BUILDER_STR_PROPERTY_COUNT 7
49
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
52
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
55
56 #define CHECK_EXPECT(func) \
57 do { \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 expect_ ## func = FALSE; \
60 called_ ## func = TRUE; \
61 }while(0)
62
63 #define CHECK_EXPECT2(func) \
64 do { \
65 ok(expect_ ##func, "unexpected call " #func "\n"); \
66 called_ ## func = TRUE; \
67 }while(0)
68
69 #define CHECK_CALLED(func) \
70 do { \
71 ok(called_ ## func, "expected " #func "\n"); \
72 expect_ ## func = called_ ## func = FALSE; \
73 }while(0)
74
75 DEFINE_EXPECT(CombineUrl);
76 DEFINE_EXPECT(ParseUrl);
77
78 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
79 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
80 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
81 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
82 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
83 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
84 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
85 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
86 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
87
88 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
89 '.','o','r','g','/',0};
90 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
91 '.','o','r','g','/','#','F','r','a','g',0};
92
93 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
94 'e','s','t','i','n','g',0};
95 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
96 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
97
98 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
99
100 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
101 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
102
103 static PARSEACTION parse_action;
104 static DWORD parse_flags;
105
106 typedef struct _uri_create_flag_test {
107 DWORD flags;
108 HRESULT expected;
109 } uri_create_flag_test;
110
111 static const uri_create_flag_test invalid_flag_tests[] = {
112 /* Set of invalid flag combinations to test for. */
113 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
114 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
115 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
116 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
117 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
118 };
119
120 typedef struct _uri_str_property {
121 const char* value;
122 HRESULT expected;
123 BOOL todo;
124 const char* broken_value;
125 const char* value2;
126 HRESULT expected2;
127 } uri_str_property;
128
129 typedef struct _uri_dword_property {
130 DWORD value;
131 HRESULT expected;
132 BOOL todo;
133 BOOL broken_combine_hres;
134 } uri_dword_property;
135
136 typedef struct _uri_properties {
137 const char* uri;
138 DWORD create_flags;
139 HRESULT create_expected;
140 BOOL create_todo;
141
142 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
143 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
144 } uri_properties;
145
146 static const uri_properties uri_tests[] = {
147 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
148 {
149 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
150 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
151 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
152 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
153 {"",S_FALSE,FALSE}, /* EXTENSION */
154 {"",S_FALSE,FALSE}, /* FRAGMENT */
155 {"www.winehq.org",S_OK,FALSE}, /* HOST */
156 {"",S_FALSE,FALSE}, /* PASSWORD */
157 {"/",S_OK,FALSE}, /* PATH */
158 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
159 {"",S_FALSE,FALSE}, /* QUERY */
160 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
161 {"http",S_OK,FALSE}, /* SCHEME_NAME */
162 {"",S_FALSE,FALSE}, /* USER_INFO */
163 {"",S_FALSE,FALSE} /* USER_NAME */
164 },
165 {
166 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
167 {80,S_OK,FALSE}, /* PORT */
168 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
169 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
170 }
171 },
172 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
173 {
174 {"http://winehq.org/tests",S_OK,FALSE},
175 {"winehq.org",S_OK,FALSE},
176 {"http://winehq.org/tests",S_OK,FALSE},
177 {"winehq.org",S_OK,FALSE},
178 {"",S_FALSE,FALSE},
179 {"",S_FALSE,FALSE},
180 {"winehq.org",S_OK,FALSE},
181 {"",S_FALSE,FALSE},
182 {"/tests",S_OK,FALSE},
183 {"/tests",S_OK,FALSE},
184 {"",S_FALSE,FALSE},
185 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
186 {"http",S_OK,FALSE},
187 {"",S_FALSE,FALSE},
188 {"",S_FALSE,FALSE}
189 },
190 {
191 {Uri_HOST_DNS,S_OK,FALSE},
192 {80,S_OK,FALSE},
193 {URL_SCHEME_HTTP,S_OK,FALSE},
194 {URLZONE_INVALID,E_NOTIMPL,FALSE}
195 }
196 },
197 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
198 {
199 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
200 {"www.winehq.org",S_OK,FALSE},
201 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
202 {"winehq.org",S_OK,FALSE},
203 {"",S_FALSE,FALSE},
204 {"",S_FALSE,FALSE},
205 {"www.winehq.org",S_OK,FALSE},
206 {"",S_FALSE,FALSE},
207 {"/",S_OK,FALSE},
208 {"/?query=x&return=y",S_OK,FALSE},
209 {"?query=x&return=y",S_OK,FALSE},
210 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
211 {"http",S_OK,FALSE},
212 {"",S_FALSE,FALSE},
213 {"",S_FALSE,FALSE}
214 },
215 {
216 {Uri_HOST_DNS,S_OK,FALSE},
217 {80,S_OK,FALSE},
218 {URL_SCHEME_HTTP,S_OK,FALSE},
219 {URLZONE_INVALID,E_NOTIMPL,FALSE},
220 }
221 },
222 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
223 {
224 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
225 {"www.winehq.org",S_OK,FALSE},
226 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
227 {"winehq.org",S_OK,FALSE},
228 {"",S_FALSE,FALSE},
229 {"",S_FALSE,FALSE},
230 {"www.winehq.org",S_OK,FALSE},
231 {"",S_FALSE,FALSE},
232 {"/",S_OK,FALSE},
233 {"/?query=x&return=y",S_OK,FALSE},
234 {"?query=x&return=y",S_OK,FALSE},
235 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
236 {"https",S_OK,FALSE},
237 {"",S_FALSE,FALSE},
238 {"",S_FALSE,FALSE}
239 },
240 {
241 {Uri_HOST_DNS,S_OK,FALSE},
242 {443,S_OK,FALSE},
243 {URL_SCHEME_HTTPS,S_OK,FALSE},
244 {URLZONE_INVALID,E_NOTIMPL,FALSE},
245 }
246 },
247 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
248 {
249 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
250 {"usEr%3Ainfo@example.com",S_OK,FALSE},
251 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
252 {"example.com",S_OK,FALSE},
253 {"",S_FALSE,FALSE},
254 {"",S_FALSE,FALSE},
255 {"example.com",S_OK,FALSE},
256 {"",S_FALSE,FALSE},
257 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
258 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
259 {"",S_FALSE,FALSE},
260 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
261 {"http",S_OK,FALSE},
262 {"usEr%3Ainfo",S_OK,FALSE},
263 {"usEr%3Ainfo",S_OK,FALSE}
264 },
265 {
266 {Uri_HOST_DNS,S_OK,FALSE},
267 {80,S_OK,FALSE},
268 {URL_SCHEME_HTTP,S_OK,FALSE},
269 {URLZONE_INVALID,E_NOTIMPL,FALSE},
270 }
271 },
272 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
273 {
274 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
275 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
276 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
277 {"winehq.org",S_OK,FALSE},
278 {".txt",S_OK,FALSE},
279 {"",S_FALSE,FALSE},
280 {"ftp.winehq.org",S_OK,FALSE},
281 {"wine",S_OK,FALSE},
282 {"/dir/foo%20bar.txt",S_OK,FALSE},
283 {"/dir/foo%20bar.txt",S_OK,FALSE},
284 {"",S_FALSE,FALSE},
285 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
286 {"ftp",S_OK,FALSE},
287 {"winepass:wine",S_OK,FALSE},
288 {"winepass",S_OK,FALSE}
289 },
290 {
291 {Uri_HOST_DNS,S_OK,FALSE},
292 {9999,S_OK,FALSE},
293 {URL_SCHEME_FTP,S_OK,FALSE},
294 {URLZONE_INVALID,E_NOTIMPL,FALSE}
295 }
296 },
297 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
298 {
299 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
300 {"",S_FALSE,FALSE},
301 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
302 {"",S_FALSE,FALSE},
303 {".mp3",S_OK,FALSE},
304 {"",S_FALSE,FALSE},
305 {"",S_FALSE,FALSE},
306 {"",S_FALSE,FALSE},
307 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
308 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
309 {"",S_FALSE,FALSE},
310 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
311 {"file",S_OK,FALSE},
312 {"",S_FALSE,FALSE},
313 {"",S_FALSE,FALSE}
314 },
315 {
316 {Uri_HOST_UNKNOWN,S_OK,FALSE},
317 {0,S_FALSE,FALSE},
318 {URL_SCHEME_FILE,S_OK,FALSE},
319 {URLZONE_INVALID,E_NOTIMPL,FALSE}
320 }
321 },
322 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
323 {
324 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
325 {"",S_FALSE,FALSE},
326 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
327 {"",S_FALSE,FALSE},
328 {".mp3",S_OK,FALSE},
329 {"",S_FALSE,FALSE},
330 {"",S_FALSE,FALSE},
331 {"",S_FALSE,FALSE},
332 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
333 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
334 {"",S_FALSE,FALSE},
335 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
336 {"file",S_OK,FALSE},
337 {"",S_FALSE,FALSE},
338 {"",S_FALSE,FALSE}
339 },
340 {
341 {Uri_HOST_UNKNOWN,S_OK,FALSE},
342 {0,S_FALSE,FALSE},
343 {URL_SCHEME_FILE,S_OK,FALSE},
344 {URLZONE_INVALID,E_NOTIMPL,FALSE}
345 }
346 },
347 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
348 {
349 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
350 {"",S_FALSE,FALSE},
351 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
352 {"",S_FALSE,FALSE},
353 {".txt",S_OK,FALSE},
354 {"",S_FALSE,FALSE},
355 {"",S_FALSE,FALSE},
356 {"",S_FALSE,FALSE},
357 {"/tests/test%20file.README.txt",S_OK,FALSE},
358 {"/tests/test%20file.README.txt",S_OK,FALSE},
359 {"",S_FALSE,FALSE},
360 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
361 {"file",S_OK,FALSE},
362 {"",S_FALSE,FALSE},
363 {"",S_FALSE,FALSE}
364 },
365 {
366 {Uri_HOST_UNKNOWN,S_OK,FALSE},
367 {0,S_FALSE,FALSE},
368 {URL_SCHEME_FILE,S_OK,FALSE},
369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
370 }
371 },
372 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
373 {
374 {"file:///z:/test%20dir/README.txt",S_OK},
375 {"",S_FALSE},
376 {"file:///z:/test%20dir/README.txt",S_OK},
377 {"",S_FALSE},
378 {".txt",S_OK},
379 {"",S_FALSE},
380 {"",S_FALSE},
381 {"",S_FALSE},
382 {"/z:/test%20dir/README.txt",S_OK},
383 {"/z:/test%20dir/README.txt",S_OK},
384 {"",S_FALSE},
385 {"file:///z:/test dir/README.txt",S_OK},
386 {"file",S_OK},
387 {"",S_FALSE},
388 {"",S_FALSE}
389 },
390 {
391 {Uri_HOST_UNKNOWN,S_OK,FALSE},
392 {0,S_FALSE,FALSE},
393 {URL_SCHEME_FILE,S_OK,FALSE},
394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
395 }
396 },
397 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
398 {
399 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
400 {"",S_FALSE},
401 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
402 {"",S_FALSE},
403 {".txt#hash%20part",S_OK},
404 {"",S_FALSE},
405 {"",S_FALSE},
406 {"",S_FALSE},
407 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
408 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
409 {"",S_FALSE},
410 {"file:///z:/test dir/README.txt#hash part",S_OK},
411 {"file",S_OK},
412 {"",S_FALSE},
413 {"",S_FALSE}
414 },
415 {
416 {Uri_HOST_UNKNOWN,S_OK,FALSE},
417 {0,S_FALSE,FALSE},
418 {URL_SCHEME_FILE,S_OK,FALSE},
419 {URLZONE_INVALID,E_NOTIMPL,FALSE}
420 }
421 },
422 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
423 {
424 {"urn:nothing:should:happen here",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {"urn:nothing:should:happen here",S_OK,FALSE},
427 {"",S_FALSE,FALSE},
428 {"",S_FALSE,FALSE},
429 {"",S_FALSE,FALSE},
430 {"",S_FALSE,FALSE},
431 {"",S_FALSE,FALSE},
432 {"nothing:should:happen here",S_OK,FALSE},
433 {"nothing:should:happen here",S_OK,FALSE},
434 {"",S_FALSE,FALSE},
435 {"urn:nothing:should:happen here",S_OK,FALSE},
436 {"urn",S_OK,FALSE},
437 {"",S_FALSE,FALSE},
438 {"",S_FALSE,FALSE}
439 },
440 {
441 {Uri_HOST_UNKNOWN,S_OK,FALSE},
442 {0,S_FALSE,FALSE},
443 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
444 {URLZONE_INVALID,E_NOTIMPL,FALSE}
445 }
446 },
447 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
448 {
449 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
450 {"127.0.0.1",S_OK,FALSE},
451 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
452 {"",S_FALSE,FALSE},
453 {".txt",S_OK,FALSE},
454 {"",S_FALSE,FALSE},
455 {"127.0.0.1",S_OK,FALSE},
456 {"",S_FALSE,FALSE},
457 {"/test%20dir/test.txt",S_OK,FALSE},
458 {"/test%20dir/test.txt",S_OK,FALSE},
459 {"",S_FALSE,FALSE},
460 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
461 {"http",S_OK,FALSE},
462 {"",S_FALSE,FALSE},
463 {"",S_FALSE,FALSE}
464 },
465 {
466 {Uri_HOST_IPV4,S_OK,FALSE},
467 {80,S_OK,FALSE},
468 {URL_SCHEME_HTTP,S_OK,FALSE},
469 {URLZONE_INVALID,E_NOTIMPL,FALSE}
470 }
471 },
472 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
473 {
474 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
475 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
476 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
477 {"",S_FALSE,FALSE},
478 {"",S_FALSE,FALSE},
479 {"",S_FALSE,FALSE},
480 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
481 {"",S_FALSE,FALSE},
482 {"/",S_OK,FALSE},
483 {"/",S_OK,FALSE},
484 {"",S_FALSE,FALSE},
485 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
486 {"http",S_OK,FALSE},
487 {"",S_FALSE,FALSE},
488 {"",S_FALSE,FALSE}
489 },
490 {
491 {Uri_HOST_IPV6,S_OK,FALSE},
492 {80,S_OK,FALSE},
493 {URL_SCHEME_HTTP,S_OK,FALSE},
494 {URLZONE_INVALID,E_NOTIMPL,FALSE}
495 }
496 },
497 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
498 {
499 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
500 {"[::13.1.68.3]",S_OK,FALSE},
501 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
502 {"",S_FALSE,FALSE},
503 {"",S_FALSE,FALSE},
504 {"",S_FALSE,FALSE},
505 {"::13.1.68.3",S_OK,FALSE},
506 {"",S_FALSE,FALSE},
507 {"/",S_OK,FALSE},
508 {"/",S_OK,FALSE},
509 {"",S_FALSE,FALSE},
510 {"ftp://[::13.1.68.3]",S_OK,FALSE},
511 {"ftp",S_OK,FALSE},
512 {"",S_FALSE,FALSE},
513 {"",S_FALSE,FALSE}
514 },
515 {
516 {Uri_HOST_IPV6,S_OK,FALSE},
517 {21,S_OK,FALSE},
518 {URL_SCHEME_FTP,S_OK,FALSE},
519 {URLZONE_INVALID,E_NOTIMPL,FALSE}
520 }
521 },
522 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
523 {
524 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
525 {"[fedc:ba98::3210]",S_OK,FALSE},
526 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
527 {"",S_FALSE,FALSE},
528 {"",S_FALSE,FALSE},
529 {"",S_FALSE,FALSE},
530 {"fedc:ba98::3210",S_OK,FALSE},
531 {"",S_FALSE,FALSE},
532 {"/",S_OK,FALSE},
533 {"/",S_OK,FALSE},
534 {"",S_FALSE,FALSE},
535 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
536 {"http",S_OK,FALSE},
537 {"",S_FALSE,FALSE},
538 {"",S_FALSE,FALSE},
539 },
540 {
541 {Uri_HOST_IPV6,S_OK,FALSE},
542 {80,S_OK,FALSE},
543 {URL_SCHEME_HTTP,S_OK,FALSE},
544 {URLZONE_INVALID,E_NOTIMPL,FALSE}
545 }
546 },
547 { "1234://www.winehq.org", 0, S_OK, FALSE,
548 {
549 {"1234://www.winehq.org/",S_OK,FALSE},
550 {"www.winehq.org",S_OK,FALSE},
551 {"1234://www.winehq.org/",S_OK,FALSE},
552 {"winehq.org",S_OK,FALSE},
553 {"",S_FALSE,FALSE},
554 {"",S_FALSE,FALSE},
555 {"www.winehq.org",S_OK,FALSE},
556 {"",S_FALSE,FALSE},
557 {"/",S_OK,FALSE},
558 {"/",S_OK,FALSE},
559 {"",S_FALSE,FALSE},
560 {"1234://www.winehq.org",S_OK,FALSE},
561 {"1234",S_OK,FALSE},
562 {"",S_FALSE,FALSE},
563 {"",S_FALSE,FALSE}
564 },
565 {
566 {Uri_HOST_DNS,S_OK,FALSE},
567 {0,S_FALSE,FALSE},
568 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
569 {URLZONE_INVALID,E_NOTIMPL,FALSE}
570 }
571 },
572 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
573 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
574 {
575 {"file:///C:/test/test.mp3",S_OK,FALSE},
576 {"",S_FALSE,FALSE},
577 {"file:///C:/test/test.mp3",S_OK,FALSE},
578 {"",S_FALSE,FALSE},
579 {".mp3",S_OK,FALSE},
580 {"",S_FALSE,FALSE},
581 {"",S_FALSE,FALSE},
582 {"",S_FALSE,FALSE},
583 {"/C:/test/test.mp3",S_OK,FALSE},
584 {"/C:/test/test.mp3",S_OK,FALSE},
585 {"",S_FALSE,FALSE},
586 {"C:/test/test.mp3",S_OK,FALSE},
587 {"file",S_OK,FALSE},
588 {"",S_FALSE,FALSE},
589 {"",S_FALSE,FALSE}
590 },
591 {
592 {Uri_HOST_UNKNOWN,S_OK,FALSE},
593 {0,S_FALSE,FALSE},
594 {URL_SCHEME_FILE,S_OK,FALSE},
595 {URLZONE_INVALID,E_NOTIMPL,FALSE}
596 }
597 },
598 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
599 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
600 {
601 {"file://server/test.mp3",S_OK,FALSE},
602 {"server",S_OK,FALSE},
603 {"file://server/test.mp3",S_OK,FALSE},
604 {"",S_FALSE,FALSE},
605 {".mp3",S_OK,FALSE},
606 {"",S_FALSE,FALSE},
607 {"server",S_OK,FALSE},
608 {"",S_FALSE,FALSE},
609 {"/test.mp3",S_OK,FALSE},
610 {"/test.mp3",S_OK,FALSE},
611 {"",S_FALSE,FALSE},
612 {"\\\\Server/test.mp3",S_OK,FALSE},
613 {"file",S_OK,FALSE},
614 {"",S_FALSE,FALSE},
615 {"",S_FALSE,FALSE}
616 },
617 {
618 {Uri_HOST_DNS,S_OK,FALSE},
619 {0,S_FALSE,FALSE},
620 {URL_SCHEME_FILE,S_OK,FALSE},
621 {URLZONE_INVALID,E_NOTIMPL,FALSE}
622 }
623 },
624 { "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,
625 {
626 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
627 {"",S_FALSE,FALSE},
628 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
629 {"",S_FALSE,FALSE},
630 {".mp3#fragment|part",S_OK,FALSE},
631 {"",S_FALSE,FALSE},
632 {"",S_FALSE,FALSE},
633 {"",S_FALSE,FALSE},
634 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
635 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
636 {"",S_FALSE,FALSE},
637 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
638 {"file",S_OK,FALSE},
639 {"",S_FALSE,FALSE},
640 {"",S_FALSE,FALSE}
641 },
642 {
643 {Uri_HOST_UNKNOWN,S_OK,FALSE},
644 {0,S_FALSE,FALSE},
645 {URL_SCHEME_FILE,S_OK,FALSE},
646 {URLZONE_INVALID,E_NOTIMPL,FALSE}
647 }
648 },
649 { "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,
650 {
651 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
652 {"",S_FALSE,FALSE},
653 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
654 {"",S_FALSE,FALSE},
655 {".mp3",S_OK,FALSE},
656 {"",S_FALSE,FALSE},
657 {"",S_FALSE,FALSE},
658 {"",S_FALSE,FALSE},
659 {"C:\\test\\test.mp3",S_OK,FALSE},
660 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
661 {"?query|part",S_OK,FALSE},
662 {"C:/test/test.mp3?query|part",S_OK,FALSE},
663 {"file",S_OK,FALSE},
664 {"",S_FALSE,FALSE},
665 {"",S_FALSE,FALSE}
666 },
667 {
668 {Uri_HOST_UNKNOWN,S_OK,FALSE},
669 {0,S_FALSE,FALSE},
670 {URL_SCHEME_FILE,S_OK,FALSE},
671 {URLZONE_INVALID,E_NOTIMPL,FALSE}
672 }
673 },
674 { "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,
675 {
676 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
677 {"",S_FALSE,FALSE},
678 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
679 {"",S_FALSE,FALSE},
680 {".mp3",S_OK,FALSE},
681 {"#hash|part",S_OK,FALSE},
682 {"",S_FALSE,FALSE},
683 {"",S_FALSE,FALSE},
684 {"C:\\test\\test.mp3",S_OK,FALSE},
685 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
686 {"?query|part",S_OK,FALSE},
687 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
688 {"file",S_OK,FALSE},
689 {"",S_FALSE,FALSE},
690 {"",S_FALSE,FALSE}
691 },
692 {
693 {Uri_HOST_UNKNOWN,S_OK,FALSE},
694 {0,S_FALSE,FALSE},
695 {URL_SCHEME_FILE,S_OK,FALSE},
696 {URLZONE_INVALID,E_NOTIMPL,FALSE}
697 }
698 },
699 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
700 {
701 {"*:www.winehq.org/test",S_OK,FALSE},
702 {"www.winehq.org",S_OK,FALSE},
703 {"*:www.winehq.org/test",S_OK,FALSE},
704 {"winehq.org",S_OK,FALSE},
705 {"",S_FALSE,FALSE},
706 {"",S_FALSE,FALSE},
707 {"www.winehq.org",S_OK,FALSE},
708 {"",S_FALSE,FALSE},
709 {"/test",S_OK,FALSE},
710 {"/test",S_OK,FALSE},
711 {"",S_FALSE,FALSE},
712 {"www.winehq.org/test",S_OK,FALSE},
713 {"*",S_OK,FALSE},
714 {"",S_FALSE,FALSE},
715 {"",S_FALSE,FALSE}
716 },
717 {
718 {Uri_HOST_DNS,S_OK,FALSE},
719 {0,S_FALSE,FALSE},
720 {URL_SCHEME_WILDCARD,S_OK,FALSE},
721 {URLZONE_INVALID,E_NOTIMPL,FALSE}
722 }
723 },
724 /* Valid since the '*' is the only character in the scheme name. */
725 { "*:www.winehq.org/test", 0, S_OK, FALSE,
726 {
727 {"*:www.winehq.org/test",S_OK,FALSE},
728 {"www.winehq.org",S_OK,FALSE},
729 {"*:www.winehq.org/test",S_OK,FALSE},
730 {"winehq.org",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"",S_FALSE,FALSE},
733 {"www.winehq.org",S_OK,FALSE},
734 {"",S_FALSE,FALSE},
735 {"/test",S_OK,FALSE},
736 {"/test",S_OK,FALSE},
737 {"",S_FALSE,FALSE},
738 {"*:www.winehq.org/test",S_OK,FALSE},
739 {"*",S_OK,FALSE},
740 {"",S_FALSE,FALSE},
741 {"",S_FALSE,FALSE}
742 },
743 {
744 {Uri_HOST_DNS,S_OK,FALSE},
745 {0,S_FALSE,FALSE},
746 {URL_SCHEME_WILDCARD,S_OK,FALSE},
747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
748 }
749 },
750 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
751 {
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 {".ext",S_OK,FALSE},
757 {"",S_FALSE,FALSE},
758 {"",S_FALSE,FALSE},
759 {"",S_FALSE,FALSE},
760 {"/../some dir/test.ext",S_OK,FALSE},
761 {"/../some dir/test.ext",S_OK,FALSE},
762 {"",S_FALSE,FALSE},
763 {"/../some dir/test.ext",S_OK,FALSE},
764 {"",S_FALSE,FALSE},
765 {"",S_FALSE,FALSE},
766 {"",S_FALSE,FALSE}
767 },
768 {
769 {Uri_HOST_UNKNOWN,S_OK,FALSE},
770 {0,S_FALSE,FALSE},
771 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
773 }
774 },
775 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
776 {
777 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
778 {"",S_OK,FALSE},
779 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
780 {"",S_FALSE,FALSE},
781 {"",S_FALSE,FALSE},
782 {"",S_FALSE,FALSE},
783 {"",S_OK,FALSE},
784 {"",S_FALSE,FALSE},
785 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
786 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
787 {"",S_FALSE,FALSE},
788 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
789 {"*",S_OK,FALSE},
790 {"",S_FALSE,FALSE},
791 {"",S_FALSE,FALSE},
792 },
793 {
794 {Uri_HOST_UNKNOWN,S_OK,FALSE},
795 {0,S_FALSE,FALSE},
796 {URL_SCHEME_WILDCARD,S_OK,FALSE},
797 {URLZONE_INVALID,E_NOTIMPL,FALSE}
798 }
799 },
800 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
801 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
802 {
803 {"zip:/.//google.com",S_OK,FALSE},
804 {"",S_FALSE,FALSE},
805 {"zip:/.//google.com",S_OK,FALSE},
806 {"",S_FALSE,FALSE},
807 {".com",S_OK,FALSE},
808 {"",S_FALSE,FALSE},
809 {"",S_FALSE,FALSE},
810 {"",S_FALSE,FALSE},
811 {"/.//google.com",S_OK,FALSE},
812 {"/.//google.com",S_OK,FALSE},
813 {"",S_FALSE,FALSE},
814 {"zip://google.com",S_OK,FALSE},
815 {"zip",S_OK,FALSE},
816 {"",S_FALSE,FALSE},
817 {"",S_FALSE,FALSE}
818 },
819 {
820 {Uri_HOST_UNKNOWN,S_OK,FALSE},
821 {0,S_FALSE,FALSE},
822 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
823 {URLZONE_INVALID,E_NOTIMPL,FALSE}
824 }
825 },
826 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
827 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
828 {
829 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
830 {"user:pass:word@winehq.org",S_OK,FALSE},
831 {"ftp://winehq.org/",S_OK,FALSE},
832 {"winehq.org",S_OK,FALSE},
833 {"",S_FALSE,FALSE},
834 {"",S_FALSE,FALSE},
835 {"winehq.org",S_OK,FALSE},
836 {"pass:word",S_OK,FALSE},
837 {"/",S_OK,FALSE},
838 {"/",S_OK,FALSE},
839 {"",S_FALSE,FALSE},
840 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
841 {"ftp",S_OK,FALSE},
842 {"user:pass:word",S_OK,FALSE},
843 {"user",S_OK,FALSE}
844 },
845 {
846 {Uri_HOST_DNS,S_OK,FALSE},
847 {21,S_OK,FALSE},
848 {URL_SCHEME_FTP,S_OK,FALSE},
849 {URLZONE_INVALID,E_NOTIMPL,FALSE}
850 }
851 },
852 /* Make sure % encoded unreserved characters are decoded. */
853 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
854 {
855 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
856 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
857 {"ftp://ftp.google.com/",S_OK,FALSE},
858 {"google.com",S_OK,FALSE},
859 {"",S_FALSE,FALSE},
860 {"",S_FALSE,FALSE},
861 {"ftp.google.com",S_OK,FALSE},
862 {"PASS",S_OK,FALSE},
863 {"/",S_OK,FALSE},
864 {"/",S_OK,FALSE},
865 {"",S_FALSE,FALSE},
866 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
867 {"ftp",S_OK,FALSE},
868 {"wINe:PASS",S_OK,FALSE},
869 {"wINe",S_OK,FALSE}
870 },
871 {
872 {Uri_HOST_DNS,S_OK,FALSE},
873 {21,S_OK,FALSE},
874 {URL_SCHEME_FTP,S_OK,FALSE},
875 {URLZONE_INVALID,E_NOTIMPL,FALSE}
876 }
877 },
878 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
879 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
880 {
881 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
882 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
883 {"ftp://ftp.google.com/",S_OK,FALSE},
884 {"google.com",S_OK,FALSE},
885 {"",S_FALSE,FALSE},
886 {"",S_FALSE,FALSE},
887 {"ftp.google.com",S_OK,FALSE},
888 {"PA%7B%7D",S_OK,FALSE},
889 {"/",S_OK,FALSE},
890 {"/",S_OK,FALSE},
891 {"",S_FALSE,FALSE},
892 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
893 {"ftp",S_OK,FALSE},
894 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
895 {"w%5D%5Be",S_OK,FALSE}
896 },
897 {
898 {Uri_HOST_DNS,S_OK,FALSE},
899 {21,S_OK,FALSE},
900 {URL_SCHEME_FTP,S_OK,FALSE},
901 {URLZONE_INVALID,E_NOTIMPL,FALSE}
902 }
903 },
904 /* You're allowed to have an empty password portion in the userinfo section. */
905 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
906 {
907 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
908 {"empty:@ftp.google.com",S_OK,FALSE},
909 {"ftp://ftp.google.com/",S_OK,FALSE},
910 {"google.com",S_OK,FALSE},
911 {"",S_FALSE,FALSE},
912 {"",S_FALSE,FALSE},
913 {"ftp.google.com",S_OK,FALSE},
914 {"",S_OK,FALSE},
915 {"/",S_OK,FALSE},
916 {"/",S_OK,FALSE},
917 {"",S_FALSE,FALSE},
918 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
919 {"ftp",S_OK,FALSE},
920 {"empty:",S_OK,FALSE},
921 {"empty",S_OK,FALSE}
922 },
923 {
924 {Uri_HOST_DNS,S_OK,FALSE},
925 {21,S_OK,FALSE},
926 {URL_SCHEME_FTP,S_OK,FALSE},
927 {URLZONE_INVALID,E_NOTIMPL,FALSE}
928 }
929 },
930 /* Make sure forbidden characters in "userinfo" get encoded. */
931 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
932 {
933 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
934 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
935 {"ftp://ftp.google.com/",S_OK,FALSE},
936 {"google.com",S_OK,FALSE},
937 {"",S_FALSE,FALSE},
938 {"",S_FALSE,FALSE},
939 {"ftp.google.com",S_OK,FALSE},
940 {"",S_FALSE,FALSE},
941 {"/",S_OK,FALSE},
942 {"/",S_OK,FALSE},
943 {"",S_FALSE,FALSE},
944 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
945 {"ftp",S_OK,FALSE},
946 {"%22%20%22weird",S_OK,FALSE},
947 {"%22%20%22weird",S_OK,FALSE}
948 },
949 {
950 {Uri_HOST_DNS,S_OK,FALSE},
951 {21,S_OK,FALSE},
952 {URL_SCHEME_FTP,S_OK,FALSE},
953 {URLZONE_INVALID,E_NOTIMPL,FALSE}
954 }
955 },
956 /* Make sure the forbidden characters don't get percent encoded. */
957 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
958 {
959 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
960 {"\" \"weird@ftp.google.com",S_OK,FALSE},
961 {"ftp://ftp.google.com/",S_OK,FALSE},
962 {"google.com",S_OK,FALSE},
963 {"",S_FALSE,FALSE},
964 {"",S_FALSE,FALSE},
965 {"ftp.google.com",S_OK,FALSE},
966 {"",S_FALSE,FALSE},
967 {"/",S_OK,FALSE},
968 {"/",S_OK,FALSE},
969 {"",S_FALSE,FALSE},
970 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
971 {"ftp",S_OK,FALSE},
972 {"\" \"weird",S_OK,FALSE},
973 {"\" \"weird",S_OK,FALSE}
974 },
975 {
976 {Uri_HOST_DNS,S_OK,FALSE},
977 {21,S_OK,FALSE},
978 {URL_SCHEME_FTP,S_OK,FALSE},
979 {URLZONE_INVALID,E_NOTIMPL,FALSE}
980 }
981 },
982 /* Make sure already percent encoded characters don't get unencoded. */
983 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
984 {
985 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
986 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
987 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
988 {"google.com",S_OK,FALSE},
989 {"",S_FALSE,FALSE},
990 {"",S_FALSE,FALSE},
991 {"ftp.google.com",S_OK,FALSE},
992 {"",S_FALSE,FALSE},
993 {"/\"%20\"weird",S_OK,FALSE},
994 {"/\"%20\"weird",S_OK,FALSE},
995 {"",S_FALSE,FALSE},
996 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
997 {"ftp",S_OK,FALSE},
998 {"\"%20\"weird",S_OK,FALSE},
999 {"\"%20\"weird",S_OK,FALSE}
1000 },
1001 {
1002 {Uri_HOST_DNS,S_OK,FALSE},
1003 {21,S_OK,FALSE},
1004 {URL_SCHEME_FTP,S_OK,FALSE},
1005 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1006 }
1007 },
1008 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1009 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1010 {
1011 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1012 {"%xy:word@winehq.org",S_OK,FALSE},
1013 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1014 {"winehq.org",S_OK,FALSE},
1015 {"",S_FALSE,FALSE},
1016 {"",S_FALSE,FALSE},
1017 {"winehq.org",S_OK,FALSE},
1018 {"word",S_OK,FALSE},
1019 {"/",S_OK,FALSE},
1020 {"/",S_OK,FALSE},
1021 {"",S_FALSE,FALSE},
1022 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1023 {"zip",S_OK,FALSE},
1024 {"%xy:word",S_OK,FALSE},
1025 {"%xy",S_OK,FALSE}
1026 },
1027 {
1028 {Uri_HOST_DNS,S_OK,FALSE},
1029 {0,S_FALSE,FALSE},
1030 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1031 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1032 }
1033 },
1034 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1035 * isn't known.
1036 */
1037 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1038 {
1039 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1040 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1041 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1042 {"winehq.org",S_OK,FALSE},
1043 {"",S_FALSE,FALSE},
1044 {"",S_FALSE,FALSE},
1045 {"winehq.org",S_OK,FALSE},
1046 {"%52%53ord",S_OK,FALSE},
1047 {"/",S_OK,FALSE},
1048 {"/",S_OK,FALSE},
1049 {"",S_FALSE,FALSE},
1050 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1051 {"zip",S_OK,FALSE},
1052 {"%2E:%52%53ord",S_OK,FALSE},
1053 {"%2E",S_OK,FALSE}
1054 },
1055 {
1056 {Uri_HOST_DNS,S_OK,FALSE},
1057 {0,S_FALSE,FALSE},
1058 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1059 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1060 }
1061 },
1062 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1063 {
1064 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1065 {"[](),'test':word@winehq.org",S_OK,FALSE},
1066 {"ftp://winehq.org/",S_OK,FALSE},
1067 {"winehq.org",S_OK,FALSE},
1068 {"",S_FALSE,FALSE},
1069 {"",S_FALSE,FALSE},
1070 {"winehq.org",S_OK,FALSE},
1071 {"word",S_OK,FALSE},
1072 {"/",S_OK,FALSE},
1073 {"/",S_OK,FALSE},
1074 {"",S_FALSE,FALSE},
1075 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1076 {"ftp",S_OK,FALSE},
1077 {"[](),'test':word",S_OK,FALSE},
1078 {"[](),'test'",S_OK,FALSE}
1079 },
1080 {
1081 {Uri_HOST_DNS,S_OK,FALSE},
1082 {21,S_OK,FALSE},
1083 {URL_SCHEME_FTP,S_OK,FALSE},
1084 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1085 }
1086 },
1087 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1088 {
1089 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1090 {"test",S_OK,FALSE},
1091 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1092 {"",S_FALSE,FALSE},
1093 {"",S_FALSE,FALSE},
1094 {"",S_FALSE,FALSE},
1095 {"test",S_OK,FALSE},
1096 {"",S_FALSE,FALSE},
1097 {"/",S_OK,FALSE},
1098 {"/?:word@winehq.org/",S_OK,FALSE},
1099 {"?:word@winehq.org/",S_OK,FALSE},
1100 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1101 {"ftp",S_OK,FALSE},
1102 {"",S_FALSE,FALSE},
1103 {"",S_FALSE,FALSE}
1104 },
1105 {
1106 {Uri_HOST_DNS,S_OK,FALSE},
1107 {21,S_OK,FALSE},
1108 {URL_SCHEME_FTP,S_OK,FALSE},
1109 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1110 }
1111 },
1112 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1113 {
1114 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1115 {"test",S_OK,FALSE},
1116 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1117 {"",S_FALSE,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"#:word@winehq.org/",S_OK,FALSE},
1120 {"test",S_OK,FALSE},
1121 {"",S_FALSE,FALSE},
1122 {"/",S_OK,FALSE},
1123 {"/",S_OK,FALSE},
1124 {"",S_FALSE,FALSE},
1125 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1126 {"ftp",S_OK,FALSE},
1127 {"",S_FALSE,FALSE},
1128 {"",S_FALSE,FALSE}
1129 },
1130 {
1131 {Uri_HOST_DNS,S_OK,FALSE},
1132 {21,S_OK,FALSE},
1133 {URL_SCHEME_FTP,S_OK,FALSE},
1134 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1135 }
1136 },
1137 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1138 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1139 {
1140 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1141 {"test\\:word@winehq.org",S_OK,FALSE},
1142 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1143 {"winehq.org",S_OK,FALSE},
1144 {"",S_FALSE,FALSE},
1145 {"",S_FALSE,FALSE},
1146 {"winehq.org",S_OK,FALSE},
1147 {"word",S_OK,FALSE},
1148 {"/",S_OK,FALSE},
1149 {"/",S_OK,FALSE},
1150 {"",S_FALSE,FALSE},
1151 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1152 {"zip",S_OK,FALSE},
1153 {"test\\:word",S_OK,FALSE},
1154 {"test\\",S_OK,FALSE}
1155 },
1156 {
1157 {Uri_HOST_DNS,S_OK,FALSE},
1158 {0,S_FALSE,FALSE},
1159 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1160 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1161 }
1162 },
1163 /* It normalizes IPv4 addresses correctly. */
1164 { "http://127.000.000.100/", 0, S_OK, FALSE,
1165 {
1166 {"http://127.0.0.100/",S_OK,FALSE},
1167 {"127.0.0.100",S_OK,FALSE},
1168 {"http://127.0.0.100/",S_OK,FALSE},
1169 {"",S_FALSE,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"",S_FALSE,FALSE},
1172 {"127.0.0.100",S_OK,FALSE},
1173 {"",S_FALSE,FALSE},
1174 {"/",S_OK,FALSE},
1175 {"/",S_OK,FALSE},
1176 {"",S_FALSE,FALSE},
1177 {"http://127.000.000.100/",S_OK,FALSE},
1178 {"http",S_OK,FALSE},
1179 {"",S_FALSE,FALSE},
1180 {"",S_FALSE,FALSE}
1181 },
1182 {
1183 {Uri_HOST_IPV4,S_OK,FALSE},
1184 {80,S_OK,FALSE},
1185 {URL_SCHEME_HTTP,S_OK,FALSE},
1186 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1187 }
1188 },
1189 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1190 {
1191 {"http://127.0.0.1:8000/",S_OK},
1192 {"127.0.0.1:8000",S_OK},
1193 {"http://127.0.0.1:8000/",S_OK},
1194 {"",S_FALSE},
1195 {"",S_FALSE},
1196 {"",S_FALSE},
1197 {"127.0.0.1",S_OK},
1198 {"",S_FALSE},
1199 {"/",S_OK},
1200 {"/",S_OK},
1201 {"",S_FALSE},
1202 {"http://127.0.0.1:8000",S_OK},
1203 {"http",S_OK},
1204 {"",S_FALSE},
1205 {"",S_FALSE}
1206 },
1207 {
1208 {Uri_HOST_IPV4,S_OK,FALSE},
1209 {8000,S_OK,FALSE},
1210 {URL_SCHEME_HTTP,S_OK,FALSE},
1211 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1212 }
1213 },
1214 /* Make sure it normalizes partial IPv4 addresses correctly. */
1215 { "http://127.0/", 0, S_OK, FALSE,
1216 {
1217 {"http://127.0.0.0/",S_OK,FALSE},
1218 {"127.0.0.0",S_OK,FALSE},
1219 {"http://127.0.0.0/",S_OK,FALSE},
1220 {"",S_FALSE,FALSE},
1221 {"",S_FALSE,FALSE},
1222 {"",S_FALSE,FALSE},
1223 {"127.0.0.0",S_OK,FALSE},
1224 {"",S_FALSE,FALSE},
1225 {"/",S_OK,FALSE},
1226 {"/",S_OK,FALSE},
1227 {"",S_FALSE,FALSE},
1228 {"http://127.0/",S_OK,FALSE},
1229 {"http",S_OK,FALSE},
1230 {"",S_FALSE,FALSE},
1231 {"",S_FALSE,FALSE}
1232 },
1233 {
1234 {Uri_HOST_IPV4,S_OK,FALSE},
1235 {80,S_OK,FALSE},
1236 {URL_SCHEME_HTTP,S_OK,FALSE},
1237 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1238 }
1239 },
1240 /* Make sure it converts implicit IPv4's correctly. */
1241 { "http://123456/", 0, S_OK, FALSE,
1242 {
1243 {"http://0.1.226.64/",S_OK,FALSE},
1244 {"0.1.226.64",S_OK,FALSE},
1245 {"http://0.1.226.64/",S_OK,FALSE},
1246 {"",S_FALSE,FALSE},
1247 {"",S_FALSE,FALSE},
1248 {"",S_FALSE,FALSE},
1249 {"0.1.226.64",S_OK,FALSE},
1250 {"",S_FALSE,FALSE},
1251 {"/",S_OK,FALSE},
1252 {"/",S_OK,FALSE},
1253 {"",S_FALSE,FALSE},
1254 {"http://123456/",S_OK,FALSE},
1255 {"http",S_OK,FALSE},
1256 {"",S_FALSE,FALSE},
1257 {"",S_FALSE,FALSE}
1258 },
1259 {
1260 {Uri_HOST_IPV4,S_OK,FALSE},
1261 {80,S_OK,FALSE},
1262 {URL_SCHEME_HTTP,S_OK,FALSE},
1263 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1264 }
1265 },
1266 /* UINT_MAX */
1267 { "http://4294967295/", 0, S_OK, FALSE,
1268 {
1269 {"http://255.255.255.255/",S_OK,FALSE},
1270 {"255.255.255.255",S_OK,FALSE},
1271 {"http://255.255.255.255/",S_OK,FALSE},
1272 {"",S_FALSE,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"",S_FALSE,FALSE},
1275 {"255.255.255.255",S_OK,FALSE},
1276 {"",S_FALSE,FALSE},
1277 {"/",S_OK,FALSE},
1278 {"/",S_OK,FALSE},
1279 {"",S_FALSE,FALSE},
1280 {"http://4294967295/",S_OK,FALSE},
1281 {"http",S_OK,FALSE},
1282 {"",S_FALSE,FALSE},
1283 {"",S_FALSE,FALSE}
1284 },
1285 {
1286 {Uri_HOST_IPV4,S_OK,FALSE},
1287 {80,S_OK,FALSE},
1288 {URL_SCHEME_HTTP,S_OK,FALSE},
1289 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1290 }
1291 },
1292 /* UINT_MAX+1 */
1293 { "http://4294967296/", 0, S_OK, FALSE,
1294 {
1295 {"http://4294967296/",S_OK,FALSE},
1296 {"4294967296",S_OK,FALSE},
1297 {"http://4294967296/",S_OK,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"",S_FALSE,FALSE},
1300 {"",S_FALSE,FALSE},
1301 {"4294967296",S_OK,FALSE},
1302 {"",S_FALSE,FALSE},
1303 {"/",S_OK,FALSE},
1304 {"/",S_OK,FALSE},
1305 {"",S_FALSE,FALSE},
1306 {"http://4294967296/",S_OK,FALSE},
1307 {"http",S_OK,FALSE},
1308 {"",S_FALSE,FALSE},
1309 {"",S_FALSE,FALSE}
1310 },
1311 {
1312 {Uri_HOST_DNS,S_OK,FALSE},
1313 {80,S_OK,FALSE},
1314 {URL_SCHEME_HTTP,S_OK,FALSE},
1315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1316 }
1317 },
1318 /* Window's doesn't normalize IP address for unknown schemes. */
1319 { "1234://4294967295/", 0, S_OK, FALSE,
1320 {
1321 {"1234://4294967295/",S_OK,FALSE},
1322 {"4294967295",S_OK,FALSE},
1323 {"1234://4294967295/",S_OK,FALSE},
1324 {"",S_FALSE,FALSE},
1325 {"",S_FALSE,FALSE},
1326 {"",S_FALSE,FALSE},
1327 {"4294967295",S_OK,FALSE},
1328 {"",S_FALSE,FALSE},
1329 {"/",S_OK,FALSE},
1330 {"/",S_OK,FALSE},
1331 {"",S_FALSE,FALSE},
1332 {"1234://4294967295/",S_OK,FALSE},
1333 {"1234",S_OK,FALSE},
1334 {"",S_FALSE,FALSE},
1335 {"",S_FALSE,FALSE}
1336 },
1337 {
1338 {Uri_HOST_IPV4,S_OK,FALSE},
1339 {0,S_FALSE,FALSE},
1340 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1341 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1342 }
1343 },
1344 /* Window's doesn't normalize IP address for unknown schemes. */
1345 { "1234://127.001/", 0, S_OK, FALSE,
1346 {
1347 {"1234://127.001/",S_OK,FALSE},
1348 {"127.001",S_OK,FALSE},
1349 {"1234://127.001/",S_OK,FALSE},
1350 {"",S_FALSE,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"",S_FALSE,FALSE},
1353 {"127.001",S_OK,FALSE},
1354 {"",S_FALSE,FALSE},
1355 {"/",S_OK,FALSE},
1356 {"/",S_OK,FALSE},
1357 {"",S_FALSE,FALSE},
1358 {"1234://127.001/",S_OK,FALSE},
1359 {"1234",S_OK,FALSE},
1360 {"",S_FALSE,FALSE},
1361 {"",S_FALSE,FALSE}
1362 },
1363 {
1364 {Uri_HOST_IPV4,S_OK,FALSE},
1365 {0,S_FALSE,FALSE},
1366 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1367 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1368 }
1369 },
1370 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1371 {
1372 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1373 {"[fedc:ba98::3210]",S_OK,FALSE},
1374 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1375 {"",S_FALSE,FALSE},
1376 {"",S_FALSE,FALSE},
1377 {"",S_FALSE,FALSE},
1378 {"fedc:ba98::3210",S_OK,FALSE},
1379 {"",S_FALSE,FALSE},
1380 {"/",S_OK,FALSE},
1381 {"/",S_OK,FALSE},
1382 {"",S_FALSE,FALSE},
1383 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1384 {"http",S_OK,FALSE},
1385 {"",S_FALSE,FALSE},
1386 {"",S_FALSE,FALSE},
1387 },
1388 {
1389 {Uri_HOST_IPV6,S_OK,FALSE},
1390 {80,S_OK,FALSE},
1391 {URL_SCHEME_HTTP,S_OK,FALSE},
1392 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1393 }
1394 },
1395 { "http://[::]", 0, S_OK, FALSE,
1396 {
1397 {"http://[::]/",S_OK,FALSE},
1398 {"[::]",S_OK,FALSE},
1399 {"http://[::]/",S_OK,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"",S_FALSE,FALSE},
1402 {"",S_FALSE,FALSE},
1403 {"::",S_OK,FALSE},
1404 {"",S_FALSE,FALSE},
1405 {"/",S_OK,FALSE},
1406 {"/",S_OK,FALSE},
1407 {"",S_FALSE,FALSE},
1408 {"http://[::]",S_OK,FALSE},
1409 {"http",S_OK,FALSE},
1410 {"",S_FALSE,FALSE},
1411 {"",S_FALSE,FALSE},
1412 },
1413 {
1414 {Uri_HOST_IPV6,S_OK,FALSE},
1415 {80,S_OK,FALSE},
1416 {URL_SCHEME_HTTP,S_OK,FALSE},
1417 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1418 }
1419 },
1420 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1421 {
1422 {"http://[fedc:ba98::]/",S_OK,FALSE},
1423 {"[fedc:ba98::]",S_OK,FALSE},
1424 {"http://[fedc:ba98::]/",S_OK,FALSE},
1425 {"",S_FALSE,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"",S_FALSE,FALSE},
1428 {"fedc:ba98::",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"/",S_OK,FALSE},
1431 {"/",S_OK,FALSE},
1432 {"",S_FALSE,FALSE},
1433 {"http://[FEDC:BA98::]",S_OK,FALSE},
1434 {"http",S_OK,FALSE},
1435 {"",S_FALSE,FALSE},
1436 {"",S_FALSE,FALSE},
1437 },
1438 {
1439 {Uri_HOST_IPV6,S_OK,FALSE},
1440 {80,S_OK,FALSE},
1441 {URL_SCHEME_HTTP,S_OK,FALSE},
1442 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1443 }
1444 },
1445 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1446 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1447 {
1448 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1449 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1450 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1451 {"",S_FALSE,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"",S_FALSE,FALSE},
1454 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"/",S_OK,FALSE},
1457 {"/",S_OK,FALSE},
1458 {"",S_FALSE,FALSE},
1459 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1460 {"http",S_OK,FALSE},
1461 {"",S_FALSE,FALSE},
1462 {"",S_FALSE,FALSE},
1463 },
1464 {
1465 {Uri_HOST_IPV6,S_OK,FALSE},
1466 {80,S_OK,FALSE},
1467 {URL_SCHEME_HTTP,S_OK,FALSE},
1468 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1469 }
1470 },
1471 { "http://[v2.34]/", 0, S_OK, FALSE,
1472 {
1473 {"http://[v2.34]/",S_OK,FALSE},
1474 {"[v2.34]",S_OK,FALSE},
1475 {"http://[v2.34]/",S_OK,FALSE},
1476 {"",S_FALSE,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"",S_FALSE,FALSE},
1479 {"[v2.34]",S_OK,FALSE},
1480 {"",S_FALSE,FALSE},
1481 {"/",S_OK,FALSE},
1482 {"/",S_OK,FALSE},
1483 {"",S_FALSE,FALSE},
1484 {"http://[v2.34]/",S_OK,FALSE},
1485 {"http",S_OK,FALSE},
1486 {"",S_FALSE,FALSE},
1487 {"",S_FALSE,FALSE}
1488 },
1489 {
1490 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1491 {80,S_OK,FALSE},
1492 {URL_SCHEME_HTTP,S_OK,FALSE},
1493 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1494 }
1495 },
1496 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1497 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1498 {
1499 {"http://[xyz:12345.com/test",S_OK,FALSE},
1500 {"[xyz:12345.com",S_OK,FALSE},
1501 {"http://[xyz:12345.com/test",S_OK,FALSE},
1502 {"[xyz:12345.com",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"",S_FALSE,FALSE},
1505 {"[xyz:12345.com",S_OK,FALSE},
1506 {"",S_FALSE,FALSE},
1507 {"/test",S_OK,FALSE},
1508 {"/test",S_OK,FALSE},
1509 {"",S_FALSE,FALSE},
1510 {"http://[xyz:12345.com/test",S_OK,FALSE},
1511 {"http",S_OK,FALSE},
1512 {"",S_FALSE,FALSE},
1513 {"",S_FALSE,FALSE}
1514 },
1515 {
1516 {Uri_HOST_DNS,S_OK,FALSE},
1517 {80,S_OK,FALSE},
1518 {URL_SCHEME_HTTP,S_OK,FALSE},
1519 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1520 }
1521 },
1522 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1523 * of the host name (respectively).
1524 */
1525 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1526 {
1527 {"ftp://www.[works].com/",S_OK,FALSE},
1528 {"www.[works].com",S_OK,FALSE},
1529 {"ftp://www.[works].com/",S_OK,FALSE},
1530 {"[works].com",S_OK,FALSE},
1531 {"",S_FALSE,FALSE},
1532 {"",S_FALSE,FALSE},
1533 {"www.[works].com",S_OK,FALSE},
1534 {"",S_FALSE,FALSE},
1535 {"/",S_OK,FALSE},
1536 {"/",S_OK,FALSE},
1537 {"",S_FALSE,FALSE},
1538 {"ftp://www.[works].com/",S_OK,FALSE},
1539 {"ftp",S_OK,FALSE},
1540 {"",S_FALSE,FALSE},
1541 {"",S_FALSE,FALSE}
1542 },
1543 {
1544 {Uri_HOST_DNS,S_OK,FALSE},
1545 {21,S_OK,FALSE},
1546 {URL_SCHEME_FTP,S_OK,FALSE},
1547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1548 }
1549 },
1550 /* Considers ':' a delimiter since it appears after the ']'. */
1551 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1552 {
1553 {"http://www.google.com]:12345/",S_OK,FALSE},
1554 {"www.google.com]:12345",S_OK,FALSE},
1555 {"http://www.google.com]:12345/",S_OK,FALSE},
1556 {"google.com]",S_OK,FALSE},
1557 {"",S_FALSE,FALSE},
1558 {"",S_FALSE,FALSE},
1559 {"www.google.com]",S_OK,FALSE},
1560 {"",S_FALSE,FALSE},
1561 {"/",S_OK,FALSE},
1562 {"/",S_OK,FALSE},
1563 {"",S_FALSE,FALSE},
1564 {"http://www.google.com]:12345/",S_OK,FALSE},
1565 {"http",S_OK,FALSE},
1566 {"",S_FALSE,FALSE},
1567 {"",S_FALSE,FALSE}
1568 },
1569 {
1570 {Uri_HOST_DNS,S_OK,FALSE},
1571 {12345,S_OK,FALSE},
1572 {URL_SCHEME_HTTP,S_OK,FALSE},
1573 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1574 }
1575 },
1576 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1577 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1578 {
1579 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1580 {"w%XXw%GEw.google.com",S_OK,FALSE},
1581 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1582 {"google.com",S_OK,FALSE},
1583 {"",S_FALSE,FALSE},
1584 {"",S_FALSE,FALSE},
1585 {"w%XXw%GEw.google.com",S_OK,FALSE},
1586 {"",S_FALSE,FALSE},
1587 {"/",S_OK,FALSE},
1588 {"/",S_OK,FALSE},
1589 {"",S_FALSE,FALSE},
1590 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1591 {"zip",S_OK,FALSE},
1592 {"",S_FALSE,FALSE},
1593 {"",S_FALSE,FALSE}
1594 },
1595 {
1596 {Uri_HOST_DNS,S_OK,FALSE},
1597 {0,S_FALSE,FALSE},
1598 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1599 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1600 }
1601 },
1602 /* Unknown scheme types hostname doesn't get lower cased. */
1603 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1604 {
1605 {"zip://GOOGLE.com/",S_OK,FALSE},
1606 {"GOOGLE.com",S_OK,FALSE},
1607 {"zip://GOOGLE.com/",S_OK,FALSE},
1608 {"GOOGLE.com",S_OK,FALSE},
1609 {"",S_FALSE,FALSE},
1610 {"",S_FALSE,FALSE},
1611 {"GOOGLE.com",S_OK,FALSE},
1612 {"",S_FALSE,FALSE},
1613 {"/",S_OK,FALSE},
1614 {"/",S_OK,FALSE},
1615 {"",S_FALSE,FALSE},
1616 {"zip://GOOGLE.com/",S_OK,FALSE},
1617 {"zip",S_OK,FALSE},
1618 {"",S_FALSE,FALSE},
1619 {"",S_FALSE,FALSE}
1620 },
1621 {
1622 {Uri_HOST_DNS,S_OK,FALSE},
1623 {0,S_FALSE,FALSE},
1624 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1626 }
1627 },
1628 /* Hostname gets lower-cased for known scheme types. */
1629 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1630 {
1631 {"http://www.google.com/",S_OK,FALSE},
1632 {"www.google.com",S_OK,FALSE},
1633 {"http://www.google.com/",S_OK,FALSE},
1634 {"google.com",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"",S_FALSE,FALSE},
1637 {"www.google.com",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"/",S_OK,FALSE},
1640 {"/",S_OK,FALSE},
1641 {"",S_FALSE,FALSE},
1642 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1643 {"http",S_OK,FALSE},
1644 {"",S_FALSE,FALSE},
1645 {"",S_FALSE,FALSE}
1646 },
1647 {
1648 {Uri_HOST_DNS,S_OK,FALSE},
1649 {80,S_OK,FALSE},
1650 {URL_SCHEME_HTTP,S_OK,FALSE},
1651 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1652 }
1653 },
1654 /* Characters that get % encoded in the hostname also have their percent
1655 * encoded forms lower cased.
1656 */
1657 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1658 {
1659 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1660 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1661 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1662 {"%7cgoogle%7c.com",S_OK,FALSE},
1663 {"",S_FALSE,FALSE},
1664 {"",S_FALSE,FALSE},
1665 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1666 {"",S_FALSE,FALSE},
1667 {"/",S_OK,FALSE},
1668 {"/",S_OK,FALSE},
1669 {"",S_FALSE,FALSE},
1670 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1671 {"http",S_OK,FALSE},
1672 {"",S_FALSE,FALSE},
1673 {"",S_FALSE,FALSE}
1674 },
1675 {
1676 {Uri_HOST_DNS,S_OK,FALSE},
1677 {80,S_OK,FALSE},
1678 {URL_SCHEME_HTTP,S_OK,FALSE},
1679 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1680 }
1681 },
1682 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1683 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1684 {
1685 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1686 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1687 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1688 {"",S_FALSE,FALSE},
1689 {"",S_FALSE,FALSE},
1690 {"",S_FALSE,FALSE},
1691 {"1:2:3:4:5:6::",S_OK,FALSE},
1692 {"",S_FALSE,FALSE},
1693 {"/",S_OK,FALSE},
1694 {"/",S_OK,FALSE},
1695 {"",S_FALSE,FALSE},
1696 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1697 {"http",S_OK,FALSE},
1698 {"",S_FALSE,FALSE},
1699 {"",S_FALSE,FALSE},
1700 },
1701 {
1702 {Uri_HOST_IPV6,S_OK,FALSE},
1703 {80,S_OK,FALSE},
1704 {URL_SCHEME_HTTP,S_OK,FALSE},
1705 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1706 }
1707 },
1708 /* IPv4 addresses get normalized. */
1709 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1710 {
1711 {"http://[::1.2.3.0]/",S_OK,FALSE},
1712 {"[::1.2.3.0]",S_OK,FALSE},
1713 {"http://[::1.2.3.0]/",S_OK,FALSE},
1714 {"",S_FALSE,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"",S_FALSE,FALSE},
1717 {"::1.2.3.0",S_OK,FALSE},
1718 {"",S_FALSE,FALSE},
1719 {"/",S_OK,FALSE},
1720 {"/",S_OK,FALSE},
1721 {"",S_FALSE,FALSE},
1722 {"http://[::001.002.003.000]",S_OK,FALSE},
1723 {"http",S_OK,FALSE},
1724 {"",S_FALSE,FALSE},
1725 {"",S_FALSE,FALSE},
1726 },
1727 {
1728 {Uri_HOST_IPV6,S_OK,FALSE},
1729 {80,S_OK,FALSE},
1730 {URL_SCHEME_HTTP,S_OK,FALSE},
1731 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1732 }
1733 },
1734 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1735 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1736 {
1737 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1738 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1739 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1740 {"",S_FALSE,FALSE},
1741 {"",S_FALSE,FALSE},
1742 {"",S_FALSE,FALSE},
1743 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1744 {"",S_FALSE,FALSE},
1745 {"/",S_OK,FALSE},
1746 {"/",S_OK,FALSE},
1747 {"",S_FALSE,FALSE},
1748 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1749 {"zip",S_OK,FALSE},
1750 {"",S_FALSE,FALSE},
1751 {"",S_FALSE,FALSE},
1752 },
1753 {
1754 {Uri_HOST_IPV6,S_OK,FALSE},
1755 {0,S_FALSE,FALSE},
1756 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1757 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1758 }
1759 },
1760 /* IPv4 address is converted into 2 h16 components. */
1761 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1762 {
1763 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1764 {"[ffff::c0de:6f20]",S_OK,FALSE},
1765 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1766 {"",S_FALSE,FALSE},
1767 {"",S_FALSE,FALSE},
1768 {"",S_FALSE,FALSE},
1769 {"ffff::c0de:6f20",S_OK,FALSE},
1770 {"",S_FALSE,FALSE},
1771 {"/",S_OK,FALSE},
1772 {"/",S_OK,FALSE},
1773 {"",S_FALSE,FALSE},
1774 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1775 {"http",S_OK,FALSE},
1776 {"",S_FALSE,FALSE},
1777 {"",S_FALSE,FALSE},
1778 },
1779 {
1780 {Uri_HOST_IPV6,S_OK,FALSE},
1781 {80,S_OK,FALSE},
1782 {URL_SCHEME_HTTP,S_OK,FALSE},
1783 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1784 }
1785 },
1786 /* Max value for a port. */
1787 { "http://google.com:65535", 0, S_OK, FALSE,
1788 {
1789 {"http://google.com:65535/",S_OK,FALSE},
1790 {"google.com:65535",S_OK,FALSE},
1791 {"http://google.com:65535/",S_OK,FALSE},
1792 {"google.com",S_OK,FALSE},
1793 {"",S_FALSE,FALSE},
1794 {"",S_FALSE,FALSE},
1795 {"google.com",S_OK,FALSE},
1796 {"",S_FALSE,FALSE},
1797 {"/",S_OK,FALSE},
1798 {"/",S_OK,FALSE},
1799 {"",S_FALSE,FALSE},
1800 {"http://google.com:65535",S_OK,FALSE},
1801 {"http",S_OK,FALSE},
1802 {"",S_FALSE,FALSE},
1803 {"",S_FALSE,FALSE}
1804 },
1805 {
1806 {Uri_HOST_DNS,S_OK,FALSE},
1807 {65535,S_OK,FALSE},
1808 {URL_SCHEME_HTTP,S_OK,FALSE},
1809 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1810 }
1811 },
1812 { "zip://google.com:65536", 0, S_OK, FALSE,
1813 {
1814 {"zip://google.com:65536/",S_OK,FALSE},
1815 {"google.com:65536",S_OK,FALSE},
1816 {"zip://google.com:65536/",S_OK,FALSE},
1817 {"google.com:65536",S_OK,FALSE},
1818 {"",S_FALSE,FALSE},
1819 {"",S_FALSE,FALSE},
1820 {"google.com:65536",S_OK,FALSE},
1821 {"",S_FALSE,FALSE},
1822 {"/",S_OK,FALSE},
1823 {"/",S_OK,FALSE},
1824 {"",S_FALSE,FALSE},
1825 {"zip://google.com:65536",S_OK,FALSE},
1826 {"zip",S_OK,FALSE},
1827 {"",S_FALSE,FALSE},
1828 {"",S_FALSE,FALSE}
1829 },
1830 {
1831 {Uri_HOST_DNS,S_OK,FALSE},
1832 {0,S_FALSE,FALSE},
1833 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1834 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1835 }
1836 },
1837 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1838 {
1839 {"zip://google.com:65536:25/",S_OK,FALSE},
1840 {"google.com:65536:25",S_OK,FALSE},
1841 {"zip://google.com:65536:25/",S_OK,FALSE},
1842 {"google.com:65536:25",S_OK,FALSE},
1843 {"",S_FALSE,FALSE},
1844 {"",S_FALSE,FALSE},
1845 {"google.com:65536:25",S_OK,FALSE},
1846 {"",S_FALSE,FALSE},
1847 {"/",S_OK,FALSE},
1848 {"/",S_OK,FALSE},
1849 {"",S_FALSE,FALSE},
1850 {"zip://google.com:65536:25",S_OK,FALSE},
1851 {"zip",S_OK,FALSE},
1852 {"",S_FALSE,FALSE},
1853 {"",S_FALSE,FALSE}
1854 },
1855 {
1856 {Uri_HOST_DNS,S_OK,FALSE},
1857 {0,S_FALSE,FALSE},
1858 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1860 }
1861 },
1862 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1863 {
1864 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1865 {"[::ffff]:abcd",S_OK,FALSE},
1866 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1867 {"",S_FALSE,FALSE},
1868 {"",S_FALSE,FALSE},
1869 {"",S_FALSE,FALSE},
1870 {"[::ffff]:abcd",S_OK,FALSE},
1871 {"",S_FALSE,FALSE},
1872 {"/",S_OK,FALSE},
1873 {"/",S_OK,FALSE},
1874 {"",S_FALSE,FALSE},
1875 {"zip://[::ffff]:abcd",S_OK,FALSE},
1876 {"zip",S_OK,FALSE},
1877 {"",S_FALSE,FALSE},
1878 {"",S_FALSE,FALSE}
1879 },
1880 {
1881 {Uri_HOST_DNS,S_OK,FALSE},
1882 {0,S_FALSE,FALSE},
1883 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1884 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1885 }
1886 },
1887 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1888 {
1889 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1890 {"127.0.0.1:abcd",S_OK,FALSE},
1891 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1892 {"0.1:abcd",S_OK,FALSE},
1893 {"",S_FALSE,FALSE},
1894 {"",S_FALSE,FALSE},
1895 {"127.0.0.1:abcd",S_OK,FALSE},
1896 {"",S_FALSE,FALSE},
1897 {"/",S_OK,FALSE},
1898 {"/",S_OK,FALSE},
1899 {"",S_FALSE,FALSE},
1900 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1901 {"zip",S_OK,FALSE},
1902 {"",S_FALSE,FALSE},
1903 {"",S_FALSE,FALSE}
1904 },
1905 {
1906 {Uri_HOST_DNS,S_OK,FALSE},
1907 {0,S_FALSE,FALSE},
1908 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1909 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1910 }
1911 },
1912 /* Port is just copied over. */
1913 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1914 {
1915 {"http://google.com:00035",S_OK,FALSE},
1916 {"google.com:00035",S_OK,FALSE},
1917 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1918 {"google.com",S_OK,FALSE},
1919 {"",S_FALSE,FALSE},
1920 {"",S_FALSE,FALSE},
1921 {"google.com",S_OK,FALSE},
1922 {"",S_FALSE,FALSE},
1923 {"",S_FALSE,FALSE},
1924 {"",S_FALSE,FALSE},
1925 {"",S_FALSE,FALSE},
1926 {"http://google.com:00035",S_OK,FALSE},
1927 {"http",S_OK,FALSE},
1928 {"",S_FALSE,FALSE},
1929 {"",S_FALSE,FALSE}
1930 },
1931 {
1932 {Uri_HOST_DNS,S_OK,FALSE},
1933 {35,S_OK,FALSE},
1934 {URL_SCHEME_HTTP,S_OK,FALSE},
1935 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1936 }
1937 },
1938 /* Default port is copied over. */
1939 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1940 {
1941 {"http://google.com:80",S_OK,FALSE},
1942 {"google.com:80",S_OK,FALSE},
1943 {"http://google.com:80",S_OK,FALSE},
1944 {"google.com",S_OK,FALSE},
1945 {"",S_FALSE,FALSE},
1946 {"",S_FALSE,FALSE},
1947 {"google.com",S_OK,FALSE},
1948 {"",S_FALSE,FALSE},
1949 {"",S_FALSE,FALSE},
1950 {"",S_FALSE,FALSE},
1951 {"",S_FALSE,FALSE},
1952 {"http://google.com:80",S_OK,FALSE},
1953 {"http",S_OK,FALSE},
1954 {"",S_FALSE,FALSE},
1955 {"",S_FALSE,FALSE}
1956 },
1957 {
1958 {Uri_HOST_DNS,S_OK,FALSE},
1959 {80,S_OK,FALSE},
1960 {URL_SCHEME_HTTP,S_OK,FALSE},
1961 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1962 }
1963 },
1964 { "http://google.com.uk", 0, S_OK, FALSE,
1965 {
1966 {"http://google.com.uk/",S_OK,FALSE},
1967 {"google.com.uk",S_OK,FALSE},
1968 {"http://google.com.uk/",S_OK,FALSE},
1969 {"google.com.uk",S_OK,FALSE,NULL,"com.uk",S_OK}, /* cf. google.co.uk below */
1970 {"",S_FALSE,FALSE},
1971 {"",S_FALSE,FALSE},
1972 {"google.com.uk",S_OK,FALSE},
1973 {"",S_FALSE,FALSE},
1974 {"/",S_OK,FALSE},
1975 {"/",S_OK,FALSE},
1976 {"",S_FALSE,FALSE},
1977 {"http://google.com.uk",S_OK,FALSE},
1978 {"http",S_OK,FALSE},
1979 {"",S_FALSE,FALSE},
1980 {"",S_FALSE,FALSE}
1981 },
1982 {
1983 {Uri_HOST_DNS,S_OK,FALSE},
1984 {80,S_OK,FALSE},
1985 {URL_SCHEME_HTTP,S_OK,FALSE},
1986 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1987 }
1988 },
1989 { "http://google.co.uk", 0, S_OK, FALSE,
1990 {
1991 {"http://google.co.uk/",S_OK,FALSE},
1992 {"google.co.uk",S_OK,FALSE},
1993 {"http://google.co.uk/",S_OK,FALSE},
1994 {"google.co.uk",S_OK,FALSE},
1995 {"",S_FALSE,FALSE},
1996 {"",S_FALSE,FALSE},
1997 {"google.co.uk",S_OK,FALSE},
1998 {"",S_FALSE,FALSE},
1999 {"/",S_OK,FALSE},
2000 {"/",S_OK,FALSE},
2001 {"",S_FALSE,FALSE},
2002 {"http://google.co.uk",S_OK,FALSE},
2003 {"http",S_OK,FALSE},
2004 {"",S_FALSE,FALSE},
2005 {"",S_FALSE,FALSE}
2006 },
2007 {
2008 {Uri_HOST_DNS,S_OK,FALSE},
2009 {80,S_OK,FALSE},
2010 {URL_SCHEME_HTTP,S_OK,FALSE},
2011 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2012 }
2013 },
2014 { "http://google.com.com", 0, S_OK, FALSE,
2015 {
2016 {"http://google.com.com/",S_OK,FALSE},
2017 {"google.com.com",S_OK,FALSE},
2018 {"http://google.com.com/",S_OK,FALSE},
2019 {"com.com",S_OK,FALSE},
2020 {"",S_FALSE,FALSE},
2021 {"",S_FALSE,FALSE},
2022 {"google.com.com",S_OK,FALSE},
2023 {"",S_FALSE,FALSE},
2024 {"/",S_OK,FALSE},
2025 {"/",S_OK,FALSE},
2026 {"",S_FALSE,FALSE},
2027 {"http://google.com.com",S_OK,FALSE},
2028 {"http",S_OK,FALSE},
2029 {"",S_FALSE,FALSE},
2030 {"",S_FALSE,FALSE}
2031 },
2032 {
2033 {Uri_HOST_DNS,S_OK,FALSE},
2034 {80,S_OK,FALSE},
2035 {URL_SCHEME_HTTP,S_OK,FALSE},
2036 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2037 }
2038 },
2039 { "http://google.uk.1", 0, S_OK, FALSE,
2040 {
2041 {"http://google.uk.1/",S_OK,FALSE},
2042 {"google.uk.1",S_OK,FALSE},
2043 {"http://google.uk.1/",S_OK,FALSE},
2044 {"google.uk.1",S_OK,FALSE,NULL,"uk.1",S_OK},
2045 {"",S_FALSE,FALSE},
2046 {"",S_FALSE,FALSE},
2047 {"google.uk.1",S_OK,FALSE},
2048 {"",S_FALSE,FALSE},
2049 {"/",S_OK,FALSE},
2050 {"/",S_OK,FALSE},
2051 {"",S_FALSE,FALSE},
2052 {"http://google.uk.1",S_OK,FALSE},
2053 {"http",S_OK,FALSE},
2054 {"",S_FALSE,FALSE},
2055 {"",S_FALSE,FALSE}
2056 },
2057 {
2058 {Uri_HOST_DNS,S_OK,FALSE},
2059 {80,S_OK,FALSE},
2060 {URL_SCHEME_HTTP,S_OK,FALSE},
2061 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2062 }
2063 },
2064 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2065 { "http://google.foo.uk", 0, S_OK, FALSE,
2066 {
2067 {"http://google.foo.uk/",S_OK,FALSE},
2068 {"google.foo.uk",S_OK,FALSE},
2069 {"http://google.foo.uk/",S_OK,FALSE},
2070 {"foo.uk",S_OK,FALSE},
2071 {"",S_FALSE,FALSE},
2072 {"",S_FALSE,FALSE},
2073 {"google.foo.uk",S_OK,FALSE},
2074 {"",S_FALSE,FALSE},
2075 {"/",S_OK,FALSE},
2076 {"/",S_OK,FALSE},
2077 {"",S_FALSE,FALSE},
2078 {"http://google.foo.uk",S_OK,FALSE},
2079 {"http",S_OK,FALSE},
2080 {"",S_FALSE,FALSE},
2081 {"",S_FALSE,FALSE}
2082 },
2083 {
2084 {Uri_HOST_DNS,S_OK,FALSE},
2085 {80,S_OK,FALSE},
2086 {URL_SCHEME_HTTP,S_OK,FALSE},
2087 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2088 }
2089 },
2090 { "http://.com", 0, S_OK, FALSE,
2091 {
2092 {"http://.com/",S_OK,FALSE},
2093 {".com",S_OK,FALSE},
2094 {"http://.com/",S_OK,FALSE},
2095 {".com",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"",S_FALSE,FALSE},
2098 {".com",S_OK,FALSE},
2099 {"",S_FALSE,FALSE},
2100 {"/",S_OK,FALSE},
2101 {"/",S_OK,FALSE},
2102 {"",S_FALSE,FALSE},
2103 {"http://.com",S_OK,FALSE},
2104 {"http",S_OK,FALSE},
2105 {"",S_FALSE,FALSE},
2106 {"",S_FALSE,FALSE}
2107 },
2108 {
2109 {Uri_HOST_DNS,S_OK,FALSE},
2110 {80,S_OK,FALSE},
2111 {URL_SCHEME_HTTP,S_OK,FALSE},
2112 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2113 }
2114 },
2115 { "http://.uk", 0, S_OK, FALSE,
2116 {
2117 {"http://.uk/",S_OK,FALSE},
2118 {".uk",S_OK,FALSE},
2119 {"http://.uk/",S_OK,FALSE},
2120 {"",S_FALSE,FALSE,NULL,".uk",S_OK},
2121 {"",S_FALSE,FALSE},
2122 {"",S_FALSE,FALSE},
2123 {".uk",S_OK,FALSE},
2124 {"",S_FALSE,FALSE},
2125 {"/",S_OK,FALSE},
2126 {"/",S_OK,FALSE},
2127 {"",S_FALSE,FALSE},
2128 {"http://.uk",S_OK,FALSE},
2129 {"http",S_OK,FALSE},
2130 {"",S_FALSE,FALSE},
2131 {"",S_FALSE,FALSE}
2132 },
2133 {
2134 {Uri_HOST_DNS,S_OK,FALSE},
2135 {80,S_OK,FALSE},
2136 {URL_SCHEME_HTTP,S_OK,FALSE},
2137 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2138 }
2139 },
2140 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2141 {
2142 {"http://www.co.google.com.[]/",S_OK,FALSE},
2143 {"www.co.google.com.[]",S_OK,FALSE},
2144 {"http://www.co.google.com.[]/",S_OK,FALSE},
2145 {"google.com.[]",S_OK,FALSE,NULL,"com.[]",S_OK},
2146 {"",S_FALSE,FALSE},
2147 {"",S_FALSE,FALSE},
2148 {"www.co.google.com.[]",S_OK,FALSE},
2149 {"",S_FALSE,FALSE},
2150 {"/",S_OK,FALSE},
2151 {"/",S_OK,FALSE},
2152 {"",S_FALSE,FALSE},
2153 {"http://www.co.google.com.[]",S_OK,FALSE},
2154 {"http",S_OK,FALSE},
2155 {"",S_FALSE,FALSE},
2156 {"",S_FALSE,FALSE}
2157 },
2158 {
2159 {Uri_HOST_DNS,S_OK,FALSE},
2160 {80,S_OK,FALSE},
2161 {URL_SCHEME_HTTP,S_OK,FALSE},
2162 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2163 }
2164 },
2165 { "http://co.uk", 0, S_OK, FALSE,
2166 {
2167 {"http://co.uk/",S_OK,FALSE},
2168 {"co.uk",S_OK,FALSE},
2169 {"http://co.uk/",S_OK,FALSE},
2170 {"",S_FALSE,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"",S_FALSE,FALSE},
2173 {"co.uk",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"/",S_OK,FALSE},
2176 {"/",S_OK,FALSE},
2177 {"",S_FALSE,FALSE},
2178 {"http://co.uk",S_OK,FALSE},
2179 {"http",S_OK,FALSE},
2180 {"",S_FALSE,FALSE},
2181 {"",S_FALSE,FALSE}
2182 },
2183 {
2184 {Uri_HOST_DNS,S_OK,FALSE},
2185 {80,S_OK,FALSE},
2186 {URL_SCHEME_HTTP,S_OK,FALSE},
2187 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2188 }
2189 },
2190 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2191 {
2192 {"http://www.co.google.us.test/",S_OK,FALSE},
2193 {"www.co.google.us.test",S_OK,FALSE},
2194 {"http://www.co.google.us.test/",S_OK,FALSE},
2195 {"us.test",S_OK,FALSE},
2196 {"",S_FALSE,FALSE},
2197 {"",S_FALSE,FALSE},
2198 {"www.co.google.us.test",S_OK,FALSE},
2199 {"",S_FALSE,FALSE},
2200 {"/",S_OK,FALSE},
2201 {"/",S_OK,FALSE},
2202 {"",S_FALSE,FALSE},
2203 {"http://www.co.google.us.test",S_OK,FALSE},
2204 {"http",S_OK,FALSE},
2205 {"",S_FALSE,FALSE},
2206 {"",S_FALSE,FALSE}
2207 },
2208 {
2209 {Uri_HOST_DNS,S_OK,FALSE},
2210 {80,S_OK,FALSE},
2211 {URL_SCHEME_HTTP,S_OK,FALSE},
2212 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2213 }
2214 },
2215 { "http://gov.uk", 0, S_OK, FALSE,
2216 {
2217 {"http://gov.uk/",S_OK,FALSE},
2218 {"gov.uk",S_OK,FALSE},
2219 {"http://gov.uk/",S_OK,FALSE},
2220 {"",S_FALSE,FALSE},
2221 {"",S_FALSE,FALSE},
2222 {"",S_FALSE,FALSE},
2223 {"gov.uk",S_OK,FALSE},
2224 {"",S_FALSE,FALSE},
2225 {"/",S_OK,FALSE},
2226 {"/",S_OK,FALSE},
2227 {"",S_FALSE,FALSE},
2228 {"http://gov.uk",S_OK,FALSE},
2229 {"http",S_OK,FALSE},
2230 {"",S_FALSE,FALSE},
2231 {"",S_FALSE,FALSE}
2232 },
2233 {
2234 {Uri_HOST_DNS,S_OK,FALSE},
2235 {80,S_OK,FALSE},
2236 {URL_SCHEME_HTTP,S_OK,FALSE},
2237 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2238 }
2239 },
2240 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2241 {
2242 {"zip://www.google.com\\test",S_OK,FALSE},
2243 {"www.google.com\\test",S_OK,FALSE},
2244 {"zip://www.google.com\\test",S_OK,FALSE},
2245 {"google.com\\test",S_OK,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"",S_FALSE,FALSE},
2248 {"www.google.com\\test",S_OK,FALSE},
2249 {"",S_FALSE,FALSE},
2250 {"",S_FALSE,FALSE},
2251 {"",S_FALSE,FALSE},
2252 {"",S_FALSE,FALSE},
2253 {"zip://www.google.com\\test",S_OK,FALSE},
2254 {"zip",S_OK,FALSE},
2255 {"",S_FALSE,FALSE},
2256 {"",S_FALSE,FALSE}
2257 },
2258 {
2259 {Uri_HOST_DNS,S_OK,FALSE},
2260 {0,S_FALSE,FALSE},
2261 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2262 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2263 }
2264 },
2265 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2266 {
2267 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2270 {"",S_FALSE,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"",S_FALSE,FALSE},
2273 {"",S_FALSE,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2276 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2277 {"",S_FALSE,FALSE},
2278 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2279 {"urn",S_OK,FALSE},
2280 {"",S_FALSE,FALSE},
2281 {"",S_FALSE,FALSE}
2282 },
2283 {
2284 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2285 {0,S_FALSE,FALSE},
2286 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2287 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2288 }
2289 },
2290 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2291 * are decoded and all '%' are encoded.
2292 */
2293 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2294 {
2295 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2296 {"",S_FALSE,FALSE},
2297 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2298 {"",S_FALSE,FALSE},
2299 {".mp3",S_OK,FALSE},
2300 {"",S_FALSE,FALSE},
2301 {"",S_FALSE,FALSE},
2302 {"",S_FALSE,FALSE},
2303 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2304 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2305 {"",S_FALSE,FALSE},
2306 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2307 {"file",S_OK,FALSE},
2308 {"",S_FALSE,FALSE},
2309 {"",S_FALSE,FALSE}
2310 },
2311 {
2312 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2313 {0,S_FALSE,FALSE},
2314 {URL_SCHEME_FILE,S_OK,FALSE},
2315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2316 }
2317 },
2318 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2319 * is decoded and only %'s in front of invalid hex digits are encoded.
2320 */
2321 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2322 {
2323 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2324 {"",S_FALSE,FALSE},
2325 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2326 {"",S_FALSE,FALSE},
2327 {".mp3",S_OK,FALSE},
2328 {"",S_FALSE,FALSE},
2329 {"",S_FALSE,FALSE},
2330 {"",S_FALSE,FALSE},
2331 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2332 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2333 {"",S_FALSE,FALSE},
2334 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2335 {"file",S_OK,FALSE},
2336 {"",S_FALSE,FALSE},
2337 {"",S_FALSE,FALSE}
2338 },
2339 {
2340 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2341 {0,S_FALSE,FALSE},
2342 {URL_SCHEME_FILE,S_OK,FALSE},
2343 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2344 }
2345 },
2346 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2347 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2348 {
2349 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2350 {"[::1.2.3.0]",S_OK,FALSE},
2351 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2352 {"",S_FALSE,FALSE},
2353 {"",S_FALSE,FALSE},
2354 {"",S_FALSE,FALSE},
2355 {"::1.2.3.0",S_OK,FALSE},
2356 {"",S_FALSE,FALSE},
2357 {"/%3F%23.T/test",S_OK,FALSE},
2358 {"/%3F%23.T/test",S_OK,FALSE},
2359 {"",S_FALSE,FALSE},
2360 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2361 {"http",S_OK,FALSE},
2362 {"",S_FALSE,FALSE},
2363 {"",S_FALSE,FALSE},
2364 },
2365 {
2366 {Uri_HOST_IPV6,S_OK,FALSE},
2367 {80,S_OK,FALSE},
2368 {URL_SCHEME_HTTP,S_OK,FALSE},
2369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2370 }
2371 },
2372 /* Forbidden characters are always encoded for file URIs. */
2373 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2374 {
2375 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2376 {"",S_FALSE,FALSE},
2377 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {".mp3",S_OK,FALSE},
2380 {"",S_FALSE,FALSE},
2381 {"",S_FALSE,FALSE},
2382 {"",S_FALSE,FALSE},
2383 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2384 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2385 {"",S_FALSE,FALSE},
2386 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2387 {"file",S_OK,FALSE},
2388 {"",S_FALSE,FALSE},
2389 {"",S_FALSE,FALSE}
2390 },
2391 {
2392 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2393 {0,S_FALSE,FALSE},
2394 {URL_SCHEME_FILE,S_OK,FALSE},
2395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2396 }
2397 },
2398 /* Forbidden characters are never encoded for unknown scheme types. */
2399 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2400 {
2401 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2402 {"4294967295",S_OK,FALSE},
2403 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2404 {"",S_FALSE,FALSE},
2405 {"",S_FALSE,FALSE},
2406 {"",S_FALSE,FALSE},
2407 {"4294967295",S_OK,FALSE},
2408 {"",S_FALSE,FALSE},
2409 {"/<|>\" test<|>",S_OK,FALSE},
2410 {"/<|>\" test<|>",S_OK,FALSE},
2411 {"",S_FALSE,FALSE},
2412 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2413 {"1234",S_OK,FALSE},
2414 {"",S_FALSE,FALSE},
2415 {"",S_FALSE,FALSE}
2416 },
2417 {
2418 {Uri_HOST_IPV4,S_OK,FALSE},
2419 {0,S_FALSE,FALSE},
2420 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2421 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2422 }
2423 },
2424 /* Make sure forbidden characters are percent encoded. */
2425 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2426 {
2427 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2428 {"gov.uk",S_OK,FALSE},
2429 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"",S_FALSE,FALSE},
2432 {"",S_FALSE,FALSE},
2433 {"gov.uk",S_OK,FALSE},
2434 {"",S_FALSE,FALSE},
2435 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2436 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2437 {"",S_FALSE,FALSE},
2438 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2439 {"http",S_OK,FALSE},
2440 {"",S_FALSE,FALSE},
2441 {"",S_FALSE,FALSE}
2442 },
2443 {
2444 {Uri_HOST_DNS,S_OK,FALSE},
2445 {80,S_OK,FALSE},
2446 {URL_SCHEME_HTTP,S_OK,FALSE},
2447 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2448 }
2449 },
2450 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2451 {
2452 {"http://gov.uk/",S_OK,FALSE},
2453 {"gov.uk",S_OK,FALSE},
2454 {"http://gov.uk/",S_OK,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {"",S_FALSE,FALSE},
2457 {"",S_FALSE,FALSE},
2458 {"gov.uk",S_OK,FALSE},
2459 {"",S_FALSE,FALSE},
2460 {"/",S_OK,FALSE},
2461 {"/",S_OK,FALSE},
2462 {"",S_FALSE,FALSE},
2463 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2464 {"http",S_OK,FALSE},
2465 {"",S_FALSE,FALSE},
2466 {"",S_FALSE,FALSE}
2467 },
2468 {
2469 {Uri_HOST_DNS,S_OK,FALSE},
2470 {80,S_OK,FALSE},
2471 {URL_SCHEME_HTTP,S_OK,FALSE},
2472 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2473 }
2474 },
2475 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2476 {
2477 {"http://gov.uk/",S_OK,FALSE},
2478 {"gov.uk",S_OK,FALSE},
2479 {"http://gov.uk/",S_OK,FALSE},
2480 {"",S_FALSE,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"",S_FALSE,FALSE},
2483 {"gov.uk",S_OK,FALSE},
2484 {"",S_FALSE,FALSE},
2485 {"/",S_OK,FALSE},
2486 {"/",S_OK,FALSE},
2487 {"",S_FALSE,FALSE},
2488 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2489 {"http",S_OK,FALSE},
2490 {"",S_FALSE,FALSE},
2491 {"",S_FALSE,FALSE}
2492 },
2493 {
2494 {Uri_HOST_DNS,S_OK,FALSE},
2495 {80,S_OK,FALSE},
2496 {URL_SCHEME_HTTP,S_OK,FALSE},
2497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2498 }
2499 },
2500 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2501 {
2502 {"http://gov.uk/",S_OK,FALSE},
2503 {"gov.uk",S_OK,FALSE},
2504 {"http://gov.uk/",S_OK,FALSE},
2505 {"",S_FALSE,FALSE},
2506 {"",S_FALSE,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {"gov.uk",S_OK,FALSE},
2509 {"",S_FALSE,FALSE},
2510 {"/",S_OK,FALSE},
2511 {"/",S_OK,FALSE},
2512 {"",S_FALSE,FALSE},
2513 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2514 {"http",S_OK,FALSE},
2515 {"",S_FALSE,FALSE},
2516 {"",S_FALSE,FALSE}
2517 },
2518 {
2519 {Uri_HOST_DNS,S_OK,FALSE},
2520 {80,S_OK,FALSE},
2521 {URL_SCHEME_HTTP,S_OK,FALSE},
2522 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2523 }
2524 },
2525 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2526 {
2527 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2528 {"",S_FALSE,FALSE},
2529 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {".mp3",S_OK,FALSE},
2532 {"",S_FALSE,FALSE},
2533 {"",S_FALSE,FALSE},
2534 {"",S_FALSE,FALSE},
2535 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2536 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2537 {"",S_FALSE,FALSE},
2538 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2539 {"file",S_OK,FALSE},
2540 {"",S_FALSE,FALSE},
2541 {"",S_FALSE,FALSE}
2542 },
2543 {
2544 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2545 {0,S_FALSE,FALSE},
2546 {URL_SCHEME_FILE,S_OK,FALSE},
2547 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2548 }
2549 },
2550 /* Dot removal happens for unknown scheme types. */
2551 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2552 {
2553 {"zip://gov.uk/",S_OK,FALSE},
2554 {"gov.uk",S_OK,FALSE},
2555 {"zip://gov.uk/",S_OK,FALSE},
2556 {"",S_FALSE,FALSE},
2557 {"",S_FALSE,FALSE},
2558 {"",S_FALSE,FALSE},
2559 {"gov.uk",S_OK,FALSE},
2560 {"",S_FALSE,FALSE},
2561 {"/",S_OK,FALSE},
2562 {"/",S_OK,FALSE},
2563 {"",S_FALSE,FALSE},
2564 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2565 {"zip",S_OK,FALSE},
2566 {"",S_FALSE,FALSE},
2567 {"",S_FALSE,FALSE}
2568 },
2569 {
2570 {Uri_HOST_DNS,S_OK,FALSE},
2571 {0,S_FALSE,FALSE},
2572 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2573 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2574 }
2575 },
2576 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2577 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2578 {
2579 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2580 {"gov.uk",S_OK,FALSE},
2581 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2582 {"",S_FALSE,FALSE},
2583 {".",S_OK,FALSE},
2584 {"",S_FALSE,FALSE},
2585 {"gov.uk",S_OK,FALSE},
2586 {"",S_FALSE,FALSE},
2587 {"/test/test2/../../.",S_OK,FALSE},
2588 {"/test/test2/../../.",S_OK,FALSE},
2589 {"",S_FALSE,FALSE},
2590 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2591 {"http",S_OK,FALSE},
2592 {"",S_FALSE,FALSE},
2593 {"",S_FALSE,FALSE}
2594 },
2595 {
2596 {Uri_HOST_DNS,S_OK,FALSE},
2597 {80,S_OK,FALSE},
2598 {URL_SCHEME_HTTP,S_OK,FALSE},
2599 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2600 }
2601 },
2602 /* Dot removal doesn't happen for wildcard scheme types. */
2603 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2604 {
2605 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2606 {"gov.uk",S_OK,FALSE},
2607 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2608 {"",S_FALSE,FALSE},
2609 {".",S_OK,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {"gov.uk",S_OK,FALSE},
2612 {"",S_FALSE,FALSE},
2613 {"/test/test2/../../.",S_OK,FALSE},
2614 {"/test/test2/../../.",S_OK,FALSE},
2615 {"",S_FALSE,FALSE},
2616 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2617 {"*",S_OK,FALSE},
2618 {"",S_FALSE,FALSE},
2619 {"",S_FALSE,FALSE}
2620 },
2621 {
2622 {Uri_HOST_DNS,S_OK,FALSE},
2623 {0,S_FALSE,FALSE},
2624 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2625 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2626 }
2627 },
2628 /* Forbidden characters are encoded for opaque known scheme types. */
2629 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2630 {
2631 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2634 {"",S_FALSE,FALSE},
2635 {".com%22",S_OK,FALSE},
2636 {"",S_FALSE,FALSE},
2637 {"",S_FALSE,FALSE},
2638 {"",S_FALSE,FALSE},
2639 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2640 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2641 {"",S_FALSE,FALSE},
2642 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2643 {"mailto",S_OK,FALSE},
2644 {"",S_FALSE,FALSE},
2645 {"",S_FALSE,FALSE}
2646 },
2647 {
2648 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2649 {0,S_FALSE,FALSE},
2650 {URL_SCHEME_MAILTO,S_OK,FALSE},
2651 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2652 }
2653 },
2654 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2655 {
2656 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2659 {"",S_FALSE,FALSE},
2660 {".com",S_OK,FALSE},
2661 {"",S_FALSE,FALSE},
2662 {"",S_FALSE,FALSE},
2663 {"",S_FALSE,FALSE},
2664 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2665 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2666 {"",S_FALSE,FALSE},
2667 {"news:test.tes<|>t.com",S_OK,FALSE},
2668 {"news",S_OK,FALSE},
2669 {"",S_FALSE,FALSE},
2670 {"",S_FALSE,FALSE}
2671 },
2672 {
2673 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2674 {0,S_FALSE,FALSE},
2675 {URL_SCHEME_NEWS,S_OK,FALSE},
2676 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2677 }
2678 },
2679 /* Don't encode forbidden characters. */
2680 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2681 {
2682 {"news:test.tes<|>t.com",S_OK,FALSE},
2683 {"",S_FALSE,FALSE},
2684 {"news:test.tes<|>t.com",S_OK,FALSE},
2685 {"",S_FALSE,FALSE},
2686 {".com",S_OK,FALSE},
2687 {"",S_FALSE,FALSE},
2688 {"",S_FALSE,FALSE},
2689 {"",S_FALSE,FALSE},
2690 {"test.tes<|>t.com",S_OK,FALSE},
2691 {"test.tes<|>t.com",S_OK,FALSE},
2692 {"",S_FALSE,FALSE},
2693 {"news:test.tes<|>t.com",S_OK,FALSE},
2694 {"news",S_OK,FALSE},
2695 {"",S_FALSE,FALSE},
2696 {"",S_FALSE,FALSE}
2697 },
2698 {
2699 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2700 {0,S_FALSE,FALSE},
2701 {URL_SCHEME_NEWS,S_OK,FALSE},
2702 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2703 }
2704 },
2705 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2706 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2707 {
2708 {"urn:test.tes<|>t.com",S_OK,FALSE},
2709 {"",S_FALSE,FALSE},
2710 {"urn:test.tes<|>t.com",S_OK,FALSE},
2711 {"",S_FALSE,FALSE},
2712 {".com",S_OK,FALSE},
2713 {"",S_FALSE,FALSE},
2714 {"",S_FALSE,FALSE},
2715 {"",S_FALSE,FALSE},
2716 {"test.tes<|>t.com",S_OK,FALSE},
2717 {"test.tes<|>t.com",S_OK,FALSE},
2718 {"",S_FALSE,FALSE},
2719 {"urn:test.tes<|>t.com",S_OK,FALSE},
2720 {"urn",S_OK,FALSE},
2721 {"",S_FALSE,FALSE},
2722 {"",S_FALSE,FALSE}
2723 },
2724 {
2725 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2726 {0,S_FALSE,FALSE},
2727 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2728 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2729 }
2730 },
2731 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2732 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2733 {
2734 {"news:test.test.com",S_OK,FALSE},
2735 {"",S_FALSE,FALSE},
2736 {"news:test.test.com",S_OK,FALSE},
2737 {"",S_FALSE,FALSE},
2738 {".com",S_OK,FALSE},
2739 {"",S_FALSE,FALSE},
2740 {"",S_FALSE,FALSE},
2741 {"",S_FALSE,FALSE},
2742 {"test.test.com",S_OK,FALSE},
2743 {"test.test.com",S_OK,FALSE},
2744 {"",S_FALSE,FALSE},
2745 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2746 {"news",S_OK,FALSE},
2747 {"",S_FALSE,FALSE},
2748 {"",S_FALSE,FALSE}
2749 },
2750 {
2751 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2752 {0,S_FALSE,FALSE},
2753 {URL_SCHEME_NEWS,S_OK,FALSE},
2754 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2755 }
2756 },
2757 /* Percent encoded characters are still decoded for known scheme types. */
2758 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2759 {
2760 {"news:test.test.com",S_OK,FALSE},
2761 {"",S_FALSE,FALSE},
2762 {"news:test.test.com",S_OK,FALSE},
2763 {"",S_FALSE,FALSE},
2764 {".com",S_OK,FALSE},
2765 {"",S_FALSE,FALSE},
2766 {"",S_FALSE,FALSE},
2767 {"",S_FALSE,FALSE},
2768 {"test.test.com",S_OK,FALSE},
2769 {"test.test.com",S_OK,FALSE},
2770 {"",S_FALSE,FALSE},
2771 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2772 {"news",S_OK,FALSE},
2773 {"",S_FALSE,FALSE},
2774 {"",S_FALSE,FALSE}
2775 },
2776 {
2777 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2778 {0,S_FALSE,FALSE},
2779 {URL_SCHEME_NEWS,S_OK,FALSE},
2780 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2781 }
2782 },
2783 /* Percent encoded characters aren't decoded for unknown scheme types. */
2784 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2785 {
2786 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2787 {"",S_FALSE,FALSE},
2788 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2789 {"",S_FALSE,FALSE},
2790 {".com",S_OK,FALSE},
2791 {"",S_FALSE,FALSE},
2792 {"",S_FALSE,FALSE},
2793 {"",S_FALSE,FALSE},
2794 {"test.%74%65%73%74.com",S_OK,FALSE},
2795 {"test.%74%65%73%74.com",S_OK,FALSE},
2796 {"",S_FALSE,FALSE},
2797 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2798 {"urn",S_OK,FALSE},
2799 {"",S_FALSE,FALSE},
2800 {"",S_FALSE,FALSE}
2801 },
2802 {
2803 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2804 {0,S_FALSE,FALSE},
2805 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2806 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2807 }
2808 },
2809 /* Unknown scheme types can have invalid % encoded data in query string. */
2810 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2811 {
2812 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2813 {"www.winehq.org",S_OK,FALSE},
2814 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2815 {"winehq.org",S_OK,FALSE},
2816 {"",S_FALSE,FALSE},
2817 {"",S_FALSE,FALSE},
2818 {"www.winehq.org",S_OK,FALSE},
2819 {"",S_FALSE,FALSE},
2820 {"/",S_OK,FALSE},
2821 {"/?query=%xx&return=y",S_OK,FALSE},
2822 {"?query=%xx&return=y",S_OK,FALSE},
2823 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2824 {"zip",S_OK,FALSE},
2825 {"",S_FALSE,FALSE},
2826 {"",S_FALSE,FALSE}
2827 },
2828 {
2829 {Uri_HOST_DNS,S_OK,FALSE},
2830 {0,S_FALSE,FALSE},
2831 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2832 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2833 }
2834 },
2835 /* Known scheme types can have invalid % encoded data with the right flags. */
2836 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2837 {
2838 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2839 {"www.winehq.org",S_OK,FALSE},
2840 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2841 {"winehq.org",S_OK,FALSE},
2842 {"",S_FALSE,FALSE},
2843 {"",S_FALSE,FALSE},
2844 {"www.winehq.org",S_OK,FALSE},
2845 {"",S_FALSE,FALSE},
2846 {"/",S_OK,FALSE},
2847 {"/?query=%xx&return=y",S_OK,FALSE},
2848 {"?query=%xx&return=y",S_OK,FALSE},
2849 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2850 {"http",S_OK,FALSE},
2851 {"",S_FALSE,FALSE},
2852 {"",S_FALSE,FALSE}
2853 },
2854 {
2855 {Uri_HOST_DNS,S_OK,FALSE},
2856 {80,S_OK,FALSE},
2857 {URL_SCHEME_HTTP,S_OK,FALSE},
2858 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2859 }
2860 },
2861 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2862 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2863 {
2864 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2865 {"www.winehq.org",S_OK,FALSE},
2866 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2867 {"winehq.org",S_OK,FALSE},
2868 {"",S_FALSE,FALSE},
2869 {"",S_FALSE,FALSE},
2870 {"www.winehq.org",S_OK,FALSE},
2871 {"",S_FALSE,FALSE},
2872 {"/",S_OK,FALSE},
2873 {"/?query=<|>&return=y",S_OK,FALSE},
2874 {"?query=<|>&return=y",S_OK,FALSE},
2875 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2876 {"http",S_OK,FALSE},
2877 {"",S_FALSE,FALSE},
2878 {"",S_FALSE,FALSE}
2879 },
2880 {
2881 {Uri_HOST_DNS,S_OK,FALSE},
2882 {80,S_OK,FALSE},
2883 {URL_SCHEME_HTTP,S_OK,FALSE},
2884 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2885 }
2886 },
2887 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2888 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2889 {
2890 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2891 {"www.winehq.org",S_OK,FALSE},
2892 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2893 {"winehq.org",S_OK,FALSE},
2894 {"",S_FALSE,FALSE},
2895 {"",S_FALSE,FALSE},
2896 {"www.winehq.org",S_OK,FALSE},
2897 {"",S_FALSE,FALSE},
2898 {"/",S_OK,FALSE},
2899 {"/?query=<|>&return=y",S_OK,FALSE},
2900 {"?query=<|>&return=y",S_OK,FALSE},
2901 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2902 {"http",S_OK,FALSE},
2903 {"",S_FALSE,FALSE},
2904 {"",S_FALSE,FALSE}
2905 },
2906 {
2907 {Uri_HOST_DNS,S_OK,FALSE},
2908 {80,S_OK,FALSE},
2909 {URL_SCHEME_HTTP,S_OK,FALSE},
2910 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2911 }
2912 },
2913 /* Forbidden characters are encoded for known scheme types. */
2914 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2915 {
2916 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2917 {"www.winehq.org",S_OK,FALSE},
2918 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2919 {"winehq.org",S_OK,FALSE},
2920 {"",S_FALSE,FALSE},
2921 {"",S_FALSE,FALSE},
2922 {"www.winehq.org",S_OK,FALSE},
2923 {"",S_FALSE,FALSE},
2924 {"/",S_OK,FALSE},
2925 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2926 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2927 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2928 {"http",S_OK,FALSE},
2929 {"",S_FALSE,FALSE},
2930 {"",S_FALSE,FALSE}
2931 },
2932 {
2933 {Uri_HOST_DNS,S_OK,FALSE},
2934 {80,S_OK,FALSE},
2935 {URL_SCHEME_HTTP,S_OK,FALSE},
2936 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2937 }
2938 },
2939 /* Forbidden characters are not encoded for unknown scheme types. */
2940 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2941 {
2942 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2943 {"www.winehq.org",S_OK,FALSE},
2944 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2945 {"winehq.org",S_OK,FALSE},
2946 {"",S_FALSE,FALSE},
2947 {"",S_FALSE,FALSE},
2948 {"www.winehq.org",S_OK,FALSE},
2949 {"",S_FALSE,FALSE},
2950 {"/",S_OK,FALSE},
2951 {"/?query=<|>&return=y",S_OK,FALSE},
2952 {"?query=<|>&return=y",S_OK,FALSE},
2953 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2954 {"zip",S_OK,FALSE},
2955 {"",S_FALSE,FALSE},
2956 {"",S_FALSE,FALSE}
2957 },
2958 {
2959 {Uri_HOST_DNS,S_OK,FALSE},
2960 {0,S_FALSE,FALSE},
2961 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2962 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2963 }
2964 },
2965 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2966 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2967 {
2968 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2969 {"www.winehq.org",S_OK,FALSE},
2970 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2971 {"winehq.org",S_OK,FALSE},
2972 {"",S_FALSE,FALSE},
2973 {"",S_FALSE,FALSE},
2974 {"www.winehq.org",S_OK,FALSE},
2975 {"",S_FALSE,FALSE},
2976 {"/",S_OK,FALSE},
2977 {"/?query=01&return=y",S_OK,FALSE},
2978 {"?query=01&return=y",S_OK,FALSE},
2979 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2980 {"http",S_OK,FALSE},
2981 {"",S_FALSE,FALSE},
2982 {"",S_FALSE,FALSE}
2983 },
2984 {
2985 {Uri_HOST_DNS,S_OK,FALSE},
2986 {80,S_OK,FALSE},
2987 {URL_SCHEME_HTTP,S_OK,FALSE},
2988 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2989 }
2990 },
2991 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2992 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2993 {
2994 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2995 {"www.winehq.org",S_OK,FALSE},
2996 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2997 {"winehq.org",S_OK,FALSE},
2998 {"",S_FALSE,FALSE},
2999 {"",S_FALSE,FALSE},
3000 {"www.winehq.org",S_OK,FALSE},
3001 {"",S_FALSE,FALSE},
3002 {"/",S_OK,FALSE},
3003 {"/?query=%30%31&return=y",S_OK,FALSE},
3004 {"?query=%30%31&return=y",S_OK,FALSE},
3005 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3006 {"zip",S_OK,FALSE},
3007 {"",S_FALSE,FALSE},
3008 {"",S_FALSE,FALSE}
3009 },
3010 {
3011 {Uri_HOST_DNS,S_OK,FALSE},
3012 {0,S_FALSE,FALSE},
3013 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3014 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3015 }
3016 },
3017 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
3018 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3019 {
3020 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3021 {"www.winehq.org",S_OK,FALSE},
3022 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
3023 {"winehq.org",S_OK,FALSE},
3024 {"",S_FALSE,FALSE},
3025 {"",S_FALSE,FALSE},
3026 {"www.winehq.org",S_OK,FALSE},
3027 {"",S_FALSE,FALSE},
3028 {"/",S_OK,FALSE},
3029 {"/?query=%30%31&return=y",S_OK,FALSE},
3030 {"?query=%30%31&return=y",S_OK,FALSE},
3031 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3032 {"http",S_OK,FALSE},
3033 {"",S_FALSE,FALSE},
3034 {"",S_FALSE,FALSE}
3035 },
3036 {
3037 {Uri_HOST_DNS,S_OK,FALSE},
3038 {80,S_OK,FALSE},
3039 {URL_SCHEME_HTTP,S_OK,FALSE},
3040 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3041 }
3042 },
3043 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3044 {
3045 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3046 {"www.winehq.org",S_OK,FALSE},
3047 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3048 {"winehq.org",S_OK,FALSE},
3049 {"",S_FALSE,FALSE},
3050 {"",S_FALSE,FALSE},
3051 {"www.winehq.org",S_OK,FALSE},
3052 {"",S_FALSE,FALSE},
3053 {"",S_FALSE,FALSE},
3054 {"?query=12&return=y",S_OK,FALSE},
3055 {"?query=12&return=y",S_OK,FALSE},
3056 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3057 {"http",S_OK,FALSE},
3058 {"",S_FALSE,FALSE},
3059 {"",S_FALSE,FALSE}
3060 },
3061 {
3062 {Uri_HOST_DNS,S_OK,FALSE},
3063 {80,S_OK,FALSE},
3064 {URL_SCHEME_HTTP,S_OK,FALSE},
3065 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3066 }
3067 },
3068 /* Unknown scheme types can have invalid % encoded data in fragments. */
3069 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
3070 {
3071 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3072 {"www.winehq.org",S_OK,FALSE},
3073 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3074 {"winehq.org",S_OK,FALSE},
3075 {"",S_FALSE,FALSE},
3076 {"#Te%xx",S_OK,FALSE},
3077 {"www.winehq.org",S_OK,FALSE},
3078 {"",S_FALSE,FALSE},
3079 {"/tests/",S_OK,FALSE},
3080 {"/tests/",S_OK,FALSE},
3081 {"",S_FALSE,FALSE},
3082 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3083 {"zip",S_OK,FALSE},
3084 {"",S_FALSE,FALSE},
3085 {"",S_FALSE,FALSE}
3086 },
3087 {
3088 {Uri_HOST_DNS,S_OK,FALSE},
3089 {0,S_FALSE,FALSE},
3090 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3091 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3092 }
3093 },
3094 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3095 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3096 {
3097 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3098 {"www.winehq.org",S_OK,FALSE},
3099 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3100 {"winehq.org",S_OK,FALSE},
3101 {"",S_FALSE,FALSE},
3102 {"#Te<|>",S_OK,FALSE},
3103 {"www.winehq.org",S_OK,FALSE},
3104 {"",S_FALSE,FALSE},
3105 {"/tests/",S_OK,FALSE},
3106 {"/tests/",S_OK,FALSE},
3107 {"",S_FALSE,FALSE},
3108 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3109 {"zip",S_OK,FALSE},
3110 {"",S_FALSE,FALSE},
3111 {"",S_FALSE,FALSE}
3112 },
3113 {
3114 {Uri_HOST_DNS,S_OK,FALSE},
3115 {0,S_FALSE,FALSE},
3116 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3117 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3118 }
3119 },
3120 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3121 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3122 {
3123 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3124 {"www.winehq.org",S_OK,FALSE},
3125 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3126 {"winehq.org",S_OK,FALSE},
3127 {"",S_FALSE,FALSE},
3128 {"#Te%3C%7C%3E",S_OK,FALSE},
3129 {"www.winehq.org",S_OK,FALSE},
3130 {"",S_FALSE,FALSE},
3131 {"/tests/",S_OK,FALSE},
3132 {"/tests/",S_OK,FALSE},
3133 {"",S_FALSE,FALSE},
3134 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3135 {"http",S_OK,FALSE},
3136 {"",S_FALSE,FALSE},
3137 {"",S_FALSE,FALSE}
3138 },
3139 {
3140 {Uri_HOST_DNS,S_OK,FALSE},
3141 {80,S_OK,FALSE},
3142 {URL_SCHEME_HTTP,S_OK,FALSE},
3143 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3144 }
3145 },
3146 /* Forbidden characters aren't encoded in the fragment with this flag. */
3147 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3148 {
3149 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3150 {"www.winehq.org",S_OK,FALSE},
3151 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3152 {"winehq.org",S_OK,FALSE},
3153 {"",S_FALSE,FALSE},
3154 {"#Te<|>",S_OK,FALSE},
3155 {"www.winehq.org",S_OK,FALSE},
3156 {"",S_FALSE,FALSE},
3157 {"/tests/",S_OK,FALSE},
3158 {"/tests/",S_OK,FALSE},
3159 {"",S_FALSE,FALSE},
3160 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3161 {"http",S_OK,FALSE},
3162 {"",S_FALSE,FALSE},
3163 {"",S_FALSE,FALSE}
3164 },
3165 {
3166 {Uri_HOST_DNS,S_OK,FALSE},
3167 {80,S_OK,FALSE},
3168 {URL_SCHEME_HTTP,S_OK,FALSE},
3169 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3170 }
3171 },
3172 /* Forbidden characters aren't encoded in the fragment with this flag. */
3173 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3174 {
3175 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3176 {"www.winehq.org",S_OK,FALSE},
3177 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3178 {"winehq.org",S_OK,FALSE},
3179 {"",S_FALSE,FALSE},
3180 {"#Te<|>",S_OK,FALSE},
3181 {"www.winehq.org",S_OK,FALSE},
3182 {"",S_FALSE,FALSE},
3183 {"/tests/",S_OK,FALSE},
3184 {"/tests/",S_OK,FALSE},
3185 {"",S_FALSE,FALSE},
3186 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3187 {"http",S_OK,FALSE},
3188 {"",S_FALSE,FALSE},
3189 {"",S_FALSE,FALSE}
3190 },
3191 {
3192 {Uri_HOST_DNS,S_OK,FALSE},
3193 {80,S_OK,FALSE},
3194 {URL_SCHEME_HTTP,S_OK,FALSE},
3195 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3196 }
3197 },
3198 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3199 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3200 {
3201 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3202 {"www.winehq.org",S_OK,FALSE},
3203 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3204 {"winehq.org",S_OK,FALSE},
3205 {"",S_FALSE,FALSE},
3206 {"#Te%30%31%32",S_OK,FALSE},
3207 {"www.winehq.org",S_OK,FALSE},
3208 {"",S_FALSE,FALSE},
3209 {"/tests/",S_OK,FALSE},
3210 {"/tests/",S_OK,FALSE},
3211 {"",S_FALSE,FALSE},
3212 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3213 {"zip",S_OK,FALSE},
3214 {"",S_FALSE,FALSE},
3215 {"",S_FALSE,FALSE}
3216 },
3217 {
3218 {Uri_HOST_DNS,S_OK,FALSE},
3219 {0,S_FALSE,FALSE},
3220 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3221 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3222 }
3223 },
3224 /* Percent encoded, unreserved characters are decoded for known schemes. */
3225 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3226 {
3227 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3228 {"www.winehq.org",S_OK,FALSE},
3229 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3230 {"winehq.org",S_OK,FALSE},
3231 {"",S_FALSE,FALSE},
3232 {"#Te012",S_OK,FALSE},
3233 {"www.winehq.org",S_OK,FALSE},
3234 {"",S_FALSE,FALSE},
3235 {"/tests/",S_OK,FALSE},
3236 {"/tests/",S_OK,FALSE},
3237 {"",S_FALSE,FALSE},
3238 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3239 {"http",S_OK,FALSE},
3240 {"",S_FALSE,FALSE},
3241 {"",S_FALSE,FALSE}
3242 },
3243 {
3244 {Uri_HOST_DNS,S_OK,FALSE},
3245 {80,S_OK,FALSE},
3246 {URL_SCHEME_HTTP,S_OK,FALSE},
3247 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3248 }
3249 },
3250 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3251 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3252 {
3253 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3254 {"www.winehq.org",S_OK,FALSE},
3255 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3256 {"winehq.org",S_OK,FALSE},
3257 {"",S_FALSE,FALSE},
3258 {"#Te012",S_OK,FALSE},
3259 {"www.winehq.org",S_OK,FALSE},
3260 {"",S_FALSE,FALSE},
3261 {"/tests/",S_OK,FALSE},
3262 {"/tests/",S_OK,FALSE},
3263 {"",S_FALSE,FALSE},
3264 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3265 {"http",S_OK,FALSE},
3266 {"",S_FALSE,FALSE},
3267 {"",S_FALSE,FALSE}
3268 },
3269 {
3270 {Uri_HOST_DNS,S_OK,FALSE},
3271 {80,S_OK,FALSE},
3272 {URL_SCHEME_HTTP,S_OK,FALSE},
3273 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3274 }
3275 },
3276 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3277 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3278 {
3279 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3280 {"www.winehq.org",S_OK,FALSE},
3281 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3282 {"winehq.org",S_OK,FALSE},
3283 {"",S_FALSE,FALSE},
3284 {"#Te%30%31%32",S_OK,FALSE},
3285 {"www.winehq.org",S_OK,FALSE},
3286 {"",S_FALSE,FALSE},
3287 {"/tests/",S_OK,FALSE},
3288 {"/tests/",S_OK,FALSE},
3289 {"",S_FALSE,FALSE},
3290 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3291 {"http",S_OK,FALSE},
3292 {"",S_FALSE,FALSE},
3293 {"",S_FALSE,FALSE}
3294 },
3295 {
3296 {Uri_HOST_DNS,S_OK,FALSE},
3297 {80,S_OK,FALSE},
3298 {URL_SCHEME_HTTP,S_OK,FALSE},
3299 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3300 }
3301 },
3302 /* Leading/Trailing whitespace is removed. */
3303 { " http://google.com/ ", 0, S_OK, FALSE,
3304 {
3305 {"http://google.com/",S_OK,FALSE},
3306 {"google.com",S_OK,FALSE},
3307 {"http://google.com/",S_OK,FALSE},
3308 {"google.com",S_OK,FALSE},
3309 {"",S_FALSE,FALSE},
3310 {"",S_FALSE,FALSE},
3311 {"google.com",S_OK,FALSE},
3312 {"",S_FALSE,FALSE},
3313 {"/",S_OK,FALSE},
3314 {"/",S_OK,FALSE},
3315 {"",S_FALSE,FALSE},
3316 {"http://google.com/",S_OK,FALSE},
3317 {"http",S_OK,FALSE},
3318 {"",S_FALSE,FALSE},
3319 {"",S_FALSE,FALSE}
3320 },
3321 {
3322 {Uri_HOST_DNS,S_OK,FALSE},
3323 {80,S_OK,FALSE},
3324 {URL_SCHEME_HTTP,S_OK,FALSE},
3325 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3326 }
3327 },
3328 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3329 {
3330 {"http://google.com/",S_OK,FALSE},
3331 {"google.com",S_OK,FALSE},
3332 {"http://google.com/",S_OK,FALSE},
3333 {"google.com",S_OK,FALSE},
3334 {"",S_FALSE,FALSE},
3335 {"",S_FALSE,FALSE},
3336 {"google.com",S_OK,FALSE},
3337 {"",S_FALSE,FALSE},
3338 {"/",S_OK,FALSE},
3339 {"/",S_OK,FALSE},
3340 {"",S_FALSE,FALSE},
3341 {"http://google.com/",S_OK,FALSE},
3342 {"http",S_OK,FALSE},
3343 {"",S_FALSE,FALSE},
3344 {"",S_FALSE,FALSE}
3345 },
3346 {
3347 {Uri_HOST_DNS,S_OK,FALSE},
3348 {80,S_OK,FALSE},
3349 {URL_SCHEME_HTTP,S_OK,FALSE},
3350 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3351 }
3352 },
3353 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3354 {
3355 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3356 {"g%0aoogle.co%0dm",S_OK,FALSE},
3357 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3358 {"g%0aoogle.co%0dm",S_OK,FALSE},
3359 {"",S_FALSE,FALSE},
3360 {"",S_FALSE,FALSE},
3361 {"g%0aoogle.co%0dm",S_OK,FALSE},
3362 {"",S_FALSE,FALSE},
3363 {"/%0A%0A%0A",S_OK,FALSE},
3364 {"/%0A%0A%0A",S_OK,FALSE},
3365 {"",S_FALSE,FALSE},
3366 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3367 {"http",S_OK,FALSE},
3368 {"",S_FALSE,FALSE},
3369 {"",S_FALSE,FALSE}
3370 },
3371 {
3372 {Uri_HOST_DNS,S_OK,FALSE},
3373 {80,S_OK,FALSE},
3374 {URL_SCHEME_HTTP,S_OK,FALSE},
3375 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3376 }
3377 },
3378 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3379 {
3380 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3381 {"g\noogle.co\rm",S_OK,FALSE},
3382 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3383 {"g\noogle.co\rm",S_OK,FALSE},
3384 {"",S_FALSE,FALSE},
3385 {"",S_FALSE,FALSE},
3386 {"g\noogle.co\rm",S_OK,FALSE},
3387 {"",S_FALSE,FALSE},
3388 {"/\n\n\n",S_OK,FALSE},
3389 {"/\n\n\n",S_OK,FALSE},
3390 {"",S_FALSE,FALSE},
3391 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3392 {"zip",S_OK,FALSE},
3393 {"",S_FALSE,FALSE},
3394 {"",S_FALSE,FALSE}
3395 },
3396 {
3397 {Uri_HOST_DNS,S_OK,FALSE},
3398 {0,S_FALSE,FALSE},
3399 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3400 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3401 }
3402 },
3403 /* Since file URLs are usually hierarchical, it returns an empty string
3404 * for the absolute URI property since it was declared as an opaque URI.
3405 */
3406 { "file:index.html", 0, S_OK, FALSE,
3407 {
3408 {"",S_FALSE,FALSE},
3409 {"",S_FALSE,FALSE},
3410 {"file:index.html",S_OK,FALSE},
3411 {"",S_FALSE,FALSE},
3412 {".html",S_OK,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {"",S_FALSE,FALSE},
3415 {"",S_FALSE,FALSE},
3416 {"index.html",S_OK,FALSE},
3417 {"index.html",S_OK,FALSE},
3418 {"",S_FALSE,FALSE},
3419 {"file:index.html",S_OK,FALSE},
3420 {"file",S_OK,FALSE},
3421 {"",S_FALSE,FALSE},
3422 {"",S_FALSE,FALSE}
3423 },
3424 {
3425 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3426 {0,S_FALSE,FALSE},
3427 {URL_SCHEME_FILE,S_OK,FALSE},
3428 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3429 }
3430 },
3431 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3432 { "http:test.com/index.html", 0, S_OK, FALSE,
3433 {
3434 {"",S_FALSE,FALSE},
3435 {"",S_FALSE,FALSE},
3436 {"http:test.com/index.html",S_OK,FALSE},
3437 {"",S_FALSE,FALSE},
3438 {".html",S_OK,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {"",S_FALSE,FALSE},
3441 {"",S_FALSE,FALSE},
3442 {"test.com/index.html",S_OK,FALSE},
3443 {"test.com/index.html",S_OK,FALSE},
3444 {"",S_FALSE,FALSE},
3445 {"http:test.com/index.html",S_OK,FALSE},
3446 {"http",S_OK,FALSE},
3447 {"",S_FALSE,FALSE},
3448 {"",S_FALSE,FALSE}
3449 },
3450 {
3451 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3452 {80,S_OK,FALSE},
3453 {URL_SCHEME_HTTP,S_OK,FALSE},
3454 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3455 }
3456 },
3457 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3458 {
3459 {"",S_FALSE,FALSE},
3460 {"",S_FALSE,FALSE},
3461 {"ftp:test.com/index.html",S_OK,FALSE},
3462 {"",S_FALSE,FALSE},
3463 {".html",S_OK,FALSE},
3464 {"",S_FALSE,FALSE},
3465 {"",S_FALSE,FALSE},
3466 {"",S_FALSE,FALSE},
3467 {"test.com/index.html",S_OK,FALSE},
3468 {"test.com/index.html",S_OK,FALSE},
3469 {"",S_FALSE,FALSE},
3470 {"ftp:test.com/index.html",S_OK,FALSE},
3471 {"ftp",S_OK,FALSE},
3472 {"",S_FALSE,FALSE},
3473 {"",S_FALSE,FALSE}
3474 },
3475 {
3476 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3477 {21,S_OK,FALSE},
3478 {URL_SCHEME_FTP,S_OK,FALSE},
3479 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3480 }
3481 },
3482 { "file://C|/test.mp3", 0, S_OK, FALSE,
3483 {
3484 {"file:///C:/test.mp3",S_OK,FALSE},
3485 {"",S_FALSE,FALSE},
3486 {"file:///C:/test.mp3",S_OK,FALSE},
3487 {"",S_FALSE,FALSE},
3488 {".mp3",S_OK,FALSE},
3489 {"",S_FALSE,FALSE},
3490 {"",S_FALSE,FALSE},
3491 {"",S_FALSE,FALSE},
3492 {"/C:/test.mp3",S_OK,FALSE},
3493 {"/C:/test.mp3",S_OK,FALSE},
3494 {"",S_FALSE,FALSE},
3495 {"file://C|/test.mp3",S_OK,FALSE},
3496 {"file",S_OK,FALSE},
3497 {"",S_FALSE,FALSE},
3498 {"",S_FALSE,FALSE}
3499 },
3500 {
3501 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3502 {0,S_FALSE,FALSE},
3503 {URL_SCHEME_FILE,S_OK,FALSE},
3504 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3505 }
3506 },
3507 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3508 {
3509 {"file:///C:/test.mp3",S_OK,FALSE},
3510 {"",S_FALSE,FALSE},
3511 {"file:///C:/test.mp3",S_OK,FALSE},
3512 {"",S_FALSE,FALSE},
3513 {".mp3",S_OK,FALSE},
3514 {"",S_FALSE,FALSE},
3515 {"",S_FALSE,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {"/C:/test.mp3",S_OK,FALSE},
3518 {"/C:/test.mp3",S_OK,FALSE},
3519 {"",S_FALSE,FALSE},
3520 {"file:///C|/test.mp3",S_OK,FALSE},
3521 {"file",S_OK,FALSE},
3522 {"",S_FALSE,FALSE},
3523 {"",S_FALSE,FALSE}
3524 },
3525 {
3526 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3527 {0,S_FALSE,FALSE},
3528 {URL_SCHEME_FILE,S_OK,FALSE},
3529 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3530 }
3531 },
3532 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3533 * to '\\'.
3534 */
3535 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3536 {
3537 {"file://c:\\dir\\index.html",S_OK,FALSE},
3538 {"",S_FALSE,FALSE},
3539 {"file://c:\\dir\\index.html",S_OK,FALSE},
3540 {"",S_FALSE,FALSE},
3541 {".html",S_OK,FALSE},
3542 {"",S_FALSE,FALSE},
3543 {"",S_FALSE,FALSE},
3544 {"",S_FALSE,FALSE},
3545 {"c:\\dir\\index.html",S_OK,FALSE},
3546 {"c:\\dir\\index.html",S_OK,FALSE},
3547 {"",S_FALSE,FALSE},
3548 {"file://c:/dir/index.html",S_OK,FALSE},
3549 {"file",S_OK,FALSE},
3550 {"",S_FALSE,FALSE},
3551 {"",S_FALSE,FALSE}
3552 },
3553 {
3554 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3555 {0,S_FALSE,FALSE},
3556 {URL_SCHEME_FILE,S_OK,FALSE},
3557 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3558 }
3559 },
3560 /* Extra '/' after "file://" is removed. */
3561 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3562 {
3563 {"file://c:\\dir\\index.html",S_OK,FALSE},
3564 {"",S_FALSE,FALSE},
3565 {"file://c:\\dir\\index.html",S_OK,FALSE},
3566 {"",S_FALSE,FALSE},
3567 {".html",S_OK,FALSE},
3568 {"",S_FALSE,FALSE},
3569 {"",S_FALSE,FALSE},
3570 {"",S_FALSE,FALSE},
3571 {"c:\\dir\\index.html",S_OK,FALSE},
3572 {"c:\\dir\\index.html",S_OK,FALSE},
3573 {"",S_FALSE,FALSE},
3574 {"file:///c:/dir/index.html",S_OK,FALSE},
3575 {"file",S_OK,FALSE},
3576 {"",S_FALSE,FALSE},
3577 {"",S_FALSE,FALSE}
3578 },
3579 {
3580 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3581 {0,S_FALSE,FALSE},
3582 {URL_SCHEME_FILE,S_OK,FALSE},
3583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3584 }
3585 },
3586 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3587 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3588 {
3589 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3592 {"",S_FALSE,FALSE},
3593 {".html",S_OK,FALSE},
3594 {"",S_FALSE,FALSE},
3595 {"",S_FALSE,FALSE},
3596 {"",S_FALSE,FALSE},
3597 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3598 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3599 {"",S_FALSE,FALSE},
3600 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3601 {"file",S_OK,FALSE},
3602 {"",S_FALSE,FALSE},
3603 {"",S_FALSE,FALSE}
3604 },
3605 {
3606 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3607 {0,S_FALSE,FALSE},
3608 {URL_SCHEME_FILE,S_OK,FALSE},
3609 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3610 }
3611 },
3612 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3613 {
3614 {"file://c:\\dir\\index.html",S_OK,FALSE},
3615 {"",S_FALSE,FALSE},
3616 {"file://c:\\dir\\index.html",S_OK,FALSE},
3617 {"",S_FALSE,FALSE},
3618 {".html",S_OK,FALSE},
3619 {"",S_FALSE,FALSE},
3620 {"",S_FALSE,FALSE},
3621 {"",S_FALSE,FALSE},
3622 {"c:\\dir\\index.html",S_OK,FALSE},
3623 {"c:\\dir\\index.html",S_OK,FALSE},
3624 {"",S_FALSE,FALSE},
3625 {"file://c|/dir\\index.html",S_OK,FALSE},
3626 {"file",S_OK,FALSE},
3627 {"",S_FALSE,FALSE},
3628 {"",S_FALSE,FALSE}
3629 },
3630 {
3631 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3632 {0,S_FALSE,FALSE},
3633 {URL_SCHEME_FILE,S_OK,FALSE},
3634 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3635 }
3636 },
3637 /* The backslashes after the scheme name are converted to forward slashes. */
3638 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3639 {
3640 {"file://c:\\dir\\index.html",S_OK,FALSE},
3641 {"",S_FALSE,FALSE},
3642 {"file://c:\\dir\\index.html",S_OK,FALSE},
3643 {"",S_FALSE,FALSE},
3644 {".html",S_OK,FALSE},
3645 {"",S_FALSE,FALSE},
3646 {"",S_FALSE,FALSE},
3647 {"",S_FALSE,FALSE},
3648 {"c:\\dir\\index.html",S_OK,FALSE},
3649 {"c:\\dir\\index.html",S_OK,FALSE},
3650 {"",S_FALSE,FALSE},
3651 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3652 {"file",S_OK,FALSE},
3653 {"",S_FALSE,FALSE},
3654 {"",S_FALSE,FALSE}
3655 },
3656 {
3657 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3658 {0,S_FALSE,FALSE},
3659 {URL_SCHEME_FILE,S_OK,FALSE},
3660 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3661 }
3662 },
3663 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3664 {
3665 {"file:///c:/dir/index.html",S_OK,FALSE},
3666 {"",S_FALSE,FALSE},
3667 {"file:///c:/dir/index.html",S_OK,FALSE},
3668 {"",S_FALSE,FALSE},
3669 {".html",S_OK,FALSE},
3670 {"",S_FALSE,FALSE},
3671 {"",S_FALSE,FALSE},
3672 {"",S_FALSE,FALSE},
3673 {"/c:/dir/index.html",S_OK,FALSE},
3674 {"/c:/dir/index.html",S_OK,FALSE},
3675 {"",S_FALSE,FALSE},
3676 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3677 {"file",S_OK,FALSE},
3678 {"",S_FALSE,FALSE},
3679 {"",S_FALSE,FALSE}
3680 },
3681 {
3682 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3683 {0,S_FALSE,FALSE},
3684 {URL_SCHEME_FILE,S_OK,FALSE},
3685 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3686 }
3687 },
3688 { "http:\\\\google.com", 0, S_OK, FALSE,
3689 {
3690 {"http://google.com/",S_OK,FALSE},
3691 {"google.com",S_OK,FALSE},
3692 {"http://google.com/",S_OK,FALSE},
3693 {"google.com",S_OK,FALSE},
3694 {"",S_FALSE,FALSE},
3695 {"",S_FALSE,FALSE},
3696 {"google.com",S_OK,FALSE},
3697 {"",S_FALSE,FALSE},
3698 {"/",S_OK,FALSE},
3699 {"/",S_OK,FALSE},
3700 {"",S_FALSE,FALSE},
3701 {"http:\\\\google.com",S_OK,FALSE},
3702 {"http",S_OK,FALSE},
3703 {"",S_FALSE,FALSE},
3704 {"",S_FALSE,FALSE}
3705 },
3706 {
3707 {Uri_HOST_DNS,S_OK,FALSE},
3708 {80,S_OK,FALSE},
3709 {URL_SCHEME_HTTP,S_OK,FALSE},
3710 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3711 }
3712 },
3713 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3714 { "zip:\\\\google.com", 0, S_OK, FALSE,
3715 {
3716 {"zip:\\\\google.com",S_OK,FALSE},
3717 {"",S_FALSE,FALSE},
3718 {"zip:\\\\google.com",S_OK,FALSE},
3719 {"",S_FALSE,FALSE},
3720 {".com",S_OK,FALSE},
3721 {"",S_FALSE,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {"",S_FALSE,FALSE},
3724 {"\\\\google.com",S_OK,FALSE},
3725 {"\\\\google.com",S_OK,FALSE},
3726 {"",S_FALSE,FALSE},
3727 {"zip:\\\\google.com",S_OK,FALSE},
3728 {"zip",S_OK,FALSE},
3729 {"",S_FALSE,FALSE},
3730 {"",S_FALSE,FALSE}
3731 },
3732 {
3733 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3734 {0,S_FALSE,FALSE},
3735 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3736 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3737 }
3738 },
3739 /* Dot segments aren't removed. */
3740 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3741 {
3742 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3743 {"",S_FALSE,FALSE},
3744 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3745 {"",S_FALSE,FALSE},
3746 {".html",S_OK,FALSE},
3747 {"",S_FALSE,FALSE},
3748 {"",S_FALSE,FALSE},
3749 {"",S_FALSE,FALSE},
3750 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3751 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3752 {"",S_FALSE,FALSE},
3753 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3754 {"file",S_OK,FALSE},
3755 {"",S_FALSE,FALSE},
3756 {"",S_FALSE,FALSE}
3757 },
3758 {
3759 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3760 {0,S_FALSE,FALSE},
3761 {URL_SCHEME_FILE,S_OK,FALSE},
3762 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3763 }
3764 },
3765 /* Forbidden characters aren't percent encoded. */
3766 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3767 {
3768 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3769 {"",S_FALSE,FALSE},
3770 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3771 {"",S_FALSE,FALSE},
3772 {".html",S_OK,FALSE},
3773 {"",S_FALSE,FALSE},
3774 {"",S_FALSE,FALSE},
3775 {"",S_FALSE,FALSE},
3776 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3777 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3778 {"",S_FALSE,FALSE},
3779 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3780 {"file",S_OK,FALSE},
3781 {"",S_FALSE,FALSE},
3782 {"",S_FALSE,FALSE}
3783 },
3784 {
3785 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3786 {0,S_FALSE,FALSE},
3787 {URL_SCHEME_FILE,S_OK,FALSE},
3788 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3789 }
3790 },
3791 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3792 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3793 {
3794 {"",S_FALSE,FALSE},
3795 {"",S_FALSE,FALSE},
3796 {"file:c:/dir/../../index.html",S_OK,FALSE},
3797 {"",S_FALSE,FALSE},
3798 {".html",S_OK,FALSE},
3799 {"",S_FALSE,FALSE},
3800 {"",S_FALSE,FALSE},
3801 {"",S_FALSE,FALSE},
3802 {"c:/dir/../../index.html",S_OK,FALSE},
3803 {"c:/dir/../../index.html",S_OK,FALSE},
3804 {"",S_FALSE,FALSE},
3805 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3806 {"file",S_OK,FALSE},
3807 {"",S_FALSE,FALSE},
3808 {"",S_FALSE,FALSE}
3809 },
3810 {
3811 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3812 {0,S_FALSE,FALSE},
3813 {URL_SCHEME_FILE,S_OK,FALSE},
3814 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3815 }
3816 },
3817 /* '/' are still converted to '\' even though it's an opaque URI. */
3818 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3819 {
3820 {"",S_FALSE,FALSE},
3821 {"",S_FALSE,FALSE},
3822 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3823 {"",S_FALSE,FALSE},
3824 {".html",S_OK,FALSE},
3825 {"",S_FALSE,FALSE},
3826 {"",S_FALSE,FALSE},
3827 {"",S_FALSE,FALSE},
3828 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3829 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3830 {"",S_FALSE,FALSE},
3831 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3832 {"file",S_OK,FALSE},
3833 {"",S_FALSE,FALSE},
3834 {"",S_FALSE,FALSE}
3835 },
3836 {
3837 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3838 {0,S_FALSE,FALSE},
3839 {URL_SCHEME_FILE,S_OK,FALSE},
3840 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3841 }
3842 },
3843 /* Forbidden characters aren't percent encoded. */
3844 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3845 {
3846 {"",S_FALSE,FALSE},
3847 {"",S_FALSE,FALSE},
3848 {"file:c:\\in^|dex.html",S_OK,FALSE},
3849 {"",S_FALSE,FALSE},
3850 {".html",S_OK,FALSE},
3851 {"",S_FALSE,FALSE},
3852 {"",S_FALSE,FALSE},
3853 {"",S_FALSE,FALSE},
3854 {"c:\\in^|dex.html",S_OK,FALSE},
3855 {"c:\\in^|dex.html",S_OK,FALSE},
3856 {"",S_FALSE,FALSE},
3857 {"file:c:\\in^|dex.html",S_OK,FALSE},
3858 {"file",S_OK,FALSE},
3859 {"",S_FALSE,FALSE},
3860 {"",S_FALSE,FALSE}
3861 },
3862 {
3863 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3864 {0,S_FALSE,FALSE},
3865 {URL_SCHEME_FILE,S_OK,FALSE},
3866 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3867 }
3868 },
3869 /* Doesn't have a UserName since the ':' appears at the beginning of the
3870 * userinfo section.
3871 */
3872 { "http://:password@gov.uk", 0, S_OK, FALSE,
3873 {
3874 {"http://:password@gov.uk/",S_OK,FALSE},
3875 {":password@gov.uk",S_OK,FALSE},
3876 {"http://gov.uk/",S_OK,FALSE},
3877 {"",S_FALSE,FALSE},
3878 {"",S_FALSE,FALSE},
3879 {"",S_FALSE,FALSE},
3880 {"gov.uk",S_OK,FALSE},
3881 {"password",S_OK,FALSE},
3882 {"/",S_OK,FALSE},
3883 {"/",S_OK,FALSE},
3884 {"",S_FALSE,FALSE},
3885 {"http://:password@gov.uk",S_OK,FALSE},
3886 {"http",S_OK,FALSE},
3887 {":password",S_OK,FALSE},
3888 {"",S_FALSE,FALSE}
3889 },
3890 {
3891 {Uri_HOST_DNS,S_OK,FALSE},
3892 {80,S_OK,FALSE},
3893 {URL_SCHEME_HTTP,S_OK,FALSE},
3894 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3895 }
3896 },
3897 /* Has a UserName since the userinfo section doesn't contain a password. */
3898 { "http://@gov.uk", 0, S_OK, FALSE,
3899 {
3900 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3901 {"@gov.uk",S_OK,FALSE},
3902 {"http://gov.uk/",S_OK,FALSE},
3903 {"",S_FALSE,FALSE},
3904 {"",S_FALSE,FALSE},
3905 {"",S_FALSE,FALSE},
3906 {"gov.uk",S_OK,FALSE},
3907 {"",S_FALSE,FALSE},
3908 {"/",S_OK,FALSE},
3909 {"/",S_OK,FALSE},
3910 {"",S_FALSE,FALSE},
3911 {"http://@gov.uk",S_OK,FALSE},
3912 {"http",S_OK,FALSE},
3913 {"",S_OK,FALSE},
3914 {"",S_OK,FALSE}
3915 },
3916 {
3917 {Uri_HOST_DNS,S_OK,FALSE},
3918 {80,S_OK,FALSE},
3919 {URL_SCHEME_HTTP,S_OK,FALSE},
3920 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3921 }
3922 },
3923 /* ":@" not included in the absolute URI. */
3924 { "http://:@gov.uk", 0, S_OK, FALSE,
3925 {
3926 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3927 {":@gov.uk",S_OK,FALSE},
3928 {"http://gov.uk/",S_OK,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {"",S_FALSE,FALSE},
3931 {"",S_FALSE,FALSE},
3932 {"gov.uk",S_OK,FALSE},
3933 {"",S_OK,FALSE},
3934 {"/",S_OK,FALSE},
3935 {"/",S_OK,FALSE},
3936 {"",S_FALSE,FALSE},
3937 {"http://:@gov.uk",S_OK,FALSE},
3938 {"http",S_OK,FALSE},
3939 {":",S_OK,FALSE},
3940 {"",S_FALSE,FALSE}
3941 },
3942 {
3943 {Uri_HOST_DNS,S_OK,FALSE},
3944 {80,S_OK,FALSE},
3945 {URL_SCHEME_HTTP,S_OK,FALSE},
3946 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3947 }
3948 },
3949 /* '@' is included because it's an unknown scheme type. */
3950 { "zip://@gov.uk", 0, S_OK, FALSE,
3951 {
3952 {"zip://@gov.uk/",S_OK,FALSE},
3953 {"@gov.uk",S_OK,FALSE},
3954 {"zip://@gov.uk/",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"",S_FALSE,FALSE},
3957 {"",S_FALSE,FALSE},
3958 {"gov.uk",S_OK,FALSE},
3959 {"",S_FALSE,FALSE},
3960 {"/",S_OK,FALSE},
3961 {"/",S_OK,FALSE},
3962 {"",S_FALSE,FALSE},
3963 {"zip://@gov.uk",S_OK,FALSE},
3964 {"zip",S_OK,FALSE},
3965 {"",S_OK,FALSE},
3966 {"",S_OK,FALSE}
3967 },
3968 {
3969 {Uri_HOST_DNS,S_OK,FALSE},
3970 {0,S_FALSE,FALSE},
3971 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3972 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3973 }
3974 },
3975 /* ":@" are included because it's an unknown scheme type. */
3976 { "zip://:@gov.uk", 0, S_OK, FALSE,
3977 {
3978 {"zip://:@gov.uk/",S_OK,FALSE},
3979 {":@gov.uk",S_OK,FALSE},
3980 {"zip://:@gov.uk/",S_OK,FALSE},
3981 {"",S_FALSE,FALSE},
3982 {"",S_FALSE,FALSE},
3983 {"",S_FALSE,FALSE},
3984 {"gov.uk",S_OK,FALSE},
3985 {"",S_OK,FALSE},
3986 {"/",S_OK,FALSE},
3987 {"/",S_OK,FALSE},
3988 {"",S_FALSE,FALSE},
3989 {"zip://:@gov.uk",S_OK,FALSE},
3990 {"zip",S_OK,FALSE},
3991 {":",S_OK,FALSE},
3992 {"",S_FALSE,FALSE}
3993 },
3994 {
3995 {Uri_HOST_DNS,S_OK,FALSE},
3996 {0,S_FALSE,FALSE},
3997 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3998 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3999 }
4000 },
4001 { "about:blank", 0, S_OK, FALSE,
4002 {
4003 {"about:blank",S_OK,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {"about:blank",S_OK,FALSE},
4006 {"",S_FALSE,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"",S_FALSE,FALSE},
4009 {"",S_FALSE,FALSE},
4010 {"",S_FALSE,FALSE},
4011 {"blank",S_OK,FALSE},
4012 {"blank",S_OK,FALSE},
4013 {"",S_FALSE,FALSE},
4014 {"about:blank",S_OK,FALSE},
4015 {"about",S_OK,FALSE},
4016 {"",S_FALSE,FALSE},
4017 {"",S_FALSE,FALSE}
4018 },
4019 {
4020 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4021 {0,S_FALSE,FALSE},
4022 {URL_SCHEME_ABOUT,S_OK,FALSE},
4023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4024 }
4025 },
4026 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
4027 {
4028 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4031 {"",S_FALSE,FALSE},
4032 {".htm",S_OK,FALSE},
4033 {"",S_FALSE,FALSE},
4034 {"",S_FALSE,FALSE},
4035 {"",S_FALSE,FALSE},
4036 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4037 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4038 {"",S_FALSE,FALSE},
4039 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4040 {"mk",S_OK,FALSE},
4041 {"",S_FALSE,FALSE},
4042 {"",S_FALSE,FALSE}
4043 },
4044 {
4045 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4046 {0,S_FALSE,FALSE},
4047 {URL_SCHEME_MK,S_OK,FALSE},
4048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4049 }
4050 },
4051 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
4052 {
4053 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4054 {"",S_FALSE,FALSE},
4055 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4056 {"",S_FALSE,FALSE},
4057 {".htm",S_OK,FALSE},
4058 {"",S_FALSE,FALSE},
4059 {"",S_FALSE,FALSE},
4060 {"",S_FALSE,FALSE},
4061 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4062 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4063 {"",S_FALSE,FALSE},
4064 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4065 {"mk",S_OK,FALSE},
4066 {"",S_FALSE,FALSE},
4067 {"",S_FALSE,FALSE}
4068 },
4069 {
4070 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4071 {0,S_FALSE,FALSE},
4072 {URL_SCHEME_MK,S_OK,FALSE},
4073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4074 }
4075 },
4076 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4077 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
4078 {
4079 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4080 {"server",S_OK,FALSE},
4081 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4082 {"",S_FALSE,FALSE},
4083 {".html",S_OK,FALSE},
4084 {"",S_FALSE,FALSE},
4085 {"server",S_OK,FALSE},
4086 {"",S_FALSE,FALSE},
4087 {"\\dir\\index.html",S_OK,FALSE},
4088 {"\\dir\\index.html",S_OK,FALSE},
4089 {"",S_FALSE,FALSE},
4090 {"file://server/dir/index.html",S_OK,FALSE},
4091 {"file",S_OK,FALSE},
4092 {"",S_FALSE,FALSE},
4093 {"",S_FALSE,FALSE}
4094 },
4095 {
4096 {Uri_HOST_DNS,S_OK,FALSE},
4097 {0,S_FALSE,FALSE},
4098 {URL_SCHEME_FILE,S_OK,FALSE},
4099 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4100 }
4101 },
4102 /* When CreateUri generates an IUri, it still displays the default port in the
4103 * authority.
4104 */
4105 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4106 {
4107 {"http://google.com:80/",S_OK,FALSE},
4108 {"google.com:80",S_OK,FALSE},
4109 {"http://google.com:80/",S_OK,FALSE},
4110 {"google.com",S_OK,FALSE},
4111 {"",S_FALSE,FALSE},
4112 {"",S_FALSE,FALSE},
4113 {"google.com",S_OK,FALSE},
4114 {"",S_FALSE,FALSE},
4115 {"/",S_OK,FALSE},
4116 {"/",S_OK,FALSE},
4117 {"",S_FALSE,FALSE},
4118 {"http://google.com:80/",S_OK,FALSE},
4119 {"http",S_OK,FALSE},
4120 {"",S_FALSE,FALSE},
4121 {"",S_FALSE,FALSE}
4122 },
4123 {
4124 {Uri_HOST_DNS,S_OK,FALSE},
4125 {80,S_OK,FALSE},
4126 {URL_SCHEME_HTTP,S_OK,FALSE},
4127 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4128 }
4129 },
4130 /* For res URIs the host is everything up until the first '/'. */
4131 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4132 {
4133 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4134 {"C:\\dir\\file.exe",S_OK,FALSE},
4135 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4136 {"",S_FALSE,FALSE},
4137 {".html",S_OK,FALSE},
4138 {"",S_FALSE,FALSE},
4139 {"C:\\dir\\file.exe",S_OK,FALSE},
4140 {"",S_FALSE,FALSE},
4141 {"/DATA/test.html",S_OK,FALSE},
4142 {"/DATA/test.html",S_OK,FALSE},
4143 {"",S_FALSE,FALSE},
4144 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4145 {"res",S_OK,FALSE},
4146 {"",S_FALSE,FALSE},
4147 {"",S_FALSE,FALSE}
4148 },
4149 {
4150 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4151 {0,S_FALSE,FALSE},
4152 {URL_SCHEME_RES,S_OK,FALSE},
4153 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4154 }
4155 },
4156 /* Res URI can contain a '|' in the host name. */
4157 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4158 {
4159 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4160 {"c:\\di|r\\file.exe",S_OK,FALSE},
4161 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {"",S_FALSE,FALSE},
4164 {"",S_FALSE,FALSE},
4165 {"c:\\di|r\\file.exe",S_OK,FALSE},
4166 {"",S_FALSE,FALSE},
4167 {"/test",S_OK,FALSE},
4168 {"/test",S_OK,FALSE},
4169 {"",S_FALSE,FALSE},
4170 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4171 {"res",S_OK,FALSE},
4172 {"",S_FALSE,FALSE},
4173 {"",S_FALSE,FALSE}
4174 },
4175 {
4176 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4177 {0,S_FALSE,FALSE},
4178 {URL_SCHEME_RES,S_OK,FALSE},
4179 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4180 }
4181 },
4182 /* Res URIs can have invalid percent encoded values. */
4183 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4184 {
4185 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4186 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4187 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4188 {"",S_FALSE,FALSE},
4189 {"",S_FALSE,FALSE},
4190 {"",S_FALSE,FALSE},
4191 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4192 {"",S_FALSE,FALSE},
4193 {"/test",S_OK,FALSE},
4194 {"/test",S_OK,FALSE},
4195 {"",S_FALSE,FALSE},
4196 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4197 {"res",S_OK,FALSE},
4198 {"",S_FALSE,FALSE},
4199 {"",S_FALSE,FALSE}
4200 },
4201 {
4202 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4203 {0,S_FALSE,FALSE},
4204 {URL_SCHEME_RES,S_OK,FALSE},
4205 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4206 }
4207 },
4208 /* Res doesn't get forbidden characters percent encoded in its path. */
4209 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4210 {
4211 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4212 {"c:\\test",S_OK,FALSE},
4213 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4214 {"",S_FALSE,FALSE},
4215 {"",S_FALSE,FALSE},
4216 {"",S_FALSE,FALSE},
4217 {"c:\\test",S_OK,FALSE},
4218 {"",S_FALSE,FALSE},
4219 {"/tes<|>t",S_OK,FALSE},
4220 {"/tes<|>t",S_OK,FALSE},
4221 {"",S_FALSE,FALSE},
4222 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4223 {"res",S_OK,FALSE},
4224 {"",S_FALSE,FALSE},
4225 {"",S_FALSE,FALSE}
4226 },
4227 {
4228 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4229 {0,S_FALSE,FALSE},
4230 {URL_SCHEME_RES,S_OK,FALSE},
4231 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4232 }
4233 },
4234 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4235 {
4236 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4239 {"",S_FALSE,FALSE},
4240 {".jpg",S_OK,FALSE},
4241 {"",S_FALSE,FALSE},
4242 {"",S_FALSE,FALSE},
4243 {"",S_FALSE,FALSE},
4244 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4245 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4246 {"",S_FALSE,FALSE},
4247 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4248 {"mk",S_OK,FALSE},
4249 {"",S_FALSE,FALSE},
4250 {"",S_FALSE,FALSE}
4251 },
4252 {
4253 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4254 {0,S_FALSE,FALSE},
4255 {URL_SCHEME_MK,S_OK,FALSE},
4256 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4257 }
4258 },
4259 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4260 {
4261 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4264 {"",S_FALSE,FALSE},
4265 {".jpg",S_OK,FALSE},
4266 {"",S_FALSE,FALSE},
4267 {"",S_FALSE,FALSE},
4268 {"",S_FALSE,FALSE},
4269 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4270 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4271 {"",S_FALSE,FALSE},
4272 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4273 {"mk",S_OK,FALSE},
4274 {"",S_FALSE,FALSE},
4275 {"",S_FALSE,FALSE}
4276 },
4277 {
4278 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4279 {0,S_FALSE,FALSE},
4280 {URL_SCHEME_MK,S_OK,FALSE},
4281 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4282 }
4283 },
4284 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4285 {
4286 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4289 {"",S_FALSE,FALSE},
4290 {".jpg",S_OK,FALSE},
4291 {"",S_FALSE,FALSE},
4292 {"",S_FALSE,FALSE},
4293 {"",S_FALSE,FALSE},
4294 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4295 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4296 {"",S_FALSE,FALSE},
4297 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4298 {"xx",S_OK,FALSE},
4299 {"",S_FALSE,FALSE},
4300 {"",S_FALSE,FALSE}
4301 },
4302 {
4303 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4304 {0,S_FALSE,FALSE},
4305 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4306 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4307 }
4308 },
4309 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4310 {
4311 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4312 {"",S_FALSE,FALSE},
4313 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4314 {"",S_FALSE,FALSE},
4315 {".jpg",S_OK,FALSE},
4316 {"",S_FALSE,FALSE},
4317 {"",S_FALSE,FALSE},
4318 {"",S_FALSE,FALSE},
4319 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4320 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4321 {"",S_FALSE,FALSE},
4322 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4323 {"mk",S_OK,FALSE},
4324 {"",S_FALSE,FALSE},
4325 {"",S_FALSE,FALSE}
4326 },
4327 {
4328 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4329 {0,S_FALSE,FALSE},
4330 {URL_SCHEME_MK,S_OK,FALSE},
4331 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4332 }
4333 },
4334 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4335 {
4336 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4337 {"",S_FALSE,FALSE},
4338 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4339 {"",S_FALSE,FALSE},
4340 {".jpg",S_OK,FALSE},
4341 {"",S_FALSE,FALSE},
4342 {"",S_FALSE,FALSE},
4343 {"",S_FALSE,FALSE},
4344 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4345 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4346 {"",S_FALSE,FALSE},
4347 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4348 {"mk",S_OK,FALSE},
4349 {"",S_FALSE,FALSE},
4350 {"",S_FALSE,FALSE}
4351 },
4352 {
4353 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4354 {0,S_FALSE,FALSE},
4355 {URL_SCHEME_MK,S_OK,FALSE},
4356 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4357 }
4358 },
4359 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4360 {
4361 {"mk:images/xxx.jpg",S_OK,FALSE},
4362 {"",S_FALSE,FALSE},
4363 {"mk:images/xxx.jpg",S_OK,FALSE},
4364 {"",S_FALSE,FALSE},
4365 {".jpg",S_OK,FALSE},
4366 {"",S_FALSE,FALSE},
4367 {"",S_FALSE,FALSE},
4368 {"",S_FALSE,FALSE},
4369 {"images/xxx.jpg",S_OK,FALSE},
4370 {"images/xxx.jpg",S_OK,FALSE},
4371 {"",S_FALSE,FALSE},
4372 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4373 {"mk",S_OK,FALSE},
4374 {"",S_FALSE,FALSE},
4375 {"",S_FALSE,FALSE}
4376 },
4377 {
4378 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4379 {0,S_FALSE,FALSE},
4380 {URL_SCHEME_MK,S_OK,FALSE},
4381 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4382 }
4383 },
4384 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4385 {
4386 {"",S_OK,FALSE},
4387 {"",S_FALSE,FALSE},
4388 {"",S_OK,FALSE},
4389 {"",S_FALSE,FALSE},
4390 {"",S_FALSE,FALSE},
4391 {"",S_FALSE,FALSE},
4392 {"",S_FALSE,FALSE},
4393 {"",S_FALSE,FALSE},
4394 {"",S_OK,FALSE},
4395 {"",S_OK,FALSE},
4396 {"",S_FALSE,FALSE},
4397 {"",S_OK,FALSE},
4398 {"",S_FALSE,FALSE},
4399 {"",S_FALSE,FALSE},
4400 {"",S_FALSE,FALSE}
4401 },
4402 {
4403 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4404 {0,S_FALSE,FALSE},
4405 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4406 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4407 }
4408 },
4409 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4410 {
4411 {"",S_OK,FALSE},
4412 {"",S_FALSE,FALSE},
4413 {"",S_OK,FALSE},
4414 {"",S_FALSE,FALSE},
4415 {"",S_FALSE,FALSE},
4416 {"",S_FALSE,FALSE},
4417 {"",S_FALSE,FALSE},
4418 {"",S_FALSE,FALSE},
4419 {"",S_OK,FALSE},
4420 {"",S_OK,FALSE},
4421 {"",S_FALSE,FALSE},
4422 {"",S_OK,FALSE},
4423 {"",S_FALSE,FALSE},
4424 {"",S_FALSE,FALSE},
4425 {"",S_FALSE,FALSE}
4426 },
4427 {
4428 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4429 {0,S_FALSE,FALSE},
4430 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4431 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4432 }
4433 },
4434 { "javascript:void", 0, S_OK, FALSE,
4435 {
4436 {"javascript:void",S_OK},
4437 {"",S_FALSE},
4438 {"javascript:void",S_OK},
4439 {"",S_FALSE},
4440 {"",S_FALSE},
4441 {"",S_FALSE},
4442 {"",S_FALSE},
4443 {"",S_FALSE},
4444 {"void",S_OK},
4445 {"void",S_OK},
4446 {"",S_FALSE},
4447 {"javascript:void",S_OK},
4448 {"javascript",S_OK},
4449 {"",S_FALSE},
4450 {"",S_FALSE}
4451 },
4452 {
4453 {Uri_HOST_UNKNOWN,S_OK},
4454 {0,S_FALSE},
4455 {URL_SCHEME_JAVASCRIPT,S_OK},
4456 {URLZONE_INVALID,E_NOTIMPL}
4457 }
4458 },
4459 { "javascript://undefined", 0, S_OK, FALSE,
4460 {
4461 {"javascript://undefined",S_OK},
4462 {"",S_FALSE},
4463 {"javascript://undefined",S_OK},
4464 {"",S_FALSE},
4465 {"",S_FALSE},
4466 {"",S_FALSE},
4467 {"",S_FALSE},
4468 {"",S_FALSE},
4469 {"//undefined",S_OK},
4470 {"//undefined",S_OK},
4471 {"",S_FALSE},
4472 {"javascript://undefined",S_OK},
4473 {"javascript",S_OK},
4474 {"",S_FALSE},
4475 {"",S_FALSE}
4476 },
4477 {
4478 {Uri_HOST_UNKNOWN,S_OK},
4479 {0,S_FALSE},
4480 {URL_SCHEME_JAVASCRIPT,S_OK},
4481 {URLZONE_INVALID,E_NOTIMPL}
4482 }
4483 },
4484 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4485 {
4486 {"javascript:escape('/\\?#?')",S_OK},
4487 {"",S_FALSE},
4488 {"javascript:escape('/\\?#?')",S_OK},
4489 {"",S_FALSE},
4490 {"",S_FALSE},
4491 {"",S_FALSE},
4492 {"",S_FALSE},
4493 {"",S_FALSE},
4494 {"escape('/\\?#?')",S_OK},
4495 {"escape('/\\?#?')",S_OK},
4496 {"",S_FALSE},
4497 {"JavaSCript:escape('/\\?#?')",S_OK},
4498 {"javascript",S_OK},
4499 {"",S_FALSE},
4500 {"",S_FALSE}
4501 },
4502 {
4503 {Uri_HOST_UNKNOWN,S_OK},
4504 {0,S_FALSE},
4505 {URL_SCHEME_JAVASCRIPT,S_OK},
4506 {URLZONE_INVALID,E_NOTIMPL}
4507 }
4508 },
4509 { "*://google.com", 0, S_OK, FALSE,
4510 {
4511 {"*:google.com/",S_OK,FALSE},
4512 {"google.com",S_OK},
4513 {"*:google.com/",S_OK,FALSE},
4514 {"google.com",S_OK,FALSE},
4515 {"",S_FALSE,FALSE},
4516 {"",S_FALSE,FALSE},
4517 {"google.com",S_OK,FALSE},
4518 {"",S_FALSE,FALSE},
4519 {"/",S_OK,FALSE},
4520 {"/",S_OK,FALSE},
4521 {"",S_FALSE,FALSE},
4522 {"*://google.com",S_OK,FALSE},
4523 {"*",S_OK,FALSE},
4524 {"",S_FALSE,FALSE},
4525 {"",S_FALSE,FALSE}
4526 },
4527 {
4528 {Uri_HOST_DNS,S_OK,FALSE},
4529 {0,S_FALSE,FALSE},
4530 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4531 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4532 }
4533 },
4534 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4535 {
4536 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4537 {"",S_FALSE},
4538 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4539 {"",S_FALSE},
4540 {".txt",S_OK},
4541 {"",S_FALSE},
4542 {"",S_FALSE},
4543 {"",S_FALSE},
4544 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4545 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4546 {"",S_FALSE},
4547 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4548 {"mk",S_OK},
4549 {"",S_FALSE},
4550 {"",S_FALSE}
4551 },
4552 {
4553 {Uri_HOST_UNKNOWN,S_OK},
4554 {0,S_FALSE},
4555 {URL_SCHEME_MK,S_OK},
4556 {URLZONE_INVALID,E_NOTIMPL}
4557 }
4558 },
4559 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4560 {
4561 {"gopher://test.winehq.org:151/file.txt",S_OK},
4562 {"test.winehq.org:151",S_OK},
4563 {"gopher://test.winehq.org:151/file.txt",S_OK},
4564 {"winehq.org",S_OK},
4565 {".txt",S_OK},
4566 {"",S_FALSE},
4567 {"test.winehq.org",S_OK},
4568 {"",S_FALSE},
4569 {"/file.txt",S_OK},
4570 {"/file.txt",S_OK},
4571 {"",S_FALSE},
4572 {"gopher://test.winehq.org:151/file.txt",S_OK},
4573 {"gopher",S_OK},
4574 {"",S_FALSE},
4575 {"",S_FALSE}
4576 },
4577 {
4578 {Uri_HOST_DNS,S_OK},
4579 {151,S_OK},
4580 {URL_SCHEME_GOPHER,S_OK},
4581 {URLZONE_INVALID,E_NOTIMPL}
4582 }
4583 },
4584 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4585 {
4586 {"//host.com/path/file.txt?query",S_OK},
4587 {"host.com",S_OK},
4588 {"//host.com/path/file.txt?query",S_OK},
4589 {"host.com",S_OK},
4590 {".txt",S_OK},
4591 {"",S_FALSE},
4592 {"host.com",S_OK},
4593 {"",S_FALSE},
4594 {"/path/file.txt",S_OK},
4595 {"/path/file.txt?query",S_OK},
4596 {"?query",S_OK},
4597 {"//host.com/path/file.txt?query",S_OK},
4598 {"",S_FALSE},
4599 {"",S_FALSE},
4600 {"",S_FALSE},
4601 },
4602 {
4603 {Uri_HOST_DNS,S_OK},
4604 {0,S_FALSE},
4605 {URL_SCHEME_UNKNOWN,S_OK},
4606 {URLZONE_INVALID,E_NOTIMPL}
4607 }
4608 },
4609 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4610 {
4611 {"//host/path/file.txt?query",S_OK},
4612 {"host",S_OK},
4613 {"//host/path/file.txt?query",S_OK},
4614 {"",S_FALSE},
4615 {".txt",S_OK},
4616 {"",S_FALSE},
4617 {"host",S_OK},
4618 {"",S_FALSE},
4619 {"/path/file.txt",S_OK},
4620 {"/path/file.txt?query",S_OK},
4621 {"?query",S_OK},
4622 {"//host/path/file.txt?query",S_OK},
4623 {"",S_FALSE},
4624 {"",S_FALSE},
4625 {"",S_FALSE},
4626 },
4627 {
4628 {Uri_HOST_DNS,S_OK},
4629 {0,S_FALSE},
4630 {URL_SCHEME_UNKNOWN,S_OK},
4631 {URLZONE_INVALID,E_NOTIMPL}
4632 }
4633 },
4634 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4635 {
4636 {"//host/",S_OK},
4637 {"host",S_OK},
4638 {"//host/",S_OK},
4639 {"",S_FALSE},
4640 {"",S_FALSE},
4641 {"",S_FALSE},
4642 {"host",S_OK},
4643 {"",S_FALSE},
4644 {"/",S_OK},
4645 {"/",S_OK},
4646 {"",S_FALSE},
4647 {"//host",S_OK},
4648 {"",S_FALSE},
4649 {"",S_FALSE},
4650 {"",S_FALSE},
4651 },
4652 {
4653 {Uri_HOST_DNS,S_OK},
4654 {0,S_FALSE},
4655 {URL_SCHEME_UNKNOWN,S_OK},
4656 {URLZONE_INVALID,E_NOTIMPL}
4657 }
4658 },
4659 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4660 {
4661 {"mailto:",S_OK},
4662 {"",S_FALSE},
4663 {"mailto:",S_OK},
4664 {"",S_FALSE},
4665 {"",S_FALSE},
4666 {"",S_FALSE},
4667 {"",S_FALSE},
4668 {"",S_FALSE},
4669 {"",S_FALSE},
4670 {"",S_FALSE},
4671 {"",S_FALSE},
4672 {"mailto://",S_OK,FALSE,"mailto:"},
4673 {"mailto",S_OK},
4674 {"",S_FALSE},
4675 {"",S_FALSE}
4676 },
4677 {
4678 {Uri_HOST_UNKNOWN,S_OK},
4679 {0,S_FALSE},
4680 {URL_SCHEME_MAILTO,S_OK},
4681 {URLZONE_INVALID,E_NOTIMPL}
4682 }
4683 },
4684 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4685 {
4686 {"mailto:a@b.com",S_OK},
4687 {"",S_FALSE},
4688 {"mailto:a@b.com",S_OK},
4689 {"",S_FALSE},
4690 {".com",S_OK},
4691 {"",S_FALSE},
4692 {"",S_FALSE},
4693 {"",S_FALSE},
4694 {"a@b.com",S_OK},
4695 {"a@b.com",S_OK},
4696 {"",S_FALSE},
4697 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4698 {"mailto",S_OK},
4699 {"",S_FALSE},
4700 {"",S_FALSE}
4701 },
4702 {
4703 {Uri_HOST_UNKNOWN,S_OK},
4704 {0,S_FALSE},
4705 {URL_SCHEME_MAILTO,S_OK},
4706 {URLZONE_INVALID,E_NOTIMPL}
4707 }
4708 },
4709 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4710 {
4711 {"file://c:\\test file.html",S_OK,FALSE},
4712 {"",S_FALSE,FALSE},
4713 {"file://c:\\test file.html",S_OK,FALSE},
4714 {"",S_FALSE,FALSE},
4715 {".html",S_OK,FALSE},
4716 {"",S_FALSE,FALSE},
4717 {"",S_FALSE,FALSE},
4718 {"",S_FALSE,FALSE},
4719 {"c:\\test file.html",S_OK,FALSE},
4720 {"c:\\test file.html",S_OK,FALSE},
4721 {"",S_FALSE,FALSE},
4722 {"c:\\test file.html",S_OK,FALSE},
4723 {"file",S_OK,FALSE},
4724 {"",S_FALSE,FALSE},
4725 {"",S_FALSE,FALSE}
4726 },
4727 {
4728 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4729 {0,S_FALSE,FALSE},
4730 {URL_SCHEME_FILE,S_OK,FALSE},
4731 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4732 }
4733 },
4734 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4735 {
4736 {"file://c:\\test%20file.html",S_OK,FALSE},
4737 {"",S_FALSE,FALSE},
4738 {"file://c:\\test%20file.html",S_OK,FALSE},
4739 {"",S_FALSE,FALSE},
4740 {".html",S_OK,FALSE},
4741 {"",S_FALSE,FALSE},
4742 {"",S_FALSE,FALSE},
4743 {"",S_FALSE,FALSE},
4744 {"c:\\test%20file.html",S_OK,FALSE},
4745 {"c:\\test%20file.html",S_OK,FALSE},
4746 {"",S_FALSE,FALSE},
4747 {"c:\\test%20file.html",S_OK,FALSE},
4748 {"file",S_OK,FALSE},
4749 {"",S_FALSE,FALSE},
4750 {"",S_FALSE,FALSE}
4751 },
4752 {
4753 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4754 {0,S_FALSE,FALSE},
4755 {URL_SCHEME_FILE,S_OK,FALSE},
4756 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4757 }
4758 },
4759 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4760 {
4761 {"file:///c:/test%20file.html",S_OK,FALSE},
4762 {"",S_FALSE,FALSE},
4763 {"file:///c:/test%20file.html",S_OK,FALSE},
4764 {"",S_FALSE,FALSE},
4765 {".html",S_OK,FALSE},
4766 {"",S_FALSE,FALSE},
4767 {"",S_FALSE,FALSE},
4768 {"",S_FALSE,FALSE},
4769 {"/c:/test%20file.html",S_OK,FALSE},
4770 {"/c:/test%20file.html",S_OK,FALSE},
4771 {"",S_FALSE,FALSE},
4772 {"c:\\test file.html",S_OK,FALSE},
4773 {"file",S_OK,FALSE},
4774 {"",S_FALSE,FALSE},
4775 {"",S_FALSE,FALSE}
4776 },
4777 {
4778 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4779 {0,S_FALSE,FALSE},
4780 {URL_SCHEME_FILE,S_OK,FALSE},
4781 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4782 }
4783 },
4784 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4785 {
4786 {"file:///c:/test%2520file.html",S_OK,FALSE},
4787 {"",S_FALSE,FALSE},
4788 {"file:///c:/test%2520file.html",S_OK,FALSE},
4789 {"",S_FALSE,FALSE},
4790 {".html",S_OK,FALSE},
4791 {"",S_FALSE,FALSE},
4792 {"",S_FALSE,FALSE},
4793 {"",S_FALSE,FALSE},
4794 {"/c:/test%2520file.html",S_OK,FALSE},
4795 {"/c:/test%2520file.html",S_OK,FALSE},
4796 {"",S_FALSE,FALSE},
4797 {"c:\\test%20file.html",S_OK,FALSE},
4798 {"file",S_OK,FALSE},
4799 {"",S_FALSE,FALSE},
4800 {"",S_FALSE,FALSE}
4801 },
4802 {
4803 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4804 {0,S_FALSE,FALSE},
4805 {URL_SCHEME_FILE,S_OK,FALSE},
4806 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4807 }
4808 }
4809 };
4810
4811 typedef struct _invalid_uri {
4812 const char* uri;
4813 DWORD flags;
4814 BOOL todo;
4815 } invalid_uri;
4816
4817 static const invalid_uri invalid_uri_tests[] = {
4818 /* Has to have a scheme name. */
4819 {"://www.winehq.org",0,FALSE},
4820 /* Windows doesn't like URIs which are implicitly file paths without the
4821 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4822 */
4823 {"C:/test/test.mp3",0,FALSE},
4824 {"\\\\Server/test/test.mp3",0,FALSE},
4825 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4826 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4827 /* Invalid schemes. */
4828 {"*abcd://not.valid.com",0,FALSE},
4829 {"*a*b*c*d://not.valid.com",0,FALSE},
4830 /* Not allowed to have invalid % encoded data. */
4831 {"ftp://google.co%XX/",0,FALSE},
4832 /* Too many h16 components. */
4833 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4834 /* Not enough room for IPv4 address. */
4835 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4836 /* Not enough h16 components. */
4837 {"http://[1:2:3:4]",0,FALSE},
4838 /* Not enough components including IPv4. */
4839 {"http://[1:192.0.1.0]",0,FALSE},
4840 /* Not allowed to have partial IPv4 in IPv6. */
4841 {"http://[::192.0]",0,FALSE},
4842 /* Can't have elision of 1 h16 at beginning of address. */
4843 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4844 /* Expects a valid IP Literal. */
4845 {"ftp://[not.valid.uri]/",0,FALSE},
4846 /* Expects valid port for a known scheme type. */
4847 {"ftp://www.winehq.org:123fgh",0,FALSE},
4848 /* Port exceeds USHORT_MAX for known scheme type. */
4849 {"ftp://www.winehq.org:65536",0,FALSE},
4850 /* Invalid port with IPv4 address. */
4851 {"http://www.winehq.org:1abcd",0,FALSE},
4852 /* Invalid port with IPv6 address. */
4853 {"http://[::ffff]:32xy",0,FALSE},
4854 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4855 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4856 /* Not allowed to have invalid % encoded data in opaque URI path. */
4857 {"news:test%XX",0,FALSE},
4858 {"mailto:wine@winehq%G8.com",0,FALSE},
4859 /* Known scheme types can't have invalid % encoded data in query string. */
4860 {"http://google.com/?query=te%xx",0,FALSE},
4861 /* Invalid % encoded data in fragment of know scheme type. */
4862 {"ftp://google.com/#Test%xx",0,FALSE},
4863 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4864 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4865 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4866 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4867 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4868 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4869 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4870 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4871 /* res URIs aren't allowed to have forbidden dos path characters in the
4872 * hostname.
4873 */
4874 {"res://c:\\te<st\\test/test",0,FALSE},
4875 {"res://c:\\te>st\\test/test",0,FALSE},
4876 {"res://c:\\te\"st\\test/test",0,FALSE},
4877 {"res://c:\\test/te%xxst",0,FALSE}
4878 };
4879
4880 typedef struct _uri_equality {
4881 const char* a;
4882 DWORD create_flags_a;
4883 const char* b;
4884 DWORD create_flags_b;
4885 BOOL equal;
4886 BOOL todo;
4887 } uri_equality;
4888
4889 static const uri_equality equality_tests[] = {
4890 {
4891 "HTTP://www.winehq.org/test dir/./",0,
4892 "http://www.winehq.org/test dir/../test dir/",0,
4893 TRUE
4894 },
4895 {
4896 /* http://www.winehq.org/test%20dir */
4897 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4898 "http://www.winehq.org/test dir",0,
4899 TRUE
4900 },
4901 {
4902 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4903 "file:///c:/test.mp3",0,
4904 TRUE
4905 },
4906 {
4907 "ftp://ftp.winehq.org/",0,
4908 "ftp://ftp.winehq.org",0,
4909 TRUE
4910 },
4911 {
4912 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4913 "ftp://ftp.winehq.org/t%45stB/",0,
4914 FALSE
4915 },
4916 {
4917 "http://google.com/TEST",0,
4918 "http://google.com/test",0,
4919 FALSE
4920 },
4921 {
4922 "http://GOOGLE.com/",0,
4923 "http://google.com/",0,
4924 TRUE
4925 },
4926 /* Performs case insensitive compare of host names (for known scheme types). */
4927 {
4928 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4929 "ftp://google.com/",0,
4930 TRUE
4931 },
4932 {
4933 "zip://GOOGLE.com/",0,
4934 "zip://google.com/",0,
4935 FALSE
4936 },
4937 {
4938 "file:///c:/TEST/TeST/",0,
4939 "file:///c:/test/test/",0,
4940 TRUE
4941 },
4942 {
4943 "file:///server/TEST",0,
4944 "file:///SERVER/TEST",0,
4945 TRUE
4946 },
4947 {
4948 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4949 "http://google.com/",0,
4950 TRUE
4951 },
4952 {
4953 "ftp://google.com:21/",0,
4954 "ftp://google.com/",0,
4955 TRUE
4956 },
4957 {
4958 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4959 "http://google.com/",0,
4960 TRUE
4961 },
4962 {
4963 "http://google.com:70/",0,
4964 "http://google.com:71/",0,
4965 FALSE
4966 },
4967 {
4968 "file:///c:/dir/file.txt", 0,
4969 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4970 TRUE
4971 },
4972 {
4973 "file:///c:/dir/file.txt", 0,
4974 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4975 TRUE
4976 },
4977 {
4978 "file:///c:/dir/file.txt", 0,
4979 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4980 TRUE
4981 },
4982 {
4983 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4984 "file:///c:/%20dir/file.txt", 0,
4985 TRUE
4986 },
4987 {
4988 "file:///c:/Dir/file.txt", 0,
4989 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4990 TRUE
4991 },
4992 {
4993 "file:///c:/dir/file.txt", 0,
4994 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4995 TRUE
4996 },
4997 {
4998 "file:///c:/dir/file.txt#a", 0,
4999 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
5000 FALSE
5001 },
5002 /* Tests of an empty hash/fragment part */
5003 {
5004 "http://google.com/test",0,
5005 "http://google.com/test#",0,
5006 FALSE
5007 },
5008 {
5009 "ftp://ftp.winehq.org/",0,
5010 "ftp://ftp.winehq.org/#",0,
5011 FALSE
5012 },
5013 {
5014 "file:///c:/dir/file.txt#", 0,
5015 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
5016 FALSE
5017 }
5018 };
5019
5020 typedef struct _uri_with_fragment {
5021 const char* uri;
5022 const char* fragment;
5023 DWORD create_flags;
5024 HRESULT create_expected;
5025 BOOL create_todo;
5026
5027 const char* expected_uri;
5028 BOOL expected_todo;
5029 } uri_with_fragment;
5030
5031 static const uri_with_fragment uri_fragment_tests[] = {
5032 {
5033 "http://google.com/","#fragment",0,S_OK,FALSE,
5034 "http://google.com/#fragment",FALSE
5035 },
5036 {
5037 "http://google.com/","fragment",0,S_OK,FALSE,
5038 "http://google.com/#fragment",FALSE
5039 },
5040 {
5041 "zip://test.com/","?test",0,S_OK,FALSE,
5042 "zip://test.com/#?test",FALSE
5043 },
5044 /* The fragment can be empty. */
5045 {
5046 "ftp://ftp.google.com/","",0,S_OK,FALSE,
5047 "ftp://ftp.google.com/#",FALSE
5048 }
5049 };
5050
5051 typedef struct _uri_builder_property {
5052 BOOL change;
5053 const char *value;
5054 const char *expected_value;
5055 Uri_PROPERTY property;
5056 HRESULT expected;
5057 BOOL todo;
5058 } uri_builder_property;
5059
5060 typedef struct _uri_builder_port {
5061 BOOL change;
5062 BOOL set;
5063 DWORD value;
5064 HRESULT expected;
5065 BOOL todo;
5066 } uri_builder_port;
5067
5068 typedef struct _uri_builder_str_property {
5069 const char* expected;
5070 HRESULT result;
5071 BOOL todo;
5072 } uri_builder_str_property;
5073
5074 typedef struct _uri_builder_dword_property {
5075 DWORD expected;
5076 HRESULT result;
5077 BOOL todo;
5078 } uri_builder_dword_property;
5079
5080 typedef struct _uri_builder_test {
5081 const char *uri;
5082 DWORD create_flags;
5083 HRESULT create_builder_expected;
5084 BOOL create_builder_todo;
5085
5086 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
5087
5088 uri_builder_port port_prop;
5089
5090 DWORD uri_flags;
5091 HRESULT uri_hres;
5092 BOOL uri_todo;
5093
5094 DWORD uri_simple_encode_flags;
5095 HRESULT uri_simple_hres;
5096 BOOL uri_simple_todo;
5097
5098 DWORD uri_with_flags;
5099 DWORD uri_with_builder_flags;
5100 DWORD uri_with_encode_flags;
5101 HRESULT uri_with_hres;
5102 BOOL uri_with_todo;
5103
5104 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
5105 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
5106 } uri_builder_test;
5107
5108 static const uri_builder_test uri_builder_tests[] = {
5109 { "http://google.com/",0,S_OK,FALSE,
5110 {
5111 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5112 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
5113 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
5114 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5115 },
5116 {FALSE},
5117 0,S_OK,FALSE,
5118 0,S_OK,FALSE,
5119 0,0,0,S_OK,FALSE,
5120 {
5121 {"http://username:password@google.com/?query=x#fragment",S_OK},
5122 {"username:password@google.com",S_OK},
5123 {"http://google.com/?query=x#fragment",S_OK},
5124 {"google.com",S_OK},
5125 {"",S_FALSE},
5126 {"#fragment",S_OK},
5127 {"google.com",S_OK},
5128 {"password",S_OK},
5129 {"/",S_OK},
5130 {"/?query=x",S_OK},
5131 {"?query=x",S_OK},
5132 {"http://username:password@google.com/?query=x#fragment",S_OK},
5133 {"http",S_OK},
5134 {"username:password",S_OK},
5135 {"username",S_OK}
5136 },
5137 {
5138 {Uri_HOST_DNS,S_OK},
5139 {80,S_OK},
5140 {URL_SCHEME_HTTP,S_OK},
5141 {URLZONE_INVALID,E_NOTIMPL}
5142 }
5143 },
5144 { "http://google.com/",0,S_OK,FALSE,
5145 {
5146 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5147 },
5148 {TRUE,TRUE,120,S_OK,FALSE},
5149 0,S_OK,FALSE,
5150 0,S_OK,FALSE,
5151 0,0,0,S_OK,FALSE,
5152 {
5153 {"test://google.com:120/",S_OK},
5154 {"google.com:120",S_OK},
5155 {"test://google.com:120/",S_OK},
5156 {"google.com",S_OK},
5157 {"",S_FALSE},
5158 {"",S_FALSE},
5159 {"google.com",S_OK},
5160 {"",S_FALSE},
5161 {"/",S_OK},
5162 {"/",S_OK},
5163 {"",S_FALSE},
5164 {"test://google.com:120/",S_OK},
5165 {"test",S_OK},
5166 {"",S_FALSE},
5167 {"",S_FALSE}
5168 },
5169 {
5170 {Uri_HOST_DNS,S_OK},
5171 {120,S_OK},
5172 {URL_SCHEME_UNKNOWN,S_OK},
5173 {URLZONE_INVALID,E_NOTIMPL}
5174 }
5175 },
5176 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5177 {
5178 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5179 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5180 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5181 },
5182 {FALSE},
5183 0,S_OK,FALSE,
5184 0,S_OK,FALSE,
5185 0,0,0,S_OK,FALSE,
5186 {
5187 {"http://[::192.2.3.4]/",S_OK},
5188 {"[::192.2.3.4]",S_OK},
5189 {"http://[::192.2.3.4]/",S_OK},
5190 {"",S_FALSE},
5191 {"",S_FALSE},
5192 {"",S_FALSE},
5193 {"::192.2.3.4",S_OK},
5194 {"",S_FALSE},
5195 {"/",S_OK},
5196 {"/",S_OK},
5197 {"",S_FALSE},
5198 {"http://[::192.2.3.4]/",S_OK},
5199 {"http",S_OK},
5200 {"",S_FALSE},
5201 {"",S_FALSE}
5202 },
5203 {
5204 {Uri_HOST_IPV6,S_OK},
5205 {80,S_OK},
5206 {URL_SCHEME_HTTP,S_OK},
5207 {URLZONE_INVALID,E_NOTIMPL}
5208 }
5209 },
5210 { "http://google.com/",0,S_OK,FALSE,
5211 {
5212 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5213 },
5214 {FALSE},
5215 0,S_OK,FALSE,
5216 0,S_OK,FALSE,
5217 0,0,0,S_OK,FALSE,
5218 {
5219 {"http://google.com/#Frag",S_OK},
5220 {"google.com",S_OK},
5221 {"http://google.com/#Frag",S_OK},
5222 {"google.com",S_OK},
5223 {"",S_FALSE},
5224 {"#Frag",S_OK},
5225 {"google.com",S_OK},
5226 {"",S_FALSE},
5227 {"/",S_OK},
5228 {"/",S_OK},
5229 {"",S_FALSE},
5230 {"http://google.com/#Frag",S_OK},
5231 {"http",S_OK},
5232 {"",S_FALSE},
5233 {"",S_FALSE}
5234 },
5235 {
5236 {Uri_HOST_DNS,S_OK},
5237 {80,S_OK},
5238 {URL_SCHEME_HTTP,S_OK},
5239 {URLZONE_INVALID,E_NOTIMPL}
5240 }
5241 },
5242 { "http://google.com/",0,S_OK,FALSE,
5243 {
5244 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5245 },
5246 {FALSE},
5247 0,S_OK,FALSE,
5248 0,S_OK,FALSE,
5249 0,0,0,S_OK,FALSE,
5250 {
5251 {"http://google.com/#",S_OK},
5252 {"google.com",S_OK},
5253 {"http://google.com/#",S_OK},
5254 {"google.com",S_OK},
5255 {"",S_FALSE},
5256 {"#",S_OK},
5257 {"google.com",S_OK},
5258 {"",S_FALSE},
5259 {"/",S_OK},
5260 {"/",S_OK},
5261 {"",S_FALSE},
5262 {"http://google.com/#",S_OK},
5263 {"http",S_OK},
5264 {"",S_FALSE},
5265 {"",S_FALSE}
5266 },
5267 {
5268 {Uri_HOST_DNS,S_OK},
5269 {80,S_OK},
5270 {URL_SCHEME_HTTP,S_OK},
5271 {URLZONE_INVALID,E_NOTIMPL}
5272 }
5273 },
5274 { "http://google.com/",0,S_OK,FALSE,
5275 {
5276 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5277 },
5278 {FALSE},
5279 0,S_OK,FALSE,
5280 0,S_OK,FALSE,
5281 0,0,0,S_OK,FALSE,
5282 {
5283 {"http://::password@google.com/",S_OK},
5284 {"::password@google.com",S_OK},
5285 {"http://google.com/",S_OK},
5286 {"google.com",S_OK},
5287 {"",S_FALSE},
5288 {"",S_FALSE},
5289 {"google.com",S_OK},
5290 {":password",S_OK},
5291 {"/",S_OK},
5292 {"/",S_OK},
5293 {"",S_FALSE},
5294 {"http://::password@google.com/",S_OK},
5295 {"http",S_OK},
5296 {"::password",S_OK},
5297 {"",S_FALSE}
5298 },
5299 {
5300 {Uri_HOST_DNS,S_OK},
5301 {80,S_OK},
5302 {URL_SCHEME_HTTP,S_OK},
5303 {URLZONE_INVALID,E_NOTIMPL}
5304 }
5305 },
5306 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5307 {
5308 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5309 },
5310 {FALSE},
5311 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5312 0,S_OK,FALSE,
5313 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5314 {
5315 {":password@test/test",S_OK},
5316 {":password@",S_OK},
5317 {":password@test/test",S_OK},
5318 {"",S_FALSE},
5319 {"",S_FALSE},
5320 {"",S_FALSE},
5321 {"",S_FALSE},
5322 {"password",S_OK},
5323 {"test/test",S_OK},
5324 {"test/test",S_OK},
5325 {"",S_FALSE},
5326 {":password@test/test",S_OK},
5327 {"",S_FALSE},
5328 {":password",S_OK},
5329 {"",S_FALSE}
5330 },
5331 {
5332 {Uri_HOST_UNKNOWN,S_OK},
5333 {0,S_FALSE},
5334 {URL_SCHEME_UNKNOWN,S_OK},
5335 {URLZONE_INVALID,E_NOTIMPL}
5336 }
5337 },
5338 { "http://google.com/",0,S_OK,FALSE,
5339 {
5340 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5341 },
5342 {FALSE},
5343 0,S_OK,FALSE,
5344 0,S_OK,FALSE,
5345 0,0,0,S_OK,FALSE,
5346 {
5347 {"http://google.com/test/test",S_OK},
5348 {"google.com",S_OK},
5349 {"http://google.com/test/test",S_OK},
5350 {"google.com",S_OK},
5351 {"",S_FALSE},
5352 {"",S_FALSE},
5353 {"google.com",S_OK},
5354 {"",S_FALSE},
5355 {"/test/test",S_OK},
5356 {"/test/test",S_OK},
5357 {"",S_FALSE},
5358 {"http://google.com/test/test",S_OK},
5359 {"http",S_OK},
5360 {"",S_FALSE},
5361 {"",S_FALSE}
5362 },
5363 {
5364 {Uri_HOST_DNS,S_OK},
5365 {80,S_OK},
5366 {URL_SCHEME_HTTP,S_OK},
5367 {URLZONE_INVALID,E_NOTIMPL}
5368 }
5369 },
5370 { "zip:testing/test",0,S_OK,FALSE,
5371 {
5372 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5373 },
5374 {FALSE},
5375 0,S_OK,FALSE,
5376 0,S_OK,FALSE,
5377 0,0,0,S_OK,FALSE,
5378 {
5379 {"zip:test",S_OK},
5380 {"",S_FALSE},
5381 {"zip:test",S_OK},
5382 {"",S_FALSE},
5383 {"",S_FALSE},
5384 {"",S_FALSE},
5385 {"",S_FALSE},
5386 {"",S_FALSE},
5387 {"test",S_OK},
5388 {"test",S_OK},
5389 {"",S_FALSE},
5390 {"zip:test",S_OK},
5391 {"zip",S_OK},
5392 {"",S_FALSE},
5393 {"",S_FALSE}
5394 },
5395 {
5396 {Uri_HOST_UNKNOWN,S_OK},
5397 {0,S_FALSE},
5398 {URL_SCHEME_UNKNOWN,S_OK},
5399 {URLZONE_INVALID,E_NOTIMPL}
5400 }
5401 },
5402 { "http://google.com/",0,S_OK,FALSE,
5403 {
5404 {FALSE},
5405 },
5406 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5407 {TRUE,FALSE,555,S_OK,FALSE},
5408 0,S_OK,FALSE,
5409 0,S_OK,FALSE,
5410 0,0,0,S_OK,FALSE,
5411 {
5412 {"http://google.com/",S_OK},
5413 {"google.com",S_OK},
5414 {"http://google.com/",S_OK},
5415 {"google.com",S_OK},
5416 {"",S_FALSE},
5417 {"",S_FALSE},
5418 {"google.com",S_OK},
5419 {"",S_FALSE},
5420 {"/",S_OK},
5421 {"/",S_OK},
5422 {"",S_FALSE},
5423 {"http://google.com/",S_OK},
5424 {"http",S_OK},
5425 {"",S_FALSE},
5426 {"",S_FALSE}
5427 },
5428 {
5429 {Uri_HOST_DNS,S_OK},
5430 /* Still returns 80, even though earlier the port was disabled. */
5431 {80,S_OK},
5432 {URL_SCHEME_HTTP,S_OK},
5433 {URLZONE_INVALID,E_NOTIMPL}
5434 }
5435 },
5436 { "http://google.com/",0,S_OK,FALSE,
5437 {
5438 {FALSE},
5439 },
5440 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5441 * you'll get 122345 instead.
5442 */
5443 {TRUE,122345,222,S_OK,FALSE},
5444 0,S_OK,FALSE,
5445 0,S_OK,FALSE,
5446 0,0,0,S_OK,FALSE,
5447 {
5448 {"http://google.com:222/",S_OK},
5449 {"google.com:222",S_OK},
5450 {"http://google.com:222/",S_OK},
5451 {"google.com",S_OK},
5452 {"",S_FALSE},
5453 {"",S_FALSE},
5454 {"google.com",S_OK},
5455 {"",S_FALSE},
5456 {"/",S_OK},
5457 {"/",S_OK},
5458 {"",S_FALSE},
5459 {"http://google.com:222/",S_OK},
5460 {"http",S_OK},
5461 {"",S_FALSE},
5462 {"",S_FALSE}
5463 },
5464 {
5465 {Uri_HOST_DNS,S_OK},
5466 {222,S_OK},
5467 {URL_SCHEME_HTTP,S_OK},
5468 {URLZONE_INVALID,E_NOTIMPL}
5469 }
5470 },
5471 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5472 { "http://google.com/",0,S_OK,FALSE,
5473 {
5474 {FALSE},
5475 },
5476 {TRUE,TRUE,999999,S_OK,FALSE},
5477 0,S_OK,FALSE,
5478 0,S_OK,FALSE,
5479 0,0,0,S_OK,FALSE,
5480 {
5481 {"http://google.com:999999/",S_OK},
5482 {"google.com:999999",S_OK},
5483 {"http://google.com:999999/",S_OK},
5484 {"google.com",S_OK},
5485 {"",S_FALSE},
5486 {"",S_FALSE},
5487 {"google.com",S_OK},
5488 {"",S_FALSE},
5489 {"/",S_OK},
5490 {"/",S_OK},
5491 {"",S_FALSE},
5492 {"http://google.com:999999/",S_OK},
5493 {"http",S_OK},
5494 {"",S_FALSE},
5495 {"",S_FALSE}
5496 },
5497 {
5498 {Uri_HOST_DNS,S_OK},
5499 {999999,S_OK},
5500 {URL_SCHEME_HTTP,S_OK},
5501 {URLZONE_INVALID,E_NOTIMPL}
5502 }
5503 },
5504 { "http://google.com/",0,S_OK,FALSE,
5505 {
5506 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5507 },
5508
5509 {FALSE},
5510 0,S_OK,FALSE,
5511 0,S_OK,FALSE,
5512 0,0,0,S_OK,FALSE,
5513 {
5514 {"http://google.com/?test",S_OK},
5515 {"google.com",S_OK},
5516 {"http://google.com/?test",S_OK},
5517 {"google.com",S_OK},
5518 {"",S_FALSE},
5519 {"",S_FALSE},
5520 {"google.com",S_OK},
5521 {"",S_FALSE},
5522 {"/",S_OK},
5523 {"/?test",S_OK},
5524 {"?test",S_OK},
5525 {"http://google.com/?test",S_OK},
5526 {"http",S_OK},
5527 {"",S_FALSE},
5528 {"",S_FALSE}
5529 },
5530 {
5531 {Uri_HOST_DNS,S_OK},
5532 {80,S_OK},
5533 {URL_SCHEME_HTTP,S_OK},
5534 {URLZONE_INVALID,E_NOTIMPL}
5535 }
5536 },
5537 { "http://:password@google.com/",0,S_OK,FALSE,
5538 {
5539 {FALSE},
5540 },
5541 {FALSE},
5542 0,S_OK,FALSE,
5543 0,S_OK,FALSE,
5544 0,0,0,S_OK,FALSE,
5545 {
5546 {"http://:password@google.com/",S_OK},
5547 {":password@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 {"password",S_OK},
5554 {"/",S_OK},
5555 {"/",S_OK},
5556 {"",S_FALSE},
5557 {"http://:password@google.com/",S_OK},
5558 {"http",S_OK},
5559 {":password",S_OK},
5560 {"",S_FALSE}
5561 },
5562 {
5563 {Uri_HOST_DNS,S_OK},
5564 {80,S_OK},
5565 {URL_SCHEME_HTTP,S_OK},
5566 {URLZONE_INVALID,E_NOTIMPL}
5567 }
5568 },
5569 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5570 { NULL,0,S_OK,FALSE,
5571 {
5572 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5573 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5574 },
5575 {FALSE},
5576 0,S_OK,FALSE,
5577 0,S_OK,FALSE,
5578 0,0,0,S_OK,FALSE,
5579 {
5580 {"http://google.com/",S_OK},
5581 {"google.com",S_OK},
5582 {"http://google.com/",S_OK},
5583 {"google.com",S_OK},
5584 {"",S_FALSE},
5585 {"",S_FALSE},
5586 {"google.com",S_OK},
5587 {"",S_FALSE},
5588 {"/",S_OK},
5589 {"/",S_OK},
5590 {"",S_FALSE},
5591 {"http://google.com/",S_OK},
5592 {"http",S_OK},
5593 {"",S_FALSE},
5594 {"",S_FALSE}
5595 },
5596 {
5597 {Uri_HOST_DNS,S_OK},
5598 {80,S_OK},
5599 {URL_SCHEME_HTTP,S_OK},
5600 {URLZONE_INVALID,E_NOTIMPL}
5601 }
5602 },
5603 /* Can't set the scheme name to NULL. */
5604 { "zip://google.com/",0,S_OK,FALSE,
5605 {
5606 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5607 },
5608 {FALSE},
5609 0,S_OK,FALSE,
5610 0,S_OK,FALSE,
5611 0,0,0,S_OK,FALSE,
5612 {
5613 {"zip://google.com/",S_OK},
5614 {"google.com",S_OK},
5615 {"zip://google.com/",S_OK},
5616 {"google.com",S_OK},
5617 {"",S_FALSE},
5618 {"",S_FALSE},
5619 {"google.com",S_OK},
5620 {"",S_FALSE},
5621 {"/",S_OK},
5622 {"/",S_OK},
5623 {"",S_FALSE},
5624 {"zip://google.com/",S_OK},
5625 {"zip",S_OK},
5626 {"",S_FALSE},
5627 {"",S_FALSE}
5628 },
5629 {
5630 {Uri_HOST_DNS,S_OK},
5631 {0,S_FALSE},
5632 {URL_SCHEME_UNKNOWN,S_OK},
5633 {URLZONE_INVALID,E_NOTIMPL}
5634 }
5635 },
5636 /* Can't set the scheme name to an empty string. */
5637 { "zip://google.com/",0,S_OK,FALSE,
5638 {
5639 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5640 },
5641 {FALSE},
5642 0,S_OK,FALSE,
5643 0,S_OK,FALSE,
5644 0,0,0,S_OK,FALSE,
5645 {
5646 {"zip://google.com/",S_OK},
5647 {"google.com",S_OK},
5648 {"zip://google.com/",S_OK},
5649 {"google.com",S_OK},
5650 {"",S_FALSE},
5651 {"",S_FALSE},
5652 {"google.com",S_OK},
5653 {"",S_FALSE},
5654 {"/",S_OK},
5655 {"/",S_OK},
5656 {"",S_FALSE},
5657 {"zip://google.com/",S_OK},
5658 {"zip",S_OK},
5659 {"",S_FALSE},
5660 {"",S_FALSE}
5661 },
5662 {
5663 {Uri_HOST_DNS,S_OK},
5664 {0,S_FALSE},
5665 {URL_SCHEME_UNKNOWN,S_OK},
5666 {URLZONE_INVALID,E_NOTIMPL}
5667 }
5668 },
5669 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5670 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5671 */
5672 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5673 {{FALSE}},
5674 {FALSE},
5675 -1,S_OK,FALSE,
5676 0,S_OK,FALSE,
5677 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5678 {
5679 {"http://google.com/../../",S_OK},
5680 {"google.com",S_OK},
5681 {"http://google.com/../../",S_OK},
5682 {"google.com",S_OK},
5683 {"",S_FALSE},
5684 {"",S_FALSE},
5685 {"google.com",S_OK},
5686 {"",S_FALSE},
5687 {"/../../",S_OK},
5688 {"/../../",S_OK},
5689 {"",S_FALSE},
5690 {"http://google.com/../../",S_OK},
5691 {"http",S_OK},
5692 {"",S_FALSE},
5693 {"",S_FALSE}
5694 },
5695 {
5696 {Uri_HOST_DNS,S_OK},
5697 {80,S_OK},
5698 {URL_SCHEME_HTTP,S_OK},
5699 {URLZONE_INVALID,E_NOTIMPL}
5700 }
5701 },
5702 { "http://google.com/",0,S_OK,FALSE,
5703 {
5704 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5705 },
5706 {FALSE},
5707 -1,S_OK,FALSE,
5708 0,S_OK,FALSE,
5709 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5710 {
5711 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5712 {"google.com",S_OK},
5713 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5714 {"google.com",S_OK},
5715 {"",S_FALSE},
5716 {"#Fr%3C%7C%3Eg",S_OK},
5717 {"google.com",S_OK},
5718 {"",S_FALSE},
5719 {"/",S_OK},
5720 {"/",S_OK},
5721 {"",S_FALSE},
5722 {"http://google.com/#Fr<|>g",S_OK},
5723 {"http",S_OK},
5724 {"",S_FALSE},
5725 {"",S_FALSE}
5726 },
5727 {
5728 {Uri_HOST_DNS,S_OK},
5729 {80,S_OK},
5730 {URL_SCHEME_HTTP,S_OK},
5731 {URLZONE_INVALID,E_NOTIMPL}
5732 }
5733 },
5734 { "http://google.com/",0,S_OK,FALSE,
5735 {
5736 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5737 },
5738 {FALSE},
5739 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5740 0,S_OK,FALSE,
5741 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5742 {
5743 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5744 {"google.com",S_OK},
5745 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5746 {"google.com",S_OK},
5747 {"",S_FALSE},
5748 {"#Fr%3C%7C%3Eg",S_OK},
5749 {"google.com",S_OK},
5750 {"",S_FALSE},
5751 {"/",S_OK},
5752 {"/",S_OK},
5753 {"",S_FALSE},
5754 {"http://google.com/#Fr<|>g",S_OK},
5755 {"http",S_OK},
5756 {"",S_FALSE},
5757 {"",S_FALSE}
5758 },
5759 {
5760 {Uri_HOST_DNS,S_OK},
5761 {80,S_OK},
5762 {URL_SCHEME_HTTP,S_OK},
5763 {URLZONE_INVALID,E_NOTIMPL}
5764 }
5765 },
5766 { NULL,0,S_OK,FALSE,
5767 {
5768 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5769 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5770 },
5771 {FALSE},
5772 0,INET_E_INVALID_URL,FALSE,
5773 0,INET_E_INVALID_URL,FALSE,
5774 0,0,0,INET_E_INVALID_URL,FALSE
5775 },
5776 { "http://google.com/",0,S_OK,FALSE,
5777 {
5778 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5779 },
5780 {FALSE},
5781 0,INET_E_INVALID_URL,FALSE,
5782 0,INET_E_INVALID_URL,FALSE,
5783 0,0,0,INET_E_INVALID_URL,FALSE
5784 },
5785 /* File scheme's can't have a username set. */
5786 { "file://google.com/",0,S_OK,FALSE,
5787 {
5788 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5789 },
5790 {FALSE},
5791 0,INET_E_INVALID_URL,FALSE,
5792 0,INET_E_INVALID_URL,FALSE,
5793 0,0,0,INET_E_INVALID_URL,FALSE
5794 },
5795 /* File schemes can't have a password set. */
5796 { "file://google.com/",0,S_OK,FALSE,
5797 {
5798 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5799 },
5800 {FALSE},
5801 0,INET_E_INVALID_URL,FALSE,
5802 0,INET_E_INVALID_URL,FALSE,
5803 0,0,0,INET_E_INVALID_URL,FALSE
5804 },
5805 /* UserName can't contain any character that is a delimiter for another
5806 * component that appears after it in a normal URI.
5807 */
5808 { "http://google.com/",0,S_OK,FALSE,
5809 {
5810 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5811 },
5812 {FALSE},
5813 0,INET_E_INVALID_URL,FALSE,
5814 0,INET_E_INVALID_URL,FALSE,
5815 0,0,0,INET_E_INVALID_URL,FALSE
5816 },
5817 { "http://google.com/",0,S_OK,FALSE,
5818 {
5819 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5820 },
5821 {FALSE},
5822 0,INET_E_INVALID_URL,FALSE,
5823 0,INET_E_INVALID_URL,FALSE,
5824 0,0,0,INET_E_INVALID_URL,FALSE
5825 },
5826 { "http://google.com/",0,S_OK,FALSE,
5827 {
5828 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5829 },
5830 {FALSE},
5831 0,INET_E_INVALID_URL,FALSE,
5832 0,INET_E_INVALID_URL,FALSE,
5833 0,0,0,INET_E_INVALID_URL,FALSE
5834 },
5835 { "http://google.com/",0,S_OK,FALSE,
5836 {
5837 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5838 },
5839 {FALSE},
5840 0,INET_E_INVALID_URL,FALSE,
5841 0,INET_E_INVALID_URL,FALSE,
5842 0,0,0,INET_E_INVALID_URL,FALSE
5843 },
5844 { "http://google.com/",0,S_OK,FALSE,
5845 {
5846 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5847 },
5848 {FALSE},
5849 0,INET_E_INVALID_URL,FALSE,
5850 0,INET_E_INVALID_URL,FALSE,
5851 0,0,0,INET_E_INVALID_URL,FALSE
5852 },
5853 { "http://google.com/",0,S_OK,FALSE,
5854 {
5855 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5856 },
5857 {FALSE},
5858 0,INET_E_INVALID_URL,FALSE,
5859 0,INET_E_INVALID_URL,FALSE,
5860 0,0,0,INET_E_INVALID_URL,FALSE
5861 },
5862 { "http://google.com/",0,S_OK,FALSE,
5863 {
5864 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5865 },
5866 {FALSE},
5867 0,INET_E_INVALID_URL,FALSE,
5868 0,INET_E_INVALID_URL,FALSE,
5869 0,0,0,INET_E_INVALID_URL,FALSE
5870 },
5871 { "http://google.com/",0,S_OK,FALSE,
5872 {
5873 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5874 },
5875 {FALSE},
5876 0,INET_E_INVALID_URL,FALSE,
5877 0,INET_E_INVALID_URL,FALSE,
5878 0,0,0,INET_E_INVALID_URL,FALSE
5879 },
5880 { "http://google.com/",0,S_OK,FALSE,
5881 {
5882 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5883 },
5884 {FALSE},
5885 0,INET_E_INVALID_URL,FALSE,
5886 0,INET_E_INVALID_URL,FALSE,
5887 0,0,0,INET_E_INVALID_URL,FALSE
5888 },
5889 { "http://google.com/",0,S_OK,FALSE,
5890 {
5891 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5892 },
5893 {FALSE},
5894 0,INET_E_INVALID_URL,FALSE,
5895 0,INET_E_INVALID_URL,FALSE,
5896 0,0,0,INET_E_INVALID_URL,FALSE
5897 },
5898 { "http://google.com/",0,S_OK,FALSE,
5899 {
5900 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5901 },
5902 {FALSE},
5903 0,INET_E_INVALID_URL,FALSE,
5904 0,INET_E_INVALID_URL,FALSE,
5905 0,0,0,INET_E_INVALID_URL,FALSE
5906 },
5907 { "http://google.com/",0,S_OK,FALSE,
5908 {
5909 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5910 },
5911 {FALSE},
5912 0,INET_E_INVALID_URL,FALSE,
5913 0,INET_E_INVALID_URL,FALSE,
5914 0,0,0,INET_E_INVALID_URL,FALSE
5915 },
5916 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5917 { "http://google.com/",0,S_OK,FALSE,
5918 {
5919 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5920 },
5921 {FALSE},
5922 0,S_OK,FALSE,
5923 0,S_OK,FALSE,
5924 0,0,0,S_OK,FALSE,
5925 {
5926 {"http://winehq.org:test/",S_OK},
5927 {"winehq.org:test",S_OK},
5928 {"http://winehq.org:test/",S_OK},
5929 {"winehq.org:test",S_OK},
5930 {"",S_FALSE},
5931 {"",S_FALSE},
5932 {"winehq.org:test",S_OK},
5933 {"",S_FALSE},
5934 {"/",S_OK},
5935 {"/",S_OK},
5936 {"",S_FALSE},
5937 {"http://winehq.org:test/",S_OK},
5938 {"http",S_OK},
5939 {"",S_FALSE},
5940 {"",S_FALSE}
5941 },
5942 {
5943 {Uri_HOST_DNS,S_OK},
5944 {80,S_OK},
5945 {URL_SCHEME_HTTP,S_OK},
5946 {URLZONE_INVALID,E_NOTIMPL}
5947 }
5948 },
5949 /* Can't set the host name to NULL. */
5950 { "http://google.com/",0,S_OK,FALSE,
5951 {
5952 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5953 },
5954 {FALSE},
5955 0,S_OK,FALSE,
5956 0,S_OK,FALSE,
5957 0,0,0,S_OK,FALSE,
5958 {
5959 {"http://google.com/",S_OK},
5960 {"google.com",S_OK},
5961 {"http://google.com/",S_OK},
5962 {"google.com",S_OK},
5963 {"",S_FALSE},
5964 {"",S_FALSE},
5965 {"google.com",S_OK},
5966 {"",S_FALSE},
5967 {"/",S_OK},
5968 {"/",S_OK},
5969 {"",S_FALSE},
5970 {"http://google.com/",S_OK},
5971 {"http",S_OK},
5972 {"",S_FALSE},
5973 {"",S_FALSE}
5974 },
5975 {
5976 {Uri_HOST_DNS,S_OK},
5977 {80,S_OK},
5978 {URL_SCHEME_HTTP,S_OK},
5979 {URLZONE_INVALID,E_NOTIMPL}
5980 }
5981 },
5982 /* Can set the host name to an empty string. */
5983 { "http://google.com/",0,S_OK,FALSE,
5984 {
5985 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5986 },
5987 {FALSE},
5988 0,S_OK,FALSE,
5989 0,S_OK,FALSE,
5990 0,0,0,S_OK,FALSE,
5991 {
5992 {"http:///",S_OK},
5993 {"",S_OK},
5994 {"http:///",S_OK},
5995 {"",S_FALSE},
5996 {"",S_FALSE},
5997 {"",S_FALSE},
5998 {"",S_OK},
5999 {"",S_FALSE},
6000 {"/",S_OK},
6001 {"/",S_OK},
6002 {"",S_FALSE},
6003 {"http:///",S_OK},
6004 {"http",S_OK},
6005 {"",S_FALSE},
6006 {"",S_FALSE}
6007 },
6008 {
6009 {Uri_HOST_UNKNOWN,S_OK},
6010 {80,S_OK},
6011 {URL_SCHEME_HTTP,S_OK},
6012 {URLZONE_INVALID,E_NOTIMPL}
6013 }
6014 },
6015 { "http://google.com/",0,S_OK,FALSE,
6016 {
6017 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6018 },
6019 {FALSE},
6020 0,INET_E_INVALID_URL,FALSE,
6021 0,INET_E_INVALID_URL,FALSE,
6022 0,0,0,INET_E_INVALID_URL,FALSE
6023 },
6024 { "http://google.com/",0,S_OK,FALSE,
6025 {
6026 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6027 },
6028 {FALSE},
6029 0,INET_E_INVALID_URL,FALSE,
6030 0,INET_E_INVALID_URL,FALSE,
6031 0,0,0,INET_E_INVALID_URL,FALSE
6032 },
6033 { "http://google.com/",0,S_OK,FALSE,
6034 {
6035 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
6036 },
6037 {FALSE},
6038 0,INET_E_INVALID_URL,FALSE,
6039 0,INET_E_INVALID_URL,FALSE,
6040 0,0,0,INET_E_INVALID_URL,FALSE
6041 },
6042 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6043 {
6044 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6045 },
6046 {FALSE},
6047 0,S_OK,FALSE,
6048 0,S_OK,FALSE,
6049 0,0,0,S_OK,FALSE,
6050 {
6051 {"file:///c:/dir/file.html",S_OK},
6052 {"",S_FALSE},
6053 {"file:///c:/dir/file.html",S_OK},
6054 {"",S_FALSE},
6055 {".html",S_OK},
6056 {"",S_FALSE},
6057 {"",S_FALSE},
6058 {"",S_FALSE},
6059 {"/c:/dir/file.html",S_OK},
6060 {"/c:/dir/file.html",S_OK},
6061 {"",S_FALSE},
6062 {"file:///c:/dir/file.html",S_OK},
6063 {"file",S_OK},
6064 {"",S_FALSE},
6065 {"",S_FALSE}
6066 },
6067 {
6068 {Uri_HOST_UNKNOWN,S_OK},
6069 {0,S_FALSE},
6070 {URL_SCHEME_FILE,S_OK},
6071 {URLZONE_INVALID,E_NOTIMPL}
6072 }
6073 },
6074 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6075 {
6076 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6077 },
6078 {FALSE},
6079 0,S_OK,FALSE,
6080 0,S_OK,FALSE,
6081 0,0,0,S_OK,FALSE,
6082 {
6083 {"file:///c:/dir/file.html#",S_OK},
6084 {"",S_FALSE},
6085 {"file:///c:/dir/file.html#",S_OK},
6086 {"",S_FALSE},
6087 {".html",S_OK},
6088 {"#",S_OK},
6089 {"",S_FALSE},
6090 {"",S_FALSE},
6091 {"/c:/dir/file.html",S_OK},
6092 {"/c:/dir/file.html",S_OK},
6093 {"",S_FALSE},
6094 {"file:///c:/dir/file.html#",S_OK},
6095 {"file",S_OK},
6096 {"",S_FALSE},
6097 {"",S_FALSE}
6098 },
6099 {
6100 {Uri_HOST_UNKNOWN,S_OK},
6101 {0,S_FALSE},
6102 {URL_SCHEME_FILE,S_OK},
6103 {URLZONE_INVALID,E_NOTIMPL}
6104 }
6105 }
6106 };
6107
6108 typedef struct _uri_builder_remove_test {
6109 const char *uri;
6110 DWORD create_flags;
6111 HRESULT create_builder_expected;
6112 BOOL create_builder_todo;
6113
6114 DWORD remove_properties;
6115 HRESULT remove_expected;
6116 BOOL remove_todo;
6117
6118 const char *expected_uri;
6119 DWORD expected_flags;
6120 HRESULT expected_hres;
6121 BOOL expected_todo;
6122 } uri_builder_remove_test;
6123
6124 static const uri_builder_remove_test uri_builder_remove_tests[] = {
6125 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
6126 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
6127 "http://google.com/",0,S_OK,FALSE
6128 },
6129 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
6130 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
6131 "http://winehq.org/",0,S_OK,FALSE
6132 },
6133 { "zip://google.com?Test=x",0,S_OK,FALSE,
6134 Uri_HAS_HOST,S_OK,FALSE,
6135 "zip:/?Test=x",0,S_OK,FALSE
6136 },
6137 /* Doesn't remove the whole userinfo component. */
6138 { "http://username:pass@google.com/",0,S_OK,FALSE,
6139 Uri_HAS_USER_INFO,S_OK,FALSE,
6140 "http://username:pass@google.com/",0,S_OK,FALSE
6141 },
6142 /* Doesn't remove the domain. */
6143 { "http://google.com/",0,S_OK,FALSE,
6144 Uri_HAS_DOMAIN,S_OK,FALSE,
6145 "http://google.com/",0,S_OK,FALSE
6146 },
6147 { "http://google.com:120/",0,S_OK,FALSE,
6148 Uri_HAS_AUTHORITY,S_OK,FALSE,
6149 "http://google.com:120/",0,S_OK,FALSE
6150 },
6151 { "http://google.com/test.com/",0,S_OK,FALSE,
6152 Uri_HAS_EXTENSION,S_OK,FALSE,
6153 "http://google.com/test.com/",0,S_OK,FALSE
6154 },
6155 { "http://google.com/?test=x",0,S_OK,FALSE,
6156 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6157 "http://google.com/?test=x",0,S_OK,FALSE
6158 },
6159 /* Can't remove the scheme name. */
6160 { "http://google.com/?test=x",0,S_OK,FALSE,
6161 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6162 "http://google.com/?test=x",0,S_OK,FALSE
6163 }
6164 };
6165
6166 typedef struct _uri_combine_str_property {
6167 const char *value;
6168 HRESULT expected;
6169 BOOL todo;
6170 const char *broken_value;
6171 const char *value_ex;
6172 } uri_combine_str_property;
6173
6174 typedef struct _uri_combine_test {
6175 const char *base_uri;
6176 DWORD base_create_flags;
6177 const char *relative_uri;
6178 DWORD relative_create_flags;
6179 DWORD combine_flags;
6180 HRESULT expected;
6181 BOOL todo;
6182
6183 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6184 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6185 } uri_combine_test;
6186
6187 static const uri_combine_test uri_combine_tests[] = {
6188 { "http://google.com/fun/stuff",0,
6189 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6190 0,S_OK,FALSE,
6191 {
6192 {"http://google.com/not/fun/stuff",S_OK},
6193 {"google.com",S_OK},
6194 {"http://google.com/not/fun/stuff",S_OK},
6195 {"google.com",S_OK},
6196 {"",S_FALSE},
6197 {"",S_FALSE},
6198 {"google.com",S_OK},
6199 {"",S_FALSE},
6200 {"/not/fun/stuff",S_OK},
6201 {"/not/fun/stuff",S_OK},
6202 {"",S_FALSE},
6203 {"http://google.com/not/fun/stuff",S_OK},
6204 {"http",S_OK},
6205 {"",S_FALSE},
6206 {"",S_FALSE}
6207 },
6208 {
6209 {Uri_HOST_DNS,S_OK},
6210 {80,S_OK},
6211 {URL_SCHEME_HTTP,S_OK},
6212 {URLZONE_INVALID,E_NOTIMPL}
6213 }
6214 },
6215 { "http://google.com/test",0,
6216 "zip://test.com/cool",0,
6217 0,S_OK,FALSE,
6218 {
6219 {"zip://test.com/cool",S_OK},
6220 {"test.com",S_OK},
6221 {"zip://test.com/cool",S_OK},
6222 {"test.com",S_OK},
6223 {"",S_FALSE},
6224 {"",S_FALSE},
6225 {"test.com",S_OK},
6226 {"",S_FALSE},
6227 {"/cool",S_OK},
6228 {"/cool",S_OK},
6229 {"",S_FALSE},
6230 {"zip://test.com/cool",S_OK},
6231 {"zip",S_OK},
6232 {"",S_FALSE},
6233 {"",S_FALSE}
6234 },
6235 {
6236 {Uri_HOST_DNS,S_OK},
6237 {0,S_FALSE},
6238 {URL_SCHEME_UNKNOWN,S_OK},
6239 {URLZONE_INVALID,E_NOTIMPL}
6240 }
6241 },
6242 { "http://google.com/use/base/path",0,
6243 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6244 0,S_OK,FALSE,
6245 {
6246 {"http://google.com/use/base/path?relative",S_OK},
6247 {"google.com",S_OK},
6248 {"http://google.com/use/base/path?relative",S_OK},
6249 {"google.com",S_OK},
6250 {"",S_FALSE},
6251 {"",S_FALSE},
6252 {"google.com",S_OK},
6253 {"",S_FALSE},
6254 {"/use/base/path",S_OK},
6255 {"/use/base/path?relative",S_OK},
6256 {"?relative",S_OK},
6257 {"http://google.com/use/base/path?relative",S_OK},
6258 {"http",S_OK},
6259 {"",S_FALSE},
6260 {"",S_FALSE}
6261 },
6262 {
6263 {Uri_HOST_DNS,S_OK},
6264 {80,S_OK},
6265 {URL_SCHEME_HTTP,S_OK},
6266 {URLZONE_INVALID,E_NOTIMPL}
6267 }
6268 },
6269 { "http://google.com/path",0,
6270 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6271 0,S_OK,FALSE,
6272 {
6273 {"http://google.com/testing",S_OK},
6274 {"google.com",S_OK},
6275 {"http://google.com/testing",S_OK},
6276 {"google.com",S_OK},
6277 {"",S_FALSE},
6278 {"",S_FALSE},
6279 {"google.com",S_OK},
6280 {"",S_FALSE},
6281 {"/testing",S_OK},
6282 {"/testing",S_OK},
6283 {"",S_FALSE},
6284 {"http://google.com/testing",S_OK},
6285 {"http",S_OK},
6286 {"",S_FALSE},
6287 {"",S_FALSE}
6288 },
6289 {
6290 {Uri_HOST_DNS,S_OK},
6291 {80,S_OK},
6292 {URL_SCHEME_HTTP,S_OK},
6293 {URLZONE_INVALID,E_NOTIMPL}
6294 }
6295 },
6296 { "http://google.com/path",0,
6297 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6298 URL_DONT_SIMPLIFY,S_OK,FALSE,
6299 {
6300 {"http://google.com:80/test/../test/.././testing",S_OK},
6301 {"google.com",S_OK},
6302 {"http://google.com:80/test/../test/.././testing",S_OK},
6303 {"google.com",S_OK},
6304 {"",S_FALSE},
6305 {"",S_FALSE},
6306 {"google.com",S_OK},
6307 {"",S_FALSE},
6308 {"/test/../test/.././testing",S_OK},
6309 {"/test/../test/.././testing",S_OK},
6310 {"",S_FALSE},
6311 {"http://google.com:80/test/../test/.././testing",S_OK},
6312 {"http",S_OK},
6313 {"",S_FALSE},
6314 {"",S_FALSE}
6315 },
6316 {
6317 {Uri_HOST_DNS,S_OK},
6318 {80,S_OK},
6319 {URL_SCHEME_HTTP,S_OK},
6320 {URLZONE_INVALID,E_NOTIMPL}
6321 }
6322 },
6323 { "http://winehq.org/test/abc",0,
6324 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6325 0,S_OK,FALSE,
6326 {
6327 {"http://winehq.org/test/testing/test",S_OK},
6328 {"winehq.org",S_OK},
6329 {"http://winehq.org/test/testing/test",S_OK},
6330 {"winehq.org",S_OK},
6331 {"",S_FALSE},
6332 {"",S_FALSE},
6333 {"winehq.org",S_OK},
6334 {"",S_FALSE},
6335 {"/test/testing/test",S_OK},
6336 {"/test/testing/test",S_OK},
6337 {"",S_FALSE},
6338 {"http://winehq.org/test/testing/test",S_OK},
6339 {"http",S_OK},
6340 {"",S_FALSE},
6341 {"",S_FALSE}
6342 },
6343 {
6344 {Uri_HOST_DNS,S_OK},
6345 {80,S_OK},
6346 {URL_SCHEME_HTTP,S_OK},
6347 {URLZONE_INVALID,E_NOTIMPL}
6348 }
6349 },
6350 { "http://winehq.org/test/abc",0,
6351 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6352 URL_DONT_SIMPLIFY,S_OK,FALSE,
6353 {
6354 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6355 /* Default port is hidden in the authority. */
6356 {"winehq.org",S_OK},
6357 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6358 {"winehq.org",S_OK},
6359 {"",S_FALSE},
6360 {"",S_FALSE},
6361 {"winehq.org",S_OK},
6362 {"",S_FALSE},
6363 {"/test/testing/abc/../test",S_OK},
6364 {"/test/testing/abc/../test",S_OK},
6365 {"",S_FALSE},
6366 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6367 {"http",S_OK},
6368 {"",S_FALSE},
6369 {"",S_FALSE}
6370 },
6371 {
6372 {Uri_HOST_DNS,S_OK},
6373 {80,S_OK},
6374 {URL_SCHEME_HTTP,S_OK},
6375 {URLZONE_INVALID,E_NOTIMPL}
6376 }
6377 },
6378 { "http://winehq.org/test?query",0,
6379 "testing",Uri_CREATE_ALLOW_RELATIVE,
6380 0,S_OK,FALSE,
6381 {
6382 {"http://winehq.org/testing",S_OK},
6383 {"winehq.org",S_OK},
6384 {"http://winehq.org/testing",S_OK},
6385 {"winehq.org",S_OK},
6386 {"",S_FALSE},
6387 {"",S_FALSE},
6388 {"winehq.org",S_OK},
6389 {"",S_FALSE},
6390 {"/testing",S_OK},
6391 {"/testing",S_OK},
6392 {"",S_FALSE},
6393 {"http://winehq.org/testing",S_OK},
6394 {"http",S_OK},
6395 {"",S_FALSE},
6396 {"",S_FALSE}
6397 },
6398 {
6399 {Uri_HOST_DNS,S_OK},
6400 {80,S_OK},
6401 {URL_SCHEME_HTTP,S_OK},
6402 {URLZONE_INVALID,E_NOTIMPL}
6403 }
6404 },
6405 { "http://winehq.org/test#frag",0,
6406 "testing",Uri_CREATE_ALLOW_RELATIVE,
6407 0,S_OK,FALSE,
6408 {
6409 {"http://winehq.org/testing",S_OK},
6410 {"winehq.org",S_OK},
6411 {"http://winehq.org/testing",S_OK},
6412 {"winehq.org",S_OK},
6413 {"",S_FALSE},
6414 {"",S_FALSE},
6415 {"winehq.org",S_OK},
6416 {"",S_FALSE},
6417 {"/testing",S_OK},
6418 {"/testing",S_OK},
6419 {"",S_FALSE},
6420 {"http://winehq.org/testing",S_OK},
6421 {"http",S_OK},
6422 {"",S_FALSE},
6423 {"",S_FALSE}
6424 },
6425 {
6426 {Uri_HOST_DNS,S_OK},
6427 {80,S_OK},
6428 {URL_SCHEME_HTTP,S_OK},
6429 {URLZONE_INVALID,E_NOTIMPL}
6430 }
6431 },
6432 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6433 "test",Uri_CREATE_ALLOW_RELATIVE,
6434 0,S_OK,FALSE,
6435 {
6436 {"test",S_OK},
6437 {"",S_FALSE},
6438 {"test",S_OK},
6439 {"",S_FALSE},
6440 {"",S_FALSE},
6441 {"",S_FALSE},
6442 {"",S_FALSE},
6443 {"",S_FALSE},
6444 {"test",S_OK},
6445 {"test",S_OK},
6446 {"",S_FALSE},
6447 {"test",S_OK},
6448 {"",S_FALSE},
6449 {"",S_FALSE},
6450 {"",S_FALSE}
6451 },
6452 {
6453 {Uri_HOST_UNKNOWN,S_OK},
6454 {0,S_FALSE},
6455 {URL_SCHEME_UNKNOWN,S_OK},
6456 {URLZONE_INVALID,E_NOTIMPL}
6457 }
6458 },
6459 { "file:///c:/test/test",0,
6460 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6461 URL_FILE_USE_PATHURL,S_OK,FALSE,
6462 {
6463 {"file://c:\\testing.mp3",S_OK},
6464 {"",S_FALSE},
6465 {"file://c:\\testing.mp3",S_OK},
6466 {"",S_FALSE},
6467 {".mp3",S_OK},
6468 {"",S_FALSE},
6469 {"",S_FALSE},
6470 {"",S_FALSE},
6471 {"c:\\testing.mp3",S_OK},
6472 {"c:\\testing.mp3",S_OK},
6473 {"",S_FALSE},
6474 {"file://c:\\testing.mp3",S_OK},
6475 {"file",S_OK},
6476 {"",S_FALSE},
6477 {"",S_FALSE}
6478 },
6479 {
6480 {Uri_HOST_UNKNOWN,S_OK},
6481 {0,S_FALSE},
6482 {URL_SCHEME_FILE,S_OK},
6483 {URLZONE_INVALID,E_NOTIMPL}
6484 }
6485 },
6486 { "file:///c:/test/test",0,
6487 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6488 0,S_OK,FALSE,
6489 {
6490 {"file:///c:/testing.mp3",S_OK},
6491 {"",S_FALSE},
6492 {"file:///c:/testing.mp3",S_OK},
6493 {"",S_FALSE},
6494 {".mp3",S_OK},
6495 {"",S_FALSE},
6496 {"",S_FALSE},
6497 {"",S_FALSE},
6498 {"/c:/testing.mp3",S_OK},
6499 {"/c:/testing.mp3",S_OK},
6500 {"",S_FALSE},
6501 {"file:///c:/testing.mp3",S_OK},
6502 {"file",S_OK},
6503 {"",S_FALSE},
6504 {"",S_FALSE}
6505 },
6506 {
6507 {Uri_HOST_UNKNOWN,S_OK},
6508 {0,S_FALSE},
6509 {URL_SCHEME_FILE,S_OK},
6510 {URLZONE_INVALID,E_NOTIMPL}
6511 }
6512 },
6513 { "file://test.com/test/test",0,
6514 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6515 URL_FILE_USE_PATHURL,S_OK,FALSE,
6516 {
6517 {"file://\\\\test.com\\testing.mp3",S_OK},
6518 {"test.com",S_OK},
6519 {"file://\\\\test.com\\testing.mp3",S_OK},
6520 {"test.com",S_OK},
6521 {".mp3",S_OK},
6522 {"",S_FALSE},
6523 {"test.com",S_OK},
6524 {"",S_FALSE},
6525 {"\\testing.mp3",S_OK},
6526 {"\\testing.mp3",S_OK},
6527 {"",S_FALSE},
6528 {"file://\\\\test.com\\testing.mp3",S_OK},
6529 {"file",S_OK},
6530 {"",S_FALSE},
6531 {"",S_FALSE}
6532 },
6533 {
6534 {Uri_HOST_DNS,S_OK},
6535 {0,S_FALSE},
6536 {URL_SCHEME_FILE,S_OK},
6537 {URLZONE_INVALID,E_NOTIMPL}
6538 }
6539 },
6540 /* URL_DONT_SIMPLIFY has no effect. */
6541 { "http://google.com/test",0,
6542 "zip://test.com/cool/../cool/test",0,
6543 URL_DONT_SIMPLIFY,S_OK,FALSE,
6544 {
6545 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6546 {"test.com",S_OK},
6547 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6548 {"test.com",S_OK},
6549 {"",S_FALSE},
6550 {"",S_FALSE},
6551 {"test.com",S_OK},
6552 {"",S_FALSE},
6553 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6554 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6555 {"",S_FALSE},
6556 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6557 * On IE 7 it reduces the path in the Raw URI.
6558 */
6559 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6560 {"zip",S_OK},
6561 {"",S_FALSE},
6562 {"",S_FALSE}
6563 },
6564 {
6565 {Uri_HOST_DNS,S_OK},
6566 {0,S_FALSE},
6567 {URL_SCHEME_UNKNOWN,S_OK},
6568 {URLZONE_INVALID,E_NOTIMPL}
6569 }
6570 },
6571 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6572 * resulting URI is converted into a dos path.
6573 */
6574 { "http://google.com/test",0,
6575 "file:///c:/test/",0,
6576 URL_FILE_USE_PATHURL,S_OK,FALSE,
6577 {
6578 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6579 {"",S_FALSE},
6580 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6581 {"",S_FALSE},
6582 {"",S_FALSE},
6583 {"",S_FALSE},
6584 {"",S_FALSE},
6585 {"",S_FALSE},
6586 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6587 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6588 {"",S_FALSE},
6589 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6590 {"file",S_OK},
6591 {"",S_FALSE},
6592 {"",S_FALSE}
6593 },
6594 {
6595 {Uri_HOST_UNKNOWN,S_OK},
6596 {0,S_FALSE},
6597 {URL_SCHEME_FILE,S_OK},
6598 {URLZONE_INVALID,E_NOTIMPL}
6599 }
6600 },
6601 { "http://google.com/test",0,
6602 "http://test.com/test#%30test",0,
6603 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6604 {
6605 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6606 {"test.com",S_OK},
6607 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6608 {"test.com",S_OK},
6609 {"",S_FALSE},
6610 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6611 {"test.com",S_OK},
6612 {"",S_FALSE},
6613 {"/test",S_OK},
6614 {"/test",S_OK},
6615 {"",S_FALSE},
6616 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6617 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6618 {"http",S_OK},
6619 {"",S_FALSE},
6620 {"",S_FALSE}
6621 },
6622 {
6623 {Uri_HOST_DNS,S_OK},
6624 {80,S_OK},
6625 {URL_SCHEME_HTTP,S_OK},
6626 {URLZONE_INVALID,E_NOTIMPL}
6627 }
6628 },
6629 /* Windows validates the path component from the relative Uri. */
6630 { "http://google.com/test",0,
6631 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6632 0,E_INVALIDARG,FALSE
6633 },
6634 /* Windows doesn't validate the query from the relative Uri. */
6635 { "http://google.com/test",0,
6636 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6637 0,S_OK,FALSE,
6638 {
6639 {"http://google.com/test?Tes%XXt",S_OK},
6640 {"google.com",S_OK},
6641 {"http://google.com/test?Tes%XXt",S_OK},
6642 {"google.com",S_OK},
6643 {"",S_FALSE},
6644 {"",S_FALSE},
6645 {"google.com",S_OK},
6646 {"",S_FALSE},
6647 {"/test",S_OK},
6648 {"/test?Tes%XXt",S_OK},
6649 {"?Tes%XXt",S_OK},
6650 {"http://google.com/test?Tes%XXt",S_OK},
6651 {"http",S_OK},
6652 {"",S_FALSE},
6653 {"",S_FALSE}
6654 },
6655 {
6656 {Uri_HOST_DNS,S_OK},
6657 {80,S_OK},
6658 {URL_SCHEME_HTTP,S_OK},
6659 {URLZONE_INVALID,E_NOTIMPL}
6660 }
6661 },
6662 /* Windows doesn't validate the fragment from the relative Uri. */
6663 { "http://google.com/test",0,
6664 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6665 0,S_OK,FALSE,
6666 {
6667 {"http://google.com/test#Tes%XXt",S_OK},
6668 {"google.com",S_OK},
6669 {"http://google.com/test#Tes%XXt",S_OK},
6670 {"google.com",S_OK},
6671 {"",S_FALSE},
6672 {"#Tes%XXt",S_OK},
6673 {"google.com",S_OK},
6674 {"",S_FALSE},
6675 {"/test",S_OK},
6676 {"/test",S_OK},
6677 {"",S_FALSE},
6678 {"http://google.com/test#Tes%XXt",S_OK},
6679 {"http",S_OK},
6680 {"",S_FALSE},
6681 {"",S_FALSE}
6682 },
6683 {
6684 {Uri_HOST_DNS,S_OK},
6685 {80,S_OK},
6686 {URL_SCHEME_HTTP,S_OK},
6687 {URLZONE_INVALID,E_NOTIMPL}
6688 }
6689 },
6690 /* Creates an IUri which contains an invalid dos path char. */
6691 { "file:///c:/test",0,
6692 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6693 URL_FILE_USE_PATHURL,S_OK,FALSE,
6694 {
6695 {"file://c:\\test<ing",S_OK},
6696 {"",S_FALSE},
6697 {"file://c:\\test<ing",S_OK},
6698 {"",S_FALSE},
6699 {"",S_FALSE},
6700 {"",S_FALSE},
6701 {"",S_FALSE},
6702 {"",S_FALSE},
6703 {"c:\\test<ing",S_OK},
6704 {"c:\\test<ing",S_OK},
6705 {"",S_FALSE},
6706 {"file://c:\\test<ing",S_OK},
6707 {"file",S_OK},
6708 {"",S_FALSE},
6709 {"",S_FALSE}
6710 },
6711 {
6712 {Uri_HOST_UNKNOWN,S_OK},
6713 {0,S_FALSE},
6714 {URL_SCHEME_FILE,S_OK},
6715 {URLZONE_INVALID,E_NOTIMPL}
6716 }
6717 },
6718 /* Appends the path after the drive letter (if any). */
6719 { "file:///c:/test",0,
6720 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6721 0,S_OK,FALSE,
6722 {
6723 {"file:///c:/c:/testing",S_OK},
6724 {"",S_FALSE},
6725 {"file:///c:/c:/testing",S_OK},
6726 {"",S_FALSE},
6727 {"",S_FALSE},
6728 {"",S_FALSE},
6729 {"",S_FALSE},
6730 {"",S_FALSE},
6731 {"/c:/c:/testing",S_OK},
6732 {"/c:/c:/testing",S_OK},
6733 {"",S_FALSE},
6734 {"file:///c:/c:/testing",S_OK},
6735 {"file",S_OK},
6736 {"",S_FALSE},
6737 {"",S_FALSE}
6738 },
6739 {
6740 {Uri_HOST_UNKNOWN,S_OK},
6741 {0,S_FALSE},
6742 {URL_SCHEME_FILE,S_OK},
6743 {URLZONE_INVALID,E_NOTIMPL}
6744 }
6745 },
6746 /* A '/' is added if the base URI doesn't have a path and the
6747 * relative URI doesn't contain a path (since the base URI is
6748 * hierarchical.
6749 */
6750 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6751 "?test",Uri_CREATE_ALLOW_RELATIVE,
6752 0,S_OK,FALSE,
6753 {
6754 {"http://google.com/?test",S_OK},
6755 {"google.com",S_OK},
6756 {"http://google.com/?test",S_OK},
6757 {"google.com",S_OK},
6758 {"",S_FALSE},
6759 {"",S_FALSE},
6760 {"google.com",S_OK},
6761 {"",S_FALSE},
6762 {"/",S_OK},
6763 {"/?test",S_OK},
6764 {"?test",S_OK},
6765 {"http://google.com/?test",S_OK},
6766 {"http",S_OK},
6767 {"",S_FALSE},
6768 {"",S_FALSE}
6769 },
6770 {
6771 {Uri_HOST_DNS,S_OK},
6772 {80,S_OK},
6773 {URL_SCHEME_HTTP,S_OK},
6774 {URLZONE_INVALID,E_NOTIMPL}
6775 }
6776 },
6777 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6778 "?test",Uri_CREATE_ALLOW_RELATIVE,
6779 0,S_OK,FALSE,
6780 {
6781 {"zip://google.com/?test",S_OK},
6782 {"google.com",S_OK},
6783 {"zip://google.com/?test",S_OK},
6784 {"google.com",S_OK},
6785 {"",S_FALSE},
6786 {"",S_FALSE},
6787 {"google.com",S_OK},
6788 {"",S_FALSE},
6789 {"/",S_OK},
6790 {"/?test",S_OK},
6791 {"?test",S_OK},
6792 {"zip://google.com/?test",S_OK},
6793 {"zip",S_OK},
6794 {"",S_FALSE},
6795 {"",S_FALSE}
6796 },
6797 {
6798 {Uri_HOST_DNS,S_OK},
6799 {0,S_FALSE},
6800 {URL_SCHEME_UNKNOWN,S_OK},
6801 {URLZONE_INVALID,E_NOTIMPL}
6802 }
6803 },
6804 /* No path is appended since the base URI is opaque. */
6805 { "zip:?testing",0,
6806 "?test",Uri_CREATE_ALLOW_RELATIVE,
6807 0,S_OK,FALSE,
6808 {
6809 {"zip:?test",S_OK},
6810 {"",S_FALSE},
6811 {"zip:?test",S_OK},
6812 {"",S_FALSE},
6813 {"",S_FALSE},
6814 {"",S_FALSE},
6815 {"",S_FALSE},
6816 {"",S_FALSE},
6817 {"",S_OK},
6818 {"?test",S_OK},
6819 {"?test",S_OK},
6820 {"zip:?test",S_OK},
6821 {"zip",S_OK},
6822 {"",S_FALSE},
6823 {"",S_FALSE}
6824 },
6825 {
6826 {Uri_HOST_UNKNOWN,S_OK},
6827 {0,S_FALSE},
6828 {URL_SCHEME_UNKNOWN,S_OK},
6829 {URLZONE_INVALID,E_NOTIMPL}
6830 }
6831 },
6832 { "file:///c:/",0,
6833 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6834 0,S_OK,FALSE,
6835 {
6836 {"file:///c:/testing/test",S_OK},
6837 {"",S_FALSE},
6838 {"file:///c:/testing/test",S_OK},
6839 {"",S_FALSE},
6840 {"",S_FALSE},
6841 {"",S_FALSE},
6842 {"",S_FALSE},
6843 {"",S_FALSE},
6844 {"/c:/testing/test",S_OK},
6845 {"/c:/testing/test",S_OK},
6846 {"",S_FALSE},
6847 {"file:///c:/testing/test",S_OK},
6848 {"file",S_OK},
6849 {"",S_FALSE},
6850 {"",S_FALSE}
6851 },
6852 {
6853 {Uri_HOST_UNKNOWN,S_OK},
6854 {0,S_FALSE},
6855 {URL_SCHEME_FILE,S_OK},
6856 {URLZONE_INVALID,E_NOTIMPL}
6857 }
6858 },
6859 { "http://winehq.org/dir/testfile",0,
6860 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6861 0,S_OK,FALSE,
6862 {
6863 {"http://winehq.org/dir/test?querystring",S_OK},
6864 {"winehq.org",S_OK},
6865 {"http://winehq.org/dir/test?querystring",S_OK},
6866 {"winehq.org",S_OK},
6867 {"",S_FALSE},
6868 {"",S_FALSE},
6869 {"winehq.org",S_OK},
6870 {"",S_FALSE},
6871 {"/dir/test",S_OK},
6872 {"/dir/test?querystring",S_OK},
6873 {"?querystring",S_OK},
6874 {"http://winehq.org/dir/test?querystring",S_OK},
6875 {"http",S_OK},
6876 {"",S_FALSE},
6877 {"",S_FALSE}
6878 },
6879 {
6880 {Uri_HOST_DNS,S_OK},
6881 {80,S_OK},
6882 {URL_SCHEME_HTTP,S_OK},
6883 {URLZONE_INVALID,E_NOTIMPL}
6884 }
6885 },
6886 { "http://winehq.org/dir/test",0,
6887 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6888 0,S_OK,FALSE,
6889 {
6890 {"http://winehq.org/dir/test?querystring",S_OK},
6891 {"winehq.org",S_OK},
6892 {"http://winehq.org/dir/test?querystring",S_OK},
6893 {"winehq.org",S_OK},
6894 {"",S_FALSE},
6895 {"",S_FALSE},
6896 {"winehq.org",S_OK},
6897 {"",S_FALSE},
6898 {"/dir/test",S_OK},
6899 {"/dir/test?querystring",S_OK},
6900 {"?querystring",S_OK},
6901 {"http://winehq.org/dir/test?querystring",S_OK},
6902 {"http",S_OK},
6903 {"",S_FALSE},
6904 {"",S_FALSE}
6905 },
6906 {
6907 {Uri_HOST_DNS,S_OK},
6908 {80,S_OK},
6909 {URL_SCHEME_HTTP,S_OK},
6910 {URLZONE_INVALID,E_NOTIMPL}
6911 }
6912 },
6913 { "http://winehq.org/dir/test?querystring",0,
6914 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6915 0,S_OK,FALSE,
6916 {
6917 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6918 {"winehq.org",S_OK},
6919 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6920 {"winehq.org",S_OK},
6921 {"",S_FALSE},
6922 {"#hash",S_OK},
6923 {"winehq.org",S_OK},
6924 {"",S_FALSE},
6925 {"/dir/test",S_OK},
6926 {"/dir/test?querystring",S_OK},
6927 {"?querystring",S_OK},
6928 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6929 {"http",S_OK},
6930 {"",S_FALSE},
6931 {"",S_FALSE}
6932 },
6933 {
6934 {Uri_HOST_DNS,S_OK},
6935 {80,S_OK},
6936 {URL_SCHEME_HTTP,S_OK},
6937 {URLZONE_INVALID,E_NOTIMPL}
6938 }
6939 },
6940 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6941 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6942 0,S_OK,FALSE,
6943 {
6944 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6945 {"",S_FALSE},
6946 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6947 {"",S_FALSE},
6948 {".txt",S_OK},
6949 {"",S_FALSE},
6950 {"",S_FALSE},
6951 {"",S_FALSE},
6952 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6953 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6954 {"",S_FALSE},
6955 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6956 {"mk",S_OK},
6957 {"",S_FALSE},
6958 {"",S_FALSE}
6959 },
6960 {
6961 {Uri_HOST_UNKNOWN,S_OK},
6962 {0,S_FALSE},
6963 {URL_SCHEME_MK,S_OK},
6964 {URLZONE_INVALID,E_NOTIMPL}
6965 }
6966 },
6967 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6968 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6969 0,S_OK,FALSE,
6970 {
6971 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6972 {"",S_FALSE},
6973 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6974 {"",S_FALSE},
6975 {".txt",S_OK},
6976 {"",S_FALSE},
6977 {"",S_FALSE},
6978 {"",S_FALSE},
6979 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6980 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6981 {"",S_FALSE},
6982 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6983 {"mk",S_OK},
6984 {"",S_FALSE},
6985 {"",S_FALSE}
6986 },
6987 {
6988 {Uri_HOST_UNKNOWN,S_OK},
6989 {0,S_FALSE},
6990 {URL_SCHEME_MK,S_OK},
6991 {URLZONE_INVALID,E_NOTIMPL}
6992 }
6993 },
6994 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6995 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6996 0,S_OK,FALSE,
6997 {
6998 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6999 {"",S_FALSE},
7000 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7001 {"",S_FALSE},
7002 {".txt",S_OK},
7003 {"",S_FALSE},
7004 {"",S_FALSE},
7005 {"",S_FALSE},
7006 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7007 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7008 {"",S_FALSE},
7009 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
7010 {"mk",S_OK},
7011 {"",S_FALSE},
7012 {"",S_FALSE}
7013 },
7014 {
7015 {Uri_HOST_UNKNOWN,S_OK},
7016 {0,S_FALSE},
7017 {URL_SCHEME_MK,S_OK},
7018 {URLZONE_INVALID,E_NOTIMPL}
7019 }
7020 },
7021 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7022 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7023 0,S_OK,FALSE,
7024 {
7025 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7026 {"",S_FALSE},
7027 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7028 {"",S_FALSE},
7029 {".txt",S_OK},
7030 {"",S_FALSE},
7031 {"",S_FALSE},
7032 {"",S_FALSE},
7033 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7034 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7035 {"",S_FALSE},
7036 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7037 {"mk",S_OK},
7038 {"",S_FALSE},
7039 {"",S_FALSE}
7040 },
7041 {
7042 {Uri_HOST_UNKNOWN,S_OK},
7043 {0,S_FALSE},
7044 {URL_SCHEME_MK,S_OK},
7045 {URLZONE_INVALID,E_NOTIMPL}
7046 }
7047 },
7048 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7049 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7050 0,S_OK,FALSE,
7051 {
7052 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7053 {"",S_FALSE},
7054 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7055 {"",S_FALSE},
7056 {".txt",S_OK},
7057 {"",S_FALSE},
7058 {"",S_FALSE},
7059 {"",S_FALSE},
7060 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7061 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7062 {"",S_FALSE},
7063 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7064 {"mk",S_OK},
7065 {"",S_FALSE},
7066 {"",S_FALSE}
7067 },
7068 {
7069 {Uri_HOST_UNKNOWN,S_OK},
7070 {0,S_FALSE},
7071 {URL_SCHEME_MK,S_OK},
7072 {URLZONE_INVALID,E_NOTIMPL}
7073 }
7074 },
7075 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7076 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7077 0,S_OK,FALSE,
7078 {
7079 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7080 {"",S_FALSE},
7081 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7082 {"",S_FALSE},
7083 {".txt",S_OK},
7084 {"",S_FALSE},
7085 {"",S_FALSE},
7086 {"",S_FALSE},
7087 {"@MSITSTORE:/relative/path.txt",S_OK},
7088 {"@MSITSTORE:/relative/path.txt",S_OK},
7089 {"",S_FALSE},
7090 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7091 {"mk",S_OK},
7092 {"",S_FALSE},
7093 {"",S_FALSE}
7094 },
7095 {
7096 {Uri_HOST_UNKNOWN,S_OK},
7097 {0,S_FALSE},
7098 {URL_SCHEME_MK,S_OK},
7099 {URLZONE_INVALID,E_NOTIMPL}
7100 }
7101 },
7102 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7103 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7104 0,S_OK,FALSE,
7105 {
7106 {"mk:@xxx:/relative/path.txt",S_OK},
7107 {"",S_FALSE},
7108 {"mk:@xxx:/relative/path.txt",S_OK},
7109 {"",S_FALSE},
7110 {".txt",S_OK},
7111 {"",S_FALSE},
7112 {"",S_FALSE},
7113 {"",S_FALSE},
7114 {"@xxx:/relative/path.txt",S_OK},
7115 {"@xxx:/relative/path.txt",S_OK},
7116 {"",S_FALSE},
7117 {"mk:@xxx:/relative/path.txt",S_OK},
7118 {"mk",S_OK},
7119 {"",S_FALSE},
7120 {"",S_FALSE}
7121 },
7122 {
7123 {Uri_HOST_UNKNOWN,S_OK},
7124 {0,S_FALSE},
7125 {URL_SCHEME_MK,S_OK},
7126 {URLZONE_INVALID,E_NOTIMPL}
7127 }
7128 },
7129 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7130 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7131 0,S_OK,FALSE,
7132 {
7133 {"mk:/relative/path.txt",S_OK},
7134 {"",S_FALSE},
7135 {"mk:/relative/path.txt",S_OK},
7136 {"",S_FALSE},
7137 {".txt",S_OK},
7138 {"",S_FALSE},
7139 {"",S_FALSE},
7140 {"",S_FALSE},
7141 {"/relative/path.txt",S_OK},
7142 {"/relative/path.txt",S_OK},
7143 {"",S_FALSE},
7144 {"mk:/relative/path.txt",S_OK},
7145 {"mk",S_OK},
7146 {"",S_FALSE},
7147 {"",S_FALSE}
7148 },
7149 {
7150 {Uri_HOST_UNKNOWN,S_OK},
7151 {0,S_FALSE},
7152 {URL_SCHEME_MK,S_OK},
7153 {URLZONE_INVALID,E_NOTIMPL}
7154 }
7155 },
7156 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7157 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7158 0,S_OK,FALSE,
7159 {
7160 {"ml:/relative/path.txt",S_OK},
7161 {"",S_FALSE},
7162 {"ml:/relative/path.txt",S_OK},
7163 {"",S_FALSE},
7164 {".txt",S_OK},
7165 {"",S_FALSE},
7166 {"",S_FALSE},
7167 {"",S_FALSE},
7168 {"/relative/path.txt",S_OK},
7169 {"/relative/path.txt",S_OK},
7170 {"",S_FALSE},
7171 {"ml:/relative/path.txt",S_OK},
7172 {"ml",S_OK},
7173 {"",S_FALSE},
7174 {"",S_FALSE}
7175 },
7176 {
7177 {Uri_HOST_UNKNOWN,S_OK},
7178 {0,S_FALSE},
7179 {URL_SCHEME_UNKNOWN,S_OK},
7180 {URLZONE_INVALID,E_NOTIMPL}
7181 }
7182 },
7183 { "http://winehq.org/dir/test?querystring",0,
7184 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7185 0,S_OK,FALSE,
7186 {
7187 {"http://winehq.com/#hash",S_OK},
7188 {"winehq.com",S_OK},
7189 {"http://winehq.com/#hash",S_OK},
7190 {"winehq.com",S_OK},
7191 {"",S_FALSE},
7192 {"#hash",S_OK},
7193 {"winehq.com",S_OK},
7194 {"",S_FALSE},
7195 {"/",S_OK},
7196 {"/",S_OK},
7197 {"",S_FALSE},
7198 {"http://winehq.com/#hash",S_OK},
7199 {"http",S_OK},
7200 {"",S_FALSE},
7201 {"",S_FALSE}
7202 },
7203 {
7204 {Uri_HOST_DNS,S_OK},
7205 {80,S_OK,FALSE,TRUE},
7206 {URL_SCHEME_HTTP,S_OK},
7207 {URLZONE_INVALID,E_NOTIMPL}
7208 }
7209 },
7210 { "http://winehq.org/dir/test?querystring",0,
7211 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7212 0,S_OK,FALSE,
7213 {
7214 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7215 {"winehq.com",S_OK},
7216 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7217 {"winehq.com",S_OK},
7218 {".txt",S_OK},
7219 {"#hash",S_OK},
7220 {"winehq.com",S_OK},
7221 {"",S_FALSE},
7222 {"/dir/file.txt",S_OK},
7223 {"/dir/file.txt?query",S_OK},
7224 {"?query",S_OK},
7225 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7226 {"http",S_OK},
7227 {"",S_FALSE},
7228 {"",S_FALSE}
7229 },
7230 {
7231 {Uri_HOST_DNS,S_OK},
7232 {80,S_OK,FALSE,TRUE},
7233 {URL_SCHEME_HTTP,S_OK},
7234 {URLZONE_INVALID,E_NOTIMPL}
7235 }
7236 },
7237 { "http://google.com/test",0,
7238 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7239 0,S_OK,FALSE,
7240 {
7241 {"file:///c:/test/",S_OK},
7242 {"",S_FALSE},
7243 {"file:///c:/test/",S_OK},
7244 {"",S_FALSE},
7245 {"",S_FALSE},
7246 {"",S_FALSE},
7247 {"",S_FALSE},
7248 {"",S_FALSE},
7249 {"/c:/test/",S_OK},
7250 {"/c:/test/",S_OK},
7251 {"",S_FALSE},
7252 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7253 {"file",S_OK},
7254 {"",S_FALSE},
7255 {"",S_FALSE}
7256 },
7257 {
7258 {Uri_HOST_UNKNOWN,S_OK},
7259 {0,S_FALSE},
7260 {URL_SCHEME_FILE,S_OK},
7261 {URLZONE_INVALID,E_NOTIMPL}
7262 }
7263 },
7264 { "http://google.com/test",0,
7265 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7266 0,S_OK,FALSE,
7267 {
7268 {"file:///c:/test/",S_OK},
7269 {"",S_FALSE},
7270 {"file:///c:/test/",S_OK},
7271 {"",S_FALSE},
7272 {"",S_FALSE},
7273 {"",S_FALSE},
7274 {"",S_FALSE},
7275 {"",S_FALSE},
7276 {"/c:/test/",S_OK},
7277 {"/c:/test/",S_OK},
7278 {"",S_FALSE},
7279 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7280 {"file",S_OK},
7281 {"",S_FALSE},
7282 {"",S_FALSE}
7283 },
7284 {
7285 {Uri_HOST_UNKNOWN,S_OK},
7286 {0,S_FALSE},
7287 {URL_SCHEME_FILE,S_OK},
7288 {URLZONE_INVALID,E_NOTIMPL}
7289 }
7290 },
7291 { "http://winehq.org",0,
7292 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7293 0,S_OK,FALSE,
7294 {
7295 {"mailto:",S_OK},
7296 {"",S_FALSE},
7297 {"mailto:",S_OK},
7298 {"",S_FALSE},
7299 {"",S_FALSE},
7300 {"",S_FALSE},
7301 {"",S_FALSE},
7302 {"",S_FALSE},
7303 {"",S_FALSE},
7304 {"",S_FALSE},
7305 {"",S_FALSE},
7306 {"mailto://",S_OK,FALSE,"mailto:"},
7307 {"mailto",S_OK},
7308 {"",S_FALSE},
7309 {"",S_FALSE}
7310 },
7311 {
7312 {Uri_HOST_UNKNOWN,S_OK},
7313 {0,S_FALSE},
7314 {URL_SCHEME_MAILTO,S_OK},
7315 {URLZONE_INVALID,E_NOTIMPL}
7316 }
7317 },
7318 { "http://winehq.org",0,
7319 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7320 0,S_OK,FALSE,
7321 {
7322 {"mailto:a@b.com",S_OK},
7323 {"",S_FALSE},
7324 {"mailto:a@b.com",S_OK},
7325 {"",S_FALSE},
7326 {".com",S_OK},
7327 {"",S_FALSE},
7328 {"",S_FALSE},
7329 {"",S_FALSE},
7330 {"a@b.com",S_OK},
7331 {"a@b.com",S_OK},
7332 {"",S_FALSE},
7333 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7334 {"mailto",S_OK},
7335 {"",S_FALSE},
7336 {"",S_FALSE}
7337 },
7338 {
7339 {Uri_HOST_UNKNOWN,S_OK},
7340 {0,S_FALSE},
7341 {URL_SCHEME_MAILTO,S_OK},
7342 {URLZONE_INVALID,E_NOTIMPL}
7343 }
7344 }
7345 };
7346
7347 typedef struct _uri_parse_test {
7348 const char *uri;
7349 DWORD uri_flags;
7350 PARSEACTION action;
7351 DWORD flags;
7352 const char *property;
7353 HRESULT expected;
7354 BOOL todo;
7355 const char *property2;
7356 } uri_parse_test;
7357
7358 static const uri_parse_test uri_parse_tests[] = {
7359 /* PARSE_CANONICALIZE tests. */
7360 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7361 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7362 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7363 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7364 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7365 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7366 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7367 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7368 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7369 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7370 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7371 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7372
7373 /* PARSE_FRIENDLY tests. */
7374 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7375 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7376
7377 /* PARSE_ROOTDOCUMENT tests. */
7378 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7379 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7380 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7381 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7382 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7383 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7384
7385 /* PARSE_DOCUMENT tests. */
7386 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7387 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7388 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7389 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7390 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7391 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7392
7393 /* PARSE_PATH_FROM_URL tests. */
7394 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7395 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7396 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7397 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7398 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7399
7400 /* PARSE_URL_FROM_PATH tests. */
7401 /* This function almost seems to useless (just returns the absolute uri). */
7402 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7403 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7404 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7405 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7406 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7407
7408 /* PARSE_SCHEMA tests. */
7409 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7410 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7411
7412 /* PARSE_SITE tests. */
7413 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7414 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7415 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7416 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7417
7418 /* PARSE_DOMAIN tests. */
7419 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE,"com.uk"},
7420 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7421 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7422 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7423
7424 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7425 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7426 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7427 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7428 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7429 };
7430
7431 static inline LPWSTR a2w(LPCSTR str) {
7432 LPWSTR ret = NULL;
7433
7434 if(str) {
7435 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7436 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7437 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7438 }
7439
7440 return ret;
7441 }
7442
7443 static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
7444 {
7445 return HeapAlloc(GetProcessHeap(), 0, size);
7446 }
7447
7448 static inline BOOL heap_free(void *mem)
7449 {
7450 return HeapFree(GetProcessHeap(), 0, mem);
7451 }
7452
7453 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7454 LPWSTR strAW = a2w(strA);
7455 DWORD ret = lstrcmpW(strAW, strB);
7456 heap_free(strAW);
7457 return ret;
7458 }
7459
7460 static inline ULONG get_refcnt(IUri *uri) {
7461 IUri_AddRef(uri);
7462 return IUri_Release(uri);
7463 }
7464
7465 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7466 DWORD test_index) {
7467 HRESULT hr;
7468 LPWSTR valueW;
7469
7470 valueW = a2w(prop->value);
7471 switch(prop->property) {
7472 case Uri_PROPERTY_FRAGMENT:
7473 hr = IUriBuilder_SetFragment(builder, valueW);
7474 todo_wine_if(prop->todo) {
7475 ok(hr == prop->expected,
7476 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7477 hr, prop->expected, test_index);
7478 }
7479 break;
7480 case Uri_PROPERTY_HOST:
7481 hr = IUriBuilder_SetHost(builder, valueW);
7482 todo_wine_if(prop->todo) {
7483 ok(hr == prop->expected,
7484 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7485 hr, prop->expected, test_index);
7486 }
7487 break;
7488 case Uri_PROPERTY_PASSWORD:
7489 hr = IUriBuilder_SetPassword(builder, valueW);
7490 todo_wine_if(prop->todo) {
7491 ok(hr == prop->expected,
7492 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7493 hr, prop->expected, test_index);
7494 }
7495 break;
7496 case Uri_PROPERTY_PATH:
7497 hr = IUriBuilder_SetPath(builder, valueW);
7498 todo_wine_if(prop->todo) {
7499 ok(hr == prop->expected,
7500 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7501 hr, prop->expected, test_index);
7502 }
7503 break;
7504 case Uri_PROPERTY_QUERY:
7505 hr = IUriBuilder_SetQuery(builder, valueW);
7506 todo_wine_if(prop->todo) {
7507 ok(hr == prop->expected,
7508 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7509 hr, prop->expected, test_index);
7510 }
7511 break;
7512 case Uri_PROPERTY_SCHEME_NAME:
7513 hr = IUriBuilder_SetSchemeName(builder, valueW);
7514 todo_wine_if(prop->todo) {
7515 ok(hr == prop->expected,
7516 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7517 hr, prop->expected, test_index);
7518 }
7519 break;
7520 case Uri_PROPERTY_USER_NAME:
7521 hr = IUriBuilder_SetUserName(builder, valueW);
7522 todo_wine_if(prop->todo) {
7523 ok(hr == prop->expected,
7524 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7525 hr, prop->expected, test_index);
7526 }
7527 break;
7528 default:
7529 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7530 }
7531
7532 heap_free(valueW);
7533 }
7534
7535 /*
7536 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7537 * correctly.
7538 */
7539 static void test_CreateUri_InvalidFlags(void) {
7540 DWORD i;
7541
7542 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7543 HRESULT hr;
7544 IUri *uri = (void*) 0xdeadbeef;
7545
7546 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7547 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7548 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7549 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7550 }
7551 }
7552
7553 static void test_CreateUri_InvalidArgs(void) {
7554 HRESULT hr;
7555 IUri *uri = (void*) 0xdeadbeef;
7556
7557 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7558 static const WCHAR emptyW[] = {0};
7559
7560 hr = pCreateUri(http_urlW, 0, 0, NULL);
7561 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7562
7563 hr = pCreateUri(NULL, 0, 0, &uri);
7564 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7565 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7566
7567 uri = (void*) 0xdeadbeef;
7568 hr = pCreateUri(invalidW, 0, 0, &uri);
7569 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7570 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7571
7572 uri = (void*) 0xdeadbeef;
7573 hr = pCreateUri(emptyW, 0, 0, &uri);
7574 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7575 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7576 }
7577
7578 static void test_CreateUri_InvalidUri(void) {
7579 DWORD i;
7580
7581 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7582 invalid_uri test = invalid_uri_tests[i];
7583 IUri *uri = NULL;
7584 LPWSTR uriW;
7585 HRESULT hr;
7586
7587 uriW = a2w(test.uri);
7588 hr = pCreateUri(uriW, test.flags, 0, &uri);
7589 todo_wine_if(test.todo)
7590 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7591 hr, E_INVALIDARG, i);
7592 if(uri) IUri_Release(uri);
7593
7594 heap_free(uriW);
7595 }
7596 }
7597
7598 static void test_IUri_GetPropertyBSTR(void) {
7599 IUri *uri = NULL;
7600 HRESULT hr;
7601 DWORD i;
7602
7603 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7604 hr = pCreateUri(http_urlW, 0, 0, &uri);
7605 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7606 if(SUCCEEDED(hr)) {
7607 BSTR received = NULL;
7608
7609 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7610 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7611
7612 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7613 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7614 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7615 if(SUCCEEDED(hr)) {
7616 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7617 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7618 SysFreeString(received);
7619 }else {
7620 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7621 }
7622
7623 /* Make sure it handles the ZONE property correctly. */
7624 received = NULL;
7625 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7626 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7627 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7628 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7629 SysFreeString(received);
7630 }
7631 if(uri) IUri_Release(uri);
7632
7633 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7634 uri_properties test = uri_tests[i];
7635 LPWSTR uriW;
7636 uri = NULL;
7637
7638 uriW = a2w(test.uri);
7639 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7640 todo_wine_if(test.create_todo)
7641 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7642 hr, test.create_expected, i);
7643
7644 if(SUCCEEDED(hr)) {
7645 DWORD j;
7646
7647 /* Checks all the string properties of the uri. */
7648 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7649 BSTR received = NULL;
7650 uri_str_property prop = test.str_props[j];
7651
7652 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7653 todo_wine_if(prop.todo) {
7654 ok(hr == prop.expected ||
7655 (prop.value2 && hr == prop.expected2),
7656 "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7657 hr, prop.expected, i, j);
7658 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)) ||
7659 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7660 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7661 prop.value, wine_dbgstr_w(received), i, j);
7662 }
7663
7664 SysFreeString(received);
7665 }
7666 }
7667
7668 if(uri) IUri_Release(uri);
7669
7670 heap_free(uriW);
7671 }
7672 }
7673
7674 static void test_IUri_GetPropertyDWORD(void) {
7675 IUri *uri = NULL;
7676 HRESULT hr;
7677 DWORD i;
7678
7679 hr = pCreateUri(http_urlW, 0, 0, &uri);
7680 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7681 if(SUCCEEDED(hr)) {
7682 DWORD received = 0xdeadbeef;
7683
7684 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7685 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7686
7687 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7688 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7689 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7690 }
7691 if(uri) IUri_Release(uri);
7692
7693 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7694 uri_properties test = uri_tests[i];
7695 LPWSTR uriW;
7696 uri = NULL;
7697
7698 uriW = a2w(test.uri);
7699 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7700 todo_wine_if(test.create_todo)
7701 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7702 hr, test.create_expected, i);
7703
7704 if(SUCCEEDED(hr)) {
7705 DWORD j;
7706
7707 /* Checks all the DWORD properties of the uri. */
7708 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7709 DWORD received;
7710 uri_dword_property prop = test.dword_props[j];
7711
7712 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7713 todo_wine_if(prop.todo) {
7714 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7715 hr, prop.expected, i, j);
7716 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7717 prop.value, received, i, j);
7718 }
7719 }
7720 }
7721
7722 if(uri) IUri_Release(uri);
7723
7724 heap_free(uriW);
7725 }
7726 }
7727
7728 /* Tests all the 'Get*' property functions which deal with strings. */
7729 static void test_IUri_GetStrProperties(void) {
7730 IUri *uri = NULL;
7731 HRESULT hr;
7732 DWORD i;
7733
7734 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7735 hr = pCreateUri(http_urlW, 0, 0, &uri);
7736 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7737 if(SUCCEEDED(hr)) {
7738 hr = IUri_GetAbsoluteUri(uri, NULL);
7739 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7740
7741 hr = IUri_GetAuthority(uri, NULL);
7742 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7743
7744 hr = IUri_GetDisplayUri(uri, NULL);
7745 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7746
7747 hr = IUri_GetDomain(uri, NULL);
7748 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7749
7750 hr = IUri_GetExtension(uri, NULL);
7751 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7752
7753 hr = IUri_GetFragment(uri, NULL);
7754 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7755
7756 hr = IUri_GetHost(uri, NULL);
7757 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7758
7759 hr = IUri_GetPassword(uri, NULL);
7760 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7761
7762 hr = IUri_GetPath(uri, NULL);
7763 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7764
7765 hr = IUri_GetPathAndQuery(uri, NULL);
7766 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7767
7768 hr = IUri_GetQuery(uri, NULL);
7769 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7770
7771 hr = IUri_GetRawUri(uri, NULL);
7772 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7773
7774 hr = IUri_GetSchemeName(uri, NULL);
7775 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7776
7777 hr = IUri_GetUserInfo(uri, NULL);
7778 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7779
7780 hr = IUri_GetUserName(uri, NULL);
7781 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7782 }
7783 if(uri) IUri_Release(uri);
7784
7785 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7786 uri_properties test = uri_tests[i];
7787 LPWSTR uriW;
7788 uri = NULL;
7789
7790 uriW = a2w(test.uri);
7791 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7792 todo_wine_if(test.create_todo)
7793 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7794 hr, test.create_expected, i);
7795
7796 if(SUCCEEDED(hr)) {
7797 uri_str_property prop;
7798 BSTR received = NULL;
7799
7800 /* GetAbsoluteUri() tests. */
7801 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7802 hr = IUri_GetAbsoluteUri(uri, &received);
7803 todo_wine_if(prop.todo) {
7804 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7805 hr, prop.expected, i);
7806 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7807 "Error: Expected %s but got %s on uri_tests[%d].\n",
7808 prop.value, wine_dbgstr_w(received), i);
7809 }
7810 SysFreeString(received);
7811 received = NULL;
7812
7813 /* GetAuthority() tests. */
7814 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7815 hr = IUri_GetAuthority(uri, &received);
7816 todo_wine_if(prop.todo) {
7817 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7818 hr, prop.expected, i);
7819 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7820 prop.value, wine_dbgstr_w(received), i);
7821 }
7822 SysFreeString(received);
7823 received = NULL;
7824
7825 /* GetDisplayUri() tests. */
7826 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7827 hr = IUri_GetDisplayUri(uri, &received);
7828 todo_wine_if(prop.todo) {
7829 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7830 hr, prop.expected, i);
7831 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7832 "Error: Expected %s but got %s on uri_tests[%d].\n",
7833 prop.value, wine_dbgstr_w(received), i);
7834 }
7835 SysFreeString(received);
7836 received = NULL;
7837
7838 /* GetDomain() tests. */
7839 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7840 hr = IUri_GetDomain(uri, &received);
7841 todo_wine_if(prop.todo) {
7842 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
7843 "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7844 hr, prop.expected, i);
7845 ok(!strcmp_aw(prop.value, received) || (prop.value2 && !strcmp_aw(prop.value2, received)),
7846 "Error: Expected %s but got %s on uri_tests[%d].\n",
7847 prop.value, wine_dbgstr_w(received), i);
7848 }
7849 SysFreeString(received);
7850 received = NULL;
7851
7852 /* GetExtension() tests. */
7853 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7854 hr = IUri_GetExtension(uri, &received);
7855 todo_wine_if(prop.todo) {
7856 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7857 hr, prop.expected, i);
7858 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7859 prop.value, wine_dbgstr_w(received), i);
7860 }
7861 SysFreeString(received);
7862 received = NULL;
7863
7864 /* GetFragment() tests. */
7865 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7866 hr = IUri_GetFragment(uri, &received);
7867 todo_wine_if(prop.todo) {
7868 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7869 hr, prop.expected, i);
7870 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7871 prop.value, wine_dbgstr_w(received), i);
7872 }
7873 SysFreeString(received);
7874 received = NULL;
7875
7876 /* GetHost() tests. */
7877 prop = test.str_props[Uri_PROPERTY_HOST];
7878 hr = IUri_GetHost(uri, &received);
7879 todo_wine_if(prop.todo) {
7880 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7881 hr, prop.expected, i);
7882 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7883 prop.value, wine_dbgstr_w(received), i);
7884 }
7885 SysFreeString(received);
7886 received = NULL;
7887
7888 /* GetPassword() tests. */
7889 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7890 hr = IUri_GetPassword(uri, &received);
7891 todo_wine_if(prop.todo) {
7892 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7893 hr, prop.expected, i);
7894 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7895 prop.value, wine_dbgstr_w(received), i);
7896 }
7897 SysFreeString(received);
7898 received = NULL;
7899
7900 /* GetPath() tests. */
7901 prop = test.str_props[Uri_PROPERTY_PATH];
7902 hr = IUri_GetPath(uri, &received);
7903 todo_wine_if(prop.todo) {
7904 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7905 hr, prop.expected, i);
7906 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7907 prop.value, wine_dbgstr_w(received), i);
7908 }
7909 SysFreeString(received);
7910 received = NULL;
7911
7912 /* GetPathAndQuery() tests. */
7913 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7914 hr = IUri_GetPathAndQuery(uri, &received);
7915 todo_wine_if(prop.todo) {
7916 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7917 hr, prop.expected, i);
7918 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7919 prop.value, wine_dbgstr_w(received), i);
7920 }
7921 SysFreeString(received);
7922 received = NULL;
7923
7924 /* GetQuery() tests. */
7925 prop = test.str_props[Uri_PROPERTY_QUERY];
7926 hr = IUri_GetQuery(uri, &received);
7927 todo_wine_if(prop.todo) {
7928 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7929 hr, prop.expected, i);
7930 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7931 prop.value, wine_dbgstr_w(received), i);
7932 }
7933 SysFreeString(received);
7934 received = NULL;
7935
7936 /* GetRawUri() tests. */
7937 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7938 hr = IUri_GetRawUri(uri, &received);
7939 todo_wine_if(prop.todo) {
7940 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7941 hr, prop.expected, i);
7942 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7943 prop.value, wine_dbgstr_w(received), i);
7944 }
7945 SysFreeString(received);
7946 received = NULL;
7947
7948 /* GetSchemeName() tests. */
7949 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7950 hr = IUri_GetSchemeName(uri, &received);
7951 todo_wine_if(prop.todo) {
7952 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7953 hr, prop.expected, i);
7954 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7955 prop.value, wine_dbgstr_w(received), i);
7956 }
7957 SysFreeString(received);
7958 received = NULL;
7959
7960 /* GetUserInfo() tests. */
7961 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7962 hr = IUri_GetUserInfo(uri, &received);
7963 todo_wine_if(prop.todo) {
7964 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7965 hr, prop.expected, i);
7966 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7967 prop.value, wine_dbgstr_w(received), i);
7968 }
7969 SysFreeString(received);
7970 received = NULL;
7971
7972 /* GetUserName() tests. */
7973 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7974 hr = IUri_GetUserName(uri, &received);
7975 todo_wine_if(prop.todo) {
7976 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7977 hr, prop.expected, i);
7978 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7979 prop.value, wine_dbgstr_w(received), i);
7980 }
7981 SysFreeString(received);
7982 }
7983
7984 if(uri) IUri_Release(uri);
7985
7986 heap_free(uriW);
7987 }
7988 }
7989
7990 static void test_IUri_GetDwordProperties(void) {
7991 IUri *uri = NULL;
7992 HRESULT hr;
7993 DWORD i;
7994
7995 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7996 hr = pCreateUri(http_urlW, 0, 0, &uri);
7997 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7998 if(SUCCEEDED(hr)) {
7999 hr = IUri_GetHostType(uri, NULL);
8000 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8001
8002 hr = IUri_GetPort(uri, NULL);
8003 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8004
8005 hr = IUri_GetScheme(uri, NULL);
8006 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8007
8008 hr = IUri_GetZone(uri, NULL);
8009 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8010 }
8011 if(uri) IUri_Release(uri);
8012
8013 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8014 uri_properties test = uri_tests[i];
8015 LPWSTR uriW;
8016 uri = NULL;
8017
8018 uriW = a2w(test.uri);
8019 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8020 todo_wine_if(test.create_todo)
8021 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8022 hr, test.create_expected, i);
8023
8024 if(SUCCEEDED(hr)) {
8025 uri_dword_property prop;
8026 DWORD received;
8027
8028 /* Assign an insane value so tests don't accidentally pass when
8029 * they shouldn't!
8030 */
8031 received = -9999999;
8032
8033 /* GetHostType() tests. */
8034 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8035 hr = IUri_GetHostType(uri, &received);
8036 todo_wine_if(prop.todo) {
8037 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8038 hr, prop.expected, i);
8039 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8040 }
8041 received = -9999999;
8042
8043 /* GetPort() tests. */
8044 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8045 hr = IUri_GetPort(uri, &received);
8046 todo_wine_if(prop.todo) {
8047 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8048 hr, prop.expected, i);
8049 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8050 }
8051 received = -9999999;
8052
8053 /* GetScheme() tests. */
8054 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8055 hr = IUri_GetScheme(uri, &received);
8056 todo_wine_if(prop.todo) {
8057 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8058 hr, prop.expected, i);
8059 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8060 }
8061 received = -9999999;
8062
8063 /* GetZone() tests. */
8064 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8065 hr = IUri_GetZone(uri, &received);
8066 todo_wine_if(prop.todo) {
8067 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8068 hr, prop.expected, i);
8069 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8070 }
8071 }
8072
8073 if(uri) IUri_Release(uri);
8074
8075 heap_free(uriW);
8076 }
8077 }
8078
8079 static void test_IUri_GetPropertyLength(void) {
8080 IUri *uri = NULL;
8081 HRESULT hr;
8082 DWORD i;
8083
8084 /* Make sure it handles invalid args correctly. */
8085 hr = pCreateUri(http_urlW, 0, 0, &uri);
8086 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8087 if(SUCCEEDED(hr)) {
8088 DWORD received = 0xdeadbeef;
8089
8090 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8091 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8092
8093 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8094 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8095 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8096 }
8097 if(uri) IUri_Release(uri);
8098
8099 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8100 uri_properties test = uri_tests[i];
8101 LPWSTR uriW;
8102 uri = NULL;
8103
8104 uriW = a2w(test.uri);
8105 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8106 todo_wine_if(test.create_todo)
8107 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8108 hr, test.create_expected, i);
8109
8110 if(SUCCEEDED(hr)) {
8111 DWORD j;
8112
8113 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8114 DWORD expectedLen, receivedLen;
8115 uri_str_property prop = test.str_props[j];
8116
8117 expectedLen = lstrlenA(prop.value);
8118
8119 /* This won't be necessary once GetPropertyLength is implemented. */
8120 receivedLen = -1;
8121
8122 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8123 todo_wine_if(prop.todo) {
8124 ok(hr == prop.expected || (prop.value2 && hr == prop.expected2),
8125 "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8126 hr, prop.expected, i, j);
8127 ok(receivedLen == expectedLen || (prop.value2 && receivedLen == lstrlenA(prop.value2)) ||
8128 broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8129 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8130 expectedLen, receivedLen, i, j);
8131 }
8132 }
8133 }
8134
8135 if(uri) IUri_Release(uri);
8136
8137 heap_free(uriW);
8138 }
8139 }
8140
8141 static DWORD compute_expected_props(uri_properties *test, DWORD *mask)
8142 {
8143 DWORD ret = 0, i;
8144
8145 *mask = 0;
8146
8147 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8148 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8149 ret |= 1<<i;
8150 if(test->str_props[i-Uri_PROPERTY_STRING_START].value2 == NULL ||
8151 test->str_props[i-Uri_PROPERTY_STRING_START].expected ==
8152 test->str_props[i-Uri_PROPERTY_STRING_START].expected2)
8153 *mask |= 1<<i;
8154 }
8155
8156 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8157 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8158 ret |= 1<<i;
8159 *mask |= 1<<i;
8160 }
8161
8162 return ret;
8163 }
8164
8165 static void test_IUri_GetProperties(void) {
8166 IUri *uri = NULL;
8167 HRESULT hr;
8168 DWORD i;
8169
8170 hr = pCreateUri(http_urlW, 0, 0, &uri);
8171 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8172 if(SUCCEEDED(hr)) {
8173 hr = IUri_GetProperties(uri, NULL);
8174 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8175 }
8176 if(uri) IUri_Release(uri);
8177
8178 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8179 uri_properties test = uri_tests[i];
8180 LPWSTR uriW;
8181 uri = NULL;
8182
8183 uriW = a2w(test.uri);
8184 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8185 todo_wine_if(test.create_todo)
8186 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8187
8188 if(SUCCEEDED(hr)) {
8189 DWORD received = 0, expected_props, mask;
8190 DWORD j;
8191
8192 hr = IUri_GetProperties(uri, &received);
8193 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8194
8195 expected_props = compute_expected_props(&test, &mask);
8196
8197 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8198 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8199 if(mask & (1 << j)) {
8200 if(expected_props & (1 << j))
8201 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8202 else
8203 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8204 }
8205 }
8206 }
8207
8208 if(uri) IUri_Release(uri);
8209
8210 heap_free(uriW);
8211 }
8212 }
8213
8214 static void test_IUri_HasProperty(void) {
8215 IUri *uri = NULL;
8216 HRESULT hr;
8217 DWORD i;
8218
8219 hr = pCreateUri(http_urlW, 0, 0, &uri);
8220 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8221 if(SUCCEEDED(hr)) {
8222 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8223 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8224 }
8225 if(uri) IUri_Release(uri);
8226
8227 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8228 uri_properties test = uri_tests[i];
8229 LPWSTR uriW;
8230 uri = NULL;
8231
8232 uriW = a2w(test.uri);
8233
8234 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8235 todo_wine_if(test.create_todo)
8236 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8237
8238 if(SUCCEEDED(hr)) {
8239 DWORD expected_props, j, mask;
8240
8241 expected_props = compute_expected_props(&test, &mask);
8242
8243 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8244 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8245 BOOL received = -1;
8246
8247 hr = IUri_HasProperty(uri, j, &received);
8248 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8249 hr, S_OK, j, i);
8250
8251 if(mask & (1 << j)) {
8252 if(expected_props & (1 << j)) {
8253 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8254 } else {
8255 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8256 }
8257 }
8258 }
8259 }
8260
8261 if(uri) IUri_Release(uri);
8262
8263 heap_free(uriW);
8264 }
8265 }
8266
8267 static void test_IUri_IsEqual(void) {
8268 IUri *uriA, *uriB;
8269 BOOL equal;
8270 HRESULT hres;
8271 DWORD i;
8272
8273 uriA = uriB = NULL;
8274
8275 /* Make sure IsEqual handles invalid args correctly. */
8276 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8277 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8278 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8279 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8280
8281 equal = -1;
8282 hres = IUri_IsEqual(uriA, NULL, &equal);
8283 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8284 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8285
8286 hres = IUri_IsEqual(uriA, uriB, NULL);
8287 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8288
8289 IUri_Release(uriA);
8290 IUri_Release(uriB);
8291
8292 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8293 uri_equality test = equality_tests[i];
8294 LPWSTR uriA_W, uriB_W;
8295
8296 uriA = uriB = NULL;
8297
8298 uriA_W = a2w(test.a);
8299 uriB_W = a2w(test.b);
8300
8301 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8302 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8303
8304 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8305 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8306
8307 equal = -1;
8308 hres = IUri_IsEqual(uriA, uriB, &equal);
8309 todo_wine_if(test.todo) {
8310 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8311 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8312 }
8313 if(uriA) IUri_Release(uriA);
8314 if(uriB) IUri_Release(uriB);
8315
8316 heap_free(uriA_W);
8317 heap_free(uriB_W);
8318 }
8319 }
8320
8321 static void test_CreateUriWithFragment_InvalidArgs(void) {
8322 HRESULT hr;
8323 IUri *uri = (void*) 0xdeadbeef;
8324 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8325
8326 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8327 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8328 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8329
8330 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8331 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8332
8333 /* Original URI can't already contain a fragment component. */
8334 uri = (void*) 0xdeadbeef;
8335 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8336 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8337 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8338 }
8339
8340 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8341 static void test_CreateUriWithFragment_InvalidFlags(void) {
8342 DWORD i;
8343
8344 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8345 HRESULT hr;
8346 IUri *uri = (void*) 0xdeadbeef;
8347
8348 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8349 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8350 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8351 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8352 }
8353 }
8354
8355 static void test_CreateUriWithFragment(void) {
8356 DWORD i;
8357
8358 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8359 HRESULT hr;
8360 IUri *uri = NULL;
8361 LPWSTR uriW, fragW;
8362 uri_with_fragment test = uri_fragment_tests[i];
8363
8364 uriW = a2w(test.uri);
8365 fragW = a2w(test.fragment);
8366
8367 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8368 todo_wine_if(test.expected_todo)
8369 ok(hr == test.create_expected,
8370 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8371 hr, test.create_expected, i);
8372
8373 if(SUCCEEDED(hr)) {
8374 BSTR received = NULL;
8375
8376 hr = IUri_GetAbsoluteUri(uri, &received);
8377 todo_wine_if(test.expected_todo) {
8378 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8379 hr, S_OK, i);
8380 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8381 test.expected_uri, wine_dbgstr_w(received), i);
8382 }
8383
8384 SysFreeString(received);
8385 }
8386
8387 if(uri) IUri_Release(uri);
8388 heap_free(uriW);
8389 heap_free(fragW);
8390 }
8391 }
8392
8393 static void test_CreateIUriBuilder(void) {
8394 HRESULT hr;
8395 IUriBuilder *builder = NULL;
8396 IUri *uri;
8397
8398 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8399 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8400 hr, E_POINTER);
8401
8402 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8403 hr = pCreateUri(http_urlW, 0, 0, &uri);
8404 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8405 if(SUCCEEDED(hr)) {
8406 ULONG cur_count, orig_count;
8407
8408 orig_count = get_refcnt(uri);
8409 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8410 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8411 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8412
8413 cur_count = get_refcnt(uri);
8414 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8415
8416 if(builder) IUriBuilder_Release(builder);
8417 cur_count = get_refcnt(uri);
8418 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8419 }
8420 if(uri) IUri_Release(uri);
8421 }
8422
8423 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8424 DWORD test_index) {
8425 HRESULT hr;
8426 IUri *uri = NULL;
8427
8428 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8429 todo_wine_if(test->uri_todo)
8430 ok(hr == test->uri_hres,
8431 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8432 hr, test->uri_hres, test_index);
8433
8434 if(SUCCEEDED(hr)) {
8435 DWORD i;
8436
8437 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8438 uri_builder_str_property prop = test->expected_str_props[i];
8439 BSTR received = NULL;
8440
8441 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8442 todo_wine_if(prop.todo)
8443 ok(hr == prop.result,
8444 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8445 hr, prop.result, test_index, i);
8446 if(SUCCEEDED(hr)) {
8447 todo_wine_if(prop.todo)
8448 ok(!strcmp_aw(prop.expected, received),
8449 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8450 prop.expected, wine_dbgstr_w(received), test_index, i);
8451 }
8452 SysFreeString(received);
8453 }
8454
8455 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8456 uri_builder_dword_property prop = test->expected_dword_props[i];
8457 DWORD received = -2;
8458
8459 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8460 todo_wine_if(prop.todo)
8461 ok(hr == prop.result,
8462 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8463 hr, prop.result, test_index, i);
8464 if(SUCCEEDED(hr)) {
8465 todo_wine_if(prop.todo)
8466 ok(received == prop.expected,
8467 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8468 prop.expected, received, test_index, i);
8469 }
8470 }
8471 }
8472 if(uri) IUri_Release(uri);
8473 }
8474
8475 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8476 DWORD test_index) {
8477 HRESULT hr;
8478 IUri *uri = NULL;
8479
8480 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8481 todo_wine_if(test->uri_simple_todo)
8482 ok(hr == test->uri_simple_hres,
8483 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8484 hr, test->uri_simple_hres, test_index);
8485
8486 if(SUCCEEDED(hr)) {
8487 DWORD i;
8488
8489 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8490 uri_builder_str_property prop = test->expected_str_props[i];
8491 BSTR received = NULL;
8492
8493 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8494 todo_wine_if(prop.todo)
8495 ok(hr == prop.result,
8496 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8497 hr, prop.result, test_index, i);
8498 if(SUCCEEDED(hr)) {
8499 todo_wine_if(prop.todo)
8500 ok(!strcmp_aw(prop.expected, received),
8501 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8502 prop.expected, wine_dbgstr_w(received), test_index, i);
8503 }
8504 SysFreeString(received);
8505 }
8506
8507 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8508 uri_builder_dword_property prop = test->expected_dword_props[i];
8509 DWORD received = -2;
8510
8511 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8512 todo_wine_if(prop.todo)
8513 ok(hr == prop.result,
8514 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8515 hr, prop.result, test_index, i);
8516 if(SUCCEEDED(hr)) {
8517 todo_wine_if(prop.todo)
8518 ok(received == prop.expected,
8519 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8520 prop.expected, received, test_index, i);
8521 }
8522 }
8523 }
8524 if(uri) IUri_Release(uri);
8525 }
8526
8527 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8528 DWORD test_index) {
8529 HRESULT hr;
8530 IUri *uri = NULL;
8531
8532 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8533 test->uri_with_encode_flags, 0, &uri);
8534 todo_wine_if(test->uri_with_todo)
8535 ok(hr == test->uri_with_hres,
8536 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8537 hr, test->uri_with_hres, test_index);
8538
8539 if(SUCCEEDED(hr)) {
8540 DWORD i;
8541
8542 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8543 uri_builder_str_property prop = test->expected_str_props[i];
8544 BSTR received = NULL;
8545
8546 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8547 todo_wine_if(prop.todo)
8548 ok(hr == prop.result,
8549 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8550 hr, prop.result, test_index, i);
8551 if(SUCCEEDED(hr)) {
8552 todo_wine_if(prop.todo)
8553 ok(!strcmp_aw(prop.expected, received),
8554 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8555 prop.expected, wine_dbgstr_w(received), test_index, i);
8556 }
8557 SysFreeString(received);
8558 }
8559
8560 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8561 uri_builder_dword_property prop = test->expected_dword_props[i];
8562 DWORD received = -2;
8563
8564 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8565 todo_wine_if(prop.todo)
8566 ok(hr == prop.result,
8567 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8568 hr, prop.result, test_index, i);
8569 if(SUCCEEDED(hr)) {
8570 todo_wine_if(prop.todo)
8571 ok(received == prop.expected,
8572 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8573 prop.expected, received, test_index, i);
8574 }
8575 }
8576 }
8577 if(uri) IUri_Release(uri);
8578 }
8579
8580 static void test_IUriBuilder_CreateInvalidArgs(void) {
8581 IUriBuilder *builder;
8582 HRESULT hr;
8583
8584 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8585 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8586 if(SUCCEEDED(hr)) {
8587 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8588
8589 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8590 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8591 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8592
8593 uri = (void*) 0xdeadbeef;
8594 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8595 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8596 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8597
8598 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8599 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8600 hr, E_POINTER);
8601
8602 uri = (void*) 0xdeadbeef;
8603 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8604 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8605 hr, E_NOTIMPL);
8606 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8607
8608 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8609 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8610 hr, E_POINTER);
8611
8612 uri = (void*) 0xdeadbeef;
8613 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8614 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8615 hr, E_NOTIMPL);
8616 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8617
8618 hr = pCreateUri(http_urlW, 0, 0, &test);
8619 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8620 if(SUCCEEDED(hr)) {
8621 hr = IUriBuilder_SetIUri(builder, test);
8622 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8623
8624 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8625 uri = NULL;
8626 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8627 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8628 ok(uri != NULL, "Error: The uri was NULL.\n");
8629 if(uri) IUri_Release(uri);
8630
8631 uri = NULL;
8632 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8633 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8634 hr, S_OK);
8635 ok(uri != NULL, "Error: uri was NULL.\n");
8636 if(uri) IUri_Release(uri);
8637
8638 uri = NULL;
8639 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8640 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8641 hr, S_OK);
8642 ok(uri != NULL, "Error: uri was NULL.\n");
8643 if(uri) IUri_Release(uri);
8644
8645 hr = IUriBuilder_SetFragment(builder, NULL);
8646 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8647
8648 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8649 uri = (void*) 0xdeadbeef;
8650 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8651 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8652 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8653
8654 uri = (void*) 0xdeadbeef;
8655 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8656 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8657 hr, S_OK);
8658 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8659
8660 uri = (void*) 0xdeadbeef;
8661 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8662 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8663 hr, E_NOTIMPL);
8664 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8665 }
8666 if(test) IUri_Release(test);
8667 }
8668 if(builder) IUriBuilder_Release(builder);
8669 }
8670
8671 /* Tests invalid args to the "Get*" functions. */
8672 static void test_IUriBuilder_GetInvalidArgs(void) {
8673 IUriBuilder *builder = NULL;
8674 HRESULT hr;
8675
8676 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8677 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8678 if(SUCCEEDED(hr)) {
8679 LPCWSTR received = (void*) 0xdeadbeef;
8680 DWORD len = -1, port = -1;
8681 BOOL set = -1;
8682
8683 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8684 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8685 hr, E_POINTER);
8686 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8687 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8688 hr, E_POINTER);
8689 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8690 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8691 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8692 hr, E_POINTER);
8693 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8694
8695 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8696 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8697 hr, E_POINTER);
8698 received = (void*) 0xdeadbeef;
8699 hr = IUriBuilder_GetHost(builder, NULL, &received);
8700 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost 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_GetHost(builder, &len, NULL);
8705 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost 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);
8708
8709 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8710 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8711 hr, E_POINTER);
8712 received = (void*) 0xdeadbeef;
8713 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8714 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword 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_GetPassword(builder, &len, NULL);
8719 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword 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);
8722
8723 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8724 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8725 hr, E_POINTER);
8726 received = (void*) 0xdeadbeef;
8727 hr = IUriBuilder_GetPath(builder, NULL, &received);
8728 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath 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_GetPath(builder, &len, NULL);
8733 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath 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);
8736
8737 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8738 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8739 hr, E_POINTER);
8740 hr = IUriBuilder_GetPort(builder, NULL, &port);
8741 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8742 hr, E_POINTER);
8743 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8744 hr = IUriBuilder_GetPort(builder, &set, NULL);
8745 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8746 hr, E_POINTER);
8747 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8748
8749 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8750 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8751 hr, E_POINTER);
8752 received = (void*) 0xdeadbeef;
8753 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8754 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8755 hr, E_POINTER);
8756 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8757 len = -1;
8758 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8759 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8760 hr, E_POINTER);
8761 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8762
8763 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8764 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8765 hr, E_POINTER);
8766 received = (void*) 0xdeadbeef;
8767 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8768 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8769 hr, E_POINTER);
8770 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8771 len = -1;
8772 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8773 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8774 hr, E_POINTER);
8775 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8776
8777 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8778 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8779 hr, E_POINTER);
8780 received = (void*) 0xdeadbeef;
8781 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8782 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8783 hr, E_POINTER);
8784 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8785 len = -1;
8786 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8787 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8788 hr, E_POINTER);
8789 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8790 }
8791 if(builder) IUriBuilder_Release(builder);
8792 }
8793
8794 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8795 DWORD test_index) {
8796 HRESULT hr;
8797 DWORD i;
8798 LPCWSTR received = NULL;
8799 DWORD len = -1;
8800 const uri_builder_property *prop = NULL;
8801
8802 /* Check if the property was set earlier. */
8803 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8804 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8805 prop = &(test->properties[i]);
8806 }
8807
8808 if(prop) {
8809 /* Use expected_value unless it's NULL, then use value. */
8810 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8811 DWORD expected_len = expected ? strlen(expected) : 0;
8812 hr = IUriBuilder_GetFragment(builder, &len, &received);
8813 todo_wine_if(prop->todo) {
8814 ok(hr == (expected ? S_OK : S_FALSE),
8815 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8816 hr, (expected ? S_OK : S_FALSE), test_index);
8817 if(SUCCEEDED(hr)) {
8818 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8819 expected, wine_dbgstr_w(received), test_index);
8820 ok(expected_len == len,
8821 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8822 expected_len, len, test_index);
8823 }
8824 }
8825 } else {
8826 /* The property wasn't set earlier, so it should return whatever
8827 * the base IUri contains (if anything).
8828 */
8829 IUri *uri = NULL;
8830 hr = IUriBuilder_GetIUri(builder, &uri);
8831 ok(hr == S_OK,
8832 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8833 hr, S_OK, test_index);
8834 if(SUCCEEDED(hr)) {
8835 if(!uri) {
8836 received = (void*) 0xdeadbeef;
8837 len = -1;
8838
8839 hr = IUriBuilder_GetFragment(builder, &len, &received);
8840 ok(hr == S_FALSE,
8841 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8842 hr, S_FALSE, test_index);
8843 if(SUCCEEDED(hr)) {
8844 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8845 len, test_index);
8846 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8847 received, test_index);
8848 }
8849 } else {
8850 BOOL has_prop = FALSE;
8851 BSTR expected = NULL;
8852
8853 hr = IUri_GetFragment(uri, &expected);
8854 ok(SUCCEEDED(hr),
8855 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8856 hr, test_index);
8857 has_prop = hr == S_OK;
8858
8859 hr = IUriBuilder_GetFragment(builder, &len, &received);
8860 if(has_prop) {
8861 ok(hr == S_OK,
8862 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8863 hr, S_OK, test_index);
8864 if(SUCCEEDED(hr)) {
8865 ok(!lstrcmpW(expected, received),
8866 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8867 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8868 ok(lstrlenW(expected) == len,
8869 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8870 lstrlenW(expected), len, test_index);
8871 }
8872 } else {
8873 ok(hr == S_FALSE,
8874 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8875 hr, S_FALSE, test_index);
8876 if(SUCCEEDED(hr)) {
8877 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8878 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8879 len, test_index);
8880 }
8881 }
8882 SysFreeString(expected);
8883 }
8884 }
8885 if(uri) IUri_Release(uri);
8886 }
8887 }
8888
8889 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8890 DWORD test_index) {
8891 HRESULT hr;
8892 DWORD i;
8893 LPCWSTR received = NULL;
8894 DWORD len = -1;
8895 const uri_builder_property *prop = NULL;
8896
8897 /* Check if the property was set earlier. */
8898 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8899 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8900 prop = &(test->properties[i]);
8901 }
8902
8903 if(prop) {
8904 /* Use expected_value unless it's NULL, then use value. */
8905 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8906 DWORD expected_len = expected ? strlen(expected) : 0;
8907 hr = IUriBuilder_GetHost(builder, &len, &received);
8908 todo_wine_if(prop->todo) {
8909 ok(hr == (expected ? S_OK : S_FALSE),
8910 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8911 hr, (expected ? S_OK : S_FALSE), test_index);
8912 if(SUCCEEDED(hr)) {
8913 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8914 expected, wine_dbgstr_w(received), test_index);
8915 ok(expected_len == len,
8916 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8917 expected_len, len, test_index);
8918 }
8919 }
8920 } else {
8921 /* The property wasn't set earlier, so it should return whatever
8922 * the base IUri contains (if anything).
8923 */
8924 IUri *uri = NULL;
8925 hr = IUriBuilder_GetIUri(builder, &uri);
8926 ok(hr == S_OK,
8927 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8928 hr, S_OK, test_index);
8929 if(SUCCEEDED(hr)) {
8930 if(!uri) {
8931 received = (void*) 0xdeadbeef;
8932 len = -1;
8933
8934 hr = IUriBuilder_GetHost(builder, &len, &received);
8935 ok(hr == S_FALSE,
8936 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8937 hr, S_FALSE, test_index);
8938 if(SUCCEEDED(hr)) {
8939 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8940 len, test_index);
8941 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8942 received, test_index);
8943 }
8944 } else {
8945 BOOL has_prop = FALSE;
8946 BSTR expected = NULL;
8947
8948 hr = IUri_GetHost(uri, &expected);
8949 ok(SUCCEEDED(hr),
8950 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8951 hr, test_index);
8952 has_prop = hr == S_OK;
8953
8954 hr = IUriBuilder_GetHost(builder, &len, &received);
8955 if(has_prop) {
8956 ok(hr == S_OK,
8957 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8958 hr, S_OK, test_index);
8959 if(SUCCEEDED(hr)) {
8960 ok(!lstrcmpW(expected, received),
8961 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8962 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8963 ok(lstrlenW(expected) == len,
8964 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8965 lstrlenW(expected), len, test_index);
8966 }
8967 } else {
8968 ok(hr == S_FALSE,
8969 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8970 hr, S_FALSE, test_index);
8971 if(SUCCEEDED(hr)) {
8972 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8973 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8974 len, test_index);
8975 }
8976 }
8977 SysFreeString(expected);
8978 }
8979 }
8980 if(uri) IUri_Release(uri);
8981 }
8982 }
8983
8984 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8985 DWORD test_index) {
8986 HRESULT hr;
8987 DWORD i;
8988 LPCWSTR received = NULL;
8989 DWORD len = -1;
8990 const uri_builder_property *prop = NULL;
8991
8992 /* Check if the property was set earlier. */
8993 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8994 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8995 prop = &(test->properties[i]);
8996 }
8997
8998 if(prop) {
8999 /* Use expected_value unless it's NULL, then use value. */
9000 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9001 DWORD expected_len = expected ? strlen(expected) : 0;
9002 hr = IUriBuilder_GetPassword(builder, &len, &received);
9003 todo_wine_if(prop->todo) {
9004 ok(hr == (expected ? S_OK : S_FALSE),
9005 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9006 hr, (expected ? S_OK : S_FALSE), test_index);
9007 if(SUCCEEDED(hr)) {
9008 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9009 expected, wine_dbgstr_w(received), test_index);
9010 ok(expected_len == len,
9011 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9012 expected_len, len, test_index);
9013 }
9014 }
9015 } else {
9016 /* The property wasn't set earlier, so it should return whatever
9017 * the base IUri contains (if anything).
9018 */
9019 IUri *uri = NULL;
9020 hr = IUriBuilder_GetIUri(builder, &uri);
9021 ok(hr == S_OK,
9022 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9023 hr, S_OK, test_index);
9024 if(SUCCEEDED(hr)) {
9025 if(!uri) {
9026 received = (void*) 0xdeadbeef;
9027 len = -1;
9028
9029 hr = IUriBuilder_GetPassword(builder, &len, &received);
9030 ok(hr == S_FALSE,
9031 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9032 hr, S_FALSE, test_index);
9033 if(SUCCEEDED(hr)) {
9034 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9035 len, test_index);
9036 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9037 received, test_index);
9038 }
9039 } else {
9040 BOOL has_prop = FALSE;
9041 BSTR expected = NULL;
9042
9043 hr = IUri_GetPassword(uri, &expected);
9044 ok(SUCCEEDED(hr),
9045 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9046 hr, test_index);
9047 has_prop = hr == S_OK;
9048
9049 hr = IUriBuilder_GetPassword(builder, &len, &received);
9050 if(has_prop) {
9051 ok(hr == S_OK,
9052 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9053 hr, S_OK, test_index);
9054 if(SUCCEEDED(hr)) {
9055 ok(!lstrcmpW(expected, received),
9056 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9057 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9058 ok(lstrlenW(expected) == len,
9059 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9060 lstrlenW(expected), len, test_index);
9061 }
9062 } else {
9063 ok(hr == S_FALSE,
9064 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9065 hr, S_FALSE, test_index);
9066 if(SUCCEEDED(hr)) {
9067 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9068 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9069 len, test_index);
9070 }
9071 }
9072 SysFreeString(expected);
9073 }
9074 }
9075 if(uri) IUri_Release(uri);
9076 }
9077 }
9078
9079 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9080 DWORD test_index) {
9081 HRESULT hr;
9082 DWORD i;
9083 LPCWSTR received = NULL;
9084 DWORD len = -1;
9085 const uri_builder_property *prop = NULL;
9086
9087 /* Check if the property was set earlier. */
9088 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9089 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9090 prop = &(test->properties[i]);
9091 }
9092
9093 if(prop) {
9094 /* Use expected_value unless it's NULL, then use value. */
9095 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9096 DWORD expected_len = expected ? strlen(expected) : 0;
9097 hr = IUriBuilder_GetPath(builder, &len, &received);
9098 todo_wine_if(prop->todo) {
9099 ok(hr == (expected ? S_OK : S_FALSE),
9100 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9101 hr, (expected ? S_OK : S_FALSE), test_index);
9102 if(SUCCEEDED(hr)) {
9103 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9104 expected, wine_dbgstr_w(received), test_index);
9105 ok(expected_len == len,
9106 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9107 expected_len, len, test_index);
9108 }
9109 }
9110 } else {
9111 /* The property wasn't set earlier, so it should return whatever
9112 * the base IUri contains (if anything).
9113 */
9114 IUri *uri = NULL;
9115 hr = IUriBuilder_GetIUri(builder, &uri);
9116 ok(hr == S_OK,
9117 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9118 hr, S_OK, test_index);
9119 if(SUCCEEDED(hr)) {
9120 if(!uri) {
9121 received = (void*) 0xdeadbeef;
9122 len = -1;
9123
9124 hr = IUriBuilder_GetPath(builder, &len, &received);
9125 ok(hr == S_FALSE,
9126 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9127 hr, S_FALSE, test_index);
9128 if(SUCCEEDED(hr)) {
9129 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9130 len, test_index);
9131 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9132 received, test_index);
9133 }
9134 } else {
9135 BOOL has_prop = FALSE;
9136 BSTR expected = NULL;
9137
9138 hr = IUri_GetPath(uri, &expected);
9139 ok(SUCCEEDED(hr),
9140 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9141 hr, test_index);
9142 has_prop = hr == S_OK;
9143
9144 hr = IUriBuilder_GetPath(builder, &len, &received);
9145 if(has_prop) {
9146 ok(hr == S_OK,
9147 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9148 hr, S_OK, test_index);
9149 if(SUCCEEDED(hr)) {
9150 ok(!lstrcmpW(expected, received),
9151 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9152 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9153 ok(lstrlenW(expected) == len,
9154 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9155 lstrlenW(expected), len, test_index);
9156 }
9157 } else {
9158 ok(hr == S_FALSE,
9159 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9160 hr, S_FALSE, test_index);
9161 if(SUCCEEDED(hr)) {
9162 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9163 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9164 len, test_index);
9165 }
9166 }
9167 SysFreeString(expected);
9168 }
9169 }
9170 if(uri) IUri_Release(uri);
9171 }
9172 }
9173
9174 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9175 DWORD test_index) {
9176 HRESULT hr;
9177 BOOL has_port = FALSE;
9178 DWORD received = -1;
9179
9180 if(test->port_prop.change) {
9181 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9182 todo_wine_if(test->port_prop.todo) {
9183 ok(hr == S_OK,
9184 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9185 hr, S_OK, test_index);
9186 if(SUCCEEDED(hr)) {
9187 ok(has_port == test->port_prop.set,
9188 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9189 test->port_prop.set, has_port, test_index);
9190 ok(received == test->port_prop.value,
9191 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9192 test->port_prop.value, received, test_index);
9193 }
9194 }
9195 } else {
9196 IUri *uri = NULL;
9197
9198 hr = IUriBuilder_GetIUri(builder, &uri);
9199 ok(hr == S_OK,
9200 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9201 hr, S_OK, test_index);
9202 if(SUCCEEDED(hr)) {
9203 if(!uri) {
9204 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9205 ok(hr == S_OK,
9206 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9207 hr, S_OK, test_index);
9208 if(SUCCEEDED(hr)) {
9209 ok(has_port == FALSE,
9210 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9211 has_port, test_index);
9212 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9213 received, test_index);
9214 }
9215 } else {
9216 DWORD expected;
9217
9218 hr = IUri_GetPort(uri, &expected);
9219 ok(SUCCEEDED(hr),
9220 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9221 hr, test_index);
9222
9223 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9224 ok(hr == S_OK,
9225 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9226 hr, S_OK, test_index);
9227 if(SUCCEEDED(hr)) {
9228 ok(!has_port,
9229 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9230 test_index);
9231 ok(received == expected,
9232 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9233 expected, received, test_index);
9234 }
9235 }
9236 }
9237 if(uri) IUri_Release(uri);
9238 }
9239 }
9240
9241 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9242 DWORD test_index) {
9243 HRESULT hr;
9244 DWORD i;
9245 LPCWSTR received = NULL;
9246 DWORD len = -1;
9247 const uri_builder_property *prop = NULL;
9248
9249 /* Check if the property was set earlier. */
9250 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9251 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9252 prop = &(test->properties[i]);
9253 }
9254
9255 if(prop) {
9256 /* Use expected_value unless it's NULL, then use value. */
9257 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9258 DWORD expected_len = expected ? strlen(expected) : 0;
9259 hr = IUriBuilder_GetQuery(builder, &len, &received);
9260 todo_wine_if(prop->todo) {
9261 ok(hr == (expected ? S_OK : S_FALSE),
9262 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9263 hr, (expected ? S_OK : S_FALSE), test_index);
9264 if(SUCCEEDED(hr)) {
9265 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9266 expected, wine_dbgstr_w(received), test_index);
9267 ok(expected_len == len,
9268 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9269 expected_len, len, test_index);
9270 }
9271 }
9272 } else {
9273 /* The property wasn't set earlier, so it should return whatever
9274 * the base IUri contains (if anything).
9275 */
9276 IUri *uri = NULL;
9277 hr = IUriBuilder_GetIUri(builder, &uri);
9278 ok(hr == S_OK,
9279 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9280 hr, S_OK, test_index);
9281 if(SUCCEEDED(hr)) {
9282 if(!uri) {
9283 received = (void*) 0xdeadbeef;
9284 len = -1;
9285
9286 hr = IUriBuilder_GetQuery(builder, &len, &received);
9287 ok(hr == S_FALSE,
9288 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9289 hr, S_FALSE, test_index);
9290 if(SUCCEEDED(hr)) {
9291 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9292 len, test_index);
9293 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9294 received, test_index);
9295 }
9296 } else {
9297 BOOL has_prop = FALSE;
9298 BSTR expected = NULL;
9299
9300 hr = IUri_GetQuery(uri, &expected);
9301 ok(SUCCEEDED(hr),
9302 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9303 hr, test_index);
9304 has_prop = hr == S_OK;
9305
9306 hr = IUriBuilder_GetQuery(builder, &len, &received);
9307 if(has_prop) {
9308 ok(hr == S_OK,
9309 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9310 hr, S_OK, test_index);
9311 if(SUCCEEDED(hr)) {
9312 ok(!lstrcmpW(expected, received),
9313 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9314 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9315 ok(lstrlenW(expected) == len,
9316 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9317 lstrlenW(expected), len, test_index);
9318 }
9319 } else {
9320 ok(hr == S_FALSE,
9321 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9322 hr, S_FALSE, test_index);
9323 if(SUCCEEDED(hr)) {
9324 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9325 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9326 len, test_index);
9327 }
9328 }
9329 SysFreeString(expected);
9330 }
9331 }
9332 if(uri) IUri_Release(uri);
9333 }
9334 }
9335
9336 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9337 DWORD test_index) {
9338 HRESULT hr;
9339 DWORD i;
9340 LPCWSTR received = NULL;
9341 DWORD len = -1;
9342 const uri_builder_property *prop = NULL;
9343
9344 /* Check if the property was set earlier. */
9345 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9346 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9347 prop = &(test->properties[i]);
9348 }
9349
9350 if(prop) {
9351 /* Use expected_value unless it's NULL, then use value. */
9352 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9353 DWORD expected_len = expected ? strlen(expected) : 0;
9354 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9355 todo_wine_if(prop->todo) {
9356 ok(hr == (expected ? S_OK : S_FALSE),
9357 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9358 hr, (expected ? S_OK : S_FALSE), test_index);
9359 if(SUCCEEDED(hr)) {
9360 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9361 expected, wine_dbgstr_w(received), test_index);
9362 ok(expected_len == len,
9363 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9364 expected_len, len, test_index);
9365 }
9366 }
9367 } else {
9368 /* The property wasn't set earlier, so it should return whatever
9369 * the base IUri contains (if anything).
9370 */
9371 IUri *uri = NULL;
9372 hr = IUriBuilder_GetIUri(builder, &uri);
9373 ok(hr == S_OK,
9374 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9375 hr, S_OK, test_index);
9376 if(SUCCEEDED(hr)) {
9377 if(!uri) {
9378 received = (void*) 0xdeadbeef;
9379 len = -1;
9380
9381 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9382 ok(hr == S_FALSE,
9383 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9384 hr, S_FALSE, test_index);
9385 if(SUCCEEDED(hr)) {
9386 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9387 len, test_index);
9388 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9389 received, test_index);
9390 }
9391 } else {
9392 BOOL has_prop = FALSE;
9393 BSTR expected = NULL;
9394
9395 hr = IUri_GetSchemeName(uri, &expected);
9396 ok(SUCCEEDED(hr),
9397 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9398 hr, test_index);
9399 has_prop = hr == S_OK;
9400
9401 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9402 if(has_prop) {
9403 ok(hr == S_OK,
9404 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9405 hr, S_OK, test_index);
9406 if(SUCCEEDED(hr)) {
9407 ok(!lstrcmpW(expected, received),
9408 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9409 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9410 ok(lstrlenW(expected) == len,
9411 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9412 lstrlenW(expected), len, test_index);
9413 }
9414 } else {
9415 ok(hr == S_FALSE,
9416 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9417 hr, S_FALSE, test_index);
9418 if(SUCCEEDED(hr)) {
9419 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9420 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9421 len, test_index);
9422 }
9423 }
9424 SysFreeString(expected);
9425 }
9426 }
9427 if(uri) IUri_Release(uri);
9428 }
9429 }
9430
9431 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9432 DWORD test_index) {
9433 HRESULT hr;
9434 DWORD i;
9435 LPCWSTR received = NULL;
9436 DWORD len = -1;
9437 const uri_builder_property *prop = NULL;
9438
9439 /* Check if the property was set earlier. */
9440 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9441 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9442 prop = &(test->properties[i]);
9443 }
9444
9445 if(prop && prop->value && *prop->value) {
9446 /* Use expected_value unless it's NULL, then use value. */
9447 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9448 DWORD expected_len = expected ? strlen(expected) : 0;
9449 hr = IUriBuilder_GetUserName(builder, &len, &received);
9450 todo_wine_if(prop->todo) {
9451 ok(hr == (expected ? S_OK : S_FALSE),
9452 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9453 hr, (expected ? S_OK : S_FALSE), test_index);
9454 if(SUCCEEDED(hr)) {
9455 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9456 expected, wine_dbgstr_w(received), test_index);
9457 ok(expected_len == len,
9458 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9459 expected_len, len, test_index);
9460 }
9461 }
9462 } else {
9463 /* The property wasn't set earlier, so it should return whatever
9464 * the base IUri contains (if anything).
9465 */
9466 IUri *uri = NULL;
9467 hr = IUriBuilder_GetIUri(builder, &uri);
9468 ok(hr == S_OK,
9469 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9470 hr, S_OK, test_index);
9471 if(SUCCEEDED(hr)) {
9472 if(!uri) {
9473 received = (void*) 0xdeadbeef;
9474 len = -1;
9475
9476 hr = IUriBuilder_GetUserName(builder, &len, &received);
9477 ok(hr == S_FALSE,
9478 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9479 hr, S_FALSE, test_index);
9480 if(SUCCEEDED(hr)) {
9481 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9482 len, test_index);
9483 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9484 received, test_index);
9485 }
9486 } else {
9487 BSTR expected = NULL;
9488 BOOL has_prop = FALSE;
9489
9490 hr = IUri_GetUserName(uri, &expected);
9491 ok(SUCCEEDED(hr),
9492 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9493 hr, test_index);
9494 has_prop = hr == S_OK;
9495
9496 hr = IUriBuilder_GetUserName(builder, &len, &received);
9497 if(has_prop) {
9498 ok(hr == S_OK,
9499 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9500 hr, S_OK, test_index);
9501 if(SUCCEEDED(hr)) {
9502 ok(!lstrcmpW(expected, received),
9503 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9504 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9505 ok(lstrlenW(expected) == len,
9506 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9507 lstrlenW(expected), len, test_index);
9508 }
9509 } else {
9510 ok(hr == S_FALSE,
9511 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9512 hr, S_FALSE, test_index);
9513 if(SUCCEEDED(hr)) {
9514 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9515 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9516 len, test_index);
9517 }
9518 }
9519 SysFreeString(expected);
9520 }
9521 }
9522 if(uri) IUri_Release(uri);
9523 }
9524 }
9525
9526 /* Tests IUriBuilder functions. */
9527 static void test_IUriBuilder(void) {
9528 HRESULT hr;
9529 IUriBuilder *builder;
9530 DWORD i;
9531
9532 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9533 IUri *uri = NULL;
9534 uri_builder_test test = uri_builder_tests[i];
9535 LPWSTR uriW = NULL;
9536
9537 if(test.uri) {
9538 uriW = a2w(test.uri);
9539 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9540 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9541 hr, S_OK, i);
9542 if(FAILED(hr)) continue;
9543 }
9544 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9545 todo_wine_if(test.create_builder_todo)
9546 ok(hr == test.create_builder_expected,
9547 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9548 hr, test.create_builder_expected, i);
9549 if(SUCCEEDED(hr)) {
9550 DWORD j;
9551 BOOL modified = FALSE, received = FALSE;
9552
9553 /* Perform all the string property changes. */
9554 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9555 uri_builder_property prop = test.properties[j];
9556 if(prop.change) {
9557 change_property(builder, &prop, i);
9558 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9559 prop.property != Uri_PROPERTY_HOST)
9560 modified = TRUE;
9561 else if(prop.value && *prop.value)
9562 modified = TRUE;
9563 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9564 /* Host name property can't be NULL, but it can be empty. */
9565 modified = TRUE;
9566 }
9567 }
9568
9569 if(test.port_prop.change) {
9570 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9571 modified = TRUE;
9572 todo_wine_if(test.port_prop.todo)
9573 ok(hr == test.port_prop.expected,
9574 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9575 hr, test.port_prop.expected, i);
9576 }
9577
9578 hr = IUriBuilder_HasBeenModified(builder, &received);
9579 ok(hr == S_OK,
9580 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9581 hr, S_OK, i);
9582 if(SUCCEEDED(hr))
9583 ok(received == modified,
9584 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9585 modified, received, i);
9586
9587 /* Test the "Get*" functions. */
9588 test_IUriBuilder_GetFragment(builder, &test, i);
9589 test_IUriBuilder_GetHost(builder, &test, i);
9590 test_IUriBuilder_GetPassword(builder, &test, i);
9591 test_IUriBuilder_GetPath(builder, &test, i);
9592 test_IUriBuilder_GetPort(builder, &test, i);
9593 test_IUriBuilder_GetQuery(builder, &test, i);
9594 test_IUriBuilder_GetSchemeName(builder, &test, i);
9595 test_IUriBuilder_GetUserName(builder, &test, i);
9596
9597 test_IUriBuilder_CreateUri(builder, &test, i);
9598 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9599 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9600 }
9601 if(builder) IUriBuilder_Release(builder);
9602 if(uri) IUri_Release(uri);
9603 heap_free(uriW);
9604 }
9605 }
9606
9607 static void test_IUriBuilder_HasBeenModified(void) {
9608 HRESULT hr;
9609 IUriBuilder *builder = NULL;
9610
9611 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9612 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9613 if(SUCCEEDED(hr)) {
9614 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9615 IUri *uri = NULL;
9616 BOOL received;
9617
9618 hr = IUriBuilder_HasBeenModified(builder, NULL);
9619 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9620 hr, E_POINTER);
9621
9622 hr = IUriBuilder_SetHost(builder, hostW);
9623 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9624 hr, S_OK);
9625
9626 hr = IUriBuilder_HasBeenModified(builder, &received);
9627 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9628 hr, S_OK);
9629 if(SUCCEEDED(hr))
9630 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9631
9632 hr = pCreateUri(http_urlW, 0, 0, &uri);
9633 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9634 if(SUCCEEDED(hr)) {
9635 LPCWSTR prop;
9636 DWORD len = -1;
9637
9638 hr = IUriBuilder_SetIUri(builder, uri);
9639 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9640 hr, S_OK);
9641
9642 hr = IUriBuilder_HasBeenModified(builder, &received);
9643 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9644 hr, S_OK);
9645 if(SUCCEEDED(hr))
9646 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9647
9648 /* Test what happens with you call SetIUri with the same IUri again. */
9649 hr = IUriBuilder_SetHost(builder, hostW);
9650 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9651
9652 hr = IUriBuilder_HasBeenModified(builder, &received);
9653 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9654 hr, S_OK);
9655 if(SUCCEEDED(hr))
9656 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9657
9658 hr = IUriBuilder_SetIUri(builder, uri);
9659 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9660
9661 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
9662 * reset any of the changes that were made to the IUriBuilder.
9663 */
9664 hr = IUriBuilder_HasBeenModified(builder, &received);
9665 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9666 if(SUCCEEDED(hr))
9667 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9668
9669 hr = IUriBuilder_GetHost(builder, &len, &prop);
9670 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9671 if(SUCCEEDED(hr)) {
9672 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9673 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9674 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9675 lstrlenW(hostW), len);
9676 }
9677
9678 hr = IUriBuilder_SetIUri(builder, NULL);
9679 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9680
9681 hr = IUriBuilder_SetHost(builder, hostW);
9682 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9683 hr = IUriBuilder_HasBeenModified(builder, &received);
9684 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9685 hr, S_OK);
9686 if(SUCCEEDED(hr))
9687 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9688
9689 hr = IUriBuilder_SetIUri(builder, NULL);
9690 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9691
9692 hr = IUriBuilder_HasBeenModified(builder, &received);
9693 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9694 hr, S_OK);
9695 if(SUCCEEDED(hr))
9696 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9697
9698 hr = IUriBuilder_GetHost(builder, &len, &prop);
9699 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9700 if(SUCCEEDED(hr)) {
9701 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9702 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9703 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9704 lstrlenW(hostW), len);
9705 }
9706 }
9707 if(uri) IUri_Release(uri);
9708 }
9709 if(builder) IUriBuilder_Release(builder);
9710 }
9711
9712 /* Test IUriBuilder {Get,Set}IUri functions. */
9713 static void test_IUriBuilder_IUriProperty(void) {
9714 IUriBuilder *builder = NULL;
9715 HRESULT hr;
9716
9717 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9718 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9719 if(SUCCEEDED(hr)) {
9720 IUri *uri = NULL;
9721
9722 hr = IUriBuilder_GetIUri(builder, NULL);
9723 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9724 hr, E_POINTER);
9725
9726 hr = pCreateUri(http_urlW, 0, 0, &uri);
9727 if(SUCCEEDED(hr)) {
9728 IUri *test = NULL;
9729 ULONG cur_count, orig_count;
9730
9731 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9732 orig_count = get_refcnt(uri);
9733 hr = IUriBuilder_SetIUri(builder, uri);
9734 cur_count = get_refcnt(uri);
9735 if(SUCCEEDED(hr))
9736 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9737 orig_count+1, cur_count);
9738
9739 hr = IUriBuilder_SetIUri(builder, NULL);
9740 cur_count = get_refcnt(uri);
9741 if(SUCCEEDED(hr))
9742 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9743 orig_count, cur_count);
9744
9745 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9746 hr = IUriBuilder_SetIUri(builder, uri);
9747 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9748 orig_count = get_refcnt(uri);
9749
9750 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9751 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9752 if(SUCCEEDED(hr)) {
9753 cur_count = get_refcnt(uri);
9754 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9755 orig_count+1, cur_count);
9756 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9757 uri, test);
9758 }
9759 if(test) IUri_Release(test);
9760
9761 test = NULL;
9762 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9763 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9764 if(SUCCEEDED(hr)) {
9765 cur_count = get_refcnt(uri);
9766 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9767 orig_count+1, cur_count);
9768 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9769 }
9770 if(test) IUri_Release(test);
9771
9772 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9773 * the base IUri.
9774 */
9775 test = NULL;
9776 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9777 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9778 if(SUCCEEDED(hr))
9779 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9780
9781 if(test) IUri_Release(test);
9782
9783 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9784 * explicitly set (because it's a default flag).
9785 */
9786 test = NULL;
9787 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9788 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9789 if(SUCCEEDED(hr)) {
9790 cur_count = get_refcnt(uri);
9791 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9792 orig_count+1, cur_count);
9793 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9794 }
9795 if(test) IUri_Release(test);
9796
9797 test = NULL;
9798 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9799 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9800 if(SUCCEEDED(hr)) {
9801 cur_count = get_refcnt(uri);
9802 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9803 orig_count+1, cur_count);
9804 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9805 }
9806 if(test) IUri_Release(test);
9807
9808 test = NULL;
9809 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9810 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9811 hr, S_OK);
9812 if(SUCCEEDED(hr)) {
9813 cur_count = get_refcnt(uri);
9814 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9815 orig_count+1, cur_count);
9816 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9817 }
9818 if(test) IUri_Release(test);
9819
9820 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9821 * the base IUri.
9822 */
9823 test = NULL;
9824 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9825 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9826 if(SUCCEEDED(hr))
9827 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9828
9829 if(test) IUri_Release(test);
9830
9831 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9832 * explicitly set (because it's a default flag).
9833 */
9834 test = NULL;
9835 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9836 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9837 if(SUCCEEDED(hr)) {
9838 cur_count = get_refcnt(uri);
9839 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9840 orig_count+1, cur_count);
9841 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9842 }
9843 if(test) IUri_Release(test);
9844 }
9845 if(uri) IUri_Release(uri);
9846 }
9847 if(builder) IUriBuilder_Release(builder);
9848 }
9849
9850 static void test_IUriBuilder_RemoveProperties(void) {
9851 IUriBuilder *builder = NULL;
9852 HRESULT hr;
9853 DWORD i;
9854
9855 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9856 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9857 if(SUCCEEDED(hr)) {
9858 /* Properties that can't be removed. */
9859 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9860 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9861
9862 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9863 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9864 if((i << 1) & invalid) {
9865 ok(hr == E_INVALIDARG,
9866 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9867 hr, E_INVALIDARG, i);
9868 } else {
9869 ok(hr == S_OK,
9870 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9871 hr, S_OK, i);
9872 }
9873 }
9874
9875 /* Also doesn't accept anything that's outside the range of the
9876 * Uri_HAS flags.
9877 */
9878 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9879 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9880 hr, E_INVALIDARG);
9881 }
9882 if(builder) IUriBuilder_Release(builder);
9883
9884 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9885 uri_builder_remove_test test = uri_builder_remove_tests[i];
9886 IUri *uri = NULL;
9887 LPWSTR uriW;
9888
9889 uriW = a2w(test.uri);
9890 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9891 if(SUCCEEDED(hr)) {
9892 builder = NULL;
9893
9894 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9895 todo_wine_if(test.create_builder_todo)
9896 ok(hr == test.create_builder_expected,
9897 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9898 hr, test.create_builder_expected, i);
9899
9900 if(SUCCEEDED(hr)) {
9901 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9902 todo_wine_if(test.remove_todo)
9903 ok(hr == test.remove_expected,
9904 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9905 hr, test.remove_expected, i);
9906 if(SUCCEEDED(hr)) {
9907 IUri *result = NULL;
9908
9909 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9910 todo_wine_if(test.expected_todo)
9911 ok(hr == test.expected_hres,
9912 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9913 hr, test.expected_hres, i);
9914 if(SUCCEEDED(hr)) {
9915 BSTR received = NULL;
9916
9917 hr = IUri_GetAbsoluteUri(result, &received);
9918 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9919 ok(!strcmp_aw(test.expected_uri, received),
9920 "Error: Expected %s but got %s instead on test %d.\n",
9921 test.expected_uri, wine_dbgstr_w(received), i);
9922 SysFreeString(received);
9923 }
9924 if(result) IUri_Release(result);
9925 }
9926 }
9927 if(builder) IUriBuilder_Release(builder);
9928 }
9929 if(uri) IUri_Release(uri);
9930 heap_free(uriW);
9931 }
9932 }
9933
9934 static void test_IUriBuilder_Misc(void) {
9935 HRESULT hr;
9936 IUri *uri;
9937
9938 hr = pCreateUri(http_urlW, 0, 0, &uri);
9939 if(SUCCEEDED(hr)) {
9940 IUriBuilder *builder;
9941
9942 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9943 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9944 if(SUCCEEDED(hr)) {
9945 BOOL has = -1;
9946 DWORD port = -1;
9947
9948 hr = IUriBuilder_GetPort(builder, &has, &port);
9949 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9950 if(SUCCEEDED(hr)) {
9951 /* 'has' will be set to FALSE, even though uri had a port. */
9952 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9953 /* Still sets 'port' to 80. */
9954 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9955 }
9956 }
9957 if(builder) IUriBuilder_Release(builder);
9958 }
9959 if(uri) IUri_Release(uri);
9960 }
9961
9962 static void test_IUriBuilderFactory(void) {
9963 HRESULT hr;
9964 IUri *uri;
9965 IUriBuilderFactory *factory;
9966 IUriBuilder *builder;
9967
9968 hr = pCreateUri(http_urlW, 0, 0, &uri);
9969 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9970 if(SUCCEEDED(hr)) {
9971 factory = NULL;
9972 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9973 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9974 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9975
9976 if(SUCCEEDED(hr)) {
9977 builder = (void*) 0xdeadbeef;
9978 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9979 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9980 hr, E_INVALIDARG);
9981 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9982
9983 builder = (void*) 0xdeadbeef;
9984 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9985 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9986 hr, E_INVALIDARG);
9987 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9988
9989 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9990 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9991 hr, E_POINTER);
9992
9993 builder = NULL;
9994 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9995 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9996 hr, S_OK);
9997 if(SUCCEEDED(hr)) {
9998 IUri *tmp = (void*) 0xdeadbeef;
9999 LPCWSTR result;
10000 DWORD result_len;
10001
10002 hr = IUriBuilder_GetIUri(builder, &tmp);
10003 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10004 hr, S_OK);
10005 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10006
10007 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10008 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10009 hr, S_FALSE);
10010 }
10011 if(builder) IUriBuilder_Release(builder);
10012
10013 builder = (void*) 0xdeadbeef;
10014 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10015 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10016 hr, E_INVALIDARG);
10017 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10018
10019 builder = (void*) 0xdeadbeef;
10020 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10021 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10022 hr, E_INVALIDARG);
10023 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10024
10025 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10026 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10027 hr, E_POINTER);
10028
10029 builder = NULL;
10030 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10031 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10032 hr, S_OK);
10033 if(SUCCEEDED(hr)) {
10034 IUri *tmp = NULL;
10035
10036 hr = IUriBuilder_GetIUri(builder, &tmp);
10037 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10038 hr, S_OK);
10039 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10040 if(uri) IUri_Release(uri);
10041 }
10042 if(builder) IUriBuilder_Release(builder);
10043 }
10044 if(factory) IUriBuilderFactory_Release(factory);
10045 }
10046 if(uri) IUri_Release(uri);
10047 }
10048
10049 static void test_CoInternetCombineIUri(void) {
10050 HRESULT hr;
10051 IUri *base, *relative, *result;
10052 DWORD i;
10053
10054 base = NULL;
10055 hr = pCreateUri(http_urlW, 0, 0, &base);
10056 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10057 if(SUCCEEDED(hr)) {
10058 result = (void*) 0xdeadbeef;
10059 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10060 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10061 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10062 }
10063
10064 relative = NULL;
10065 hr = pCreateUri(http_urlW, 0, 0, &relative);
10066 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10067 if(SUCCEEDED(hr)) {
10068 result = (void*) 0xdeadbeef;
10069 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10070 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10071 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10072 }
10073
10074 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10075 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10076
10077 if(base) IUri_Release(base);
10078 if(relative) IUri_Release(relative);
10079
10080 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10081 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10082
10083 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10084 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10085 if(SUCCEEDED(hr)) {
10086 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10087
10088 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10089 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10090 if(SUCCEEDED(hr)) {
10091 result = NULL;
10092
10093 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10094 todo_wine_if(uri_combine_tests[i].todo)
10095 ok(hr == uri_combine_tests[i].expected,
10096 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10097 hr, uri_combine_tests[i]. expected, i);
10098 if(SUCCEEDED(hr)) {
10099 DWORD j;
10100
10101 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10102 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10103 BSTR received;
10104
10105 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10106 todo_wine_if(prop.todo) {
10107 ok(hr == prop.expected,
10108 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10109 hr, prop.expected, i, j);
10110 ok(!strcmp_aw(prop.value, received) ||
10111 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10112 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10113 prop.value, wine_dbgstr_w(received), i, j);
10114 }
10115 SysFreeString(received);
10116 }
10117
10118 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10119 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10120 DWORD received;
10121
10122 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10123 todo_wine_if(prop.todo) {
10124 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10125 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10126 hr, prop.expected, i, j);
10127 if(!prop.broken_combine_hres || hr != S_FALSE)
10128 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10129 prop.value, received, i, j);
10130 }
10131 }
10132 }
10133 if(result) IUri_Release(result);
10134 }
10135 if(relative) IUri_Release(relative);
10136 heap_free(relativeW);
10137 }
10138 if(base) IUri_Release(base);
10139 heap_free(baseW);
10140 }
10141 }
10142
10143 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10144 REFIID riid, void **ppv)
10145 {
10146 ok(0, "unexpected call\n");
10147 return E_NOINTERFACE;
10148 }
10149
10150 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10151 {
10152 return 2;
10153 }
10154
10155 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10156 {
10157 return 1;
10158 }
10159
10160 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10161 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10162 DWORD *pcchResult, DWORD dwReserved)
10163 {
10164 CHECK_EXPECT(ParseUrl);
10165 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10166 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10167 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10168 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10169 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10170
10171 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10172 *pcchResult = lstrlenW(parse_resultW);
10173
10174 return S_OK;
10175 }
10176
10177 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10178 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10179 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10180 {
10181 CHECK_EXPECT(CombineUrl);
10182 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10183 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10184 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10185 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10186 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10187 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10188 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10189
10190 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10191 *pcchResult = lstrlenW(combine_resultW);
10192
10193 return S_OK;
10194 }
10195
10196 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10197 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10198 {
10199 ok(0, "unexpected call\n");
10200 return E_NOTIMPL;
10201 }
10202
10203 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10204 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10205 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10206 {
10207 ok(0, "unexpected call\n");
10208 return E_NOTIMPL;
10209 }
10210
10211 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10212 InternetProtocolInfo_QueryInterface,
10213 InternetProtocolInfo_AddRef,
10214 InternetProtocolInfo_Release,
10215 InternetProtocolInfo_ParseUrl,
10216 InternetProtocolInfo_CombineUrl,
10217 InternetProtocolInfo_CompareUrl,
10218 InternetProtocolInfo_QueryInfo
10219 };
10220
10221 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10222
10223 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10224 {
10225 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10226 *ppv = &protocol_info;
10227 return S_OK;
10228 }
10229
10230 ok(0, "unexpected call\n");
10231 return E_NOINTERFACE;
10232 }
10233
10234 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10235 {
10236 return 2;
10237 }
10238
10239 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10240 {
10241 return 1;
10242 }
10243
10244 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10245 REFIID riid, void **ppv)
10246 {
10247 ok(0, "unexpected call\n");
10248 return E_NOTIMPL;
10249 }
10250
10251 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10252 {
10253 ok(0, "unexpected call\n");
10254 return S_OK;
10255 }
10256
10257 static const IClassFactoryVtbl ClassFactoryVtbl = {
10258 ClassFactory_QueryInterface,
10259 ClassFactory_AddRef,
10260 ClassFactory_Release,
10261 ClassFactory_CreateInstance,
10262 ClassFactory_LockServer
10263 };
10264
10265 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10266
10267 static void register_protocols(void)
10268 {
10269 IInternetSession *session;
10270 HRESULT hres;
10271
10272 hres = pCoInternetGetSession(0, &session, 0);
10273 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10274 if(FAILED(hres))
10275 return;
10276
10277 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10278 winetestW, 0, NULL, 0);
10279 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10280
10281 IInternetSession_Release(session);
10282 }
10283
10284 static void unregister_protocols(void) {
10285 IInternetSession *session;
10286 HRESULT hr;
10287
10288 hr = pCoInternetGetSession(0, &session, 0);
10289 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10290 if(FAILED(hr))
10291 return;
10292
10293 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10294 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10295
10296 IInternetSession_Release(session);
10297 }
10298
10299 static void test_CoInternetCombineIUri_Pluggable(void) {
10300 HRESULT hr;
10301 IUri *base = NULL;
10302
10303 hr = pCreateUri(combine_baseW, 0, 0, &base);
10304 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10305 if(SUCCEEDED(hr)) {
10306 IUri *relative = NULL;
10307
10308 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10309 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10310 if(SUCCEEDED(hr)) {
10311 IUri *result = NULL;
10312
10313 SET_EXPECT(CombineUrl);
10314
10315 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10316 &result, 0);
10317 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10318
10319 CHECK_CALLED(CombineUrl);
10320
10321 if(SUCCEEDED(hr)) {
10322 BSTR received = NULL;
10323 hr = IUri_GetAbsoluteUri(result, &received);
10324 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10325 if(SUCCEEDED(hr)) {
10326 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10327 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10328 }
10329 SysFreeString(received);
10330 }
10331 if(result) IUri_Release(result);
10332 }
10333 if(relative) IUri_Release(relative);
10334 }
10335 if(base) IUri_Release(base);
10336 }
10337
10338 static void test_CoInternetCombineUrlEx(void) {
10339 HRESULT hr;
10340 IUri *base, *result;
10341 DWORD i;
10342
10343 base = NULL;
10344 hr = pCreateUri(http_urlW, 0, 0, &base);
10345 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10346 if(SUCCEEDED(hr)) {
10347 result = (void*) 0xdeadbeef;
10348 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10349 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10350 hr, E_UNEXPECTED);
10351 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10352 }
10353
10354 result = (void*) 0xdeadbeef;
10355 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10356 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10357 hr, E_INVALIDARG);
10358 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10359
10360 result = (void*) 0xdeadbeef;
10361 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10362 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10363 hr, E_UNEXPECTED);
10364 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10365
10366 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10367 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10368 hr, E_POINTER);
10369 if(base) IUri_Release(base);
10370
10371 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10372 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10373
10374 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10375 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10376 if(SUCCEEDED(hr)) {
10377 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10378
10379 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10380 &result, 0);
10381 todo_wine_if(uri_combine_tests[i].todo)
10382 ok(hr == uri_combine_tests[i].expected,
10383 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10384 hr, uri_combine_tests[i]. expected, i);
10385 if(SUCCEEDED(hr)) {
10386 DWORD j;
10387
10388 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10389 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10390 BSTR received;
10391 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10392
10393 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10394 todo_wine_if(prop.todo) {
10395 ok(hr == prop.expected,
10396 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10397 hr, prop.expected, i, j);
10398 ok(!strcmp_aw(value, received) ||
10399 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10400 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10401 value, wine_dbgstr_w(received), i, j);
10402 }
10403 SysFreeString(received);
10404 }
10405
10406 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10407 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10408 DWORD received;
10409
10410 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10411 todo_wine_if(prop.todo) {
10412 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10413 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10414 hr, prop.expected, i, j);
10415 if(!prop.broken_combine_hres || hr != S_FALSE)
10416 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10417 prop.value, received, i, j);
10418 }
10419 }
10420 }
10421 if(result) IUri_Release(result);
10422 heap_free(relativeW);
10423 }
10424 if(base) IUri_Release(base);
10425 heap_free(baseW);
10426 }
10427 }
10428
10429 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10430 HRESULT hr;
10431 IUri *base = NULL;
10432
10433 hr = pCreateUri(combine_baseW, 0, 0, &base);
10434 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10435 if(SUCCEEDED(hr)) {
10436 IUri *result = NULL;
10437
10438 SET_EXPECT(CombineUrl);
10439
10440 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10441 &result, 0);
10442 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10443
10444 CHECK_CALLED(CombineUrl);
10445
10446 if(SUCCEEDED(hr)) {
10447 BSTR received = NULL;
10448 hr = IUri_GetAbsoluteUri(result, &received);
10449 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10450 if(SUCCEEDED(hr)) {
10451 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10452 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10453 }
10454 SysFreeString(received);
10455 }
10456 if(result) IUri_Release(result);
10457 }
10458 if(base) IUri_Release(base);
10459 }
10460
10461 static void test_CoInternetParseIUri_InvalidArgs(void) {
10462 HRESULT hr;
10463 IUri *uri = NULL;
10464 WCHAR tmp[3];
10465 WCHAR *longurl, *copy;
10466 DWORD result = -1;
10467 DWORD i, len;
10468
10469 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10470 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10471 hr, E_INVALIDARG);
10472 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10473
10474 hr = pCreateUri(http_urlW, 0, 0, &uri);
10475 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10476 if(SUCCEEDED(hr)) {
10477 DWORD expected_len;
10478
10479 result = -1;
10480 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10481 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10482 hr, E_INVALIDARG);
10483 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10484
10485 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10486 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10487 hr, E_POINTER);
10488
10489 result = -1;
10490 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10491 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10492 hr, E_FAIL);
10493 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10494
10495 result = -1;
10496 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10497 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10498 hr, E_FAIL);
10499 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10500
10501 result = -1;
10502 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10503 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10504 hr, E_FAIL);
10505 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10506
10507 result = -1;
10508 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10509 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10510 hr, E_FAIL);
10511 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10512
10513 expected_len = lstrlenW(http_urlW);
10514 result = -1;
10515 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10516 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10517 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10518 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10519 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10520 expected_len, result);
10521 }
10522 if(uri) IUri_Release(uri);
10523
10524 /* a long url that causes a crash on Wine */
10525 len = INTERNET_MAX_URL_LENGTH*2;
10526 longurl = heap_alloc((len+1)*sizeof(WCHAR));
10527 memcpy(longurl, http_urlW, sizeof(http_urlW));
10528 for(i = sizeof(http_urlW)/sizeof(WCHAR)-1; i < len; i++)
10529 longurl[i] = 'x';
10530 longurl[len] = 0;
10531
10532 copy = heap_alloc((len+1)*sizeof(WCHAR));
10533 memcpy(copy, longurl, (len+1)*sizeof(WCHAR));
10534
10535 hr = pCreateUri(longurl, 0, 0, &uri);
10536 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10537 if(SUCCEEDED(hr)) {
10538 result = -1;
10539 memset(longurl, 0xcc, len*sizeof(WCHAR));
10540 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, longurl, len+1, &result, 0);
10541 ok(SUCCEEDED(hr), "Error: CoInternetParseIUri returned 0x%08x.\n", hr);
10542 ok(!lstrcmpW(longurl, copy), "Error: expected long url '%s' but was '%s'.\n",
10543 wine_dbgstr_w(copy), wine_dbgstr_w(longurl));
10544 ok(result == len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10545 len, result);
10546 }
10547 heap_free(longurl);
10548 heap_free(copy);
10549 if(uri) IUri_Release(uri);
10550 }
10551
10552 static void test_CoInternetParseIUri(void) {
10553 DWORD i;
10554
10555 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10556 HRESULT hr;
10557 IUri *uri;
10558 LPWSTR uriW;
10559 uri_parse_test test = uri_parse_tests[i];
10560
10561 uriW = a2w(test.uri);
10562 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10563 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10564 if(SUCCEEDED(hr)) {
10565 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10566 DWORD result_len = -1;
10567
10568 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10569 todo_wine_if(test.todo)
10570 ok(hr == test.expected,
10571 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10572 hr, test.expected, i);
10573 if(SUCCEEDED(hr)) {
10574 DWORD len = lstrlenA(test.property);
10575 ok(!strcmp_aw(test.property, result) || (test.property2 && !strcmp_aw(test.property2, result)),
10576 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10577 test.property, wine_dbgstr_w(result), i);
10578 ok(len == result_len || (test.property2 && lstrlenA(test.property2) == result_len),
10579 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10580 len, result_len, i);
10581 } else {
10582 ok(!result_len,
10583 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10584 result_len, i);
10585 }
10586 }
10587 if(uri) IUri_Release(uri);
10588 heap_free(uriW);
10589 }
10590 }
10591
10592 static void test_CoInternetParseIUri_Pluggable(void) {
10593 HRESULT hr;
10594 IUri *uri = NULL;
10595
10596 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10597 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10598 if(SUCCEEDED(hr)) {
10599 WCHAR result[200];
10600 DWORD result_len;
10601
10602 SET_EXPECT(ParseUrl);
10603
10604 parse_action = PARSE_CANONICALIZE;
10605 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10606
10607 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10608 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10609
10610 CHECK_CALLED(ParseUrl);
10611
10612 if(SUCCEEDED(hr)) {
10613 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10614 lstrlenW(parse_resultW), result_len);
10615 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10616 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10617 }
10618 }
10619 if(uri) IUri_Release(uri);
10620 }
10621
10622 typedef struct {
10623 const char *url;
10624 DWORD uri_flags;
10625 const char *base_url;
10626 DWORD base_uri_flags;
10627 const char *legacy_url;
10628 const char *uniform_url;
10629 const char *no_canon_url;
10630 const char *uri_url;
10631 } create_urlmon_test_t;
10632
10633 static const create_urlmon_test_t create_urlmon_tests[] = {
10634 {
10635 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10636 NULL,0,
10637 "http://www.winehq.org/",
10638 "http://www.winehq.org/",
10639 "http://www.winehq.org",
10640 "http://www.winehq.org"
10641 },
10642 {
10643 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10644 NULL,0,
10645 "file://c:\\dir\\file.txt",
10646 "file:///c:/dir/file.txt",
10647 "file:///c:/dir/file.txt",
10648 "file:///c:/dir/file.txt"
10649 },
10650 {
10651 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10652 NULL,0,
10653 "file://c:\\dir\\file.txt",
10654 "file:///c:/dir/file.txt",
10655 "file:///c:/dir/file.txt",
10656 "file://c:\\dir\\file.txt"
10657 },
10658 {
10659 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10660 "http://www.winehq.org",0,
10661 "http://www.winehq.org/data",
10662 "http://www.winehq.org/data",
10663 "http://www.winehq.org:80/data",
10664 },
10665 {
10666 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10667 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10668 "file://c:\\dir\\file.txt",
10669 "file:///c:/dir/file.txt",
10670 "file:///c:/dir/file.txt",
10671 },
10672 {
10673 "",Uri_CREATE_ALLOW_RELATIVE,
10674 NULL,0,
10675 "",
10676 "",
10677 "",
10678 ""
10679 },
10680 {
10681 "test",Uri_CREATE_ALLOW_RELATIVE,
10682 NULL,0,
10683 "test",
10684 "test",
10685 "test",
10686 "test"
10687 },
10688 {
10689 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10690 NULL,0,
10691 "file://c:\\dir\\file.txt",
10692 "file:///c:/dir/file.txt",
10693 "file:///c:/dir/file.txt",
10694 "file:///c:/dir/file.txt",
10695 },
10696 {
10697 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10698 NULL,0,
10699 "file://c:\\dir\\file.txt#frag|part",
10700 "file:///c:/dir/file.txt#frag%7Cpart",
10701 "file:///c:/dir/file.txt#frag%7Cpart",
10702 "file:///c:/dir/file.txt#frag%7Cpart",
10703 }
10704 };
10705
10706 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10707 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10708 {
10709 WCHAR *display_name;
10710 HRESULT hres;
10711
10712 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10713 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10714 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10715 wine_dbgstr_w(display_name), exurl);
10716
10717 CoTaskMemFree(display_name);
10718 }
10719
10720 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10721 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10722 {
10723 IUriContainer *uri_container;
10724 IUri *uri;
10725 BSTR display_uri;
10726 HRESULT hres;
10727
10728 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10729 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10730
10731 uri = NULL;
10732 hres = IUriContainer_GetIUri(uri_container, &uri);
10733 IUriContainer_Release(uri_container);
10734 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10735 ok(uri != NULL, "uri == NULL\n");
10736
10737 hres = IUri_GetDisplayUri(uri, &display_uri);
10738 IUri_Release(uri);
10739 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10740 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10741 wine_dbgstr_w(display_uri), exurl);
10742 SysFreeString(display_uri);
10743 }
10744
10745 static void test_CreateURLMoniker(void)
10746 {
10747 const create_urlmon_test_t *test;
10748 IMoniker *mon, *base_mon;
10749 WCHAR *url, *base_url;
10750 IUri *uri, *base_uri;
10751 HRESULT hres;
10752
10753 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10754 url = a2w(test->url);
10755 base_url = a2w(test->base_url);
10756
10757 if(base_url) {
10758 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10759 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10760
10761 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10762 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10763 }else {
10764 base_uri = NULL;
10765 base_mon = NULL;
10766 }
10767
10768 hres = CreateURLMoniker(base_mon, url, &mon);
10769 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10770 test_urlmon_display_name(mon, test->legacy_url);
10771 test_display_uri(mon, test->legacy_url);
10772 IMoniker_Release(mon);
10773
10774 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10775 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10776 test_urlmon_display_name(mon, test->legacy_url);
10777 test_display_uri(mon, test->legacy_url);
10778 IMoniker_Release(mon);
10779
10780 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10781 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10782 test_urlmon_display_name(mon, test->uniform_url);
10783 test_display_uri(mon, test->uniform_url);
10784 IMoniker_Release(mon);
10785
10786 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10787 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10788 test_urlmon_display_name(mon, test->no_canon_url);
10789 test_display_uri(mon, test->no_canon_url);
10790 IMoniker_Release(mon);
10791
10792 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10793 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10794
10795 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10796 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10797 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10798 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10799 IMoniker_Release(mon);
10800
10801 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10802 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10803 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10804 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10805 IMoniker_Release(mon);
10806
10807 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10808 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10809 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10810 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10811 IMoniker_Release(mon);
10812
10813 IUri_Release(uri);
10814 heap_free(url);
10815 heap_free(base_url);
10816 if(base_uri)
10817 IUri_Release(base_uri);
10818 if(base_mon)
10819 IMoniker_Release(base_mon);
10820 }
10821 }
10822
10823 static int add_default_flags(DWORD flags) {
10824 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
10825 flags |= Uri_CREATE_CANONICALIZE;
10826 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
10827 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
10828 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
10829 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
10830 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
10831 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
10832 if(!(flags & Uri_CREATE_IE_SETTINGS))
10833 flags |= Uri_CREATE_NO_IE_SETTINGS;
10834
10835 return flags;
10836 }
10837
10838 static void test_IPersistStream(void)
10839 {
10840 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
10841
10842 props_order[Uri_PROPERTY_RAW_URI] = 1;
10843 props_order[Uri_PROPERTY_FRAGMENT] = 2;
10844 props_order[Uri_PROPERTY_HOST] = 3;
10845 props_order[Uri_PROPERTY_PASSWORD] = 4;
10846 props_order[Uri_PROPERTY_PATH] = 5;
10847 props_order[Uri_PROPERTY_PORT] = 6;
10848 props_order[Uri_PROPERTY_QUERY] = 7;
10849 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
10850 props_order[Uri_PROPERTY_USER_NAME] = 9;
10851
10852 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
10853 const uri_properties *test = uri_tests+i;
10854 LPWSTR uriW;
10855 IUri *uri;
10856 IPersistStream *persist_stream;
10857 IStream *stream;
10858 IMarshal *marshal;
10859 DWORD props, props_no, dw_data[6];
10860 WCHAR str_data[1024];
10861 ULARGE_INTEGER size, max_size;
10862 LARGE_INTEGER no_off;
10863 CLSID curi;
10864 BSTR raw_uri;
10865 HRESULT hr;
10866
10867 if(test->create_todo || test->create_expected!=S_OK)
10868 continue;
10869
10870 uriW = a2w(test->uri);
10871 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
10872 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
10873
10874 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10875 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10876
10877 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
10878 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
10879 hr = IPersistStream_IsDirty(persist_stream);
10880 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10881 hr = IPersistStream_Save(persist_stream, stream, FALSE);
10882 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
10883 hr = IPersistStream_IsDirty(persist_stream);
10884 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10885 no_off.QuadPart = 0;
10886 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
10887 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10888 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10889 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10890 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
10891 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
10892 ok(U(size).LowPart+2 == U(max_size).LowPart,
10893 "%d) Written data size is %d, max_size %d.\n",
10894 i, U(size).LowPart, U(max_size).LowPart);
10895
10896 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
10897 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10898 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
10899 i, dw_data[0]-2, U(size).LowPart);
10900 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
10901 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10902 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
10903 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
10904 ok(dw_data[2] == add_default_flags(test->create_flags),
10905 "%d) Incorrect value %x, expected %x (creation flags).\n",
10906 i, dw_data[2], add_default_flags(test->create_flags));
10907 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
10908 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
10909 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
10910
10911 props_no = 0;
10912 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
10913 if(!props_order[props])
10914 continue;
10915
10916 if(props <= Uri_PROPERTY_STRING_LAST) {
10917 if(test->str_props[props].expected == S_OK)
10918 props_no++;
10919 } else {
10920 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
10921 props_no++;
10922 }
10923 }
10924 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
10925 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
10926 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
10927 props_no = 1;
10928
10929 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
10930 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10931 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
10932
10933 dw_data[2] = 0;
10934 dw_data[3] = -1;
10935 while(props) {
10936 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
10937 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10938 props--;
10939 ok(dw_data[2]<props_order[dw_data[0]],
10940 "%d) Incorrect properties order (%d, %d)\n",
10941 i, dw_data[0], dw_data[3]);
10942 dw_data[2] = props_order[dw_data[0]];
10943 dw_data[3] = dw_data[0];
10944
10945 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
10946 const uri_str_property *prop = test->str_props+dw_data[0];
10947 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
10948 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10949 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
10950 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
10951 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
10952 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
10953 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
10954 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
10955 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10956 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
10957 } else {
10958 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
10959 break;
10960 }
10961 }
10962 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
10963 i, props, dw_data[0]);
10964
10965 IUri_Release(uri);
10966
10967 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10968 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10969 hr = IPersistStream_GetClassID(persist_stream, &curi);
10970 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
10971 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
10972 IPersistStream_Release(persist_stream);
10973
10974 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
10975 &IID_IUri, (void**)&uri);
10976 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
10977 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10978 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10979 hr = IPersistStream_Load(persist_stream, stream);
10980 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
10981 hr = IUri_GetRawUri(uri, &raw_uri);
10982 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
10983 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
10984 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
10985 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
10986 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
10987 wine_dbgstr_w(raw_uri));
10988 SysFreeString(raw_uri);
10989 IPersistStream_Release(persist_stream);
10990
10991 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
10992 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
10993 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10994 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10995 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10996 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
10997 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10998 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10999 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11000 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11001 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11002 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11003 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11004 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11005 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11006 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11007 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11008 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11009 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11010 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11011 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11012 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11013 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11014 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11015 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11016 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11017 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11018 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11019 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11020
11021 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11022 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11023 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11024 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11025 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11026 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11027 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11028 i, dw_data[0]-2, U(size).LowPart);
11029 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11030 i, dw_data[1]);
11031 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11032 i, dw_data[2], dw_data[0]-8);
11033 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11034 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11035 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11036 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11037 U(max_size).LowPart += 3*sizeof(DWORD);
11038 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11039 i, dw_data[2], U(max_size).LowPart);
11040 IMarshal_Release(marshal);
11041 IUri_Release(uri);
11042
11043 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11044 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11045 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11046 &IID_IUri, (void**)&uri);
11047 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11048 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11049 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11050 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11051 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11052 hr = IUri_GetRawUri(uri, &raw_uri);
11053 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11054 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11055 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11056 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11057 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11058 wine_dbgstr_w(raw_uri));
11059 SysFreeString(raw_uri);
11060
11061 IMarshal_Release(marshal);
11062 IStream_Release(stream);
11063 IUri_Release(uri);
11064 heap_free(uriW);
11065 }
11066 }
11067
11068 static void test_UninitializedUri(void)
11069 {
11070 IUri *uri;
11071 IUriBuilderFactory *ubf;
11072 IPersistStream *ps;
11073 IUriBuilder *ub;
11074 BSTR bstr;
11075 DWORD dword;
11076 BOOL eq;
11077 ULARGE_INTEGER ui;
11078 HRESULT hr;
11079
11080 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11081 &IID_IUri, (void**)&uri);
11082 if(FAILED(hr)) {
11083 win_skip("Skipping uninitialized Uri tests.\n");
11084 return;
11085 }
11086
11087 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11088 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11089 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11090 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11091
11092 hr = IUri_GetAbsoluteUri(uri, NULL);
11093 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11094 hr = IUri_GetAbsoluteUri(uri, &bstr);
11095 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11096 hr = IUri_GetAuthority(uri, &bstr);
11097 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11098 hr = IUri_GetDisplayUri(uri, &bstr);
11099 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11100 hr = IUri_GetDomain(uri, &bstr);
11101 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11102 hr = IUri_GetExtension(uri, &bstr);
11103 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11104 hr = IUri_GetFragment(uri, &bstr);
11105 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11106 hr = IUri_GetHost(uri, &bstr);
11107 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11108 hr = IUri_GetHostType(uri, &dword);
11109 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11110 hr = IUri_GetPassword(uri, &bstr);
11111 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11112 hr = IUri_GetPassword(uri, &bstr);
11113 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11114 hr = IUri_GetPathAndQuery(uri, &bstr);
11115 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11116 hr = IUri_GetPort(uri, &dword);
11117 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11118 hr = IUri_GetProperties(uri, &dword);
11119 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11120 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11121 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11122 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11123 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11124 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11125 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11126 hr = IUri_GetQuery(uri, &bstr);
11127 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11128 hr = IUri_GetRawUri(uri, &bstr);
11129 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11130 hr = IUri_GetScheme(uri, &dword);
11131 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11132 hr = IUri_GetSchemeName(uri, &bstr);
11133 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11134 hr = IUri_GetUserInfo(uri, &bstr);
11135 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11136 hr = IUri_GetUserName(uri, &bstr);
11137 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11138 hr = IUri_GetZone(uri, &dword);
11139 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11140 hr = IUri_IsEqual(uri, uri, &eq);
11141 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11142
11143 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11144 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11145 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11146 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11147 IUriBuilder_Release(ub);
11148
11149 hr = IPersistStream_GetSizeMax(ps, &ui);
11150 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11151 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11152 hr = IPersistStream_IsDirty(ps);
11153 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11154
11155 IPersistStream_Release(ps);
11156 IUriBuilderFactory_Release(ubf);
11157 IUri_Release(uri);
11158 }
11159
11160 START_TEST(uri) {
11161 HMODULE hurlmon;
11162
11163 hurlmon = GetModuleHandleA("urlmon.dll");
11164 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11165 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11166 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11167 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11168 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11169 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11170 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11171 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11172 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11173
11174 if(!pCreateUri) {
11175 win_skip("CreateUri is not present, skipping tests.\n");
11176 return;
11177 }
11178
11179 trace("test CreateUri invalid flags...\n");
11180 test_CreateUri_InvalidFlags();
11181
11182 trace("test CreateUri invalid args...\n");
11183 test_CreateUri_InvalidArgs();
11184
11185 trace("test CreateUri invalid URIs...\n");
11186 test_CreateUri_InvalidUri();
11187
11188 trace("test IUri_GetPropertyBSTR...\n");
11189 test_IUri_GetPropertyBSTR();
11190
11191 trace("test IUri_GetPropertyDWORD...\n");
11192 test_IUri_GetPropertyDWORD();
11193
11194 trace("test IUri_GetStrProperties...\n");
11195 test_IUri_GetStrProperties();
11196
11197 trace("test IUri_GetDwordProperties...\n");
11198 test_IUri_GetDwordProperties();
11199
11200 trace("test IUri_GetPropertyLength...\n");
11201 test_IUri_GetPropertyLength();
11202
11203 trace("test IUri_GetProperties...\n");
11204 test_IUri_GetProperties();
11205
11206 trace("test IUri_HasProperty...\n");
11207 test_IUri_HasProperty();
11208
11209 trace("test IUri_IsEqual...\n");
11210 test_IUri_IsEqual();
11211
11212 trace("test CreateUriWithFragment invalid args...\n");
11213 test_CreateUriWithFragment_InvalidArgs();
11214
11215 trace("test CreateUriWithFragment invalid flags...\n");
11216 test_CreateUriWithFragment_InvalidFlags();
11217
11218 trace("test CreateUriWithFragment...\n");
11219 test_CreateUriWithFragment();
11220
11221 trace("test CreateIUriBuilder...\n");
11222 test_CreateIUriBuilder();
11223
11224 trace("test IUriBuilder_CreateInvalidArgs...\n");
11225 test_IUriBuilder_CreateInvalidArgs();
11226
11227 trace("test IUriBuilder...\n");
11228 test_IUriBuilder();
11229
11230 trace("test IUriBuilder_GetInvalidArgs...\n");
11231 test_IUriBuilder_GetInvalidArgs();
11232
11233 trace("test IUriBuilder_HasBeenModified...\n");
11234 test_IUriBuilder_HasBeenModified();
11235
11236 trace("test IUriBuilder_IUriProperty...\n");
11237 test_IUriBuilder_IUriProperty();
11238
11239 trace("test IUriBuilder_RemoveProperties...\n");
11240 test_IUriBuilder_RemoveProperties();
11241
11242 trace("test IUriBuilder miscellaneous...\n");
11243 test_IUriBuilder_Misc();
11244
11245 trace("test IUriBuilderFactory...\n");
11246 test_IUriBuilderFactory();
11247
11248 trace("test CoInternetCombineIUri...\n");
11249 test_CoInternetCombineIUri();
11250
11251 trace("test CoInternetCombineUrlEx...\n");
11252 test_CoInternetCombineUrlEx();
11253
11254 trace("test CoInternetParseIUri Invalid Args...\n");
11255 test_CoInternetParseIUri_InvalidArgs();
11256
11257 trace("test CoInternetParseIUri...\n");
11258 test_CoInternetParseIUri();
11259
11260 register_protocols();
11261
11262 trace("test CoInternetCombineIUri pluggable...\n");
11263 test_CoInternetCombineIUri_Pluggable();
11264
11265 trace("test CoInternetCombineUrlEx Pluggable...\n");
11266 test_CoInternetCombineUrlEx_Pluggable();
11267
11268 trace("test CoInternetParseIUri pluggable...\n");
11269 test_CoInternetParseIUri_Pluggable();
11270
11271 trace("test CreateURLMoniker...\n");
11272 test_CreateURLMoniker();
11273
11274 CoInitialize(NULL);
11275
11276 trace("test IPersistStream...\n");
11277 test_IPersistStream();
11278
11279 trace("test uninitialized Uri...\n");
11280 test_UninitializedUri();
11281
11282 CoUninitialize();
11283 unregister_protocols();
11284 }