[URLMON_WINETEST]
[reactos.git] / 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 } uri_str_property;
126
127 typedef struct _uri_dword_property {
128 DWORD value;
129 HRESULT expected;
130 BOOL todo;
131 BOOL broken_combine_hres;
132 } uri_dword_property;
133
134 typedef struct _uri_properties {
135 const char* uri;
136 DWORD create_flags;
137 HRESULT create_expected;
138 BOOL create_todo;
139
140 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
141 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
142 } uri_properties;
143
144 static const uri_properties uri_tests[] = {
145 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
146 {
147 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
148 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
149 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
150 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
151 {"",S_FALSE,FALSE}, /* EXTENSION */
152 {"",S_FALSE,FALSE}, /* FRAGMENT */
153 {"www.winehq.org",S_OK,FALSE}, /* HOST */
154 {"",S_FALSE,FALSE}, /* PASSWORD */
155 {"/",S_OK,FALSE}, /* PATH */
156 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
157 {"",S_FALSE,FALSE}, /* QUERY */
158 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
159 {"http",S_OK,FALSE}, /* SCHEME_NAME */
160 {"",S_FALSE,FALSE}, /* USER_INFO */
161 {"",S_FALSE,FALSE} /* USER_NAME */
162 },
163 {
164 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
165 {80,S_OK,FALSE}, /* PORT */
166 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
167 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
168 }
169 },
170 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
171 {
172 {"http://winehq.org/tests",S_OK,FALSE},
173 {"winehq.org",S_OK,FALSE},
174 {"http://winehq.org/tests",S_OK,FALSE},
175 {"winehq.org",S_OK,FALSE},
176 {"",S_FALSE,FALSE},
177 {"",S_FALSE,FALSE},
178 {"winehq.org",S_OK,FALSE},
179 {"",S_FALSE,FALSE},
180 {"/tests",S_OK,FALSE},
181 {"/tests",S_OK,FALSE},
182 {"",S_FALSE,FALSE},
183 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
184 {"http",S_OK,FALSE},
185 {"",S_FALSE,FALSE},
186 {"",S_FALSE,FALSE}
187 },
188 {
189 {Uri_HOST_DNS,S_OK,FALSE},
190 {80,S_OK,FALSE},
191 {URL_SCHEME_HTTP,S_OK,FALSE},
192 {URLZONE_INVALID,E_NOTIMPL,FALSE}
193 }
194 },
195 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
196 {
197 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
198 {"www.winehq.org",S_OK,FALSE},
199 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
200 {"winehq.org",S_OK,FALSE},
201 {"",S_FALSE,FALSE},
202 {"",S_FALSE,FALSE},
203 {"www.winehq.org",S_OK,FALSE},
204 {"",S_FALSE,FALSE},
205 {"/",S_OK,FALSE},
206 {"/?query=x&return=y",S_OK,FALSE},
207 {"?query=x&return=y",S_OK,FALSE},
208 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
209 {"http",S_OK,FALSE},
210 {"",S_FALSE,FALSE},
211 {"",S_FALSE,FALSE}
212 },
213 {
214 {Uri_HOST_DNS,S_OK,FALSE},
215 {80,S_OK,FALSE},
216 {URL_SCHEME_HTTP,S_OK,FALSE},
217 {URLZONE_INVALID,E_NOTIMPL,FALSE},
218 }
219 },
220 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
221 {
222 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
223 {"www.winehq.org",S_OK,FALSE},
224 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
225 {"winehq.org",S_OK,FALSE},
226 {"",S_FALSE,FALSE},
227 {"",S_FALSE,FALSE},
228 {"www.winehq.org",S_OK,FALSE},
229 {"",S_FALSE,FALSE},
230 {"/",S_OK,FALSE},
231 {"/?query=x&return=y",S_OK,FALSE},
232 {"?query=x&return=y",S_OK,FALSE},
233 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
234 {"https",S_OK,FALSE},
235 {"",S_FALSE,FALSE},
236 {"",S_FALSE,FALSE}
237 },
238 {
239 {Uri_HOST_DNS,S_OK,FALSE},
240 {443,S_OK,FALSE},
241 {URL_SCHEME_HTTPS,S_OK,FALSE},
242 {URLZONE_INVALID,E_NOTIMPL,FALSE},
243 }
244 },
245 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
246 {
247 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
248 {"usEr%3Ainfo@example.com",S_OK,FALSE},
249 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
250 {"example.com",S_OK,FALSE},
251 {"",S_FALSE,FALSE},
252 {"",S_FALSE,FALSE},
253 {"example.com",S_OK,FALSE},
254 {"",S_FALSE,FALSE},
255 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
256 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
257 {"",S_FALSE,FALSE},
258 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
259 {"http",S_OK,FALSE},
260 {"usEr%3Ainfo",S_OK,FALSE},
261 {"usEr%3Ainfo",S_OK,FALSE}
262 },
263 {
264 {Uri_HOST_DNS,S_OK,FALSE},
265 {80,S_OK,FALSE},
266 {URL_SCHEME_HTTP,S_OK,FALSE},
267 {URLZONE_INVALID,E_NOTIMPL,FALSE},
268 }
269 },
270 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
271 {
272 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
273 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
274 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
275 {"winehq.org",S_OK,FALSE},
276 {".txt",S_OK,FALSE},
277 {"",S_FALSE,FALSE},
278 {"ftp.winehq.org",S_OK,FALSE},
279 {"wine",S_OK,FALSE},
280 {"/dir/foo%20bar.txt",S_OK,FALSE},
281 {"/dir/foo%20bar.txt",S_OK,FALSE},
282 {"",S_FALSE,FALSE},
283 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
284 {"ftp",S_OK,FALSE},
285 {"winepass:wine",S_OK,FALSE},
286 {"winepass",S_OK,FALSE}
287 },
288 {
289 {Uri_HOST_DNS,S_OK,FALSE},
290 {9999,S_OK,FALSE},
291 {URL_SCHEME_FTP,S_OK,FALSE},
292 {URLZONE_INVALID,E_NOTIMPL,FALSE}
293 }
294 },
295 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
296 {
297 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
298 {"",S_FALSE,FALSE},
299 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
300 {"",S_FALSE,FALSE},
301 {".mp3",S_OK,FALSE},
302 {"",S_FALSE,FALSE},
303 {"",S_FALSE,FALSE},
304 {"",S_FALSE,FALSE},
305 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
306 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
307 {"",S_FALSE,FALSE},
308 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
309 {"file",S_OK,FALSE},
310 {"",S_FALSE,FALSE},
311 {"",S_FALSE,FALSE}
312 },
313 {
314 {Uri_HOST_UNKNOWN,S_OK,FALSE},
315 {0,S_FALSE,FALSE},
316 {URL_SCHEME_FILE,S_OK,FALSE},
317 {URLZONE_INVALID,E_NOTIMPL,FALSE}
318 }
319 },
320 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
321 {
322 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
323 {"",S_FALSE,FALSE},
324 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
325 {"",S_FALSE,FALSE},
326 {".mp3",S_OK,FALSE},
327 {"",S_FALSE,FALSE},
328 {"",S_FALSE,FALSE},
329 {"",S_FALSE,FALSE},
330 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
331 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
332 {"",S_FALSE,FALSE},
333 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
334 {"file",S_OK,FALSE},
335 {"",S_FALSE,FALSE},
336 {"",S_FALSE,FALSE}
337 },
338 {
339 {Uri_HOST_UNKNOWN,S_OK,FALSE},
340 {0,S_FALSE,FALSE},
341 {URL_SCHEME_FILE,S_OK,FALSE},
342 {URLZONE_INVALID,E_NOTIMPL,FALSE}
343 }
344 },
345 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
346 {
347 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
348 {"",S_FALSE,FALSE},
349 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
350 {"",S_FALSE,FALSE},
351 {".txt",S_OK,FALSE},
352 {"",S_FALSE,FALSE},
353 {"",S_FALSE,FALSE},
354 {"",S_FALSE,FALSE},
355 {"/tests/test%20file.README.txt",S_OK,FALSE},
356 {"/tests/test%20file.README.txt",S_OK,FALSE},
357 {"",S_FALSE,FALSE},
358 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
359 {"file",S_OK,FALSE},
360 {"",S_FALSE,FALSE},
361 {"",S_FALSE,FALSE}
362 },
363 {
364 {Uri_HOST_UNKNOWN,S_OK,FALSE},
365 {0,S_FALSE,FALSE},
366 {URL_SCHEME_FILE,S_OK,FALSE},
367 {URLZONE_INVALID,E_NOTIMPL,FALSE}
368 }
369 },
370 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
371 {
372 {"file:///z:/test%20dir/README.txt",S_OK},
373 {"",S_FALSE},
374 {"file:///z:/test%20dir/README.txt",S_OK},
375 {"",S_FALSE},
376 {".txt",S_OK},
377 {"",S_FALSE},
378 {"",S_FALSE},
379 {"",S_FALSE},
380 {"/z:/test%20dir/README.txt",S_OK},
381 {"/z:/test%20dir/README.txt",S_OK},
382 {"",S_FALSE},
383 {"file:///z:/test dir/README.txt",S_OK},
384 {"file",S_OK},
385 {"",S_FALSE},
386 {"",S_FALSE}
387 },
388 {
389 {Uri_HOST_UNKNOWN,S_OK,FALSE},
390 {0,S_FALSE,FALSE},
391 {URL_SCHEME_FILE,S_OK,FALSE},
392 {URLZONE_INVALID,E_NOTIMPL,FALSE}
393 }
394 },
395 { "file:///z:/test dir/README.txt#hash part", 0, S_OK, FALSE,
396 {
397 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
398 {"",S_FALSE},
399 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK},
400 {"",S_FALSE},
401 {".txt#hash%20part",S_OK},
402 {"",S_FALSE},
403 {"",S_FALSE},
404 {"",S_FALSE},
405 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
406 {"/z:/test%20dir/README.txt#hash%20part",S_OK},
407 {"",S_FALSE},
408 {"file:///z:/test dir/README.txt#hash part",S_OK},
409 {"file",S_OK},
410 {"",S_FALSE},
411 {"",S_FALSE}
412 },
413 {
414 {Uri_HOST_UNKNOWN,S_OK,FALSE},
415 {0,S_FALSE,FALSE},
416 {URL_SCHEME_FILE,S_OK,FALSE},
417 {URLZONE_INVALID,E_NOTIMPL,FALSE}
418 }
419 },
420 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
421 {
422 {"urn:nothing:should:happen here",S_OK,FALSE},
423 {"",S_FALSE,FALSE},
424 {"urn:nothing:should:happen here",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {"",S_FALSE,FALSE},
427 {"",S_FALSE,FALSE},
428 {"",S_FALSE,FALSE},
429 {"",S_FALSE,FALSE},
430 {"nothing:should:happen here",S_OK,FALSE},
431 {"nothing:should:happen here",S_OK,FALSE},
432 {"",S_FALSE,FALSE},
433 {"urn:nothing:should:happen here",S_OK,FALSE},
434 {"urn",S_OK,FALSE},
435 {"",S_FALSE,FALSE},
436 {"",S_FALSE,FALSE}
437 },
438 {
439 {Uri_HOST_UNKNOWN,S_OK,FALSE},
440 {0,S_FALSE,FALSE},
441 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
442 {URLZONE_INVALID,E_NOTIMPL,FALSE}
443 }
444 },
445 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
446 {
447 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
448 {"127.0.0.1",S_OK,FALSE},
449 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {".txt",S_OK,FALSE},
452 {"",S_FALSE,FALSE},
453 {"127.0.0.1",S_OK,FALSE},
454 {"",S_FALSE,FALSE},
455 {"/test%20dir/test.txt",S_OK,FALSE},
456 {"/test%20dir/test.txt",S_OK,FALSE},
457 {"",S_FALSE,FALSE},
458 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
459 {"http",S_OK,FALSE},
460 {"",S_FALSE,FALSE},
461 {"",S_FALSE,FALSE}
462 },
463 {
464 {Uri_HOST_IPV4,S_OK,FALSE},
465 {80,S_OK,FALSE},
466 {URL_SCHEME_HTTP,S_OK,FALSE},
467 {URLZONE_INVALID,E_NOTIMPL,FALSE}
468 }
469 },
470 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
471 {
472 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
473 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
474 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"",S_FALSE,FALSE},
477 {"",S_FALSE,FALSE},
478 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
479 {"",S_FALSE,FALSE},
480 {"/",S_OK,FALSE},
481 {"/",S_OK,FALSE},
482 {"",S_FALSE,FALSE},
483 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
484 {"http",S_OK,FALSE},
485 {"",S_FALSE,FALSE},
486 {"",S_FALSE,FALSE}
487 },
488 {
489 {Uri_HOST_IPV6,S_OK,FALSE},
490 {80,S_OK,FALSE},
491 {URL_SCHEME_HTTP,S_OK,FALSE},
492 {URLZONE_INVALID,E_NOTIMPL,FALSE}
493 }
494 },
495 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
496 {
497 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
498 {"[::13.1.68.3]",S_OK,FALSE},
499 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"",S_FALSE,FALSE},
502 {"",S_FALSE,FALSE},
503 {"::13.1.68.3",S_OK,FALSE},
504 {"",S_FALSE,FALSE},
505 {"/",S_OK,FALSE},
506 {"/",S_OK,FALSE},
507 {"",S_FALSE,FALSE},
508 {"ftp://[::13.1.68.3]",S_OK,FALSE},
509 {"ftp",S_OK,FALSE},
510 {"",S_FALSE,FALSE},
511 {"",S_FALSE,FALSE}
512 },
513 {
514 {Uri_HOST_IPV6,S_OK,FALSE},
515 {21,S_OK,FALSE},
516 {URL_SCHEME_FTP,S_OK,FALSE},
517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
518 }
519 },
520 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
521 {
522 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
523 {"[fedc:ba98::3210]",S_OK,FALSE},
524 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"",S_FALSE,FALSE},
527 {"",S_FALSE,FALSE},
528 {"fedc:ba98::3210",S_OK,FALSE},
529 {"",S_FALSE,FALSE},
530 {"/",S_OK,FALSE},
531 {"/",S_OK,FALSE},
532 {"",S_FALSE,FALSE},
533 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
534 {"http",S_OK,FALSE},
535 {"",S_FALSE,FALSE},
536 {"",S_FALSE,FALSE},
537 },
538 {
539 {Uri_HOST_IPV6,S_OK,FALSE},
540 {80,S_OK,FALSE},
541 {URL_SCHEME_HTTP,S_OK,FALSE},
542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
543 }
544 },
545 { "1234://www.winehq.org", 0, S_OK, FALSE,
546 {
547 {"1234://www.winehq.org/",S_OK,FALSE},
548 {"www.winehq.org",S_OK,FALSE},
549 {"1234://www.winehq.org/",S_OK,FALSE},
550 {"winehq.org",S_OK,FALSE},
551 {"",S_FALSE,FALSE},
552 {"",S_FALSE,FALSE},
553 {"www.winehq.org",S_OK,FALSE},
554 {"",S_FALSE,FALSE},
555 {"/",S_OK,FALSE},
556 {"/",S_OK,FALSE},
557 {"",S_FALSE,FALSE},
558 {"1234://www.winehq.org",S_OK,FALSE},
559 {"1234",S_OK,FALSE},
560 {"",S_FALSE,FALSE},
561 {"",S_FALSE,FALSE}
562 },
563 {
564 {Uri_HOST_DNS,S_OK,FALSE},
565 {0,S_FALSE,FALSE},
566 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
567 {URLZONE_INVALID,E_NOTIMPL,FALSE}
568 }
569 },
570 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
571 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
572 {
573 {"file:///C:/test/test.mp3",S_OK,FALSE},
574 {"",S_FALSE,FALSE},
575 {"file:///C:/test/test.mp3",S_OK,FALSE},
576 {"",S_FALSE,FALSE},
577 {".mp3",S_OK,FALSE},
578 {"",S_FALSE,FALSE},
579 {"",S_FALSE,FALSE},
580 {"",S_FALSE,FALSE},
581 {"/C:/test/test.mp3",S_OK,FALSE},
582 {"/C:/test/test.mp3",S_OK,FALSE},
583 {"",S_FALSE,FALSE},
584 {"C:/test/test.mp3",S_OK,FALSE},
585 {"file",S_OK,FALSE},
586 {"",S_FALSE,FALSE},
587 {"",S_FALSE,FALSE}
588 },
589 {
590 {Uri_HOST_UNKNOWN,S_OK,FALSE},
591 {0,S_FALSE,FALSE},
592 {URL_SCHEME_FILE,S_OK,FALSE},
593 {URLZONE_INVALID,E_NOTIMPL,FALSE}
594 }
595 },
596 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
597 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
598 {
599 {"file://server/test.mp3",S_OK,FALSE},
600 {"server",S_OK,FALSE},
601 {"file://server/test.mp3",S_OK,FALSE},
602 {"",S_FALSE,FALSE},
603 {".mp3",S_OK,FALSE},
604 {"",S_FALSE,FALSE},
605 {"server",S_OK,FALSE},
606 {"",S_FALSE,FALSE},
607 {"/test.mp3",S_OK,FALSE},
608 {"/test.mp3",S_OK,FALSE},
609 {"",S_FALSE,FALSE},
610 {"\\\\Server/test.mp3",S_OK,FALSE},
611 {"file",S_OK,FALSE},
612 {"",S_FALSE,FALSE},
613 {"",S_FALSE,FALSE}
614 },
615 {
616 {Uri_HOST_DNS,S_OK,FALSE},
617 {0,S_FALSE,FALSE},
618 {URL_SCHEME_FILE,S_OK,FALSE},
619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
620 }
621 },
622 { "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,
623 {
624 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
625 {"",S_FALSE,FALSE},
626 {"file://C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
627 {"",S_FALSE,FALSE},
628 {".mp3#fragment|part",S_OK,FALSE},
629 {"",S_FALSE,FALSE},
630 {"",S_FALSE,FALSE},
631 {"",S_FALSE,FALSE},
632 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
633 {"C:\\test\\test.mp3#fragment|part",S_OK,FALSE},
634 {"",S_FALSE,FALSE},
635 {"C:/test/test.mp3#fragment|part",S_OK,FALSE},
636 {"file",S_OK,FALSE},
637 {"",S_FALSE,FALSE},
638 {"",S_FALSE,FALSE}
639 },
640 {
641 {Uri_HOST_UNKNOWN,S_OK,FALSE},
642 {0,S_FALSE,FALSE},
643 {URL_SCHEME_FILE,S_OK,FALSE},
644 {URLZONE_INVALID,E_NOTIMPL,FALSE}
645 }
646 },
647 { "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,
648 {
649 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
650 {"",S_FALSE,FALSE},
651 {"file://C:\\test\\test.mp3?query|part",S_OK,FALSE},
652 {"",S_FALSE,FALSE},
653 {".mp3",S_OK,FALSE},
654 {"",S_FALSE,FALSE},
655 {"",S_FALSE,FALSE},
656 {"",S_FALSE,FALSE},
657 {"C:\\test\\test.mp3",S_OK,FALSE},
658 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
659 {"?query|part",S_OK,FALSE},
660 {"C:/test/test.mp3?query|part",S_OK,FALSE},
661 {"file",S_OK,FALSE},
662 {"",S_FALSE,FALSE},
663 {"",S_FALSE,FALSE}
664 },
665 {
666 {Uri_HOST_UNKNOWN,S_OK,FALSE},
667 {0,S_FALSE,FALSE},
668 {URL_SCHEME_FILE,S_OK,FALSE},
669 {URLZONE_INVALID,E_NOTIMPL,FALSE}
670 }
671 },
672 { "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,
673 {
674 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
675 {"",S_FALSE,FALSE},
676 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK,FALSE},
677 {"",S_FALSE,FALSE},
678 {".mp3",S_OK,FALSE},
679 {"#hash|part",S_OK,FALSE},
680 {"",S_FALSE,FALSE},
681 {"",S_FALSE,FALSE},
682 {"C:\\test\\test.mp3",S_OK,FALSE},
683 {"C:\\test\\test.mp3?query|part",S_OK,FALSE},
684 {"?query|part",S_OK,FALSE},
685 {"C:/test/test.mp3?query|part#hash|part",S_OK,FALSE},
686 {"file",S_OK,FALSE},
687 {"",S_FALSE,FALSE},
688 {"",S_FALSE,FALSE}
689 },
690 {
691 {Uri_HOST_UNKNOWN,S_OK,FALSE},
692 {0,S_FALSE,FALSE},
693 {URL_SCHEME_FILE,S_OK,FALSE},
694 {URLZONE_INVALID,E_NOTIMPL,FALSE}
695 }
696 },
697 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
698 {
699 {"*:www.winehq.org/test",S_OK,FALSE},
700 {"www.winehq.org",S_OK,FALSE},
701 {"*:www.winehq.org/test",S_OK,FALSE},
702 {"winehq.org",S_OK,FALSE},
703 {"",S_FALSE,FALSE},
704 {"",S_FALSE,FALSE},
705 {"www.winehq.org",S_OK,FALSE},
706 {"",S_FALSE,FALSE},
707 {"/test",S_OK,FALSE},
708 {"/test",S_OK,FALSE},
709 {"",S_FALSE,FALSE},
710 {"www.winehq.org/test",S_OK,FALSE},
711 {"*",S_OK,FALSE},
712 {"",S_FALSE,FALSE},
713 {"",S_FALSE,FALSE}
714 },
715 {
716 {Uri_HOST_DNS,S_OK,FALSE},
717 {0,S_FALSE,FALSE},
718 {URL_SCHEME_WILDCARD,S_OK,FALSE},
719 {URLZONE_INVALID,E_NOTIMPL,FALSE}
720 }
721 },
722 /* Valid since the '*' is the only character in the scheme name. */
723 { "*:www.winehq.org/test", 0, S_OK, FALSE,
724 {
725 {"*:www.winehq.org/test",S_OK,FALSE},
726 {"www.winehq.org",S_OK,FALSE},
727 {"*:www.winehq.org/test",S_OK,FALSE},
728 {"winehq.org",S_OK,FALSE},
729 {"",S_FALSE,FALSE},
730 {"",S_FALSE,FALSE},
731 {"www.winehq.org",S_OK,FALSE},
732 {"",S_FALSE,FALSE},
733 {"/test",S_OK,FALSE},
734 {"/test",S_OK,FALSE},
735 {"",S_FALSE,FALSE},
736 {"*:www.winehq.org/test",S_OK,FALSE},
737 {"*",S_OK,FALSE},
738 {"",S_FALSE,FALSE},
739 {"",S_FALSE,FALSE}
740 },
741 {
742 {Uri_HOST_DNS,S_OK,FALSE},
743 {0,S_FALSE,FALSE},
744 {URL_SCHEME_WILDCARD,S_OK,FALSE},
745 {URLZONE_INVALID,E_NOTIMPL,FALSE}
746 }
747 },
748 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
749 {
750 {"/../some dir/test.ext",S_OK,FALSE},
751 {"",S_FALSE,FALSE},
752 {"/../some dir/test.ext",S_OK,FALSE},
753 {"",S_FALSE,FALSE},
754 {".ext",S_OK,FALSE},
755 {"",S_FALSE,FALSE},
756 {"",S_FALSE,FALSE},
757 {"",S_FALSE,FALSE},
758 {"/../some dir/test.ext",S_OK,FALSE},
759 {"/../some dir/test.ext",S_OK,FALSE},
760 {"",S_FALSE,FALSE},
761 {"/../some dir/test.ext",S_OK,FALSE},
762 {"",S_FALSE,FALSE},
763 {"",S_FALSE,FALSE},
764 {"",S_FALSE,FALSE}
765 },
766 {
767 {Uri_HOST_UNKNOWN,S_OK,FALSE},
768 {0,S_FALSE,FALSE},
769 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
770 {URLZONE_INVALID,E_NOTIMPL,FALSE}
771 }
772 },
773 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
774 {
775 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
776 {"",S_OK,FALSE},
777 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
778 {"",S_FALSE,FALSE},
779 {"",S_FALSE,FALSE},
780 {"",S_FALSE,FALSE},
781 {"",S_OK,FALSE},
782 {"",S_FALSE,FALSE},
783 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
784 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
785 {"",S_FALSE,FALSE},
786 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
787 {"*",S_OK,FALSE},
788 {"",S_FALSE,FALSE},
789 {"",S_FALSE,FALSE},
790 },
791 {
792 {Uri_HOST_UNKNOWN,S_OK,FALSE},
793 {0,S_FALSE,FALSE},
794 {URL_SCHEME_WILDCARD,S_OK,FALSE},
795 {URLZONE_INVALID,E_NOTIMPL,FALSE}
796 }
797 },
798 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
799 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
800 {
801 {"zip:/.//google.com",S_OK,FALSE},
802 {"",S_FALSE,FALSE},
803 {"zip:/.//google.com",S_OK,FALSE},
804 {"",S_FALSE,FALSE},
805 {".com",S_OK,FALSE},
806 {"",S_FALSE,FALSE},
807 {"",S_FALSE,FALSE},
808 {"",S_FALSE,FALSE},
809 {"/.//google.com",S_OK,FALSE},
810 {"/.//google.com",S_OK,FALSE},
811 {"",S_FALSE,FALSE},
812 {"zip://google.com",S_OK,FALSE},
813 {"zip",S_OK,FALSE},
814 {"",S_FALSE,FALSE},
815 {"",S_FALSE,FALSE}
816 },
817 {
818 {Uri_HOST_UNKNOWN,S_OK,FALSE},
819 {0,S_FALSE,FALSE},
820 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
821 {URLZONE_INVALID,E_NOTIMPL,FALSE}
822 }
823 },
824 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
825 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
826 {
827 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
828 {"user:pass:word@winehq.org",S_OK,FALSE},
829 {"ftp://winehq.org/",S_OK,FALSE},
830 {"winehq.org",S_OK,FALSE},
831 {"",S_FALSE,FALSE},
832 {"",S_FALSE,FALSE},
833 {"winehq.org",S_OK,FALSE},
834 {"pass:word",S_OK,FALSE},
835 {"/",S_OK,FALSE},
836 {"/",S_OK,FALSE},
837 {"",S_FALSE,FALSE},
838 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
839 {"ftp",S_OK,FALSE},
840 {"user:pass:word",S_OK,FALSE},
841 {"user",S_OK,FALSE}
842 },
843 {
844 {Uri_HOST_DNS,S_OK,FALSE},
845 {21,S_OK,FALSE},
846 {URL_SCHEME_FTP,S_OK,FALSE},
847 {URLZONE_INVALID,E_NOTIMPL,FALSE}
848 }
849 },
850 /* Make sure % encoded unreserved characters are decoded. */
851 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
852 {
853 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
854 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
855 {"ftp://ftp.google.com/",S_OK,FALSE},
856 {"google.com",S_OK,FALSE},
857 {"",S_FALSE,FALSE},
858 {"",S_FALSE,FALSE},
859 {"ftp.google.com",S_OK,FALSE},
860 {"PASS",S_OK,FALSE},
861 {"/",S_OK,FALSE},
862 {"/",S_OK,FALSE},
863 {"",S_FALSE,FALSE},
864 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
865 {"ftp",S_OK,FALSE},
866 {"wINe:PASS",S_OK,FALSE},
867 {"wINe",S_OK,FALSE}
868 },
869 {
870 {Uri_HOST_DNS,S_OK,FALSE},
871 {21,S_OK,FALSE},
872 {URL_SCHEME_FTP,S_OK,FALSE},
873 {URLZONE_INVALID,E_NOTIMPL,FALSE}
874 }
875 },
876 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
877 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
878 {
879 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
880 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
881 {"ftp://ftp.google.com/",S_OK,FALSE},
882 {"google.com",S_OK,FALSE},
883 {"",S_FALSE,FALSE},
884 {"",S_FALSE,FALSE},
885 {"ftp.google.com",S_OK,FALSE},
886 {"PA%7B%7D",S_OK,FALSE},
887 {"/",S_OK,FALSE},
888 {"/",S_OK,FALSE},
889 {"",S_FALSE,FALSE},
890 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
891 {"ftp",S_OK,FALSE},
892 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
893 {"w%5D%5Be",S_OK,FALSE}
894 },
895 {
896 {Uri_HOST_DNS,S_OK,FALSE},
897 {21,S_OK,FALSE},
898 {URL_SCHEME_FTP,S_OK,FALSE},
899 {URLZONE_INVALID,E_NOTIMPL,FALSE}
900 }
901 },
902 /* You're allowed to have an empty password portion in the userinfo section. */
903 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
904 {
905 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
906 {"empty:@ftp.google.com",S_OK,FALSE},
907 {"ftp://ftp.google.com/",S_OK,FALSE},
908 {"google.com",S_OK,FALSE},
909 {"",S_FALSE,FALSE},
910 {"",S_FALSE,FALSE},
911 {"ftp.google.com",S_OK,FALSE},
912 {"",S_OK,FALSE},
913 {"/",S_OK,FALSE},
914 {"/",S_OK,FALSE},
915 {"",S_FALSE,FALSE},
916 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
917 {"ftp",S_OK,FALSE},
918 {"empty:",S_OK,FALSE},
919 {"empty",S_OK,FALSE}
920 },
921 {
922 {Uri_HOST_DNS,S_OK,FALSE},
923 {21,S_OK,FALSE},
924 {URL_SCHEME_FTP,S_OK,FALSE},
925 {URLZONE_INVALID,E_NOTIMPL,FALSE}
926 }
927 },
928 /* Make sure forbidden characters in "userinfo" get encoded. */
929 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
930 {
931 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
932 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
933 {"ftp://ftp.google.com/",S_OK,FALSE},
934 {"google.com",S_OK,FALSE},
935 {"",S_FALSE,FALSE},
936 {"",S_FALSE,FALSE},
937 {"ftp.google.com",S_OK,FALSE},
938 {"",S_FALSE,FALSE},
939 {"/",S_OK,FALSE},
940 {"/",S_OK,FALSE},
941 {"",S_FALSE,FALSE},
942 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
943 {"ftp",S_OK,FALSE},
944 {"%22%20%22weird",S_OK,FALSE},
945 {"%22%20%22weird",S_OK,FALSE}
946 },
947 {
948 {Uri_HOST_DNS,S_OK,FALSE},
949 {21,S_OK,FALSE},
950 {URL_SCHEME_FTP,S_OK,FALSE},
951 {URLZONE_INVALID,E_NOTIMPL,FALSE}
952 }
953 },
954 /* Make sure the forbidden characters don't get percent encoded. */
955 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
956 {
957 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
958 {"\" \"weird@ftp.google.com",S_OK,FALSE},
959 {"ftp://ftp.google.com/",S_OK,FALSE},
960 {"google.com",S_OK,FALSE},
961 {"",S_FALSE,FALSE},
962 {"",S_FALSE,FALSE},
963 {"ftp.google.com",S_OK,FALSE},
964 {"",S_FALSE,FALSE},
965 {"/",S_OK,FALSE},
966 {"/",S_OK,FALSE},
967 {"",S_FALSE,FALSE},
968 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
969 {"ftp",S_OK,FALSE},
970 {"\" \"weird",S_OK,FALSE},
971 {"\" \"weird",S_OK,FALSE}
972 },
973 {
974 {Uri_HOST_DNS,S_OK,FALSE},
975 {21,S_OK,FALSE},
976 {URL_SCHEME_FTP,S_OK,FALSE},
977 {URLZONE_INVALID,E_NOTIMPL,FALSE}
978 }
979 },
980 /* Make sure already percent encoded characters don't get unencoded. */
981 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
982 {
983 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
984 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
985 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
986 {"google.com",S_OK,FALSE},
987 {"",S_FALSE,FALSE},
988 {"",S_FALSE,FALSE},
989 {"ftp.google.com",S_OK,FALSE},
990 {"",S_FALSE,FALSE},
991 {"/\"%20\"weird",S_OK,FALSE},
992 {"/\"%20\"weird",S_OK,FALSE},
993 {"",S_FALSE,FALSE},
994 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
995 {"ftp",S_OK,FALSE},
996 {"\"%20\"weird",S_OK,FALSE},
997 {"\"%20\"weird",S_OK,FALSE}
998 },
999 {
1000 {Uri_HOST_DNS,S_OK,FALSE},
1001 {21,S_OK,FALSE},
1002 {URL_SCHEME_FTP,S_OK,FALSE},
1003 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1004 }
1005 },
1006 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1007 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
1008 {
1009 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1010 {"%xy:word@winehq.org",S_OK,FALSE},
1011 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1012 {"winehq.org",S_OK,FALSE},
1013 {"",S_FALSE,FALSE},
1014 {"",S_FALSE,FALSE},
1015 {"winehq.org",S_OK,FALSE},
1016 {"word",S_OK,FALSE},
1017 {"/",S_OK,FALSE},
1018 {"/",S_OK,FALSE},
1019 {"",S_FALSE,FALSE},
1020 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
1021 {"zip",S_OK,FALSE},
1022 {"%xy:word",S_OK,FALSE},
1023 {"%xy",S_OK,FALSE}
1024 },
1025 {
1026 {Uri_HOST_DNS,S_OK,FALSE},
1027 {0,S_FALSE,FALSE},
1028 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1029 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1030 }
1031 },
1032 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1033 * isn't known.
1034 */
1035 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
1036 {
1037 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1038 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
1039 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1040 {"winehq.org",S_OK,FALSE},
1041 {"",S_FALSE,FALSE},
1042 {"",S_FALSE,FALSE},
1043 {"winehq.org",S_OK,FALSE},
1044 {"%52%53ord",S_OK,FALSE},
1045 {"/",S_OK,FALSE},
1046 {"/",S_OK,FALSE},
1047 {"",S_FALSE,FALSE},
1048 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
1049 {"zip",S_OK,FALSE},
1050 {"%2E:%52%53ord",S_OK,FALSE},
1051 {"%2E",S_OK,FALSE}
1052 },
1053 {
1054 {Uri_HOST_DNS,S_OK,FALSE},
1055 {0,S_FALSE,FALSE},
1056 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1057 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1058 }
1059 },
1060 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
1061 {
1062 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1063 {"[](),'test':word@winehq.org",S_OK,FALSE},
1064 {"ftp://winehq.org/",S_OK,FALSE},
1065 {"winehq.org",S_OK,FALSE},
1066 {"",S_FALSE,FALSE},
1067 {"",S_FALSE,FALSE},
1068 {"winehq.org",S_OK,FALSE},
1069 {"word",S_OK,FALSE},
1070 {"/",S_OK,FALSE},
1071 {"/",S_OK,FALSE},
1072 {"",S_FALSE,FALSE},
1073 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
1074 {"ftp",S_OK,FALSE},
1075 {"[](),'test':word",S_OK,FALSE},
1076 {"[](),'test'",S_OK,FALSE}
1077 },
1078 {
1079 {Uri_HOST_DNS,S_OK,FALSE},
1080 {21,S_OK,FALSE},
1081 {URL_SCHEME_FTP,S_OK,FALSE},
1082 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1083 }
1084 },
1085 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
1086 {
1087 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1088 {"test",S_OK,FALSE},
1089 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
1090 {"",S_FALSE,FALSE},
1091 {"",S_FALSE,FALSE},
1092 {"",S_FALSE,FALSE},
1093 {"test",S_OK,FALSE},
1094 {"",S_FALSE,FALSE},
1095 {"/",S_OK,FALSE},
1096 {"/?:word@winehq.org/",S_OK,FALSE},
1097 {"?:word@winehq.org/",S_OK,FALSE},
1098 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
1099 {"ftp",S_OK,FALSE},
1100 {"",S_FALSE,FALSE},
1101 {"",S_FALSE,FALSE}
1102 },
1103 {
1104 {Uri_HOST_DNS,S_OK,FALSE},
1105 {21,S_OK,FALSE},
1106 {URL_SCHEME_FTP,S_OK,FALSE},
1107 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1108 }
1109 },
1110 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1111 {
1112 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1113 {"test",S_OK,FALSE},
1114 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1115 {"",S_FALSE,FALSE},
1116 {"",S_FALSE,FALSE},
1117 {"#:word@winehq.org/",S_OK,FALSE},
1118 {"test",S_OK,FALSE},
1119 {"",S_FALSE,FALSE},
1120 {"/",S_OK,FALSE},
1121 {"/",S_OK,FALSE},
1122 {"",S_FALSE,FALSE},
1123 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1124 {"ftp",S_OK,FALSE},
1125 {"",S_FALSE,FALSE},
1126 {"",S_FALSE,FALSE}
1127 },
1128 {
1129 {Uri_HOST_DNS,S_OK,FALSE},
1130 {21,S_OK,FALSE},
1131 {URL_SCHEME_FTP,S_OK,FALSE},
1132 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1133 }
1134 },
1135 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1136 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1137 {
1138 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1139 {"test\\:word@winehq.org",S_OK,FALSE},
1140 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1141 {"winehq.org",S_OK,FALSE},
1142 {"",S_FALSE,FALSE},
1143 {"",S_FALSE,FALSE},
1144 {"winehq.org",S_OK,FALSE},
1145 {"word",S_OK,FALSE},
1146 {"/",S_OK,FALSE},
1147 {"/",S_OK,FALSE},
1148 {"",S_FALSE,FALSE},
1149 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1150 {"zip",S_OK,FALSE},
1151 {"test\\:word",S_OK,FALSE},
1152 {"test\\",S_OK,FALSE}
1153 },
1154 {
1155 {Uri_HOST_DNS,S_OK,FALSE},
1156 {0,S_FALSE,FALSE},
1157 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1158 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1159 }
1160 },
1161 /* It normalizes IPv4 addresses correctly. */
1162 { "http://127.000.000.100/", 0, S_OK, FALSE,
1163 {
1164 {"http://127.0.0.100/",S_OK,FALSE},
1165 {"127.0.0.100",S_OK,FALSE},
1166 {"http://127.0.0.100/",S_OK,FALSE},
1167 {"",S_FALSE,FALSE},
1168 {"",S_FALSE,FALSE},
1169 {"",S_FALSE,FALSE},
1170 {"127.0.0.100",S_OK,FALSE},
1171 {"",S_FALSE,FALSE},
1172 {"/",S_OK,FALSE},
1173 {"/",S_OK,FALSE},
1174 {"",S_FALSE,FALSE},
1175 {"http://127.000.000.100/",S_OK,FALSE},
1176 {"http",S_OK,FALSE},
1177 {"",S_FALSE,FALSE},
1178 {"",S_FALSE,FALSE}
1179 },
1180 {
1181 {Uri_HOST_IPV4,S_OK,FALSE},
1182 {80,S_OK,FALSE},
1183 {URL_SCHEME_HTTP,S_OK,FALSE},
1184 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1185 }
1186 },
1187 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1188 {
1189 {"http://127.0.0.1:8000/",S_OK},
1190 {"127.0.0.1:8000",S_OK},
1191 {"http://127.0.0.1:8000/",S_OK},
1192 {"",S_FALSE},
1193 {"",S_FALSE},
1194 {"",S_FALSE},
1195 {"127.0.0.1",S_OK},
1196 {"",S_FALSE},
1197 {"/",S_OK},
1198 {"/",S_OK},
1199 {"",S_FALSE},
1200 {"http://127.0.0.1:8000",S_OK},
1201 {"http",S_OK},
1202 {"",S_FALSE},
1203 {"",S_FALSE}
1204 },
1205 {
1206 {Uri_HOST_IPV4,S_OK,FALSE},
1207 {8000,S_OK,FALSE},
1208 {URL_SCHEME_HTTP,S_OK,FALSE},
1209 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1210 }
1211 },
1212 /* Make sure it normalizes partial IPv4 addresses correctly. */
1213 { "http://127.0/", 0, S_OK, FALSE,
1214 {
1215 {"http://127.0.0.0/",S_OK,FALSE},
1216 {"127.0.0.0",S_OK,FALSE},
1217 {"http://127.0.0.0/",S_OK,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"",S_FALSE,FALSE},
1220 {"",S_FALSE,FALSE},
1221 {"127.0.0.0",S_OK,FALSE},
1222 {"",S_FALSE,FALSE},
1223 {"/",S_OK,FALSE},
1224 {"/",S_OK,FALSE},
1225 {"",S_FALSE,FALSE},
1226 {"http://127.0/",S_OK,FALSE},
1227 {"http",S_OK,FALSE},
1228 {"",S_FALSE,FALSE},
1229 {"",S_FALSE,FALSE}
1230 },
1231 {
1232 {Uri_HOST_IPV4,S_OK,FALSE},
1233 {80,S_OK,FALSE},
1234 {URL_SCHEME_HTTP,S_OK,FALSE},
1235 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1236 }
1237 },
1238 /* Make sure it converts implicit IPv4's correctly. */
1239 { "http://123456/", 0, S_OK, FALSE,
1240 {
1241 {"http://0.1.226.64/",S_OK,FALSE},
1242 {"0.1.226.64",S_OK,FALSE},
1243 {"http://0.1.226.64/",S_OK,FALSE},
1244 {"",S_FALSE,FALSE},
1245 {"",S_FALSE,FALSE},
1246 {"",S_FALSE,FALSE},
1247 {"0.1.226.64",S_OK,FALSE},
1248 {"",S_FALSE,FALSE},
1249 {"/",S_OK,FALSE},
1250 {"/",S_OK,FALSE},
1251 {"",S_FALSE,FALSE},
1252 {"http://123456/",S_OK,FALSE},
1253 {"http",S_OK,FALSE},
1254 {"",S_FALSE,FALSE},
1255 {"",S_FALSE,FALSE}
1256 },
1257 {
1258 {Uri_HOST_IPV4,S_OK,FALSE},
1259 {80,S_OK,FALSE},
1260 {URL_SCHEME_HTTP,S_OK,FALSE},
1261 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1262 }
1263 },
1264 /* UINT_MAX */
1265 { "http://4294967295/", 0, S_OK, FALSE,
1266 {
1267 {"http://255.255.255.255/",S_OK,FALSE},
1268 {"255.255.255.255",S_OK,FALSE},
1269 {"http://255.255.255.255/",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"",S_FALSE,FALSE},
1272 {"",S_FALSE,FALSE},
1273 {"255.255.255.255",S_OK,FALSE},
1274 {"",S_FALSE,FALSE},
1275 {"/",S_OK,FALSE},
1276 {"/",S_OK,FALSE},
1277 {"",S_FALSE,FALSE},
1278 {"http://4294967295/",S_OK,FALSE},
1279 {"http",S_OK,FALSE},
1280 {"",S_FALSE,FALSE},
1281 {"",S_FALSE,FALSE}
1282 },
1283 {
1284 {Uri_HOST_IPV4,S_OK,FALSE},
1285 {80,S_OK,FALSE},
1286 {URL_SCHEME_HTTP,S_OK,FALSE},
1287 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1288 }
1289 },
1290 /* UINT_MAX+1 */
1291 { "http://4294967296/", 0, S_OK, FALSE,
1292 {
1293 {"http://4294967296/",S_OK,FALSE},
1294 {"4294967296",S_OK,FALSE},
1295 {"http://4294967296/",S_OK,FALSE},
1296 {"",S_FALSE,FALSE},
1297 {"",S_FALSE,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"4294967296",S_OK,FALSE},
1300 {"",S_FALSE,FALSE},
1301 {"/",S_OK,FALSE},
1302 {"/",S_OK,FALSE},
1303 {"",S_FALSE,FALSE},
1304 {"http://4294967296/",S_OK,FALSE},
1305 {"http",S_OK,FALSE},
1306 {"",S_FALSE,FALSE},
1307 {"",S_FALSE,FALSE}
1308 },
1309 {
1310 {Uri_HOST_DNS,S_OK,FALSE},
1311 {80,S_OK,FALSE},
1312 {URL_SCHEME_HTTP,S_OK,FALSE},
1313 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1314 }
1315 },
1316 /* Window's doesn't normalize IP address for unknown schemes. */
1317 { "1234://4294967295/", 0, S_OK, FALSE,
1318 {
1319 {"1234://4294967295/",S_OK,FALSE},
1320 {"4294967295",S_OK,FALSE},
1321 {"1234://4294967295/",S_OK,FALSE},
1322 {"",S_FALSE,FALSE},
1323 {"",S_FALSE,FALSE},
1324 {"",S_FALSE,FALSE},
1325 {"4294967295",S_OK,FALSE},
1326 {"",S_FALSE,FALSE},
1327 {"/",S_OK,FALSE},
1328 {"/",S_OK,FALSE},
1329 {"",S_FALSE,FALSE},
1330 {"1234://4294967295/",S_OK,FALSE},
1331 {"1234",S_OK,FALSE},
1332 {"",S_FALSE,FALSE},
1333 {"",S_FALSE,FALSE}
1334 },
1335 {
1336 {Uri_HOST_IPV4,S_OK,FALSE},
1337 {0,S_FALSE,FALSE},
1338 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1339 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1340 }
1341 },
1342 /* Window's doesn't normalize IP address for unknown schemes. */
1343 { "1234://127.001/", 0, S_OK, FALSE,
1344 {
1345 {"1234://127.001/",S_OK,FALSE},
1346 {"127.001",S_OK,FALSE},
1347 {"1234://127.001/",S_OK,FALSE},
1348 {"",S_FALSE,FALSE},
1349 {"",S_FALSE,FALSE},
1350 {"",S_FALSE,FALSE},
1351 {"127.001",S_OK,FALSE},
1352 {"",S_FALSE,FALSE},
1353 {"/",S_OK,FALSE},
1354 {"/",S_OK,FALSE},
1355 {"",S_FALSE,FALSE},
1356 {"1234://127.001/",S_OK,FALSE},
1357 {"1234",S_OK,FALSE},
1358 {"",S_FALSE,FALSE},
1359 {"",S_FALSE,FALSE}
1360 },
1361 {
1362 {Uri_HOST_IPV4,S_OK,FALSE},
1363 {0,S_FALSE,FALSE},
1364 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1365 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1366 }
1367 },
1368 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1369 {
1370 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1371 {"[fedc:ba98::3210]",S_OK,FALSE},
1372 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1373 {"",S_FALSE,FALSE},
1374 {"",S_FALSE,FALSE},
1375 {"",S_FALSE,FALSE},
1376 {"fedc:ba98::3210",S_OK,FALSE},
1377 {"",S_FALSE,FALSE},
1378 {"/",S_OK,FALSE},
1379 {"/",S_OK,FALSE},
1380 {"",S_FALSE,FALSE},
1381 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1382 {"http",S_OK,FALSE},
1383 {"",S_FALSE,FALSE},
1384 {"",S_FALSE,FALSE},
1385 },
1386 {
1387 {Uri_HOST_IPV6,S_OK,FALSE},
1388 {80,S_OK,FALSE},
1389 {URL_SCHEME_HTTP,S_OK,FALSE},
1390 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1391 }
1392 },
1393 { "http://[::]", 0, S_OK, FALSE,
1394 {
1395 {"http://[::]/",S_OK,FALSE},
1396 {"[::]",S_OK,FALSE},
1397 {"http://[::]/",S_OK,FALSE},
1398 {"",S_FALSE,FALSE},
1399 {"",S_FALSE,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"::",S_OK,FALSE},
1402 {"",S_FALSE,FALSE},
1403 {"/",S_OK,FALSE},
1404 {"/",S_OK,FALSE},
1405 {"",S_FALSE,FALSE},
1406 {"http://[::]",S_OK,FALSE},
1407 {"http",S_OK,FALSE},
1408 {"",S_FALSE,FALSE},
1409 {"",S_FALSE,FALSE},
1410 },
1411 {
1412 {Uri_HOST_IPV6,S_OK,FALSE},
1413 {80,S_OK,FALSE},
1414 {URL_SCHEME_HTTP,S_OK,FALSE},
1415 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1416 }
1417 },
1418 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1419 {
1420 {"http://[fedc:ba98::]/",S_OK,FALSE},
1421 {"[fedc:ba98::]",S_OK,FALSE},
1422 {"http://[fedc:ba98::]/",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"",S_FALSE,FALSE},
1425 {"",S_FALSE,FALSE},
1426 {"fedc:ba98::",S_OK,FALSE},
1427 {"",S_FALSE,FALSE},
1428 {"/",S_OK,FALSE},
1429 {"/",S_OK,FALSE},
1430 {"",S_FALSE,FALSE},
1431 {"http://[FEDC:BA98::]",S_OK,FALSE},
1432 {"http",S_OK,FALSE},
1433 {"",S_FALSE,FALSE},
1434 {"",S_FALSE,FALSE},
1435 },
1436 {
1437 {Uri_HOST_IPV6,S_OK,FALSE},
1438 {80,S_OK,FALSE},
1439 {URL_SCHEME_HTTP,S_OK,FALSE},
1440 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1441 }
1442 },
1443 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1444 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1445 {
1446 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1447 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1448 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"",S_FALSE,FALSE},
1451 {"",S_FALSE,FALSE},
1452 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1453 {"",S_FALSE,FALSE},
1454 {"/",S_OK,FALSE},
1455 {"/",S_OK,FALSE},
1456 {"",S_FALSE,FALSE},
1457 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1458 {"http",S_OK,FALSE},
1459 {"",S_FALSE,FALSE},
1460 {"",S_FALSE,FALSE},
1461 },
1462 {
1463 {Uri_HOST_IPV6,S_OK,FALSE},
1464 {80,S_OK,FALSE},
1465 {URL_SCHEME_HTTP,S_OK,FALSE},
1466 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1467 }
1468 },
1469 { "http://[v2.34]/", 0, S_OK, FALSE,
1470 {
1471 {"http://[v2.34]/",S_OK,FALSE},
1472 {"[v2.34]",S_OK,FALSE},
1473 {"http://[v2.34]/",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"",S_FALSE,FALSE},
1476 {"",S_FALSE,FALSE},
1477 {"[v2.34]",S_OK,FALSE},
1478 {"",S_FALSE,FALSE},
1479 {"/",S_OK,FALSE},
1480 {"/",S_OK,FALSE},
1481 {"",S_FALSE,FALSE},
1482 {"http://[v2.34]/",S_OK,FALSE},
1483 {"http",S_OK,FALSE},
1484 {"",S_FALSE,FALSE},
1485 {"",S_FALSE,FALSE}
1486 },
1487 {
1488 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1489 {80,S_OK,FALSE},
1490 {URL_SCHEME_HTTP,S_OK,FALSE},
1491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1492 }
1493 },
1494 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1495 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1496 {
1497 {"http://[xyz:12345.com/test",S_OK,FALSE},
1498 {"[xyz:12345.com",S_OK,FALSE},
1499 {"http://[xyz:12345.com/test",S_OK,FALSE},
1500 {"[xyz:12345.com",S_OK,FALSE},
1501 {"",S_FALSE,FALSE},
1502 {"",S_FALSE,FALSE},
1503 {"[xyz:12345.com",S_OK,FALSE},
1504 {"",S_FALSE,FALSE},
1505 {"/test",S_OK,FALSE},
1506 {"/test",S_OK,FALSE},
1507 {"",S_FALSE,FALSE},
1508 {"http://[xyz:12345.com/test",S_OK,FALSE},
1509 {"http",S_OK,FALSE},
1510 {"",S_FALSE,FALSE},
1511 {"",S_FALSE,FALSE}
1512 },
1513 {
1514 {Uri_HOST_DNS,S_OK,FALSE},
1515 {80,S_OK,FALSE},
1516 {URL_SCHEME_HTTP,S_OK,FALSE},
1517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1518 }
1519 },
1520 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1521 * of the host name (respectively).
1522 */
1523 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1524 {
1525 {"ftp://www.[works].com/",S_OK,FALSE},
1526 {"www.[works].com",S_OK,FALSE},
1527 {"ftp://www.[works].com/",S_OK,FALSE},
1528 {"[works].com",S_OK,FALSE},
1529 {"",S_FALSE,FALSE},
1530 {"",S_FALSE,FALSE},
1531 {"www.[works].com",S_OK,FALSE},
1532 {"",S_FALSE,FALSE},
1533 {"/",S_OK,FALSE},
1534 {"/",S_OK,FALSE},
1535 {"",S_FALSE,FALSE},
1536 {"ftp://www.[works].com/",S_OK,FALSE},
1537 {"ftp",S_OK,FALSE},
1538 {"",S_FALSE,FALSE},
1539 {"",S_FALSE,FALSE}
1540 },
1541 {
1542 {Uri_HOST_DNS,S_OK,FALSE},
1543 {21,S_OK,FALSE},
1544 {URL_SCHEME_FTP,S_OK,FALSE},
1545 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1546 }
1547 },
1548 /* Considers ':' a delimiter since it appears after the ']'. */
1549 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1550 {
1551 {"http://www.google.com]:12345/",S_OK,FALSE},
1552 {"www.google.com]:12345",S_OK,FALSE},
1553 {"http://www.google.com]:12345/",S_OK,FALSE},
1554 {"google.com]",S_OK,FALSE},
1555 {"",S_FALSE,FALSE},
1556 {"",S_FALSE,FALSE},
1557 {"www.google.com]",S_OK,FALSE},
1558 {"",S_FALSE,FALSE},
1559 {"/",S_OK,FALSE},
1560 {"/",S_OK,FALSE},
1561 {"",S_FALSE,FALSE},
1562 {"http://www.google.com]:12345/",S_OK,FALSE},
1563 {"http",S_OK,FALSE},
1564 {"",S_FALSE,FALSE},
1565 {"",S_FALSE,FALSE}
1566 },
1567 {
1568 {Uri_HOST_DNS,S_OK,FALSE},
1569 {12345,S_OK,FALSE},
1570 {URL_SCHEME_HTTP,S_OK,FALSE},
1571 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1572 }
1573 },
1574 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1575 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1576 {
1577 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1578 {"w%XXw%GEw.google.com",S_OK,FALSE},
1579 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1580 {"google.com",S_OK,FALSE},
1581 {"",S_FALSE,FALSE},
1582 {"",S_FALSE,FALSE},
1583 {"w%XXw%GEw.google.com",S_OK,FALSE},
1584 {"",S_FALSE,FALSE},
1585 {"/",S_OK,FALSE},
1586 {"/",S_OK,FALSE},
1587 {"",S_FALSE,FALSE},
1588 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1589 {"zip",S_OK,FALSE},
1590 {"",S_FALSE,FALSE},
1591 {"",S_FALSE,FALSE}
1592 },
1593 {
1594 {Uri_HOST_DNS,S_OK,FALSE},
1595 {0,S_FALSE,FALSE},
1596 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1597 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1598 }
1599 },
1600 /* Unknown scheme types hostname doesn't get lower cased. */
1601 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1602 {
1603 {"zip://GOOGLE.com/",S_OK,FALSE},
1604 {"GOOGLE.com",S_OK,FALSE},
1605 {"zip://GOOGLE.com/",S_OK,FALSE},
1606 {"GOOGLE.com",S_OK,FALSE},
1607 {"",S_FALSE,FALSE},
1608 {"",S_FALSE,FALSE},
1609 {"GOOGLE.com",S_OK,FALSE},
1610 {"",S_FALSE,FALSE},
1611 {"/",S_OK,FALSE},
1612 {"/",S_OK,FALSE},
1613 {"",S_FALSE,FALSE},
1614 {"zip://GOOGLE.com/",S_OK,FALSE},
1615 {"zip",S_OK,FALSE},
1616 {"",S_FALSE,FALSE},
1617 {"",S_FALSE,FALSE}
1618 },
1619 {
1620 {Uri_HOST_DNS,S_OK,FALSE},
1621 {0,S_FALSE,FALSE},
1622 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1623 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1624 }
1625 },
1626 /* Hostname gets lower-cased for known scheme types. */
1627 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1628 {
1629 {"http://www.google.com/",S_OK,FALSE},
1630 {"www.google.com",S_OK,FALSE},
1631 {"http://www.google.com/",S_OK,FALSE},
1632 {"google.com",S_OK,FALSE},
1633 {"",S_FALSE,FALSE},
1634 {"",S_FALSE,FALSE},
1635 {"www.google.com",S_OK,FALSE},
1636 {"",S_FALSE,FALSE},
1637 {"/",S_OK,FALSE},
1638 {"/",S_OK,FALSE},
1639 {"",S_FALSE,FALSE},
1640 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1641 {"http",S_OK,FALSE},
1642 {"",S_FALSE,FALSE},
1643 {"",S_FALSE,FALSE}
1644 },
1645 {
1646 {Uri_HOST_DNS,S_OK,FALSE},
1647 {80,S_OK,FALSE},
1648 {URL_SCHEME_HTTP,S_OK,FALSE},
1649 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1650 }
1651 },
1652 /* Characters that get % encoded in the hostname also have their percent
1653 * encoded forms lower cased.
1654 */
1655 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1656 {
1657 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1658 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1659 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1660 {"%7cgoogle%7c.com",S_OK,FALSE},
1661 {"",S_FALSE,FALSE},
1662 {"",S_FALSE,FALSE},
1663 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1664 {"",S_FALSE,FALSE},
1665 {"/",S_OK,FALSE},
1666 {"/",S_OK,FALSE},
1667 {"",S_FALSE,FALSE},
1668 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1669 {"http",S_OK,FALSE},
1670 {"",S_FALSE,FALSE},
1671 {"",S_FALSE,FALSE}
1672 },
1673 {
1674 {Uri_HOST_DNS,S_OK,FALSE},
1675 {80,S_OK,FALSE},
1676 {URL_SCHEME_HTTP,S_OK,FALSE},
1677 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1678 }
1679 },
1680 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1681 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1682 {
1683 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1684 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1685 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1686 {"",S_FALSE,FALSE},
1687 {"",S_FALSE,FALSE},
1688 {"",S_FALSE,FALSE},
1689 {"1:2:3:4:5:6::",S_OK,FALSE},
1690 {"",S_FALSE,FALSE},
1691 {"/",S_OK,FALSE},
1692 {"/",S_OK,FALSE},
1693 {"",S_FALSE,FALSE},
1694 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1695 {"http",S_OK,FALSE},
1696 {"",S_FALSE,FALSE},
1697 {"",S_FALSE,FALSE},
1698 },
1699 {
1700 {Uri_HOST_IPV6,S_OK,FALSE},
1701 {80,S_OK,FALSE},
1702 {URL_SCHEME_HTTP,S_OK,FALSE},
1703 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1704 }
1705 },
1706 /* IPv4 addresses get normalized. */
1707 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1708 {
1709 {"http://[::1.2.3.0]/",S_OK,FALSE},
1710 {"[::1.2.3.0]",S_OK,FALSE},
1711 {"http://[::1.2.3.0]/",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"",S_FALSE,FALSE},
1714 {"",S_FALSE,FALSE},
1715 {"::1.2.3.0",S_OK,FALSE},
1716 {"",S_FALSE,FALSE},
1717 {"/",S_OK,FALSE},
1718 {"/",S_OK,FALSE},
1719 {"",S_FALSE,FALSE},
1720 {"http://[::001.002.003.000]",S_OK,FALSE},
1721 {"http",S_OK,FALSE},
1722 {"",S_FALSE,FALSE},
1723 {"",S_FALSE,FALSE},
1724 },
1725 {
1726 {Uri_HOST_IPV6,S_OK,FALSE},
1727 {80,S_OK,FALSE},
1728 {URL_SCHEME_HTTP,S_OK,FALSE},
1729 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1730 }
1731 },
1732 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1733 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1734 {
1735 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1736 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1737 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1738 {"",S_FALSE,FALSE},
1739 {"",S_FALSE,FALSE},
1740 {"",S_FALSE,FALSE},
1741 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1742 {"",S_FALSE,FALSE},
1743 {"/",S_OK,FALSE},
1744 {"/",S_OK,FALSE},
1745 {"",S_FALSE,FALSE},
1746 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1747 {"zip",S_OK,FALSE},
1748 {"",S_FALSE,FALSE},
1749 {"",S_FALSE,FALSE},
1750 },
1751 {
1752 {Uri_HOST_IPV6,S_OK,FALSE},
1753 {0,S_FALSE,FALSE},
1754 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1755 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1756 }
1757 },
1758 /* IPv4 address is converted into 2 h16 components. */
1759 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1760 {
1761 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1762 {"[ffff::c0de:6f20]",S_OK,FALSE},
1763 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1764 {"",S_FALSE,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"",S_FALSE,FALSE},
1767 {"ffff::c0de:6f20",S_OK,FALSE},
1768 {"",S_FALSE,FALSE},
1769 {"/",S_OK,FALSE},
1770 {"/",S_OK,FALSE},
1771 {"",S_FALSE,FALSE},
1772 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1773 {"http",S_OK,FALSE},
1774 {"",S_FALSE,FALSE},
1775 {"",S_FALSE,FALSE},
1776 },
1777 {
1778 {Uri_HOST_IPV6,S_OK,FALSE},
1779 {80,S_OK,FALSE},
1780 {URL_SCHEME_HTTP,S_OK,FALSE},
1781 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1782 }
1783 },
1784 /* Max value for a port. */
1785 { "http://google.com:65535", 0, S_OK, FALSE,
1786 {
1787 {"http://google.com:65535/",S_OK,FALSE},
1788 {"google.com:65535",S_OK,FALSE},
1789 {"http://google.com:65535/",S_OK,FALSE},
1790 {"google.com",S_OK,FALSE},
1791 {"",S_FALSE,FALSE},
1792 {"",S_FALSE,FALSE},
1793 {"google.com",S_OK,FALSE},
1794 {"",S_FALSE,FALSE},
1795 {"/",S_OK,FALSE},
1796 {"/",S_OK,FALSE},
1797 {"",S_FALSE,FALSE},
1798 {"http://google.com:65535",S_OK,FALSE},
1799 {"http",S_OK,FALSE},
1800 {"",S_FALSE,FALSE},
1801 {"",S_FALSE,FALSE}
1802 },
1803 {
1804 {Uri_HOST_DNS,S_OK,FALSE},
1805 {65535,S_OK,FALSE},
1806 {URL_SCHEME_HTTP,S_OK,FALSE},
1807 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1808 }
1809 },
1810 { "zip://google.com:65536", 0, S_OK, FALSE,
1811 {
1812 {"zip://google.com:65536/",S_OK,FALSE},
1813 {"google.com:65536",S_OK,FALSE},
1814 {"zip://google.com:65536/",S_OK,FALSE},
1815 {"google.com:65536",S_OK,FALSE},
1816 {"",S_FALSE,FALSE},
1817 {"",S_FALSE,FALSE},
1818 {"google.com:65536",S_OK,FALSE},
1819 {"",S_FALSE,FALSE},
1820 {"/",S_OK,FALSE},
1821 {"/",S_OK,FALSE},
1822 {"",S_FALSE,FALSE},
1823 {"zip://google.com:65536",S_OK,FALSE},
1824 {"zip",S_OK,FALSE},
1825 {"",S_FALSE,FALSE},
1826 {"",S_FALSE,FALSE}
1827 },
1828 {
1829 {Uri_HOST_DNS,S_OK,FALSE},
1830 {0,S_FALSE,FALSE},
1831 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1832 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1833 }
1834 },
1835 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1836 {
1837 {"zip://google.com:65536:25/",S_OK,FALSE},
1838 {"google.com:65536:25",S_OK,FALSE},
1839 {"zip://google.com:65536:25/",S_OK,FALSE},
1840 {"google.com:65536:25",S_OK,FALSE},
1841 {"",S_FALSE,FALSE},
1842 {"",S_FALSE,FALSE},
1843 {"google.com:65536:25",S_OK,FALSE},
1844 {"",S_FALSE,FALSE},
1845 {"/",S_OK,FALSE},
1846 {"/",S_OK,FALSE},
1847 {"",S_FALSE,FALSE},
1848 {"zip://google.com:65536:25",S_OK,FALSE},
1849 {"zip",S_OK,FALSE},
1850 {"",S_FALSE,FALSE},
1851 {"",S_FALSE,FALSE}
1852 },
1853 {
1854 {Uri_HOST_DNS,S_OK,FALSE},
1855 {0,S_FALSE,FALSE},
1856 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1857 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1858 }
1859 },
1860 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1861 {
1862 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1863 {"[::ffff]:abcd",S_OK,FALSE},
1864 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1865 {"",S_FALSE,FALSE},
1866 {"",S_FALSE,FALSE},
1867 {"",S_FALSE,FALSE},
1868 {"[::ffff]:abcd",S_OK,FALSE},
1869 {"",S_FALSE,FALSE},
1870 {"/",S_OK,FALSE},
1871 {"/",S_OK,FALSE},
1872 {"",S_FALSE,FALSE},
1873 {"zip://[::ffff]:abcd",S_OK,FALSE},
1874 {"zip",S_OK,FALSE},
1875 {"",S_FALSE,FALSE},
1876 {"",S_FALSE,FALSE}
1877 },
1878 {
1879 {Uri_HOST_DNS,S_OK,FALSE},
1880 {0,S_FALSE,FALSE},
1881 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1882 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1883 }
1884 },
1885 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1886 {
1887 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1888 {"127.0.0.1:abcd",S_OK,FALSE},
1889 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1890 {"0.1:abcd",S_OK,FALSE},
1891 {"",S_FALSE,FALSE},
1892 {"",S_FALSE,FALSE},
1893 {"127.0.0.1:abcd",S_OK,FALSE},
1894 {"",S_FALSE,FALSE},
1895 {"/",S_OK,FALSE},
1896 {"/",S_OK,FALSE},
1897 {"",S_FALSE,FALSE},
1898 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1899 {"zip",S_OK,FALSE},
1900 {"",S_FALSE,FALSE},
1901 {"",S_FALSE,FALSE}
1902 },
1903 {
1904 {Uri_HOST_DNS,S_OK,FALSE},
1905 {0,S_FALSE,FALSE},
1906 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1907 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1908 }
1909 },
1910 /* Port is just copied over. */
1911 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1912 {
1913 {"http://google.com:00035",S_OK,FALSE},
1914 {"google.com:00035",S_OK,FALSE},
1915 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1916 {"google.com",S_OK,FALSE},
1917 {"",S_FALSE,FALSE},
1918 {"",S_FALSE,FALSE},
1919 {"google.com",S_OK,FALSE},
1920 {"",S_FALSE,FALSE},
1921 {"",S_FALSE,FALSE},
1922 {"",S_FALSE,FALSE},
1923 {"",S_FALSE,FALSE},
1924 {"http://google.com:00035",S_OK,FALSE},
1925 {"http",S_OK,FALSE},
1926 {"",S_FALSE,FALSE},
1927 {"",S_FALSE,FALSE}
1928 },
1929 {
1930 {Uri_HOST_DNS,S_OK,FALSE},
1931 {35,S_OK,FALSE},
1932 {URL_SCHEME_HTTP,S_OK,FALSE},
1933 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1934 }
1935 },
1936 /* Default port is copied over. */
1937 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1938 {
1939 {"http://google.com:80",S_OK,FALSE},
1940 {"google.com:80",S_OK,FALSE},
1941 {"http://google.com:80",S_OK,FALSE},
1942 {"google.com",S_OK,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"",S_FALSE,FALSE},
1945 {"google.com",S_OK,FALSE},
1946 {"",S_FALSE,FALSE},
1947 {"",S_FALSE,FALSE},
1948 {"",S_FALSE,FALSE},
1949 {"",S_FALSE,FALSE},
1950 {"http://google.com:80",S_OK,FALSE},
1951 {"http",S_OK,FALSE},
1952 {"",S_FALSE,FALSE},
1953 {"",S_FALSE,FALSE}
1954 },
1955 {
1956 {Uri_HOST_DNS,S_OK,FALSE},
1957 {80,S_OK,FALSE},
1958 {URL_SCHEME_HTTP,S_OK,FALSE},
1959 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1960 }
1961 },
1962 { "http://google.com.uk", 0, S_OK, FALSE,
1963 {
1964 {"http://google.com.uk/",S_OK,FALSE},
1965 {"google.com.uk",S_OK,FALSE},
1966 {"http://google.com.uk/",S_OK,FALSE},
1967 {"google.com.uk",S_OK,FALSE},
1968 {"",S_FALSE,FALSE},
1969 {"",S_FALSE,FALSE},
1970 {"google.com.uk",S_OK,FALSE},
1971 {"",S_FALSE,FALSE},
1972 {"/",S_OK,FALSE},
1973 {"/",S_OK,FALSE},
1974 {"",S_FALSE,FALSE},
1975 {"http://google.com.uk",S_OK,FALSE},
1976 {"http",S_OK,FALSE},
1977 {"",S_FALSE,FALSE},
1978 {"",S_FALSE,FALSE}
1979 },
1980 {
1981 {Uri_HOST_DNS,S_OK,FALSE},
1982 {80,S_OK,FALSE},
1983 {URL_SCHEME_HTTP,S_OK,FALSE},
1984 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1985 }
1986 },
1987 { "http://google.com.com", 0, S_OK, FALSE,
1988 {
1989 {"http://google.com.com/",S_OK,FALSE},
1990 {"google.com.com",S_OK,FALSE},
1991 {"http://google.com.com/",S_OK,FALSE},
1992 {"com.com",S_OK,FALSE},
1993 {"",S_FALSE,FALSE},
1994 {"",S_FALSE,FALSE},
1995 {"google.com.com",S_OK,FALSE},
1996 {"",S_FALSE,FALSE},
1997 {"/",S_OK,FALSE},
1998 {"/",S_OK,FALSE},
1999 {"",S_FALSE,FALSE},
2000 {"http://google.com.com",S_OK,FALSE},
2001 {"http",S_OK,FALSE},
2002 {"",S_FALSE,FALSE},
2003 {"",S_FALSE,FALSE}
2004 },
2005 {
2006 {Uri_HOST_DNS,S_OK,FALSE},
2007 {80,S_OK,FALSE},
2008 {URL_SCHEME_HTTP,S_OK,FALSE},
2009 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2010 }
2011 },
2012 { "http://google.uk.1", 0, S_OK, FALSE,
2013 {
2014 {"http://google.uk.1/",S_OK,FALSE},
2015 {"google.uk.1",S_OK,FALSE},
2016 {"http://google.uk.1/",S_OK,FALSE},
2017 {"google.uk.1",S_OK,FALSE},
2018 {"",S_FALSE,FALSE},
2019 {"",S_FALSE,FALSE},
2020 {"google.uk.1",S_OK,FALSE},
2021 {"",S_FALSE,FALSE},
2022 {"/",S_OK,FALSE},
2023 {"/",S_OK,FALSE},
2024 {"",S_FALSE,FALSE},
2025 {"http://google.uk.1",S_OK,FALSE},
2026 {"http",S_OK,FALSE},
2027 {"",S_FALSE,FALSE},
2028 {"",S_FALSE,FALSE}
2029 },
2030 {
2031 {Uri_HOST_DNS,S_OK,FALSE},
2032 {80,S_OK,FALSE},
2033 {URL_SCHEME_HTTP,S_OK,FALSE},
2034 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2035 }
2036 },
2037 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2038 { "http://google.foo.uk", 0, S_OK, FALSE,
2039 {
2040 {"http://google.foo.uk/",S_OK,FALSE},
2041 {"google.foo.uk",S_OK,FALSE},
2042 {"http://google.foo.uk/",S_OK,FALSE},
2043 {"foo.uk",S_OK,FALSE},
2044 {"",S_FALSE,FALSE},
2045 {"",S_FALSE,FALSE},
2046 {"google.foo.uk",S_OK,FALSE},
2047 {"",S_FALSE,FALSE},
2048 {"/",S_OK,FALSE},
2049 {"/",S_OK,FALSE},
2050 {"",S_FALSE,FALSE},
2051 {"http://google.foo.uk",S_OK,FALSE},
2052 {"http",S_OK,FALSE},
2053 {"",S_FALSE,FALSE},
2054 {"",S_FALSE,FALSE}
2055 },
2056 {
2057 {Uri_HOST_DNS,S_OK,FALSE},
2058 {80,S_OK,FALSE},
2059 {URL_SCHEME_HTTP,S_OK,FALSE},
2060 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2061 }
2062 },
2063 { "http://.com", 0, S_OK, FALSE,
2064 {
2065 {"http://.com/",S_OK,FALSE},
2066 {".com",S_OK,FALSE},
2067 {"http://.com/",S_OK,FALSE},
2068 {".com",S_OK,FALSE},
2069 {"",S_FALSE,FALSE},
2070 {"",S_FALSE,FALSE},
2071 {".com",S_OK,FALSE},
2072 {"",S_FALSE,FALSE},
2073 {"/",S_OK,FALSE},
2074 {"/",S_OK,FALSE},
2075 {"",S_FALSE,FALSE},
2076 {"http://.com",S_OK,FALSE},
2077 {"http",S_OK,FALSE},
2078 {"",S_FALSE,FALSE},
2079 {"",S_FALSE,FALSE}
2080 },
2081 {
2082 {Uri_HOST_DNS,S_OK,FALSE},
2083 {80,S_OK,FALSE},
2084 {URL_SCHEME_HTTP,S_OK,FALSE},
2085 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2086 }
2087 },
2088 { "http://.uk", 0, S_OK, FALSE,
2089 {
2090 {"http://.uk/",S_OK,FALSE},
2091 {".uk",S_OK,FALSE},
2092 {"http://.uk/",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"",S_FALSE,FALSE},
2095 {"",S_FALSE,FALSE},
2096 {".uk",S_OK,FALSE},
2097 {"",S_FALSE,FALSE},
2098 {"/",S_OK,FALSE},
2099 {"/",S_OK,FALSE},
2100 {"",S_FALSE,FALSE},
2101 {"http://.uk",S_OK,FALSE},
2102 {"http",S_OK,FALSE},
2103 {"",S_FALSE,FALSE},
2104 {"",S_FALSE,FALSE}
2105 },
2106 {
2107 {Uri_HOST_DNS,S_OK,FALSE},
2108 {80,S_OK,FALSE},
2109 {URL_SCHEME_HTTP,S_OK,FALSE},
2110 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2111 }
2112 },
2113 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2114 {
2115 {"http://www.co.google.com.[]/",S_OK,FALSE},
2116 {"www.co.google.com.[]",S_OK,FALSE},
2117 {"http://www.co.google.com.[]/",S_OK,FALSE},
2118 {"google.com.[]",S_OK,FALSE},
2119 {"",S_FALSE,FALSE},
2120 {"",S_FALSE,FALSE},
2121 {"www.co.google.com.[]",S_OK,FALSE},
2122 {"",S_FALSE,FALSE},
2123 {"/",S_OK,FALSE},
2124 {"/",S_OK,FALSE},
2125 {"",S_FALSE,FALSE},
2126 {"http://www.co.google.com.[]",S_OK,FALSE},
2127 {"http",S_OK,FALSE},
2128 {"",S_FALSE,FALSE},
2129 {"",S_FALSE,FALSE}
2130 },
2131 {
2132 {Uri_HOST_DNS,S_OK,FALSE},
2133 {80,S_OK,FALSE},
2134 {URL_SCHEME_HTTP,S_OK,FALSE},
2135 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2136 }
2137 },
2138 { "http://co.uk", 0, S_OK, FALSE,
2139 {
2140 {"http://co.uk/",S_OK,FALSE},
2141 {"co.uk",S_OK,FALSE},
2142 {"http://co.uk/",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"",S_FALSE,FALSE},
2145 {"",S_FALSE,FALSE},
2146 {"co.uk",S_OK,FALSE},
2147 {"",S_FALSE,FALSE},
2148 {"/",S_OK,FALSE},
2149 {"/",S_OK,FALSE},
2150 {"",S_FALSE,FALSE},
2151 {"http://co.uk",S_OK,FALSE},
2152 {"http",S_OK,FALSE},
2153 {"",S_FALSE,FALSE},
2154 {"",S_FALSE,FALSE}
2155 },
2156 {
2157 {Uri_HOST_DNS,S_OK,FALSE},
2158 {80,S_OK,FALSE},
2159 {URL_SCHEME_HTTP,S_OK,FALSE},
2160 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2161 }
2162 },
2163 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2164 {
2165 {"http://www.co.google.us.test/",S_OK,FALSE},
2166 {"www.co.google.us.test",S_OK,FALSE},
2167 {"http://www.co.google.us.test/",S_OK,FALSE},
2168 {"us.test",S_OK,FALSE},
2169 {"",S_FALSE,FALSE},
2170 {"",S_FALSE,FALSE},
2171 {"www.co.google.us.test",S_OK,FALSE},
2172 {"",S_FALSE,FALSE},
2173 {"/",S_OK,FALSE},
2174 {"/",S_OK,FALSE},
2175 {"",S_FALSE,FALSE},
2176 {"http://www.co.google.us.test",S_OK,FALSE},
2177 {"http",S_OK,FALSE},
2178 {"",S_FALSE,FALSE},
2179 {"",S_FALSE,FALSE}
2180 },
2181 {
2182 {Uri_HOST_DNS,S_OK,FALSE},
2183 {80,S_OK,FALSE},
2184 {URL_SCHEME_HTTP,S_OK,FALSE},
2185 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2186 }
2187 },
2188 { "http://gov.uk", 0, S_OK, FALSE,
2189 {
2190 {"http://gov.uk/",S_OK,FALSE},
2191 {"gov.uk",S_OK,FALSE},
2192 {"http://gov.uk/",S_OK,FALSE},
2193 {"",S_FALSE,FALSE},
2194 {"",S_FALSE,FALSE},
2195 {"",S_FALSE,FALSE},
2196 {"gov.uk",S_OK,FALSE},
2197 {"",S_FALSE,FALSE},
2198 {"/",S_OK,FALSE},
2199 {"/",S_OK,FALSE},
2200 {"",S_FALSE,FALSE},
2201 {"http://gov.uk",S_OK,FALSE},
2202 {"http",S_OK,FALSE},
2203 {"",S_FALSE,FALSE},
2204 {"",S_FALSE,FALSE}
2205 },
2206 {
2207 {Uri_HOST_DNS,S_OK,FALSE},
2208 {80,S_OK,FALSE},
2209 {URL_SCHEME_HTTP,S_OK,FALSE},
2210 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2211 }
2212 },
2213 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2214 {
2215 {"zip://www.google.com\\test",S_OK,FALSE},
2216 {"www.google.com\\test",S_OK,FALSE},
2217 {"zip://www.google.com\\test",S_OK,FALSE},
2218 {"google.com\\test",S_OK,FALSE},
2219 {"",S_FALSE,FALSE},
2220 {"",S_FALSE,FALSE},
2221 {"www.google.com\\test",S_OK,FALSE},
2222 {"",S_FALSE,FALSE},
2223 {"",S_FALSE,FALSE},
2224 {"",S_FALSE,FALSE},
2225 {"",S_FALSE,FALSE},
2226 {"zip://www.google.com\\test",S_OK,FALSE},
2227 {"zip",S_OK,FALSE},
2228 {"",S_FALSE,FALSE},
2229 {"",S_FALSE,FALSE}
2230 },
2231 {
2232 {Uri_HOST_DNS,S_OK,FALSE},
2233 {0,S_FALSE,FALSE},
2234 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2235 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2236 }
2237 },
2238 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2239 {
2240 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2241 {"",S_FALSE,FALSE},
2242 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2243 {"",S_FALSE,FALSE},
2244 {"",S_FALSE,FALSE},
2245 {"",S_FALSE,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"",S_FALSE,FALSE},
2248 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2249 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2250 {"",S_FALSE,FALSE},
2251 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2252 {"urn",S_OK,FALSE},
2253 {"",S_FALSE,FALSE},
2254 {"",S_FALSE,FALSE}
2255 },
2256 {
2257 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2258 {0,S_FALSE,FALSE},
2259 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2260 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2261 }
2262 },
2263 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2264 * are decoded and all '%' are encoded.
2265 */
2266 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2267 {
2268 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2269 {"",S_FALSE,FALSE},
2270 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {".mp3",S_OK,FALSE},
2273 {"",S_FALSE,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"",S_FALSE,FALSE},
2276 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2277 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2278 {"",S_FALSE,FALSE},
2279 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2280 {"file",S_OK,FALSE},
2281 {"",S_FALSE,FALSE},
2282 {"",S_FALSE,FALSE}
2283 },
2284 {
2285 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2286 {0,S_FALSE,FALSE},
2287 {URL_SCHEME_FILE,S_OK,FALSE},
2288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2289 }
2290 },
2291 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2292 * is decoded and only %'s in front of invalid hex digits are encoded.
2293 */
2294 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2295 {
2296 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2297 {"",S_FALSE,FALSE},
2298 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2299 {"",S_FALSE,FALSE},
2300 {".mp3",S_OK,FALSE},
2301 {"",S_FALSE,FALSE},
2302 {"",S_FALSE,FALSE},
2303 {"",S_FALSE,FALSE},
2304 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2305 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2306 {"",S_FALSE,FALSE},
2307 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2308 {"file",S_OK,FALSE},
2309 {"",S_FALSE,FALSE},
2310 {"",S_FALSE,FALSE}
2311 },
2312 {
2313 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2314 {0,S_FALSE,FALSE},
2315 {URL_SCHEME_FILE,S_OK,FALSE},
2316 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2317 }
2318 },
2319 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2320 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2321 {
2322 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2323 {"[::1.2.3.0]",S_OK,FALSE},
2324 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2325 {"",S_FALSE,FALSE},
2326 {"",S_FALSE,FALSE},
2327 {"",S_FALSE,FALSE},
2328 {"::1.2.3.0",S_OK,FALSE},
2329 {"",S_FALSE,FALSE},
2330 {"/%3F%23.T/test",S_OK,FALSE},
2331 {"/%3F%23.T/test",S_OK,FALSE},
2332 {"",S_FALSE,FALSE},
2333 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2334 {"http",S_OK,FALSE},
2335 {"",S_FALSE,FALSE},
2336 {"",S_FALSE,FALSE},
2337 },
2338 {
2339 {Uri_HOST_IPV6,S_OK,FALSE},
2340 {80,S_OK,FALSE},
2341 {URL_SCHEME_HTTP,S_OK,FALSE},
2342 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2343 }
2344 },
2345 /* Forbidden characters are always encoded for file URIs. */
2346 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2347 {
2348 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2349 {"",S_FALSE,FALSE},
2350 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2351 {"",S_FALSE,FALSE},
2352 {".mp3",S_OK,FALSE},
2353 {"",S_FALSE,FALSE},
2354 {"",S_FALSE,FALSE},
2355 {"",S_FALSE,FALSE},
2356 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2357 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2358 {"",S_FALSE,FALSE},
2359 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2360 {"file",S_OK,FALSE},
2361 {"",S_FALSE,FALSE},
2362 {"",S_FALSE,FALSE}
2363 },
2364 {
2365 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2366 {0,S_FALSE,FALSE},
2367 {URL_SCHEME_FILE,S_OK,FALSE},
2368 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2369 }
2370 },
2371 /* Forbidden characters are never encoded for unknown scheme types. */
2372 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2373 {
2374 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2375 {"4294967295",S_OK,FALSE},
2376 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2377 {"",S_FALSE,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"",S_FALSE,FALSE},
2380 {"4294967295",S_OK,FALSE},
2381 {"",S_FALSE,FALSE},
2382 {"/<|>\" test<|>",S_OK,FALSE},
2383 {"/<|>\" test<|>",S_OK,FALSE},
2384 {"",S_FALSE,FALSE},
2385 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2386 {"1234",S_OK,FALSE},
2387 {"",S_FALSE,FALSE},
2388 {"",S_FALSE,FALSE}
2389 },
2390 {
2391 {Uri_HOST_IPV4,S_OK,FALSE},
2392 {0,S_FALSE,FALSE},
2393 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2394 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2395 }
2396 },
2397 /* Make sure forbidden characters are percent encoded. */
2398 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2399 {
2400 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2401 {"gov.uk",S_OK,FALSE},
2402 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2403 {"",S_FALSE,FALSE},
2404 {"",S_FALSE,FALSE},
2405 {"",S_FALSE,FALSE},
2406 {"gov.uk",S_OK,FALSE},
2407 {"",S_FALSE,FALSE},
2408 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2409 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2410 {"",S_FALSE,FALSE},
2411 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2412 {"http",S_OK,FALSE},
2413 {"",S_FALSE,FALSE},
2414 {"",S_FALSE,FALSE}
2415 },
2416 {
2417 {Uri_HOST_DNS,S_OK,FALSE},
2418 {80,S_OK,FALSE},
2419 {URL_SCHEME_HTTP,S_OK,FALSE},
2420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2421 }
2422 },
2423 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2424 {
2425 {"http://gov.uk/",S_OK,FALSE},
2426 {"gov.uk",S_OK,FALSE},
2427 {"http://gov.uk/",S_OK,FALSE},
2428 {"",S_FALSE,FALSE},
2429 {"",S_FALSE,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"gov.uk",S_OK,FALSE},
2432 {"",S_FALSE,FALSE},
2433 {"/",S_OK,FALSE},
2434 {"/",S_OK,FALSE},
2435 {"",S_FALSE,FALSE},
2436 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2437 {"http",S_OK,FALSE},
2438 {"",S_FALSE,FALSE},
2439 {"",S_FALSE,FALSE}
2440 },
2441 {
2442 {Uri_HOST_DNS,S_OK,FALSE},
2443 {80,S_OK,FALSE},
2444 {URL_SCHEME_HTTP,S_OK,FALSE},
2445 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2446 }
2447 },
2448 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2449 {
2450 {"http://gov.uk/",S_OK,FALSE},
2451 {"gov.uk",S_OK,FALSE},
2452 {"http://gov.uk/",S_OK,FALSE},
2453 {"",S_FALSE,FALSE},
2454 {"",S_FALSE,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {"gov.uk",S_OK,FALSE},
2457 {"",S_FALSE,FALSE},
2458 {"/",S_OK,FALSE},
2459 {"/",S_OK,FALSE},
2460 {"",S_FALSE,FALSE},
2461 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2462 {"http",S_OK,FALSE},
2463 {"",S_FALSE,FALSE},
2464 {"",S_FALSE,FALSE}
2465 },
2466 {
2467 {Uri_HOST_DNS,S_OK,FALSE},
2468 {80,S_OK,FALSE},
2469 {URL_SCHEME_HTTP,S_OK,FALSE},
2470 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2471 }
2472 },
2473 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2474 {
2475 {"http://gov.uk/",S_OK,FALSE},
2476 {"gov.uk",S_OK,FALSE},
2477 {"http://gov.uk/",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"",S_FALSE,FALSE},
2480 {"",S_FALSE,FALSE},
2481 {"gov.uk",S_OK,FALSE},
2482 {"",S_FALSE,FALSE},
2483 {"/",S_OK,FALSE},
2484 {"/",S_OK,FALSE},
2485 {"",S_FALSE,FALSE},
2486 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2487 {"http",S_OK,FALSE},
2488 {"",S_FALSE,FALSE},
2489 {"",S_FALSE,FALSE}
2490 },
2491 {
2492 {Uri_HOST_DNS,S_OK,FALSE},
2493 {80,S_OK,FALSE},
2494 {URL_SCHEME_HTTP,S_OK,FALSE},
2495 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2496 }
2497 },
2498 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2499 {
2500 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2501 {"",S_FALSE,FALSE},
2502 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {".mp3",S_OK,FALSE},
2505 {"",S_FALSE,FALSE},
2506 {"",S_FALSE,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2509 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2510 {"",S_FALSE,FALSE},
2511 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2512 {"file",S_OK,FALSE},
2513 {"",S_FALSE,FALSE},
2514 {"",S_FALSE,FALSE}
2515 },
2516 {
2517 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2518 {0,S_FALSE,FALSE},
2519 {URL_SCHEME_FILE,S_OK,FALSE},
2520 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2521 }
2522 },
2523 /* Dot removal happens for unknown scheme types. */
2524 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2525 {
2526 {"zip://gov.uk/",S_OK,FALSE},
2527 {"gov.uk",S_OK,FALSE},
2528 {"zip://gov.uk/",S_OK,FALSE},
2529 {"",S_FALSE,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {"",S_FALSE,FALSE},
2532 {"gov.uk",S_OK,FALSE},
2533 {"",S_FALSE,FALSE},
2534 {"/",S_OK,FALSE},
2535 {"/",S_OK,FALSE},
2536 {"",S_FALSE,FALSE},
2537 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2538 {"zip",S_OK,FALSE},
2539 {"",S_FALSE,FALSE},
2540 {"",S_FALSE,FALSE}
2541 },
2542 {
2543 {Uri_HOST_DNS,S_OK,FALSE},
2544 {0,S_FALSE,FALSE},
2545 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2546 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2547 }
2548 },
2549 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2550 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2551 {
2552 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2553 {"gov.uk",S_OK,FALSE},
2554 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2555 {"",S_FALSE,FALSE},
2556 {".",S_OK,FALSE},
2557 {"",S_FALSE,FALSE},
2558 {"gov.uk",S_OK,FALSE},
2559 {"",S_FALSE,FALSE},
2560 {"/test/test2/../../.",S_OK,FALSE},
2561 {"/test/test2/../../.",S_OK,FALSE},
2562 {"",S_FALSE,FALSE},
2563 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2564 {"http",S_OK,FALSE},
2565 {"",S_FALSE,FALSE},
2566 {"",S_FALSE,FALSE}
2567 },
2568 {
2569 {Uri_HOST_DNS,S_OK,FALSE},
2570 {80,S_OK,FALSE},
2571 {URL_SCHEME_HTTP,S_OK,FALSE},
2572 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2573 }
2574 },
2575 /* Dot removal doesn't happen for wildcard scheme types. */
2576 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2577 {
2578 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2579 {"gov.uk",S_OK,FALSE},
2580 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2581 {"",S_FALSE,FALSE},
2582 {".",S_OK,FALSE},
2583 {"",S_FALSE,FALSE},
2584 {"gov.uk",S_OK,FALSE},
2585 {"",S_FALSE,FALSE},
2586 {"/test/test2/../../.",S_OK,FALSE},
2587 {"/test/test2/../../.",S_OK,FALSE},
2588 {"",S_FALSE,FALSE},
2589 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2590 {"*",S_OK,FALSE},
2591 {"",S_FALSE,FALSE},
2592 {"",S_FALSE,FALSE}
2593 },
2594 {
2595 {Uri_HOST_DNS,S_OK,FALSE},
2596 {0,S_FALSE,FALSE},
2597 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2598 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2599 }
2600 },
2601 /* Forbidden characters are encoded for opaque known scheme types. */
2602 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2603 {
2604 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2605 {"",S_FALSE,FALSE},
2606 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2607 {"",S_FALSE,FALSE},
2608 {".com%22",S_OK,FALSE},
2609 {"",S_FALSE,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {"",S_FALSE,FALSE},
2612 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2613 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2614 {"",S_FALSE,FALSE},
2615 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2616 {"mailto",S_OK,FALSE},
2617 {"",S_FALSE,FALSE},
2618 {"",S_FALSE,FALSE}
2619 },
2620 {
2621 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2622 {0,S_FALSE,FALSE},
2623 {URL_SCHEME_MAILTO,S_OK,FALSE},
2624 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2625 }
2626 },
2627 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2628 {
2629 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2630 {"",S_FALSE,FALSE},
2631 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {".com",S_OK,FALSE},
2634 {"",S_FALSE,FALSE},
2635 {"",S_FALSE,FALSE},
2636 {"",S_FALSE,FALSE},
2637 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2638 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2639 {"",S_FALSE,FALSE},
2640 {"news:test.tes<|>t.com",S_OK,FALSE},
2641 {"news",S_OK,FALSE},
2642 {"",S_FALSE,FALSE},
2643 {"",S_FALSE,FALSE}
2644 },
2645 {
2646 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2647 {0,S_FALSE,FALSE},
2648 {URL_SCHEME_NEWS,S_OK,FALSE},
2649 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2650 }
2651 },
2652 /* Don't encode forbidden characters. */
2653 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2654 {
2655 {"news:test.tes<|>t.com",S_OK,FALSE},
2656 {"",S_FALSE,FALSE},
2657 {"news:test.tes<|>t.com",S_OK,FALSE},
2658 {"",S_FALSE,FALSE},
2659 {".com",S_OK,FALSE},
2660 {"",S_FALSE,FALSE},
2661 {"",S_FALSE,FALSE},
2662 {"",S_FALSE,FALSE},
2663 {"test.tes<|>t.com",S_OK,FALSE},
2664 {"test.tes<|>t.com",S_OK,FALSE},
2665 {"",S_FALSE,FALSE},
2666 {"news:test.tes<|>t.com",S_OK,FALSE},
2667 {"news",S_OK,FALSE},
2668 {"",S_FALSE,FALSE},
2669 {"",S_FALSE,FALSE}
2670 },
2671 {
2672 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2673 {0,S_FALSE,FALSE},
2674 {URL_SCHEME_NEWS,S_OK,FALSE},
2675 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2676 }
2677 },
2678 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2679 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2680 {
2681 {"urn:test.tes<|>t.com",S_OK,FALSE},
2682 {"",S_FALSE,FALSE},
2683 {"urn:test.tes<|>t.com",S_OK,FALSE},
2684 {"",S_FALSE,FALSE},
2685 {".com",S_OK,FALSE},
2686 {"",S_FALSE,FALSE},
2687 {"",S_FALSE,FALSE},
2688 {"",S_FALSE,FALSE},
2689 {"test.tes<|>t.com",S_OK,FALSE},
2690 {"test.tes<|>t.com",S_OK,FALSE},
2691 {"",S_FALSE,FALSE},
2692 {"urn:test.tes<|>t.com",S_OK,FALSE},
2693 {"urn",S_OK,FALSE},
2694 {"",S_FALSE,FALSE},
2695 {"",S_FALSE,FALSE}
2696 },
2697 {
2698 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2699 {0,S_FALSE,FALSE},
2700 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2701 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2702 }
2703 },
2704 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2705 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2706 {
2707 {"news:test.test.com",S_OK,FALSE},
2708 {"",S_FALSE,FALSE},
2709 {"news:test.test.com",S_OK,FALSE},
2710 {"",S_FALSE,FALSE},
2711 {".com",S_OK,FALSE},
2712 {"",S_FALSE,FALSE},
2713 {"",S_FALSE,FALSE},
2714 {"",S_FALSE,FALSE},
2715 {"test.test.com",S_OK,FALSE},
2716 {"test.test.com",S_OK,FALSE},
2717 {"",S_FALSE,FALSE},
2718 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2719 {"news",S_OK,FALSE},
2720 {"",S_FALSE,FALSE},
2721 {"",S_FALSE,FALSE}
2722 },
2723 {
2724 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2725 {0,S_FALSE,FALSE},
2726 {URL_SCHEME_NEWS,S_OK,FALSE},
2727 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2728 }
2729 },
2730 /* Percent encoded characters are still decoded for known scheme types. */
2731 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2732 {
2733 {"news:test.test.com",S_OK,FALSE},
2734 {"",S_FALSE,FALSE},
2735 {"news:test.test.com",S_OK,FALSE},
2736 {"",S_FALSE,FALSE},
2737 {".com",S_OK,FALSE},
2738 {"",S_FALSE,FALSE},
2739 {"",S_FALSE,FALSE},
2740 {"",S_FALSE,FALSE},
2741 {"test.test.com",S_OK,FALSE},
2742 {"test.test.com",S_OK,FALSE},
2743 {"",S_FALSE,FALSE},
2744 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2745 {"news",S_OK,FALSE},
2746 {"",S_FALSE,FALSE},
2747 {"",S_FALSE,FALSE}
2748 },
2749 {
2750 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2751 {0,S_FALSE,FALSE},
2752 {URL_SCHEME_NEWS,S_OK,FALSE},
2753 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2754 }
2755 },
2756 /* Percent encoded characters aren't decoded for unknown scheme types. */
2757 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2758 {
2759 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2760 {"",S_FALSE,FALSE},
2761 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2762 {"",S_FALSE,FALSE},
2763 {".com",S_OK,FALSE},
2764 {"",S_FALSE,FALSE},
2765 {"",S_FALSE,FALSE},
2766 {"",S_FALSE,FALSE},
2767 {"test.%74%65%73%74.com",S_OK,FALSE},
2768 {"test.%74%65%73%74.com",S_OK,FALSE},
2769 {"",S_FALSE,FALSE},
2770 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2771 {"urn",S_OK,FALSE},
2772 {"",S_FALSE,FALSE},
2773 {"",S_FALSE,FALSE}
2774 },
2775 {
2776 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2777 {0,S_FALSE,FALSE},
2778 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2779 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2780 }
2781 },
2782 /* Unknown scheme types can have invalid % encoded data in query string. */
2783 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2784 {
2785 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2786 {"www.winehq.org",S_OK,FALSE},
2787 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2788 {"winehq.org",S_OK,FALSE},
2789 {"",S_FALSE,FALSE},
2790 {"",S_FALSE,FALSE},
2791 {"www.winehq.org",S_OK,FALSE},
2792 {"",S_FALSE,FALSE},
2793 {"/",S_OK,FALSE},
2794 {"/?query=%xx&return=y",S_OK,FALSE},
2795 {"?query=%xx&return=y",S_OK,FALSE},
2796 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2797 {"zip",S_OK,FALSE},
2798 {"",S_FALSE,FALSE},
2799 {"",S_FALSE,FALSE}
2800 },
2801 {
2802 {Uri_HOST_DNS,S_OK,FALSE},
2803 {0,S_FALSE,FALSE},
2804 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2805 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2806 }
2807 },
2808 /* Known scheme types can have invalid % encoded data with the right flags. */
2809 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2810 {
2811 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2812 {"www.winehq.org",S_OK,FALSE},
2813 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2814 {"winehq.org",S_OK,FALSE},
2815 {"",S_FALSE,FALSE},
2816 {"",S_FALSE,FALSE},
2817 {"www.winehq.org",S_OK,FALSE},
2818 {"",S_FALSE,FALSE},
2819 {"/",S_OK,FALSE},
2820 {"/?query=%xx&return=y",S_OK,FALSE},
2821 {"?query=%xx&return=y",S_OK,FALSE},
2822 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2823 {"http",S_OK,FALSE},
2824 {"",S_FALSE,FALSE},
2825 {"",S_FALSE,FALSE}
2826 },
2827 {
2828 {Uri_HOST_DNS,S_OK,FALSE},
2829 {80,S_OK,FALSE},
2830 {URL_SCHEME_HTTP,S_OK,FALSE},
2831 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2832 }
2833 },
2834 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2835 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2836 {
2837 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2838 {"www.winehq.org",S_OK,FALSE},
2839 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2840 {"winehq.org",S_OK,FALSE},
2841 {"",S_FALSE,FALSE},
2842 {"",S_FALSE,FALSE},
2843 {"www.winehq.org",S_OK,FALSE},
2844 {"",S_FALSE,FALSE},
2845 {"/",S_OK,FALSE},
2846 {"/?query=<|>&return=y",S_OK,FALSE},
2847 {"?query=<|>&return=y",S_OK,FALSE},
2848 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2849 {"http",S_OK,FALSE},
2850 {"",S_FALSE,FALSE},
2851 {"",S_FALSE,FALSE}
2852 },
2853 {
2854 {Uri_HOST_DNS,S_OK,FALSE},
2855 {80,S_OK,FALSE},
2856 {URL_SCHEME_HTTP,S_OK,FALSE},
2857 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2858 }
2859 },
2860 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2861 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2862 {
2863 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2864 {"www.winehq.org",S_OK,FALSE},
2865 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2866 {"winehq.org",S_OK,FALSE},
2867 {"",S_FALSE,FALSE},
2868 {"",S_FALSE,FALSE},
2869 {"www.winehq.org",S_OK,FALSE},
2870 {"",S_FALSE,FALSE},
2871 {"/",S_OK,FALSE},
2872 {"/?query=<|>&return=y",S_OK,FALSE},
2873 {"?query=<|>&return=y",S_OK,FALSE},
2874 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2875 {"http",S_OK,FALSE},
2876 {"",S_FALSE,FALSE},
2877 {"",S_FALSE,FALSE}
2878 },
2879 {
2880 {Uri_HOST_DNS,S_OK,FALSE},
2881 {80,S_OK,FALSE},
2882 {URL_SCHEME_HTTP,S_OK,FALSE},
2883 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2884 }
2885 },
2886 /* Forbidden characters are encoded for known scheme types. */
2887 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2888 {
2889 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2890 {"www.winehq.org",S_OK,FALSE},
2891 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2892 {"winehq.org",S_OK,FALSE},
2893 {"",S_FALSE,FALSE},
2894 {"",S_FALSE,FALSE},
2895 {"www.winehq.org",S_OK,FALSE},
2896 {"",S_FALSE,FALSE},
2897 {"/",S_OK,FALSE},
2898 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2899 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2900 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2901 {"http",S_OK,FALSE},
2902 {"",S_FALSE,FALSE},
2903 {"",S_FALSE,FALSE}
2904 },
2905 {
2906 {Uri_HOST_DNS,S_OK,FALSE},
2907 {80,S_OK,FALSE},
2908 {URL_SCHEME_HTTP,S_OK,FALSE},
2909 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2910 }
2911 },
2912 /* Forbidden characters are not encoded for unknown scheme types. */
2913 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2914 {
2915 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2916 {"www.winehq.org",S_OK,FALSE},
2917 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2918 {"winehq.org",S_OK,FALSE},
2919 {"",S_FALSE,FALSE},
2920 {"",S_FALSE,FALSE},
2921 {"www.winehq.org",S_OK,FALSE},
2922 {"",S_FALSE,FALSE},
2923 {"/",S_OK,FALSE},
2924 {"/?query=<|>&return=y",S_OK,FALSE},
2925 {"?query=<|>&return=y",S_OK,FALSE},
2926 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2927 {"zip",S_OK,FALSE},
2928 {"",S_FALSE,FALSE},
2929 {"",S_FALSE,FALSE}
2930 },
2931 {
2932 {Uri_HOST_DNS,S_OK,FALSE},
2933 {0,S_FALSE,FALSE},
2934 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2935 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2936 }
2937 },
2938 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2939 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2940 {
2941 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2942 {"www.winehq.org",S_OK,FALSE},
2943 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2944 {"winehq.org",S_OK,FALSE},
2945 {"",S_FALSE,FALSE},
2946 {"",S_FALSE,FALSE},
2947 {"www.winehq.org",S_OK,FALSE},
2948 {"",S_FALSE,FALSE},
2949 {"/",S_OK,FALSE},
2950 {"/?query=01&return=y",S_OK,FALSE},
2951 {"?query=01&return=y",S_OK,FALSE},
2952 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2953 {"http",S_OK,FALSE},
2954 {"",S_FALSE,FALSE},
2955 {"",S_FALSE,FALSE}
2956 },
2957 {
2958 {Uri_HOST_DNS,S_OK,FALSE},
2959 {80,S_OK,FALSE},
2960 {URL_SCHEME_HTTP,S_OK,FALSE},
2961 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2962 }
2963 },
2964 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2965 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2966 {
2967 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2968 {"www.winehq.org",S_OK,FALSE},
2969 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2970 {"winehq.org",S_OK,FALSE},
2971 {"",S_FALSE,FALSE},
2972 {"",S_FALSE,FALSE},
2973 {"www.winehq.org",S_OK,FALSE},
2974 {"",S_FALSE,FALSE},
2975 {"/",S_OK,FALSE},
2976 {"/?query=%30%31&return=y",S_OK,FALSE},
2977 {"?query=%30%31&return=y",S_OK,FALSE},
2978 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2979 {"zip",S_OK,FALSE},
2980 {"",S_FALSE,FALSE},
2981 {"",S_FALSE,FALSE}
2982 },
2983 {
2984 {Uri_HOST_DNS,S_OK,FALSE},
2985 {0,S_FALSE,FALSE},
2986 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2987 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2988 }
2989 },
2990 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2991 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2992 {
2993 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2994 {"www.winehq.org",S_OK,FALSE},
2995 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2996 {"winehq.org",S_OK,FALSE},
2997 {"",S_FALSE,FALSE},
2998 {"",S_FALSE,FALSE},
2999 {"www.winehq.org",S_OK,FALSE},
3000 {"",S_FALSE,FALSE},
3001 {"/",S_OK,FALSE},
3002 {"/?query=%30%31&return=y",S_OK,FALSE},
3003 {"?query=%30%31&return=y",S_OK,FALSE},
3004 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
3005 {"http",S_OK,FALSE},
3006 {"",S_FALSE,FALSE},
3007 {"",S_FALSE,FALSE}
3008 },
3009 {
3010 {Uri_HOST_DNS,S_OK,FALSE},
3011 {80,S_OK,FALSE},
3012 {URL_SCHEME_HTTP,S_OK,FALSE},
3013 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3014 }
3015 },
3016 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3017 {
3018 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3019 {"www.winehq.org",S_OK,FALSE},
3020 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3021 {"winehq.org",S_OK,FALSE},
3022 {"",S_FALSE,FALSE},
3023 {"",S_FALSE,FALSE},
3024 {"www.winehq.org",S_OK,FALSE},
3025 {"",S_FALSE,FALSE},
3026 {"",S_FALSE,FALSE},
3027 {"?query=12&return=y",S_OK,FALSE},
3028 {"?query=12&return=y",S_OK,FALSE},
3029 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
3030 {"http",S_OK,FALSE},
3031 {"",S_FALSE,FALSE},
3032 {"",S_FALSE,FALSE}
3033 },
3034 {
3035 {Uri_HOST_DNS,S_OK,FALSE},
3036 {80,S_OK,FALSE},
3037 {URL_SCHEME_HTTP,S_OK,FALSE},
3038 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3039 }
3040 },
3041 /* Unknown scheme types can have invalid % encoded data in fragments. */
3042 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
3043 {
3044 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3045 {"www.winehq.org",S_OK,FALSE},
3046 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3047 {"winehq.org",S_OK,FALSE},
3048 {"",S_FALSE,FALSE},
3049 {"#Te%xx",S_OK,FALSE},
3050 {"www.winehq.org",S_OK,FALSE},
3051 {"",S_FALSE,FALSE},
3052 {"/tests/",S_OK,FALSE},
3053 {"/tests/",S_OK,FALSE},
3054 {"",S_FALSE,FALSE},
3055 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
3056 {"zip",S_OK,FALSE},
3057 {"",S_FALSE,FALSE},
3058 {"",S_FALSE,FALSE}
3059 },
3060 {
3061 {Uri_HOST_DNS,S_OK,FALSE},
3062 {0,S_FALSE,FALSE},
3063 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3064 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3065 }
3066 },
3067 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3068 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3069 {
3070 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3071 {"www.winehq.org",S_OK,FALSE},
3072 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3073 {"winehq.org",S_OK,FALSE},
3074 {"",S_FALSE,FALSE},
3075 {"#Te<|>",S_OK,FALSE},
3076 {"www.winehq.org",S_OK,FALSE},
3077 {"",S_FALSE,FALSE},
3078 {"/tests/",S_OK,FALSE},
3079 {"/tests/",S_OK,FALSE},
3080 {"",S_FALSE,FALSE},
3081 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3082 {"zip",S_OK,FALSE},
3083 {"",S_FALSE,FALSE},
3084 {"",S_FALSE,FALSE}
3085 },
3086 {
3087 {Uri_HOST_DNS,S_OK,FALSE},
3088 {0,S_FALSE,FALSE},
3089 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3090 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3091 }
3092 },
3093 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3094 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
3095 {
3096 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3097 {"www.winehq.org",S_OK,FALSE},
3098 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
3099 {"winehq.org",S_OK,FALSE},
3100 {"",S_FALSE,FALSE},
3101 {"#Te%3C%7C%3E",S_OK,FALSE},
3102 {"www.winehq.org",S_OK,FALSE},
3103 {"",S_FALSE,FALSE},
3104 {"/tests/",S_OK,FALSE},
3105 {"/tests/",S_OK,FALSE},
3106 {"",S_FALSE,FALSE},
3107 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3108 {"http",S_OK,FALSE},
3109 {"",S_FALSE,FALSE},
3110 {"",S_FALSE,FALSE}
3111 },
3112 {
3113 {Uri_HOST_DNS,S_OK,FALSE},
3114 {80,S_OK,FALSE},
3115 {URL_SCHEME_HTTP,S_OK,FALSE},
3116 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3117 }
3118 },
3119 /* Forbidden characters aren't encoded in the fragment with this flag. */
3120 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3121 {
3122 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3123 {"www.winehq.org",S_OK,FALSE},
3124 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3125 {"winehq.org",S_OK,FALSE},
3126 {"",S_FALSE,FALSE},
3127 {"#Te<|>",S_OK,FALSE},
3128 {"www.winehq.org",S_OK,FALSE},
3129 {"",S_FALSE,FALSE},
3130 {"/tests/",S_OK,FALSE},
3131 {"/tests/",S_OK,FALSE},
3132 {"",S_FALSE,FALSE},
3133 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3134 {"http",S_OK,FALSE},
3135 {"",S_FALSE,FALSE},
3136 {"",S_FALSE,FALSE}
3137 },
3138 {
3139 {Uri_HOST_DNS,S_OK,FALSE},
3140 {80,S_OK,FALSE},
3141 {URL_SCHEME_HTTP,S_OK,FALSE},
3142 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3143 }
3144 },
3145 /* Forbidden characters aren't encoded in the fragment with this flag. */
3146 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3147 {
3148 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3149 {"www.winehq.org",S_OK,FALSE},
3150 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3151 {"winehq.org",S_OK,FALSE},
3152 {"",S_FALSE,FALSE},
3153 {"#Te<|>",S_OK,FALSE},
3154 {"www.winehq.org",S_OK,FALSE},
3155 {"",S_FALSE,FALSE},
3156 {"/tests/",S_OK,FALSE},
3157 {"/tests/",S_OK,FALSE},
3158 {"",S_FALSE,FALSE},
3159 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3160 {"http",S_OK,FALSE},
3161 {"",S_FALSE,FALSE},
3162 {"",S_FALSE,FALSE}
3163 },
3164 {
3165 {Uri_HOST_DNS,S_OK,FALSE},
3166 {80,S_OK,FALSE},
3167 {URL_SCHEME_HTTP,S_OK,FALSE},
3168 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3169 }
3170 },
3171 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3172 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3173 {
3174 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3175 {"www.winehq.org",S_OK,FALSE},
3176 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3177 {"winehq.org",S_OK,FALSE},
3178 {"",S_FALSE,FALSE},
3179 {"#Te%30%31%32",S_OK,FALSE},
3180 {"www.winehq.org",S_OK,FALSE},
3181 {"",S_FALSE,FALSE},
3182 {"/tests/",S_OK,FALSE},
3183 {"/tests/",S_OK,FALSE},
3184 {"",S_FALSE,FALSE},
3185 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3186 {"zip",S_OK,FALSE},
3187 {"",S_FALSE,FALSE},
3188 {"",S_FALSE,FALSE}
3189 },
3190 {
3191 {Uri_HOST_DNS,S_OK,FALSE},
3192 {0,S_FALSE,FALSE},
3193 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3194 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3195 }
3196 },
3197 /* Percent encoded, unreserved characters are decoded for known schemes. */
3198 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3199 {
3200 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3201 {"www.winehq.org",S_OK,FALSE},
3202 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3203 {"winehq.org",S_OK,FALSE},
3204 {"",S_FALSE,FALSE},
3205 {"#Te012",S_OK,FALSE},
3206 {"www.winehq.org",S_OK,FALSE},
3207 {"",S_FALSE,FALSE},
3208 {"/tests/",S_OK,FALSE},
3209 {"/tests/",S_OK,FALSE},
3210 {"",S_FALSE,FALSE},
3211 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3212 {"http",S_OK,FALSE},
3213 {"",S_FALSE,FALSE},
3214 {"",S_FALSE,FALSE}
3215 },
3216 {
3217 {Uri_HOST_DNS,S_OK,FALSE},
3218 {80,S_OK,FALSE},
3219 {URL_SCHEME_HTTP,S_OK,FALSE},
3220 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3221 }
3222 },
3223 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3224 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3225 {
3226 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3227 {"www.winehq.org",S_OK,FALSE},
3228 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3229 {"winehq.org",S_OK,FALSE},
3230 {"",S_FALSE,FALSE},
3231 {"#Te012",S_OK,FALSE},
3232 {"www.winehq.org",S_OK,FALSE},
3233 {"",S_FALSE,FALSE},
3234 {"/tests/",S_OK,FALSE},
3235 {"/tests/",S_OK,FALSE},
3236 {"",S_FALSE,FALSE},
3237 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3238 {"http",S_OK,FALSE},
3239 {"",S_FALSE,FALSE},
3240 {"",S_FALSE,FALSE}
3241 },
3242 {
3243 {Uri_HOST_DNS,S_OK,FALSE},
3244 {80,S_OK,FALSE},
3245 {URL_SCHEME_HTTP,S_OK,FALSE},
3246 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3247 }
3248 },
3249 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3250 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3251 {
3252 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3253 {"www.winehq.org",S_OK,FALSE},
3254 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3255 {"winehq.org",S_OK,FALSE},
3256 {"",S_FALSE,FALSE},
3257 {"#Te%30%31%32",S_OK,FALSE},
3258 {"www.winehq.org",S_OK,FALSE},
3259 {"",S_FALSE,FALSE},
3260 {"/tests/",S_OK,FALSE},
3261 {"/tests/",S_OK,FALSE},
3262 {"",S_FALSE,FALSE},
3263 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3264 {"http",S_OK,FALSE},
3265 {"",S_FALSE,FALSE},
3266 {"",S_FALSE,FALSE}
3267 },
3268 {
3269 {Uri_HOST_DNS,S_OK,FALSE},
3270 {80,S_OK,FALSE},
3271 {URL_SCHEME_HTTP,S_OK,FALSE},
3272 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3273 }
3274 },
3275 /* Leading/Trailing whitespace is removed. */
3276 { " http://google.com/ ", 0, S_OK, FALSE,
3277 {
3278 {"http://google.com/",S_OK,FALSE},
3279 {"google.com",S_OK,FALSE},
3280 {"http://google.com/",S_OK,FALSE},
3281 {"google.com",S_OK,FALSE},
3282 {"",S_FALSE,FALSE},
3283 {"",S_FALSE,FALSE},
3284 {"google.com",S_OK,FALSE},
3285 {"",S_FALSE,FALSE},
3286 {"/",S_OK,FALSE},
3287 {"/",S_OK,FALSE},
3288 {"",S_FALSE,FALSE},
3289 {"http://google.com/",S_OK,FALSE},
3290 {"http",S_OK,FALSE},
3291 {"",S_FALSE,FALSE},
3292 {"",S_FALSE,FALSE}
3293 },
3294 {
3295 {Uri_HOST_DNS,S_OK,FALSE},
3296 {80,S_OK,FALSE},
3297 {URL_SCHEME_HTTP,S_OK,FALSE},
3298 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3299 }
3300 },
3301 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3302 {
3303 {"http://google.com/",S_OK,FALSE},
3304 {"google.com",S_OK,FALSE},
3305 {"http://google.com/",S_OK,FALSE},
3306 {"google.com",S_OK,FALSE},
3307 {"",S_FALSE,FALSE},
3308 {"",S_FALSE,FALSE},
3309 {"google.com",S_OK,FALSE},
3310 {"",S_FALSE,FALSE},
3311 {"/",S_OK,FALSE},
3312 {"/",S_OK,FALSE},
3313 {"",S_FALSE,FALSE},
3314 {"http://google.com/",S_OK,FALSE},
3315 {"http",S_OK,FALSE},
3316 {"",S_FALSE,FALSE},
3317 {"",S_FALSE,FALSE}
3318 },
3319 {
3320 {Uri_HOST_DNS,S_OK,FALSE},
3321 {80,S_OK,FALSE},
3322 {URL_SCHEME_HTTP,S_OK,FALSE},
3323 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3324 }
3325 },
3326 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3327 {
3328 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3329 {"g%0aoogle.co%0dm",S_OK,FALSE},
3330 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3331 {"g%0aoogle.co%0dm",S_OK,FALSE},
3332 {"",S_FALSE,FALSE},
3333 {"",S_FALSE,FALSE},
3334 {"g%0aoogle.co%0dm",S_OK,FALSE},
3335 {"",S_FALSE,FALSE},
3336 {"/%0A%0A%0A",S_OK,FALSE},
3337 {"/%0A%0A%0A",S_OK,FALSE},
3338 {"",S_FALSE,FALSE},
3339 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3340 {"http",S_OK,FALSE},
3341 {"",S_FALSE,FALSE},
3342 {"",S_FALSE,FALSE}
3343 },
3344 {
3345 {Uri_HOST_DNS,S_OK,FALSE},
3346 {80,S_OK,FALSE},
3347 {URL_SCHEME_HTTP,S_OK,FALSE},
3348 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3349 }
3350 },
3351 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3352 {
3353 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3354 {"g\noogle.co\rm",S_OK,FALSE},
3355 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3356 {"g\noogle.co\rm",S_OK,FALSE},
3357 {"",S_FALSE,FALSE},
3358 {"",S_FALSE,FALSE},
3359 {"g\noogle.co\rm",S_OK,FALSE},
3360 {"",S_FALSE,FALSE},
3361 {"/\n\n\n",S_OK,FALSE},
3362 {"/\n\n\n",S_OK,FALSE},
3363 {"",S_FALSE,FALSE},
3364 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3365 {"zip",S_OK,FALSE},
3366 {"",S_FALSE,FALSE},
3367 {"",S_FALSE,FALSE}
3368 },
3369 {
3370 {Uri_HOST_DNS,S_OK,FALSE},
3371 {0,S_FALSE,FALSE},
3372 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3373 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3374 }
3375 },
3376 /* Since file URLs are usually hierarchical, it returns an empty string
3377 * for the absolute URI property since it was declared as an opaque URI.
3378 */
3379 { "file:index.html", 0, S_OK, FALSE,
3380 {
3381 {"",S_FALSE,FALSE},
3382 {"",S_FALSE,FALSE},
3383 {"file:index.html",S_OK,FALSE},
3384 {"",S_FALSE,FALSE},
3385 {".html",S_OK,FALSE},
3386 {"",S_FALSE,FALSE},
3387 {"",S_FALSE,FALSE},
3388 {"",S_FALSE,FALSE},
3389 {"index.html",S_OK,FALSE},
3390 {"index.html",S_OK,FALSE},
3391 {"",S_FALSE,FALSE},
3392 {"file:index.html",S_OK,FALSE},
3393 {"file",S_OK,FALSE},
3394 {"",S_FALSE,FALSE},
3395 {"",S_FALSE,FALSE}
3396 },
3397 {
3398 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3399 {0,S_FALSE,FALSE},
3400 {URL_SCHEME_FILE,S_OK,FALSE},
3401 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3402 }
3403 },
3404 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3405 { "http:test.com/index.html", 0, S_OK, FALSE,
3406 {
3407 {"",S_FALSE,FALSE},
3408 {"",S_FALSE,FALSE},
3409 {"http:test.com/index.html",S_OK,FALSE},
3410 {"",S_FALSE,FALSE},
3411 {".html",S_OK,FALSE},
3412 {"",S_FALSE,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {"",S_FALSE,FALSE},
3415 {"test.com/index.html",S_OK,FALSE},
3416 {"test.com/index.html",S_OK,FALSE},
3417 {"",S_FALSE,FALSE},
3418 {"http:test.com/index.html",S_OK,FALSE},
3419 {"http",S_OK,FALSE},
3420 {"",S_FALSE,FALSE},
3421 {"",S_FALSE,FALSE}
3422 },
3423 {
3424 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3425 {80,S_OK,FALSE},
3426 {URL_SCHEME_HTTP,S_OK,FALSE},
3427 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3428 }
3429 },
3430 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3431 {
3432 {"",S_FALSE,FALSE},
3433 {"",S_FALSE,FALSE},
3434 {"ftp:test.com/index.html",S_OK,FALSE},
3435 {"",S_FALSE,FALSE},
3436 {".html",S_OK,FALSE},
3437 {"",S_FALSE,FALSE},
3438 {"",S_FALSE,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {"test.com/index.html",S_OK,FALSE},
3441 {"test.com/index.html",S_OK,FALSE},
3442 {"",S_FALSE,FALSE},
3443 {"ftp:test.com/index.html",S_OK,FALSE},
3444 {"ftp",S_OK,FALSE},
3445 {"",S_FALSE,FALSE},
3446 {"",S_FALSE,FALSE}
3447 },
3448 {
3449 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3450 {21,S_OK,FALSE},
3451 {URL_SCHEME_FTP,S_OK,FALSE},
3452 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3453 }
3454 },
3455 { "file://C|/test.mp3", 0, S_OK, FALSE,
3456 {
3457 {"file:///C:/test.mp3",S_OK,FALSE},
3458 {"",S_FALSE,FALSE},
3459 {"file:///C:/test.mp3",S_OK,FALSE},
3460 {"",S_FALSE,FALSE},
3461 {".mp3",S_OK,FALSE},
3462 {"",S_FALSE,FALSE},
3463 {"",S_FALSE,FALSE},
3464 {"",S_FALSE,FALSE},
3465 {"/C:/test.mp3",S_OK,FALSE},
3466 {"/C:/test.mp3",S_OK,FALSE},
3467 {"",S_FALSE,FALSE},
3468 {"file://C|/test.mp3",S_OK,FALSE},
3469 {"file",S_OK,FALSE},
3470 {"",S_FALSE,FALSE},
3471 {"",S_FALSE,FALSE}
3472 },
3473 {
3474 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3475 {0,S_FALSE,FALSE},
3476 {URL_SCHEME_FILE,S_OK,FALSE},
3477 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3478 }
3479 },
3480 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3481 {
3482 {"file:///C:/test.mp3",S_OK,FALSE},
3483 {"",S_FALSE,FALSE},
3484 {"file:///C:/test.mp3",S_OK,FALSE},
3485 {"",S_FALSE,FALSE},
3486 {".mp3",S_OK,FALSE},
3487 {"",S_FALSE,FALSE},
3488 {"",S_FALSE,FALSE},
3489 {"",S_FALSE,FALSE},
3490 {"/C:/test.mp3",S_OK,FALSE},
3491 {"/C:/test.mp3",S_OK,FALSE},
3492 {"",S_FALSE,FALSE},
3493 {"file:///C|/test.mp3",S_OK,FALSE},
3494 {"file",S_OK,FALSE},
3495 {"",S_FALSE,FALSE},
3496 {"",S_FALSE,FALSE}
3497 },
3498 {
3499 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3500 {0,S_FALSE,FALSE},
3501 {URL_SCHEME_FILE,S_OK,FALSE},
3502 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3503 }
3504 },
3505 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3506 * to '\\'.
3507 */
3508 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3509 {
3510 {"file://c:\\dir\\index.html",S_OK,FALSE},
3511 {"",S_FALSE,FALSE},
3512 {"file://c:\\dir\\index.html",S_OK,FALSE},
3513 {"",S_FALSE,FALSE},
3514 {".html",S_OK,FALSE},
3515 {"",S_FALSE,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {"",S_FALSE,FALSE},
3518 {"c:\\dir\\index.html",S_OK,FALSE},
3519 {"c:\\dir\\index.html",S_OK,FALSE},
3520 {"",S_FALSE,FALSE},
3521 {"file://c:/dir/index.html",S_OK,FALSE},
3522 {"file",S_OK,FALSE},
3523 {"",S_FALSE,FALSE},
3524 {"",S_FALSE,FALSE}
3525 },
3526 {
3527 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3528 {0,S_FALSE,FALSE},
3529 {URL_SCHEME_FILE,S_OK,FALSE},
3530 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3531 }
3532 },
3533 /* Extra '/' after "file://" is removed. */
3534 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3535 {
3536 {"file://c:\\dir\\index.html",S_OK,FALSE},
3537 {"",S_FALSE,FALSE},
3538 {"file://c:\\dir\\index.html",S_OK,FALSE},
3539 {"",S_FALSE,FALSE},
3540 {".html",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {"",S_FALSE,FALSE},
3543 {"",S_FALSE,FALSE},
3544 {"c:\\dir\\index.html",S_OK,FALSE},
3545 {"c:\\dir\\index.html",S_OK,FALSE},
3546 {"",S_FALSE,FALSE},
3547 {"file:///c:/dir/index.html",S_OK,FALSE},
3548 {"file",S_OK,FALSE},
3549 {"",S_FALSE,FALSE},
3550 {"",S_FALSE,FALSE}
3551 },
3552 {
3553 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3554 {0,S_FALSE,FALSE},
3555 {URL_SCHEME_FILE,S_OK,FALSE},
3556 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3557 }
3558 },
3559 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3560 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3561 {
3562 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3563 {"",S_FALSE,FALSE},
3564 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3565 {"",S_FALSE,FALSE},
3566 {".html",S_OK,FALSE},
3567 {"",S_FALSE,FALSE},
3568 {"",S_FALSE,FALSE},
3569 {"",S_FALSE,FALSE},
3570 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3571 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3572 {"",S_FALSE,FALSE},
3573 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3574 {"file",S_OK,FALSE},
3575 {"",S_FALSE,FALSE},
3576 {"",S_FALSE,FALSE}
3577 },
3578 {
3579 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3580 {0,S_FALSE,FALSE},
3581 {URL_SCHEME_FILE,S_OK,FALSE},
3582 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3583 }
3584 },
3585 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3586 {
3587 {"file://c:\\dir\\index.html",S_OK,FALSE},
3588 {"",S_FALSE,FALSE},
3589 {"file://c:\\dir\\index.html",S_OK,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {".html",S_OK,FALSE},
3592 {"",S_FALSE,FALSE},
3593 {"",S_FALSE,FALSE},
3594 {"",S_FALSE,FALSE},
3595 {"c:\\dir\\index.html",S_OK,FALSE},
3596 {"c:\\dir\\index.html",S_OK,FALSE},
3597 {"",S_FALSE,FALSE},
3598 {"file://c|/dir\\index.html",S_OK,FALSE},
3599 {"file",S_OK,FALSE},
3600 {"",S_FALSE,FALSE},
3601 {"",S_FALSE,FALSE}
3602 },
3603 {
3604 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3605 {0,S_FALSE,FALSE},
3606 {URL_SCHEME_FILE,S_OK,FALSE},
3607 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3608 }
3609 },
3610 /* The backslashes after the scheme name are converted to forward slashes. */
3611 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3612 {
3613 {"file://c:\\dir\\index.html",S_OK,FALSE},
3614 {"",S_FALSE,FALSE},
3615 {"file://c:\\dir\\index.html",S_OK,FALSE},
3616 {"",S_FALSE,FALSE},
3617 {".html",S_OK,FALSE},
3618 {"",S_FALSE,FALSE},
3619 {"",S_FALSE,FALSE},
3620 {"",S_FALSE,FALSE},
3621 {"c:\\dir\\index.html",S_OK,FALSE},
3622 {"c:\\dir\\index.html",S_OK,FALSE},
3623 {"",S_FALSE,FALSE},
3624 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3625 {"file",S_OK,FALSE},
3626 {"",S_FALSE,FALSE},
3627 {"",S_FALSE,FALSE}
3628 },
3629 {
3630 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3631 {0,S_FALSE,FALSE},
3632 {URL_SCHEME_FILE,S_OK,FALSE},
3633 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3634 }
3635 },
3636 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3637 {
3638 {"file:///c:/dir/index.html",S_OK,FALSE},
3639 {"",S_FALSE,FALSE},
3640 {"file:///c:/dir/index.html",S_OK,FALSE},
3641 {"",S_FALSE,FALSE},
3642 {".html",S_OK,FALSE},
3643 {"",S_FALSE,FALSE},
3644 {"",S_FALSE,FALSE},
3645 {"",S_FALSE,FALSE},
3646 {"/c:/dir/index.html",S_OK,FALSE},
3647 {"/c:/dir/index.html",S_OK,FALSE},
3648 {"",S_FALSE,FALSE},
3649 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3650 {"file",S_OK,FALSE},
3651 {"",S_FALSE,FALSE},
3652 {"",S_FALSE,FALSE}
3653 },
3654 {
3655 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3656 {0,S_FALSE,FALSE},
3657 {URL_SCHEME_FILE,S_OK,FALSE},
3658 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3659 }
3660 },
3661 { "http:\\\\google.com", 0, S_OK, FALSE,
3662 {
3663 {"http://google.com/",S_OK,FALSE},
3664 {"google.com",S_OK,FALSE},
3665 {"http://google.com/",S_OK,FALSE},
3666 {"google.com",S_OK,FALSE},
3667 {"",S_FALSE,FALSE},
3668 {"",S_FALSE,FALSE},
3669 {"google.com",S_OK,FALSE},
3670 {"",S_FALSE,FALSE},
3671 {"/",S_OK,FALSE},
3672 {"/",S_OK,FALSE},
3673 {"",S_FALSE,FALSE},
3674 {"http:\\\\google.com",S_OK,FALSE},
3675 {"http",S_OK,FALSE},
3676 {"",S_FALSE,FALSE},
3677 {"",S_FALSE,FALSE}
3678 },
3679 {
3680 {Uri_HOST_DNS,S_OK,FALSE},
3681 {80,S_OK,FALSE},
3682 {URL_SCHEME_HTTP,S_OK,FALSE},
3683 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3684 }
3685 },
3686 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3687 { "zip:\\\\google.com", 0, S_OK, FALSE,
3688 {
3689 {"zip:\\\\google.com",S_OK,FALSE},
3690 {"",S_FALSE,FALSE},
3691 {"zip:\\\\google.com",S_OK,FALSE},
3692 {"",S_FALSE,FALSE},
3693 {".com",S_OK,FALSE},
3694 {"",S_FALSE,FALSE},
3695 {"",S_FALSE,FALSE},
3696 {"",S_FALSE,FALSE},
3697 {"\\\\google.com",S_OK,FALSE},
3698 {"\\\\google.com",S_OK,FALSE},
3699 {"",S_FALSE,FALSE},
3700 {"zip:\\\\google.com",S_OK,FALSE},
3701 {"zip",S_OK,FALSE},
3702 {"",S_FALSE,FALSE},
3703 {"",S_FALSE,FALSE}
3704 },
3705 {
3706 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3707 {0,S_FALSE,FALSE},
3708 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3709 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3710 }
3711 },
3712 /* Dot segments aren't removed. */
3713 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3714 {
3715 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3716 {"",S_FALSE,FALSE},
3717 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3718 {"",S_FALSE,FALSE},
3719 {".html",S_OK,FALSE},
3720 {"",S_FALSE,FALSE},
3721 {"",S_FALSE,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3724 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3725 {"",S_FALSE,FALSE},
3726 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3727 {"file",S_OK,FALSE},
3728 {"",S_FALSE,FALSE},
3729 {"",S_FALSE,FALSE}
3730 },
3731 {
3732 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3733 {0,S_FALSE,FALSE},
3734 {URL_SCHEME_FILE,S_OK,FALSE},
3735 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3736 }
3737 },
3738 /* Forbidden characters aren't percent encoded. */
3739 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3740 {
3741 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3742 {"",S_FALSE,FALSE},
3743 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3744 {"",S_FALSE,FALSE},
3745 {".html",S_OK,FALSE},
3746 {"",S_FALSE,FALSE},
3747 {"",S_FALSE,FALSE},
3748 {"",S_FALSE,FALSE},
3749 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3750 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3751 {"",S_FALSE,FALSE},
3752 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3753 {"file",S_OK,FALSE},
3754 {"",S_FALSE,FALSE},
3755 {"",S_FALSE,FALSE}
3756 },
3757 {
3758 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3759 {0,S_FALSE,FALSE},
3760 {URL_SCHEME_FILE,S_OK,FALSE},
3761 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3762 }
3763 },
3764 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3765 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3766 {
3767 {"",S_FALSE,FALSE},
3768 {"",S_FALSE,FALSE},
3769 {"file:c:/dir/../../index.html",S_OK,FALSE},
3770 {"",S_FALSE,FALSE},
3771 {".html",S_OK,FALSE},
3772 {"",S_FALSE,FALSE},
3773 {"",S_FALSE,FALSE},
3774 {"",S_FALSE,FALSE},
3775 {"c:/dir/../../index.html",S_OK,FALSE},
3776 {"c:/dir/../../index.html",S_OK,FALSE},
3777 {"",S_FALSE,FALSE},
3778 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3779 {"file",S_OK,FALSE},
3780 {"",S_FALSE,FALSE},
3781 {"",S_FALSE,FALSE}
3782 },
3783 {
3784 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3785 {0,S_FALSE,FALSE},
3786 {URL_SCHEME_FILE,S_OK,FALSE},
3787 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3788 }
3789 },
3790 /* '/' are still converted to '\' even though it's an opaque URI. */
3791 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3792 {
3793 {"",S_FALSE,FALSE},
3794 {"",S_FALSE,FALSE},
3795 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {".html",S_OK,FALSE},
3798 {"",S_FALSE,FALSE},
3799 {"",S_FALSE,FALSE},
3800 {"",S_FALSE,FALSE},
3801 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3802 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3803 {"",S_FALSE,FALSE},
3804 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3805 {"file",S_OK,FALSE},
3806 {"",S_FALSE,FALSE},
3807 {"",S_FALSE,FALSE}
3808 },
3809 {
3810 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3811 {0,S_FALSE,FALSE},
3812 {URL_SCHEME_FILE,S_OK,FALSE},
3813 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3814 }
3815 },
3816 /* Forbidden characters aren't percent encoded. */
3817 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3818 {
3819 {"",S_FALSE,FALSE},
3820 {"",S_FALSE,FALSE},
3821 {"file:c:\\in^|dex.html",S_OK,FALSE},
3822 {"",S_FALSE,FALSE},
3823 {".html",S_OK,FALSE},
3824 {"",S_FALSE,FALSE},
3825 {"",S_FALSE,FALSE},
3826 {"",S_FALSE,FALSE},
3827 {"c:\\in^|dex.html",S_OK,FALSE},
3828 {"c:\\in^|dex.html",S_OK,FALSE},
3829 {"",S_FALSE,FALSE},
3830 {"file:c:\\in^|dex.html",S_OK,FALSE},
3831 {"file",S_OK,FALSE},
3832 {"",S_FALSE,FALSE},
3833 {"",S_FALSE,FALSE}
3834 },
3835 {
3836 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3837 {0,S_FALSE,FALSE},
3838 {URL_SCHEME_FILE,S_OK,FALSE},
3839 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3840 }
3841 },
3842 /* Doesn't have a UserName since the ':' appears at the beginning of the
3843 * userinfo section.
3844 */
3845 { "http://:password@gov.uk", 0, S_OK, FALSE,
3846 {
3847 {"http://:password@gov.uk/",S_OK,FALSE},
3848 {":password@gov.uk",S_OK,FALSE},
3849 {"http://gov.uk/",S_OK,FALSE},
3850 {"",S_FALSE,FALSE},
3851 {"",S_FALSE,FALSE},
3852 {"",S_FALSE,FALSE},
3853 {"gov.uk",S_OK,FALSE},
3854 {"password",S_OK,FALSE},
3855 {"/",S_OK,FALSE},
3856 {"/",S_OK,FALSE},
3857 {"",S_FALSE,FALSE},
3858 {"http://:password@gov.uk",S_OK,FALSE},
3859 {"http",S_OK,FALSE},
3860 {":password",S_OK,FALSE},
3861 {"",S_FALSE,FALSE}
3862 },
3863 {
3864 {Uri_HOST_DNS,S_OK,FALSE},
3865 {80,S_OK,FALSE},
3866 {URL_SCHEME_HTTP,S_OK,FALSE},
3867 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3868 }
3869 },
3870 /* Has a UserName since the userinfo section doesn't contain a password. */
3871 { "http://@gov.uk", 0, S_OK, FALSE,
3872 {
3873 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3874 {"@gov.uk",S_OK,FALSE},
3875 {"http://gov.uk/",S_OK,FALSE},
3876 {"",S_FALSE,FALSE},
3877 {"",S_FALSE,FALSE},
3878 {"",S_FALSE,FALSE},
3879 {"gov.uk",S_OK,FALSE},
3880 {"",S_FALSE,FALSE},
3881 {"/",S_OK,FALSE},
3882 {"/",S_OK,FALSE},
3883 {"",S_FALSE,FALSE},
3884 {"http://@gov.uk",S_OK,FALSE},
3885 {"http",S_OK,FALSE},
3886 {"",S_OK,FALSE},
3887 {"",S_OK,FALSE}
3888 },
3889 {
3890 {Uri_HOST_DNS,S_OK,FALSE},
3891 {80,S_OK,FALSE},
3892 {URL_SCHEME_HTTP,S_OK,FALSE},
3893 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3894 }
3895 },
3896 /* ":@" not included in the absolute URI. */
3897 { "http://:@gov.uk", 0, S_OK, FALSE,
3898 {
3899 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3900 {":@gov.uk",S_OK,FALSE},
3901 {"http://gov.uk/",S_OK,FALSE},
3902 {"",S_FALSE,FALSE},
3903 {"",S_FALSE,FALSE},
3904 {"",S_FALSE,FALSE},
3905 {"gov.uk",S_OK,FALSE},
3906 {"",S_OK,FALSE},
3907 {"/",S_OK,FALSE},
3908 {"/",S_OK,FALSE},
3909 {"",S_FALSE,FALSE},
3910 {"http://:@gov.uk",S_OK,FALSE},
3911 {"http",S_OK,FALSE},
3912 {":",S_OK,FALSE},
3913 {"",S_FALSE,FALSE}
3914 },
3915 {
3916 {Uri_HOST_DNS,S_OK,FALSE},
3917 {80,S_OK,FALSE},
3918 {URL_SCHEME_HTTP,S_OK,FALSE},
3919 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3920 }
3921 },
3922 /* '@' is included because it's an unknown scheme type. */
3923 { "zip://@gov.uk", 0, S_OK, FALSE,
3924 {
3925 {"zip://@gov.uk/",S_OK,FALSE},
3926 {"@gov.uk",S_OK,FALSE},
3927 {"zip://@gov.uk/",S_OK,FALSE},
3928 {"",S_FALSE,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {"",S_FALSE,FALSE},
3931 {"gov.uk",S_OK,FALSE},
3932 {"",S_FALSE,FALSE},
3933 {"/",S_OK,FALSE},
3934 {"/",S_OK,FALSE},
3935 {"",S_FALSE,FALSE},
3936 {"zip://@gov.uk",S_OK,FALSE},
3937 {"zip",S_OK,FALSE},
3938 {"",S_OK,FALSE},
3939 {"",S_OK,FALSE}
3940 },
3941 {
3942 {Uri_HOST_DNS,S_OK,FALSE},
3943 {0,S_FALSE,FALSE},
3944 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3945 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3946 }
3947 },
3948 /* ":@" are included because it's an unknown scheme type. */
3949 { "zip://:@gov.uk", 0, S_OK, FALSE,
3950 {
3951 {"zip://:@gov.uk/",S_OK,FALSE},
3952 {":@gov.uk",S_OK,FALSE},
3953 {"zip://:@gov.uk/",S_OK,FALSE},
3954 {"",S_FALSE,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"",S_FALSE,FALSE},
3957 {"gov.uk",S_OK,FALSE},
3958 {"",S_OK,FALSE},
3959 {"/",S_OK,FALSE},
3960 {"/",S_OK,FALSE},
3961 {"",S_FALSE,FALSE},
3962 {"zip://:@gov.uk",S_OK,FALSE},
3963 {"zip",S_OK,FALSE},
3964 {":",S_OK,FALSE},
3965 {"",S_FALSE,FALSE}
3966 },
3967 {
3968 {Uri_HOST_DNS,S_OK,FALSE},
3969 {0,S_FALSE,FALSE},
3970 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3971 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3972 }
3973 },
3974 { "about:blank", 0, S_OK, FALSE,
3975 {
3976 {"about:blank",S_OK,FALSE},
3977 {"",S_FALSE,FALSE},
3978 {"about:blank",S_OK,FALSE},
3979 {"",S_FALSE,FALSE},
3980 {"",S_FALSE,FALSE},
3981 {"",S_FALSE,FALSE},
3982 {"",S_FALSE,FALSE},
3983 {"",S_FALSE,FALSE},
3984 {"blank",S_OK,FALSE},
3985 {"blank",S_OK,FALSE},
3986 {"",S_FALSE,FALSE},
3987 {"about:blank",S_OK,FALSE},
3988 {"about",S_OK,FALSE},
3989 {"",S_FALSE,FALSE},
3990 {"",S_FALSE,FALSE}
3991 },
3992 {
3993 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3994 {0,S_FALSE,FALSE},
3995 {URL_SCHEME_ABOUT,S_OK,FALSE},
3996 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3997 }
3998 },
3999 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
4000 {
4001 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4002 {"",S_FALSE,FALSE},
4003 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {".htm",S_OK,FALSE},
4006 {"",S_FALSE,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"",S_FALSE,FALSE},
4009 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4010 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4011 {"",S_FALSE,FALSE},
4012 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
4013 {"mk",S_OK,FALSE},
4014 {"",S_FALSE,FALSE},
4015 {"",S_FALSE,FALSE}
4016 },
4017 {
4018 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4019 {0,S_FALSE,FALSE},
4020 {URL_SCHEME_MK,S_OK,FALSE},
4021 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4022 }
4023 },
4024 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
4025 {
4026 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4027 {"",S_FALSE,FALSE},
4028 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {".htm",S_OK,FALSE},
4031 {"",S_FALSE,FALSE},
4032 {"",S_FALSE,FALSE},
4033 {"",S_FALSE,FALSE},
4034 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4035 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4036 {"",S_FALSE,FALSE},
4037 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
4038 {"mk",S_OK,FALSE},
4039 {"",S_FALSE,FALSE},
4040 {"",S_FALSE,FALSE}
4041 },
4042 {
4043 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4044 {0,S_FALSE,FALSE},
4045 {URL_SCHEME_MK,S_OK,FALSE},
4046 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4047 }
4048 },
4049 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4050 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
4051 {
4052 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4053 {"server",S_OK,FALSE},
4054 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
4055 {"",S_FALSE,FALSE},
4056 {".html",S_OK,FALSE},
4057 {"",S_FALSE,FALSE},
4058 {"server",S_OK,FALSE},
4059 {"",S_FALSE,FALSE},
4060 {"\\dir\\index.html",S_OK,FALSE},
4061 {"\\dir\\index.html",S_OK,FALSE},
4062 {"",S_FALSE,FALSE},
4063 {"file://server/dir/index.html",S_OK,FALSE},
4064 {"file",S_OK,FALSE},
4065 {"",S_FALSE,FALSE},
4066 {"",S_FALSE,FALSE}
4067 },
4068 {
4069 {Uri_HOST_DNS,S_OK,FALSE},
4070 {0,S_FALSE,FALSE},
4071 {URL_SCHEME_FILE,S_OK,FALSE},
4072 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4073 }
4074 },
4075 /* When CreateUri generates an IUri, it still displays the default port in the
4076 * authority.
4077 */
4078 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4079 {
4080 {"http://google.com:80/",S_OK,FALSE},
4081 {"google.com:80",S_OK,FALSE},
4082 {"http://google.com:80/",S_OK,FALSE},
4083 {"google.com",S_OK,FALSE},
4084 {"",S_FALSE,FALSE},
4085 {"",S_FALSE,FALSE},
4086 {"google.com",S_OK,FALSE},
4087 {"",S_FALSE,FALSE},
4088 {"/",S_OK,FALSE},
4089 {"/",S_OK,FALSE},
4090 {"",S_FALSE,FALSE},
4091 {"http://google.com:80/",S_OK,FALSE},
4092 {"http",S_OK,FALSE},
4093 {"",S_FALSE,FALSE},
4094 {"",S_FALSE,FALSE}
4095 },
4096 {
4097 {Uri_HOST_DNS,S_OK,FALSE},
4098 {80,S_OK,FALSE},
4099 {URL_SCHEME_HTTP,S_OK,FALSE},
4100 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4101 }
4102 },
4103 /* For res URIs the host is everything up until the first '/'. */
4104 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4105 {
4106 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4107 {"C:\\dir\\file.exe",S_OK,FALSE},
4108 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4109 {"",S_FALSE,FALSE},
4110 {".html",S_OK,FALSE},
4111 {"",S_FALSE,FALSE},
4112 {"C:\\dir\\file.exe",S_OK,FALSE},
4113 {"",S_FALSE,FALSE},
4114 {"/DATA/test.html",S_OK,FALSE},
4115 {"/DATA/test.html",S_OK,FALSE},
4116 {"",S_FALSE,FALSE},
4117 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4118 {"res",S_OK,FALSE},
4119 {"",S_FALSE,FALSE},
4120 {"",S_FALSE,FALSE}
4121 },
4122 {
4123 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4124 {0,S_FALSE,FALSE},
4125 {URL_SCHEME_RES,S_OK,FALSE},
4126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4127 }
4128 },
4129 /* Res URI can contain a '|' in the host name. */
4130 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4131 {
4132 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4133 {"c:\\di|r\\file.exe",S_OK,FALSE},
4134 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4135 {"",S_FALSE,FALSE},
4136 {"",S_FALSE,FALSE},
4137 {"",S_FALSE,FALSE},
4138 {"c:\\di|r\\file.exe",S_OK,FALSE},
4139 {"",S_FALSE,FALSE},
4140 {"/test",S_OK,FALSE},
4141 {"/test",S_OK,FALSE},
4142 {"",S_FALSE,FALSE},
4143 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4144 {"res",S_OK,FALSE},
4145 {"",S_FALSE,FALSE},
4146 {"",S_FALSE,FALSE}
4147 },
4148 {
4149 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4150 {0,S_FALSE,FALSE},
4151 {URL_SCHEME_RES,S_OK,FALSE},
4152 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4153 }
4154 },
4155 /* Res URIs can have invalid percent encoded values. */
4156 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4157 {
4158 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4159 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4160 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4161 {"",S_FALSE,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {"",S_FALSE,FALSE},
4164 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4165 {"",S_FALSE,FALSE},
4166 {"/test",S_OK,FALSE},
4167 {"/test",S_OK,FALSE},
4168 {"",S_FALSE,FALSE},
4169 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4170 {"res",S_OK,FALSE},
4171 {"",S_FALSE,FALSE},
4172 {"",S_FALSE,FALSE}
4173 },
4174 {
4175 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4176 {0,S_FALSE,FALSE},
4177 {URL_SCHEME_RES,S_OK,FALSE},
4178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4179 }
4180 },
4181 /* Res doesn't get forbidden characters percent encoded in its path. */
4182 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4183 {
4184 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4185 {"c:\\test",S_OK,FALSE},
4186 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4187 {"",S_FALSE,FALSE},
4188 {"",S_FALSE,FALSE},
4189 {"",S_FALSE,FALSE},
4190 {"c:\\test",S_OK,FALSE},
4191 {"",S_FALSE,FALSE},
4192 {"/tes<|>t",S_OK,FALSE},
4193 {"/tes<|>t",S_OK,FALSE},
4194 {"",S_FALSE,FALSE},
4195 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4196 {"res",S_OK,FALSE},
4197 {"",S_FALSE,FALSE},
4198 {"",S_FALSE,FALSE}
4199 },
4200 {
4201 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4202 {0,S_FALSE,FALSE},
4203 {URL_SCHEME_RES,S_OK,FALSE},
4204 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4205 }
4206 },
4207 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4208 {
4209 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4210 {"",S_FALSE,FALSE},
4211 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4212 {"",S_FALSE,FALSE},
4213 {".jpg",S_OK,FALSE},
4214 {"",S_FALSE,FALSE},
4215 {"",S_FALSE,FALSE},
4216 {"",S_FALSE,FALSE},
4217 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4218 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4219 {"",S_FALSE,FALSE},
4220 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4221 {"mk",S_OK,FALSE},
4222 {"",S_FALSE,FALSE},
4223 {"",S_FALSE,FALSE}
4224 },
4225 {
4226 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4227 {0,S_FALSE,FALSE},
4228 {URL_SCHEME_MK,S_OK,FALSE},
4229 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4230 }
4231 },
4232 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4233 {
4234 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4235 {"",S_FALSE,FALSE},
4236 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {".jpg",S_OK,FALSE},
4239 {"",S_FALSE,FALSE},
4240 {"",S_FALSE,FALSE},
4241 {"",S_FALSE,FALSE},
4242 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4243 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4244 {"",S_FALSE,FALSE},
4245 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4246 {"mk",S_OK,FALSE},
4247 {"",S_FALSE,FALSE},
4248 {"",S_FALSE,FALSE}
4249 },
4250 {
4251 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4252 {0,S_FALSE,FALSE},
4253 {URL_SCHEME_MK,S_OK,FALSE},
4254 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4255 }
4256 },
4257 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4258 {
4259 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4260 {"",S_FALSE,FALSE},
4261 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {".jpg",S_OK,FALSE},
4264 {"",S_FALSE,FALSE},
4265 {"",S_FALSE,FALSE},
4266 {"",S_FALSE,FALSE},
4267 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4268 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4269 {"",S_FALSE,FALSE},
4270 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4271 {"xx",S_OK,FALSE},
4272 {"",S_FALSE,FALSE},
4273 {"",S_FALSE,FALSE}
4274 },
4275 {
4276 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4277 {0,S_FALSE,FALSE},
4278 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4279 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4280 }
4281 },
4282 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4283 {
4284 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4285 {"",S_FALSE,FALSE},
4286 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {".jpg",S_OK,FALSE},
4289 {"",S_FALSE,FALSE},
4290 {"",S_FALSE,FALSE},
4291 {"",S_FALSE,FALSE},
4292 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4293 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4294 {"",S_FALSE,FALSE},
4295 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4296 {"mk",S_OK,FALSE},
4297 {"",S_FALSE,FALSE},
4298 {"",S_FALSE,FALSE}
4299 },
4300 {
4301 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4302 {0,S_FALSE,FALSE},
4303 {URL_SCHEME_MK,S_OK,FALSE},
4304 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4305 }
4306 },
4307 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4308 {
4309 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4310 {"",S_FALSE,FALSE},
4311 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4312 {"",S_FALSE,FALSE},
4313 {".jpg",S_OK,FALSE},
4314 {"",S_FALSE,FALSE},
4315 {"",S_FALSE,FALSE},
4316 {"",S_FALSE,FALSE},
4317 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4318 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4319 {"",S_FALSE,FALSE},
4320 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4321 {"mk",S_OK,FALSE},
4322 {"",S_FALSE,FALSE},
4323 {"",S_FALSE,FALSE}
4324 },
4325 {
4326 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4327 {0,S_FALSE,FALSE},
4328 {URL_SCHEME_MK,S_OK,FALSE},
4329 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4330 }
4331 },
4332 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4333 {
4334 {"mk:images/xxx.jpg",S_OK,FALSE},
4335 {"",S_FALSE,FALSE},
4336 {"mk:images/xxx.jpg",S_OK,FALSE},
4337 {"",S_FALSE,FALSE},
4338 {".jpg",S_OK,FALSE},
4339 {"",S_FALSE,FALSE},
4340 {"",S_FALSE,FALSE},
4341 {"",S_FALSE,FALSE},
4342 {"images/xxx.jpg",S_OK,FALSE},
4343 {"images/xxx.jpg",S_OK,FALSE},
4344 {"",S_FALSE,FALSE},
4345 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4346 {"mk",S_OK,FALSE},
4347 {"",S_FALSE,FALSE},
4348 {"",S_FALSE,FALSE}
4349 },
4350 {
4351 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4352 {0,S_FALSE,FALSE},
4353 {URL_SCHEME_MK,S_OK,FALSE},
4354 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4355 }
4356 },
4357 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4358 {
4359 {"",S_OK,FALSE},
4360 {"",S_FALSE,FALSE},
4361 {"",S_OK,FALSE},
4362 {"",S_FALSE,FALSE},
4363 {"",S_FALSE,FALSE},
4364 {"",S_FALSE,FALSE},
4365 {"",S_FALSE,FALSE},
4366 {"",S_FALSE,FALSE},
4367 {"",S_OK,FALSE},
4368 {"",S_OK,FALSE},
4369 {"",S_FALSE,FALSE},
4370 {"",S_OK,FALSE},
4371 {"",S_FALSE,FALSE},
4372 {"",S_FALSE,FALSE},
4373 {"",S_FALSE,FALSE}
4374 },
4375 {
4376 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4377 {0,S_FALSE,FALSE},
4378 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4379 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4380 }
4381 },
4382 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4383 {
4384 {"",S_OK,FALSE},
4385 {"",S_FALSE,FALSE},
4386 {"",S_OK,FALSE},
4387 {"",S_FALSE,FALSE},
4388 {"",S_FALSE,FALSE},
4389 {"",S_FALSE,FALSE},
4390 {"",S_FALSE,FALSE},
4391 {"",S_FALSE,FALSE},
4392 {"",S_OK,FALSE},
4393 {"",S_OK,FALSE},
4394 {"",S_FALSE,FALSE},
4395 {"",S_OK,FALSE},
4396 {"",S_FALSE,FALSE},
4397 {"",S_FALSE,FALSE},
4398 {"",S_FALSE,FALSE}
4399 },
4400 {
4401 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4402 {0,S_FALSE,FALSE},
4403 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4404 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4405 }
4406 },
4407 { "javascript:void", 0, S_OK, FALSE,
4408 {
4409 {"javascript:void",S_OK},
4410 {"",S_FALSE},
4411 {"javascript:void",S_OK},
4412 {"",S_FALSE},
4413 {"",S_FALSE},
4414 {"",S_FALSE},
4415 {"",S_FALSE},
4416 {"",S_FALSE},
4417 {"void",S_OK},
4418 {"void",S_OK},
4419 {"",S_FALSE},
4420 {"javascript:void",S_OK},
4421 {"javascript",S_OK},
4422 {"",S_FALSE},
4423 {"",S_FALSE}
4424 },
4425 {
4426 {Uri_HOST_UNKNOWN,S_OK},
4427 {0,S_FALSE},
4428 {URL_SCHEME_JAVASCRIPT,S_OK},
4429 {URLZONE_INVALID,E_NOTIMPL}
4430 }
4431 },
4432 { "javascript://undefined", 0, S_OK, FALSE,
4433 {
4434 {"javascript://undefined",S_OK},
4435 {"",S_FALSE},
4436 {"javascript://undefined",S_OK},
4437 {"",S_FALSE},
4438 {"",S_FALSE},
4439 {"",S_FALSE},
4440 {"",S_FALSE},
4441 {"",S_FALSE},
4442 {"//undefined",S_OK},
4443 {"//undefined",S_OK},
4444 {"",S_FALSE},
4445 {"javascript://undefined",S_OK},
4446 {"javascript",S_OK},
4447 {"",S_FALSE},
4448 {"",S_FALSE}
4449 },
4450 {
4451 {Uri_HOST_UNKNOWN,S_OK},
4452 {0,S_FALSE},
4453 {URL_SCHEME_JAVASCRIPT,S_OK},
4454 {URLZONE_INVALID,E_NOTIMPL}
4455 }
4456 },
4457 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4458 {
4459 {"javascript:escape('/\\?#?')",S_OK},
4460 {"",S_FALSE},
4461 {"javascript:escape('/\\?#?')",S_OK},
4462 {"",S_FALSE},
4463 {"",S_FALSE},
4464 {"",S_FALSE},
4465 {"",S_FALSE},
4466 {"",S_FALSE},
4467 {"escape('/\\?#?')",S_OK},
4468 {"escape('/\\?#?')",S_OK},
4469 {"",S_FALSE},
4470 {"JavaSCript:escape('/\\?#?')",S_OK},
4471 {"javascript",S_OK},
4472 {"",S_FALSE},
4473 {"",S_FALSE}
4474 },
4475 {
4476 {Uri_HOST_UNKNOWN,S_OK},
4477 {0,S_FALSE},
4478 {URL_SCHEME_JAVASCRIPT,S_OK},
4479 {URLZONE_INVALID,E_NOTIMPL}
4480 }
4481 },
4482 { "*://google.com", 0, S_OK, FALSE,
4483 {
4484 {"*:google.com/",S_OK,FALSE},
4485 {"google.com",S_OK},
4486 {"*:google.com/",S_OK,FALSE},
4487 {"google.com",S_OK,FALSE},
4488 {"",S_FALSE,FALSE},
4489 {"",S_FALSE,FALSE},
4490 {"google.com",S_OK,FALSE},
4491 {"",S_FALSE,FALSE},
4492 {"/",S_OK,FALSE},
4493 {"/",S_OK,FALSE},
4494 {"",S_FALSE,FALSE},
4495 {"*://google.com",S_OK,FALSE},
4496 {"*",S_OK,FALSE},
4497 {"",S_FALSE,FALSE},
4498 {"",S_FALSE,FALSE}
4499 },
4500 {
4501 {Uri_HOST_DNS,S_OK,FALSE},
4502 {0,S_FALSE,FALSE},
4503 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4504 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4505 }
4506 },
4507 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4508 {
4509 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4510 {"",S_FALSE},
4511 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4512 {"",S_FALSE},
4513 {".txt",S_OK},
4514 {"",S_FALSE},
4515 {"",S_FALSE},
4516 {"",S_FALSE},
4517 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4518 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4519 {"",S_FALSE},
4520 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4521 {"mk",S_OK},
4522 {"",S_FALSE},
4523 {"",S_FALSE}
4524 },
4525 {
4526 {Uri_HOST_UNKNOWN,S_OK},
4527 {0,S_FALSE},
4528 {URL_SCHEME_MK,S_OK},
4529 {URLZONE_INVALID,E_NOTIMPL}
4530 }
4531 },
4532 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4533 {
4534 {"gopher://test.winehq.org:151/file.txt",S_OK},
4535 {"test.winehq.org:151",S_OK},
4536 {"gopher://test.winehq.org:151/file.txt",S_OK},
4537 {"winehq.org",S_OK},
4538 {".txt",S_OK},
4539 {"",S_FALSE},
4540 {"test.winehq.org",S_OK},
4541 {"",S_FALSE},
4542 {"/file.txt",S_OK},
4543 {"/file.txt",S_OK},
4544 {"",S_FALSE},
4545 {"gopher://test.winehq.org:151/file.txt",S_OK},
4546 {"gopher",S_OK},
4547 {"",S_FALSE},
4548 {"",S_FALSE}
4549 },
4550 {
4551 {Uri_HOST_DNS,S_OK},
4552 {151,S_OK},
4553 {URL_SCHEME_GOPHER,S_OK},
4554 {URLZONE_INVALID,E_NOTIMPL}
4555 }
4556 },
4557 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4558 {
4559 {"//host.com/path/file.txt?query",S_OK},
4560 {"host.com",S_OK},
4561 {"//host.com/path/file.txt?query",S_OK},
4562 {"host.com",S_OK},
4563 {".txt",S_OK},
4564 {"",S_FALSE},
4565 {"host.com",S_OK},
4566 {"",S_FALSE},
4567 {"/path/file.txt",S_OK},
4568 {"/path/file.txt?query",S_OK},
4569 {"?query",S_OK},
4570 {"//host.com/path/file.txt?query",S_OK},
4571 {"",S_FALSE},
4572 {"",S_FALSE},
4573 {"",S_FALSE},
4574 },
4575 {
4576 {Uri_HOST_DNS,S_OK},
4577 {0,S_FALSE},
4578 {URL_SCHEME_UNKNOWN,S_OK},
4579 {URLZONE_INVALID,E_NOTIMPL}
4580 }
4581 },
4582 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4583 {
4584 {"//host/path/file.txt?query",S_OK},
4585 {"host",S_OK},
4586 {"//host/path/file.txt?query",S_OK},
4587 {"",S_FALSE},
4588 {".txt",S_OK},
4589 {"",S_FALSE},
4590 {"host",S_OK},
4591 {"",S_FALSE},
4592 {"/path/file.txt",S_OK},
4593 {"/path/file.txt?query",S_OK},
4594 {"?query",S_OK},
4595 {"//host/path/file.txt?query",S_OK},
4596 {"",S_FALSE},
4597 {"",S_FALSE},
4598 {"",S_FALSE},
4599 },
4600 {
4601 {Uri_HOST_DNS,S_OK},
4602 {0,S_FALSE},
4603 {URL_SCHEME_UNKNOWN,S_OK},
4604 {URLZONE_INVALID,E_NOTIMPL}
4605 }
4606 },
4607 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4608 {
4609 {"//host/",S_OK},
4610 {"host",S_OK},
4611 {"//host/",S_OK},
4612 {"",S_FALSE},
4613 {"",S_FALSE},
4614 {"",S_FALSE},
4615 {"host",S_OK},
4616 {"",S_FALSE},
4617 {"/",S_OK},
4618 {"/",S_OK},
4619 {"",S_FALSE},
4620 {"//host",S_OK},
4621 {"",S_FALSE},
4622 {"",S_FALSE},
4623 {"",S_FALSE},
4624 },
4625 {
4626 {Uri_HOST_DNS,S_OK},
4627 {0,S_FALSE},
4628 {URL_SCHEME_UNKNOWN,S_OK},
4629 {URLZONE_INVALID,E_NOTIMPL}
4630 }
4631 },
4632 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4633 {
4634 {"mailto:",S_OK},
4635 {"",S_FALSE},
4636 {"mailto:",S_OK},
4637 {"",S_FALSE},
4638 {"",S_FALSE},
4639 {"",S_FALSE},
4640 {"",S_FALSE},
4641 {"",S_FALSE},
4642 {"",S_FALSE},
4643 {"",S_FALSE},
4644 {"",S_FALSE},
4645 {"mailto://",S_OK,FALSE,"mailto:"},
4646 {"mailto",S_OK},
4647 {"",S_FALSE},
4648 {"",S_FALSE}
4649 },
4650 {
4651 {Uri_HOST_UNKNOWN,S_OK},
4652 {0,S_FALSE},
4653 {URL_SCHEME_MAILTO,S_OK},
4654 {URLZONE_INVALID,E_NOTIMPL}
4655 }
4656 },
4657 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4658 {
4659 {"mailto:a@b.com",S_OK},
4660 {"",S_FALSE},
4661 {"mailto:a@b.com",S_OK},
4662 {"",S_FALSE},
4663 {".com",S_OK},
4664 {"",S_FALSE},
4665 {"",S_FALSE},
4666 {"",S_FALSE},
4667 {"a@b.com",S_OK},
4668 {"a@b.com",S_OK},
4669 {"",S_FALSE},
4670 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4671 {"mailto",S_OK},
4672 {"",S_FALSE},
4673 {"",S_FALSE}
4674 },
4675 {
4676 {Uri_HOST_UNKNOWN,S_OK},
4677 {0,S_FALSE},
4678 {URL_SCHEME_MAILTO,S_OK},
4679 {URLZONE_INVALID,E_NOTIMPL}
4680 }
4681 },
4682 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4683 {
4684 {"file://c:\\test file.html",S_OK,FALSE},
4685 {"",S_FALSE,FALSE},
4686 {"file://c:\\test file.html",S_OK,FALSE},
4687 {"",S_FALSE,FALSE},
4688 {".html",S_OK,FALSE},
4689 {"",S_FALSE,FALSE},
4690 {"",S_FALSE,FALSE},
4691 {"",S_FALSE,FALSE},
4692 {"c:\\test file.html",S_OK,FALSE},
4693 {"c:\\test file.html",S_OK,FALSE},
4694 {"",S_FALSE,FALSE},
4695 {"c:\\test file.html",S_OK,FALSE},
4696 {"file",S_OK,FALSE},
4697 {"",S_FALSE,FALSE},
4698 {"",S_FALSE,FALSE}
4699 },
4700 {
4701 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4702 {0,S_FALSE,FALSE},
4703 {URL_SCHEME_FILE,S_OK,FALSE},
4704 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4705 }
4706 },
4707 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4708 {
4709 {"file://c:\\test%20file.html",S_OK,FALSE},
4710 {"",S_FALSE,FALSE},
4711 {"file://c:\\test%20file.html",S_OK,FALSE},
4712 {"",S_FALSE,FALSE},
4713 {".html",S_OK,FALSE},
4714 {"",S_FALSE,FALSE},
4715 {"",S_FALSE,FALSE},
4716 {"",S_FALSE,FALSE},
4717 {"c:\\test%20file.html",S_OK,FALSE},
4718 {"c:\\test%20file.html",S_OK,FALSE},
4719 {"",S_FALSE,FALSE},
4720 {"c:\\test%20file.html",S_OK,FALSE},
4721 {"file",S_OK,FALSE},
4722 {"",S_FALSE,FALSE},
4723 {"",S_FALSE,FALSE}
4724 },
4725 {
4726 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4727 {0,S_FALSE,FALSE},
4728 {URL_SCHEME_FILE,S_OK,FALSE},
4729 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4730 }
4731 },
4732 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4733 {
4734 {"file:///c:/test%20file.html",S_OK,FALSE},
4735 {"",S_FALSE,FALSE},
4736 {"file:///c:/test%20file.html",S_OK,FALSE},
4737 {"",S_FALSE,FALSE},
4738 {".html",S_OK,FALSE},
4739 {"",S_FALSE,FALSE},
4740 {"",S_FALSE,FALSE},
4741 {"",S_FALSE,FALSE},
4742 {"/c:/test%20file.html",S_OK,FALSE},
4743 {"/c:/test%20file.html",S_OK,FALSE},
4744 {"",S_FALSE,FALSE},
4745 {"c:\\test file.html",S_OK,FALSE},
4746 {"file",S_OK,FALSE},
4747 {"",S_FALSE,FALSE},
4748 {"",S_FALSE,FALSE}
4749 },
4750 {
4751 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4752 {0,S_FALSE,FALSE},
4753 {URL_SCHEME_FILE,S_OK,FALSE},
4754 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4755 }
4756 },
4757 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4758 {
4759 {"file:///c:/test%2520file.html",S_OK,FALSE},
4760 {"",S_FALSE,FALSE},
4761 {"file:///c:/test%2520file.html",S_OK,FALSE},
4762 {"",S_FALSE,FALSE},
4763 {".html",S_OK,FALSE},
4764 {"",S_FALSE,FALSE},
4765 {"",S_FALSE,FALSE},
4766 {"",S_FALSE,FALSE},
4767 {"/c:/test%2520file.html",S_OK,FALSE},
4768 {"/c:/test%2520file.html",S_OK,FALSE},
4769 {"",S_FALSE,FALSE},
4770 {"c:\\test%20file.html",S_OK,FALSE},
4771 {"file",S_OK,FALSE},
4772 {"",S_FALSE,FALSE},
4773 {"",S_FALSE,FALSE}
4774 },
4775 {
4776 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4777 {0,S_FALSE,FALSE},
4778 {URL_SCHEME_FILE,S_OK,FALSE},
4779 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4780 }
4781 }
4782 };
4783
4784 typedef struct _invalid_uri {
4785 const char* uri;
4786 DWORD flags;
4787 BOOL todo;
4788 } invalid_uri;
4789
4790 static const invalid_uri invalid_uri_tests[] = {
4791 /* Has to have a scheme name. */
4792 {"://www.winehq.org",0,FALSE},
4793 /* Windows doesn't like URIs which are implicitly file paths without the
4794 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4795 */
4796 {"C:/test/test.mp3",0,FALSE},
4797 {"\\\\Server/test/test.mp3",0,FALSE},
4798 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4799 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4800 /* Invalid schemes. */
4801 {"*abcd://not.valid.com",0,FALSE},
4802 {"*a*b*c*d://not.valid.com",0,FALSE},
4803 /* Not allowed to have invalid % encoded data. */
4804 {"ftp://google.co%XX/",0,FALSE},
4805 /* Too many h16 components. */
4806 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4807 /* Not enough room for IPv4 address. */
4808 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4809 /* Not enough h16 components. */
4810 {"http://[1:2:3:4]",0,FALSE},
4811 /* Not enough components including IPv4. */
4812 {"http://[1:192.0.1.0]",0,FALSE},
4813 /* Not allowed to have partial IPv4 in IPv6. */
4814 {"http://[::192.0]",0,FALSE},
4815 /* Can't have elision of 1 h16 at beginning of address. */
4816 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4817 /* Expects a valid IP Literal. */
4818 {"ftp://[not.valid.uri]/",0,FALSE},
4819 /* Expects valid port for a known scheme type. */
4820 {"ftp://www.winehq.org:123fgh",0,FALSE},
4821 /* Port exceeds USHORT_MAX for known scheme type. */
4822 {"ftp://www.winehq.org:65536",0,FALSE},
4823 /* Invalid port with IPv4 address. */
4824 {"http://www.winehq.org:1abcd",0,FALSE},
4825 /* Invalid port with IPv6 address. */
4826 {"http://[::ffff]:32xy",0,FALSE},
4827 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4828 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4829 /* Not allowed to have invalid % encoded data in opaque URI path. */
4830 {"news:test%XX",0,FALSE},
4831 {"mailto:wine@winehq%G8.com",0,FALSE},
4832 /* Known scheme types can't have invalid % encoded data in query string. */
4833 {"http://google.com/?query=te%xx",0,FALSE},
4834 /* Invalid % encoded data in fragment of know scheme type. */
4835 {"ftp://google.com/#Test%xx",0,FALSE},
4836 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4837 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4838 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4839 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4840 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4841 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4842 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4843 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4844 /* res URIs aren't allowed to have forbidden dos path characters in the
4845 * hostname.
4846 */
4847 {"res://c:\\te<st\\test/test",0,FALSE},
4848 {"res://c:\\te>st\\test/test",0,FALSE},
4849 {"res://c:\\te\"st\\test/test",0,FALSE},
4850 {"res://c:\\test/te%xxst",0,FALSE}
4851 };
4852
4853 typedef struct _uri_equality {
4854 const char* a;
4855 DWORD create_flags_a;
4856 const char* b;
4857 DWORD create_flags_b;
4858 BOOL equal;
4859 BOOL todo;
4860 } uri_equality;
4861
4862 static const uri_equality equality_tests[] = {
4863 {
4864 "HTTP://www.winehq.org/test dir/./",0,
4865 "http://www.winehq.org/test dir/../test dir/",0,
4866 TRUE
4867 },
4868 {
4869 /* http://www.winehq.org/test%20dir */
4870 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4871 "http://www.winehq.org/test dir",0,
4872 TRUE
4873 },
4874 {
4875 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4876 "file:///c:/test.mp3",0,
4877 TRUE
4878 },
4879 {
4880 "ftp://ftp.winehq.org/",0,
4881 "ftp://ftp.winehq.org",0,
4882 TRUE
4883 },
4884 {
4885 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4886 "ftp://ftp.winehq.org/t%45stB/",0,
4887 FALSE
4888 },
4889 {
4890 "http://google.com/TEST",0,
4891 "http://google.com/test",0,
4892 FALSE
4893 },
4894 {
4895 "http://GOOGLE.com/",0,
4896 "http://google.com/",0,
4897 TRUE
4898 },
4899 /* Performs case insensitive compare of host names (for known scheme types). */
4900 {
4901 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4902 "ftp://google.com/",0,
4903 TRUE
4904 },
4905 {
4906 "zip://GOOGLE.com/",0,
4907 "zip://google.com/",0,
4908 FALSE
4909 },
4910 {
4911 "file:///c:/TEST/TeST/",0,
4912 "file:///c:/test/test/",0,
4913 TRUE
4914 },
4915 {
4916 "file:///server/TEST",0,
4917 "file:///SERVER/TEST",0,
4918 TRUE
4919 },
4920 {
4921 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4922 "http://google.com/",0,
4923 TRUE
4924 },
4925 {
4926 "ftp://google.com:21/",0,
4927 "ftp://google.com/",0,
4928 TRUE
4929 },
4930 {
4931 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4932 "http://google.com/",0,
4933 TRUE
4934 },
4935 {
4936 "http://google.com:70/",0,
4937 "http://google.com:71/",0,
4938 FALSE
4939 },
4940 {
4941 "file:///c:/dir/file.txt", 0,
4942 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4943 TRUE
4944 },
4945 {
4946 "file:///c:/dir/file.txt", 0,
4947 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4948 TRUE
4949 },
4950 {
4951 "file:///c:/dir/file.txt", 0,
4952 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4953 TRUE
4954 },
4955 {
4956 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4957 "file:///c:/%20dir/file.txt", 0,
4958 TRUE
4959 },
4960 {
4961 "file:///c:/Dir/file.txt", 0,
4962 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4963 TRUE
4964 },
4965 {
4966 "file:///c:/dir/file.txt", 0,
4967 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4968 TRUE
4969 },
4970 {
4971 "file:///c:/dir/file.txt#a", 0,
4972 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4973 FALSE
4974 },
4975 /* Tests of an empty hash/fragment part */
4976 {
4977 "http://google.com/test",0,
4978 "http://google.com/test#",0,
4979 FALSE
4980 },
4981 {
4982 "ftp://ftp.winehq.org/",0,
4983 "ftp://ftp.winehq.org/#",0,
4984 FALSE
4985 },
4986 {
4987 "file:///c:/dir/file.txt#", 0,
4988 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4989 FALSE
4990 }
4991 };
4992
4993 typedef struct _uri_with_fragment {
4994 const char* uri;
4995 const char* fragment;
4996 DWORD create_flags;
4997 HRESULT create_expected;
4998 BOOL create_todo;
4999
5000 const char* expected_uri;
5001 BOOL expected_todo;
5002 } uri_with_fragment;
5003
5004 static const uri_with_fragment uri_fragment_tests[] = {
5005 {
5006 "http://google.com/","#fragment",0,S_OK,FALSE,
5007 "http://google.com/#fragment",FALSE
5008 },
5009 {
5010 "http://google.com/","fragment",0,S_OK,FALSE,
5011 "http://google.com/#fragment",FALSE
5012 },
5013 {
5014 "zip://test.com/","?test",0,S_OK,FALSE,
5015 "zip://test.com/#?test",FALSE
5016 },
5017 /* The fragment can be empty. */
5018 {
5019 "ftp://ftp.google.com/","",0,S_OK,FALSE,
5020 "ftp://ftp.google.com/#",FALSE
5021 }
5022 };
5023
5024 typedef struct _uri_builder_property {
5025 BOOL change;
5026 const char *value;
5027 const char *expected_value;
5028 Uri_PROPERTY property;
5029 HRESULT expected;
5030 BOOL todo;
5031 } uri_builder_property;
5032
5033 typedef struct _uri_builder_port {
5034 BOOL change;
5035 BOOL set;
5036 DWORD value;
5037 HRESULT expected;
5038 BOOL todo;
5039 } uri_builder_port;
5040
5041 typedef struct _uri_builder_str_property {
5042 const char* expected;
5043 HRESULT result;
5044 BOOL todo;
5045 } uri_builder_str_property;
5046
5047 typedef struct _uri_builder_dword_property {
5048 DWORD expected;
5049 HRESULT result;
5050 BOOL todo;
5051 } uri_builder_dword_property;
5052
5053 typedef struct _uri_builder_test {
5054 const char *uri;
5055 DWORD create_flags;
5056 HRESULT create_builder_expected;
5057 BOOL create_builder_todo;
5058
5059 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
5060
5061 uri_builder_port port_prop;
5062
5063 DWORD uri_flags;
5064 HRESULT uri_hres;
5065 BOOL uri_todo;
5066
5067 DWORD uri_simple_encode_flags;
5068 HRESULT uri_simple_hres;
5069 BOOL uri_simple_todo;
5070
5071 DWORD uri_with_flags;
5072 DWORD uri_with_builder_flags;
5073 DWORD uri_with_encode_flags;
5074 HRESULT uri_with_hres;
5075 BOOL uri_with_todo;
5076
5077 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
5078 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
5079 } uri_builder_test;
5080
5081 static const uri_builder_test uri_builder_tests[] = {
5082 { "http://google.com/",0,S_OK,FALSE,
5083 {
5084 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5085 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
5086 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
5087 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5088 },
5089 {FALSE},
5090 0,S_OK,FALSE,
5091 0,S_OK,FALSE,
5092 0,0,0,S_OK,FALSE,
5093 {
5094 {"http://username:password@google.com/?query=x#fragment",S_OK},
5095 {"username:password@google.com",S_OK},
5096 {"http://google.com/?query=x#fragment",S_OK},
5097 {"google.com",S_OK},
5098 {"",S_FALSE},
5099 {"#fragment",S_OK},
5100 {"google.com",S_OK},
5101 {"password",S_OK},
5102 {"/",S_OK},
5103 {"/?query=x",S_OK},
5104 {"?query=x",S_OK},
5105 {"http://username:password@google.com/?query=x#fragment",S_OK},
5106 {"http",S_OK},
5107 {"username:password",S_OK},
5108 {"username",S_OK}
5109 },
5110 {
5111 {Uri_HOST_DNS,S_OK},
5112 {80,S_OK},
5113 {URL_SCHEME_HTTP,S_OK},
5114 {URLZONE_INVALID,E_NOTIMPL}
5115 }
5116 },
5117 { "http://google.com/",0,S_OK,FALSE,
5118 {
5119 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5120 },
5121 {TRUE,TRUE,120,S_OK,FALSE},
5122 0,S_OK,FALSE,
5123 0,S_OK,FALSE,
5124 0,0,0,S_OK,FALSE,
5125 {
5126 {"test://google.com:120/",S_OK},
5127 {"google.com:120",S_OK},
5128 {"test://google.com:120/",S_OK},
5129 {"google.com",S_OK},
5130 {"",S_FALSE},
5131 {"",S_FALSE},
5132 {"google.com",S_OK},
5133 {"",S_FALSE},
5134 {"/",S_OK},
5135 {"/",S_OK},
5136 {"",S_FALSE},
5137 {"test://google.com:120/",S_OK},
5138 {"test",S_OK},
5139 {"",S_FALSE},
5140 {"",S_FALSE}
5141 },
5142 {
5143 {Uri_HOST_DNS,S_OK},
5144 {120,S_OK},
5145 {URL_SCHEME_UNKNOWN,S_OK},
5146 {URLZONE_INVALID,E_NOTIMPL}
5147 }
5148 },
5149 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5150 {
5151 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5152 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5153 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5154 },
5155 {FALSE},
5156 0,S_OK,FALSE,
5157 0,S_OK,FALSE,
5158 0,0,0,S_OK,FALSE,
5159 {
5160 {"http://[::192.2.3.4]/",S_OK},
5161 {"[::192.2.3.4]",S_OK},
5162 {"http://[::192.2.3.4]/",S_OK},
5163 {"",S_FALSE},
5164 {"",S_FALSE},
5165 {"",S_FALSE},
5166 {"::192.2.3.4",S_OK},
5167 {"",S_FALSE},
5168 {"/",S_OK},
5169 {"/",S_OK},
5170 {"",S_FALSE},
5171 {"http://[::192.2.3.4]/",S_OK},
5172 {"http",S_OK},
5173 {"",S_FALSE},
5174 {"",S_FALSE}
5175 },
5176 {
5177 {Uri_HOST_IPV6,S_OK},
5178 {80,S_OK},
5179 {URL_SCHEME_HTTP,S_OK},
5180 {URLZONE_INVALID,E_NOTIMPL}
5181 }
5182 },
5183 { "http://google.com/",0,S_OK,FALSE,
5184 {
5185 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5186 },
5187 {FALSE},
5188 0,S_OK,FALSE,
5189 0,S_OK,FALSE,
5190 0,0,0,S_OK,FALSE,
5191 {
5192 {"http://google.com/#Frag",S_OK},
5193 {"google.com",S_OK},
5194 {"http://google.com/#Frag",S_OK},
5195 {"google.com",S_OK},
5196 {"",S_FALSE},
5197 {"#Frag",S_OK},
5198 {"google.com",S_OK},
5199 {"",S_FALSE},
5200 {"/",S_OK},
5201 {"/",S_OK},
5202 {"",S_FALSE},
5203 {"http://google.com/#Frag",S_OK},
5204 {"http",S_OK},
5205 {"",S_FALSE},
5206 {"",S_FALSE}
5207 },
5208 {
5209 {Uri_HOST_DNS,S_OK},
5210 {80,S_OK},
5211 {URL_SCHEME_HTTP,S_OK},
5212 {URLZONE_INVALID,E_NOTIMPL}
5213 }
5214 },
5215 { "http://google.com/",0,S_OK,FALSE,
5216 {
5217 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5218 },
5219 {FALSE},
5220 0,S_OK,FALSE,
5221 0,S_OK,FALSE,
5222 0,0,0,S_OK,FALSE,
5223 {
5224 {"http://google.com/#",S_OK},
5225 {"google.com",S_OK},
5226 {"http://google.com/#",S_OK},
5227 {"google.com",S_OK},
5228 {"",S_FALSE},
5229 {"#",S_OK},
5230 {"google.com",S_OK},
5231 {"",S_FALSE},
5232 {"/",S_OK},
5233 {"/",S_OK},
5234 {"",S_FALSE},
5235 {"http://google.com/#",S_OK},
5236 {"http",S_OK},
5237 {"",S_FALSE},
5238 {"",S_FALSE}
5239 },
5240 {
5241 {Uri_HOST_DNS,S_OK},
5242 {80,S_OK},
5243 {URL_SCHEME_HTTP,S_OK},
5244 {URLZONE_INVALID,E_NOTIMPL}
5245 }
5246 },
5247 { "http://google.com/",0,S_OK,FALSE,
5248 {
5249 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5250 },
5251 {FALSE},
5252 0,S_OK,FALSE,
5253 0,S_OK,FALSE,
5254 0,0,0,S_OK,FALSE,
5255 {
5256 {"http://::password@google.com/",S_OK},
5257 {"::password@google.com",S_OK},
5258 {"http://google.com/",S_OK},
5259 {"google.com",S_OK},
5260 {"",S_FALSE},
5261 {"",S_FALSE},
5262 {"google.com",S_OK},
5263 {":password",S_OK},
5264 {"/",S_OK},
5265 {"/",S_OK},
5266 {"",S_FALSE},
5267 {"http://::password@google.com/",S_OK},
5268 {"http",S_OK},
5269 {"::password",S_OK},
5270 {"",S_FALSE}
5271 },
5272 {
5273 {Uri_HOST_DNS,S_OK},
5274 {80,S_OK},
5275 {URL_SCHEME_HTTP,S_OK},
5276 {URLZONE_INVALID,E_NOTIMPL}
5277 }
5278 },
5279 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5280 {
5281 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5282 },
5283 {FALSE},
5284 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5285 0,S_OK,FALSE,
5286 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5287 {
5288 {":password@test/test",S_OK},
5289 {":password@",S_OK},
5290 {":password@test/test",S_OK},
5291 {"",S_FALSE},
5292 {"",S_FALSE},
5293 {"",S_FALSE},
5294 {"",S_FALSE},
5295 {"password",S_OK},
5296 {"test/test",S_OK},
5297 {"test/test",S_OK},
5298 {"",S_FALSE},
5299 {":password@test/test",S_OK},
5300 {"",S_FALSE},
5301 {":password",S_OK},
5302 {"",S_FALSE}
5303 },
5304 {
5305 {Uri_HOST_UNKNOWN,S_OK},
5306 {0,S_FALSE},
5307 {URL_SCHEME_UNKNOWN,S_OK},
5308 {URLZONE_INVALID,E_NOTIMPL}
5309 }
5310 },
5311 { "http://google.com/",0,S_OK,FALSE,
5312 {
5313 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5314 },
5315 {FALSE},
5316 0,S_OK,FALSE,
5317 0,S_OK,FALSE,
5318 0,0,0,S_OK,FALSE,
5319 {
5320 {"http://google.com/test/test",S_OK},
5321 {"google.com",S_OK},
5322 {"http://google.com/test/test",S_OK},
5323 {"google.com",S_OK},
5324 {"",S_FALSE},
5325 {"",S_FALSE},
5326 {"google.com",S_OK},
5327 {"",S_FALSE},
5328 {"/test/test",S_OK},
5329 {"/test/test",S_OK},
5330 {"",S_FALSE},
5331 {"http://google.com/test/test",S_OK},
5332 {"http",S_OK},
5333 {"",S_FALSE},
5334 {"",S_FALSE}
5335 },
5336 {
5337 {Uri_HOST_DNS,S_OK},
5338 {80,S_OK},
5339 {URL_SCHEME_HTTP,S_OK},
5340 {URLZONE_INVALID,E_NOTIMPL}
5341 }
5342 },
5343 { "zip:testing/test",0,S_OK,FALSE,
5344 {
5345 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5346 },
5347 {FALSE},
5348 0,S_OK,FALSE,
5349 0,S_OK,FALSE,
5350 0,0,0,S_OK,FALSE,
5351 {
5352 {"zip:test",S_OK},
5353 {"",S_FALSE},
5354 {"zip:test",S_OK},
5355 {"",S_FALSE},
5356 {"",S_FALSE},
5357 {"",S_FALSE},
5358 {"",S_FALSE},
5359 {"",S_FALSE},
5360 {"test",S_OK},
5361 {"test",S_OK},
5362 {"",S_FALSE},
5363 {"zip:test",S_OK},
5364 {"zip",S_OK},
5365 {"",S_FALSE},
5366 {"",S_FALSE}
5367 },
5368 {
5369 {Uri_HOST_UNKNOWN,S_OK},
5370 {0,S_FALSE},
5371 {URL_SCHEME_UNKNOWN,S_OK},
5372 {URLZONE_INVALID,E_NOTIMPL}
5373 }
5374 },
5375 { "http://google.com/",0,S_OK,FALSE,
5376 {
5377 {FALSE},
5378 },
5379 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5380 {TRUE,FALSE,555,S_OK,FALSE},
5381 0,S_OK,FALSE,
5382 0,S_OK,FALSE,
5383 0,0,0,S_OK,FALSE,
5384 {
5385 {"http://google.com/",S_OK},
5386 {"google.com",S_OK},
5387 {"http://google.com/",S_OK},
5388 {"google.com",S_OK},
5389 {"",S_FALSE},
5390 {"",S_FALSE},
5391 {"google.com",S_OK},
5392 {"",S_FALSE},
5393 {"/",S_OK},
5394 {"/",S_OK},
5395 {"",S_FALSE},
5396 {"http://google.com/",S_OK},
5397 {"http",S_OK},
5398 {"",S_FALSE},
5399 {"",S_FALSE}
5400 },
5401 {
5402 {Uri_HOST_DNS,S_OK},
5403 /* Still returns 80, even though earlier the port was disabled. */
5404 {80,S_OK},
5405 {URL_SCHEME_HTTP,S_OK},
5406 {URLZONE_INVALID,E_NOTIMPL}
5407 }
5408 },
5409 { "http://google.com/",0,S_OK,FALSE,
5410 {
5411 {FALSE},
5412 },
5413 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5414 * you'll get 122345 instead.
5415 */
5416 {TRUE,122345,222,S_OK,FALSE},
5417 0,S_OK,FALSE,
5418 0,S_OK,FALSE,
5419 0,0,0,S_OK,FALSE,
5420 {
5421 {"http://google.com:222/",S_OK},
5422 {"google.com:222",S_OK},
5423 {"http://google.com:222/",S_OK},
5424 {"google.com",S_OK},
5425 {"",S_FALSE},
5426 {"",S_FALSE},
5427 {"google.com",S_OK},
5428 {"",S_FALSE},
5429 {"/",S_OK},
5430 {"/",S_OK},
5431 {"",S_FALSE},
5432 {"http://google.com:222/",S_OK},
5433 {"http",S_OK},
5434 {"",S_FALSE},
5435 {"",S_FALSE}
5436 },
5437 {
5438 {Uri_HOST_DNS,S_OK},
5439 {222,S_OK},
5440 {URL_SCHEME_HTTP,S_OK},
5441 {URLZONE_INVALID,E_NOTIMPL}
5442 }
5443 },
5444 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5445 { "http://google.com/",0,S_OK,FALSE,
5446 {
5447 {FALSE},
5448 },
5449 {TRUE,TRUE,999999,S_OK,FALSE},
5450 0,S_OK,FALSE,
5451 0,S_OK,FALSE,
5452 0,0,0,S_OK,FALSE,
5453 {
5454 {"http://google.com:999999/",S_OK},
5455 {"google.com:999999",S_OK},
5456 {"http://google.com:999999/",S_OK},
5457 {"google.com",S_OK},
5458 {"",S_FALSE},
5459 {"",S_FALSE},
5460 {"google.com",S_OK},
5461 {"",S_FALSE},
5462 {"/",S_OK},
5463 {"/",S_OK},
5464 {"",S_FALSE},
5465 {"http://google.com:999999/",S_OK},
5466 {"http",S_OK},
5467 {"",S_FALSE},
5468 {"",S_FALSE}
5469 },
5470 {
5471 {Uri_HOST_DNS,S_OK},
5472 {999999,S_OK},
5473 {URL_SCHEME_HTTP,S_OK},
5474 {URLZONE_INVALID,E_NOTIMPL}
5475 }
5476 },
5477 { "http://google.com/",0,S_OK,FALSE,
5478 {
5479 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5480 },
5481
5482 {FALSE},
5483 0,S_OK,FALSE,
5484 0,S_OK,FALSE,
5485 0,0,0,S_OK,FALSE,
5486 {
5487 {"http://google.com/?test",S_OK},
5488 {"google.com",S_OK},
5489 {"http://google.com/?test",S_OK},
5490 {"google.com",S_OK},
5491 {"",S_FALSE},
5492 {"",S_FALSE},
5493 {"google.com",S_OK},
5494 {"",S_FALSE},
5495 {"/",S_OK},
5496 {"/?test",S_OK},
5497 {"?test",S_OK},
5498 {"http://google.com/?test",S_OK},
5499 {"http",S_OK},
5500 {"",S_FALSE},
5501 {"",S_FALSE}
5502 },
5503 {
5504 {Uri_HOST_DNS,S_OK},
5505 {80,S_OK},
5506 {URL_SCHEME_HTTP,S_OK},
5507 {URLZONE_INVALID,E_NOTIMPL}
5508 }
5509 },
5510 { "http://:password@google.com/",0,S_OK,FALSE,
5511 {
5512 {FALSE},
5513 },
5514 {FALSE},
5515 0,S_OK,FALSE,
5516 0,S_OK,FALSE,
5517 0,0,0,S_OK,FALSE,
5518 {
5519 {"http://:password@google.com/",S_OK},
5520 {":password@google.com",S_OK},
5521 {"http://google.com/",S_OK},
5522 {"google.com",S_OK},
5523 {"",S_FALSE},
5524 {"",S_FALSE},
5525 {"google.com",S_OK},
5526 {"password",S_OK},
5527 {"/",S_OK},
5528 {"/",S_OK},
5529 {"",S_FALSE},
5530 {"http://:password@google.com/",S_OK},
5531 {"http",S_OK},
5532 {":password",S_OK},
5533 {"",S_FALSE}
5534 },
5535 {
5536 {Uri_HOST_DNS,S_OK},
5537 {80,S_OK},
5538 {URL_SCHEME_HTTP,S_OK},
5539 {URLZONE_INVALID,E_NOTIMPL}
5540 }
5541 },
5542 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5543 { NULL,0,S_OK,FALSE,
5544 {
5545 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5546 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5547 },
5548 {FALSE},
5549 0,S_OK,FALSE,
5550 0,S_OK,FALSE,
5551 0,0,0,S_OK,FALSE,
5552 {
5553 {"http://google.com/",S_OK},
5554 {"google.com",S_OK},
5555 {"http://google.com/",S_OK},
5556 {"google.com",S_OK},
5557 {"",S_FALSE},
5558 {"",S_FALSE},
5559 {"google.com",S_OK},
5560 {"",S_FALSE},
5561 {"/",S_OK},
5562 {"/",S_OK},
5563 {"",S_FALSE},
5564 {"http://google.com/",S_OK},
5565 {"http",S_OK},
5566 {"",S_FALSE},
5567 {"",S_FALSE}
5568 },
5569 {
5570 {Uri_HOST_DNS,S_OK},
5571 {80,S_OK},
5572 {URL_SCHEME_HTTP,S_OK},
5573 {URLZONE_INVALID,E_NOTIMPL}
5574 }
5575 },
5576 /* Can't set the scheme name to NULL. */
5577 { "zip://google.com/",0,S_OK,FALSE,
5578 {
5579 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5580 },
5581 {FALSE},
5582 0,S_OK,FALSE,
5583 0,S_OK,FALSE,
5584 0,0,0,S_OK,FALSE,
5585 {
5586 {"zip://google.com/",S_OK},
5587 {"google.com",S_OK},
5588 {"zip://google.com/",S_OK},
5589 {"google.com",S_OK},
5590 {"",S_FALSE},
5591 {"",S_FALSE},
5592 {"google.com",S_OK},
5593 {"",S_FALSE},
5594 {"/",S_OK},
5595 {"/",S_OK},
5596 {"",S_FALSE},
5597 {"zip://google.com/",S_OK},
5598 {"zip",S_OK},
5599 {"",S_FALSE},
5600 {"",S_FALSE}
5601 },
5602 {
5603 {Uri_HOST_DNS,S_OK},
5604 {0,S_FALSE},
5605 {URL_SCHEME_UNKNOWN,S_OK},
5606 {URLZONE_INVALID,E_NOTIMPL}
5607 }
5608 },
5609 /* Can't set the scheme name to an empty string. */
5610 { "zip://google.com/",0,S_OK,FALSE,
5611 {
5612 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5613 },
5614 {FALSE},
5615 0,S_OK,FALSE,
5616 0,S_OK,FALSE,
5617 0,0,0,S_OK,FALSE,
5618 {
5619 {"zip://google.com/",S_OK},
5620 {"google.com",S_OK},
5621 {"zip://google.com/",S_OK},
5622 {"google.com",S_OK},
5623 {"",S_FALSE},
5624 {"",S_FALSE},
5625 {"google.com",S_OK},
5626 {"",S_FALSE},
5627 {"/",S_OK},
5628 {"/",S_OK},
5629 {"",S_FALSE},
5630 {"zip://google.com/",S_OK},
5631 {"zip",S_OK},
5632 {"",S_FALSE},
5633 {"",S_FALSE}
5634 },
5635 {
5636 {Uri_HOST_DNS,S_OK},
5637 {0,S_FALSE},
5638 {URL_SCHEME_UNKNOWN,S_OK},
5639 {URLZONE_INVALID,E_NOTIMPL}
5640 }
5641 },
5642 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5643 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5644 */
5645 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5646 {{FALSE}},
5647 {FALSE},
5648 -1,S_OK,FALSE,
5649 0,S_OK,FALSE,
5650 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5651 {
5652 {"http://google.com/../../",S_OK},
5653 {"google.com",S_OK},
5654 {"http://google.com/../../",S_OK},
5655 {"google.com",S_OK},
5656 {"",S_FALSE},
5657 {"",S_FALSE},
5658 {"google.com",S_OK},
5659 {"",S_FALSE},
5660 {"/../../",S_OK},
5661 {"/../../",S_OK},
5662 {"",S_FALSE},
5663 {"http://google.com/../../",S_OK},
5664 {"http",S_OK},
5665 {"",S_FALSE},
5666 {"",S_FALSE}
5667 },
5668 {
5669 {Uri_HOST_DNS,S_OK},
5670 {80,S_OK},
5671 {URL_SCHEME_HTTP,S_OK},
5672 {URLZONE_INVALID,E_NOTIMPL}
5673 }
5674 },
5675 { "http://google.com/",0,S_OK,FALSE,
5676 {
5677 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5678 },
5679 {FALSE},
5680 -1,S_OK,FALSE,
5681 0,S_OK,FALSE,
5682 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5683 {
5684 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5685 {"google.com",S_OK},
5686 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5687 {"google.com",S_OK},
5688 {"",S_FALSE},
5689 {"#Fr%3C%7C%3Eg",S_OK},
5690 {"google.com",S_OK},
5691 {"",S_FALSE},
5692 {"/",S_OK},
5693 {"/",S_OK},
5694 {"",S_FALSE},
5695 {"http://google.com/#Fr<|>g",S_OK},
5696 {"http",S_OK},
5697 {"",S_FALSE},
5698 {"",S_FALSE}
5699 },
5700 {
5701 {Uri_HOST_DNS,S_OK},
5702 {80,S_OK},
5703 {URL_SCHEME_HTTP,S_OK},
5704 {URLZONE_INVALID,E_NOTIMPL}
5705 }
5706 },
5707 { "http://google.com/",0,S_OK,FALSE,
5708 {
5709 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5710 },
5711 {FALSE},
5712 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5713 0,S_OK,FALSE,
5714 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5715 {
5716 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5717 {"google.com",S_OK},
5718 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5719 {"google.com",S_OK},
5720 {"",S_FALSE},
5721 {"#Fr%3C%7C%3Eg",S_OK},
5722 {"google.com",S_OK},
5723 {"",S_FALSE},
5724 {"/",S_OK},
5725 {"/",S_OK},
5726 {"",S_FALSE},
5727 {"http://google.com/#Fr<|>g",S_OK},
5728 {"http",S_OK},
5729 {"",S_FALSE},
5730 {"",S_FALSE}
5731 },
5732 {
5733 {Uri_HOST_DNS,S_OK},
5734 {80,S_OK},
5735 {URL_SCHEME_HTTP,S_OK},
5736 {URLZONE_INVALID,E_NOTIMPL}
5737 }
5738 },
5739 { NULL,0,S_OK,FALSE,
5740 {
5741 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5742 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5743 },
5744 {FALSE},
5745 0,INET_E_INVALID_URL,FALSE,
5746 0,INET_E_INVALID_URL,FALSE,
5747 0,0,0,INET_E_INVALID_URL,FALSE
5748 },
5749 { "http://google.com/",0,S_OK,FALSE,
5750 {
5751 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5752 },
5753 {FALSE},
5754 0,INET_E_INVALID_URL,FALSE,
5755 0,INET_E_INVALID_URL,FALSE,
5756 0,0,0,INET_E_INVALID_URL,FALSE
5757 },
5758 /* File scheme's can't have a username set. */
5759 { "file://google.com/",0,S_OK,FALSE,
5760 {
5761 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5762 },
5763 {FALSE},
5764 0,INET_E_INVALID_URL,FALSE,
5765 0,INET_E_INVALID_URL,FALSE,
5766 0,0,0,INET_E_INVALID_URL,FALSE
5767 },
5768 /* File schemes can't have a password set. */
5769 { "file://google.com/",0,S_OK,FALSE,
5770 {
5771 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5772 },
5773 {FALSE},
5774 0,INET_E_INVALID_URL,FALSE,
5775 0,INET_E_INVALID_URL,FALSE,
5776 0,0,0,INET_E_INVALID_URL,FALSE
5777 },
5778 /* UserName can't contain any character that is a delimeter for another
5779 * component that appears after it in a normal URI.
5780 */
5781 { "http://google.com/",0,S_OK,FALSE,
5782 {
5783 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5784 },
5785 {FALSE},
5786 0,INET_E_INVALID_URL,FALSE,
5787 0,INET_E_INVALID_URL,FALSE,
5788 0,0,0,INET_E_INVALID_URL,FALSE
5789 },
5790 { "http://google.com/",0,S_OK,FALSE,
5791 {
5792 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5793 },
5794 {FALSE},
5795 0,INET_E_INVALID_URL,FALSE,
5796 0,INET_E_INVALID_URL,FALSE,
5797 0,0,0,INET_E_INVALID_URL,FALSE
5798 },
5799 { "http://google.com/",0,S_OK,FALSE,
5800 {
5801 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5802 },
5803 {FALSE},
5804 0,INET_E_INVALID_URL,FALSE,
5805 0,INET_E_INVALID_URL,FALSE,
5806 0,0,0,INET_E_INVALID_URL,FALSE
5807 },
5808 { "http://google.com/",0,S_OK,FALSE,
5809 {
5810 {TRUE,"user?Query",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#Frag",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,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,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,"pass/path",NULL,Uri_PROPERTY_PASSWORD,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,"pass?query",NULL,Uri_PROPERTY_PASSWORD,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#frag",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,"winehq.org/test",NULL,Uri_PROPERTY_HOST,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,"winehq.org?test",NULL,Uri_PROPERTY_HOST,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,"winehq.org#test",NULL,Uri_PROPERTY_HOST,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 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5890 { "http://google.com/",0,S_OK,FALSE,
5891 {
5892 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5893 },
5894 {FALSE},
5895 0,S_OK,FALSE,
5896 0,S_OK,FALSE,
5897 0,0,0,S_OK,FALSE,
5898 {
5899 {"http://winehq.org:test/",S_OK},
5900 {"winehq.org:test",S_OK},
5901 {"http://winehq.org:test/",S_OK},
5902 {"winehq.org:test",S_OK},
5903 {"",S_FALSE},
5904 {"",S_FALSE},
5905 {"winehq.org:test",S_OK},
5906 {"",S_FALSE},
5907 {"/",S_OK},
5908 {"/",S_OK},
5909 {"",S_FALSE},
5910 {"http://winehq.org:test/",S_OK},
5911 {"http",S_OK},
5912 {"",S_FALSE},
5913 {"",S_FALSE}
5914 },
5915 {
5916 {Uri_HOST_DNS,S_OK},
5917 {80,S_OK},
5918 {URL_SCHEME_HTTP,S_OK},
5919 {URLZONE_INVALID,E_NOTIMPL}
5920 }
5921 },
5922 /* Can't set the host name to NULL. */
5923 { "http://google.com/",0,S_OK,FALSE,
5924 {
5925 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5926 },
5927 {FALSE},
5928 0,S_OK,FALSE,
5929 0,S_OK,FALSE,
5930 0,0,0,S_OK,FALSE,
5931 {
5932 {"http://google.com/",S_OK},
5933 {"google.com",S_OK},
5934 {"http://google.com/",S_OK},
5935 {"google.com",S_OK},
5936 {"",S_FALSE},
5937 {"",S_FALSE},
5938 {"google.com",S_OK},
5939 {"",S_FALSE},
5940 {"/",S_OK},
5941 {"/",S_OK},
5942 {"",S_FALSE},
5943 {"http://google.com/",S_OK},
5944 {"http",S_OK},
5945 {"",S_FALSE},
5946 {"",S_FALSE}
5947 },
5948 {
5949 {Uri_HOST_DNS,S_OK},
5950 {80,S_OK},
5951 {URL_SCHEME_HTTP,S_OK},
5952 {URLZONE_INVALID,E_NOTIMPL}
5953 }
5954 },
5955 /* Can set the host name to an empty string. */
5956 { "http://google.com/",0,S_OK,FALSE,
5957 {
5958 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5959 },
5960 {FALSE},
5961 0,S_OK,FALSE,
5962 0,S_OK,FALSE,
5963 0,0,0,S_OK,FALSE,
5964 {
5965 {"http:///",S_OK},
5966 {"",S_OK},
5967 {"http:///",S_OK},
5968 {"",S_FALSE},
5969 {"",S_FALSE},
5970 {"",S_FALSE},
5971 {"",S_OK},
5972 {"",S_FALSE},
5973 {"/",S_OK},
5974 {"/",S_OK},
5975 {"",S_FALSE},
5976 {"http:///",S_OK},
5977 {"http",S_OK},
5978 {"",S_FALSE},
5979 {"",S_FALSE}
5980 },
5981 {
5982 {Uri_HOST_UNKNOWN,S_OK},
5983 {80,S_OK},
5984 {URL_SCHEME_HTTP,S_OK},
5985 {URLZONE_INVALID,E_NOTIMPL}
5986 }
5987 },
5988 { "http://google.com/",0,S_OK,FALSE,
5989 {
5990 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5991 },
5992 {FALSE},
5993 0,INET_E_INVALID_URL,FALSE,
5994 0,INET_E_INVALID_URL,FALSE,
5995 0,0,0,INET_E_INVALID_URL,FALSE
5996 },
5997 { "http://google.com/",0,S_OK,FALSE,
5998 {
5999 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
6000 },
6001 {FALSE},
6002 0,INET_E_INVALID_URL,FALSE,
6003 0,INET_E_INVALID_URL,FALSE,
6004 0,0,0,INET_E_INVALID_URL,FALSE
6005 },
6006 { "http://google.com/",0,S_OK,FALSE,
6007 {
6008 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
6009 },
6010 {FALSE},
6011 0,INET_E_INVALID_URL,FALSE,
6012 0,INET_E_INVALID_URL,FALSE,
6013 0,0,0,INET_E_INVALID_URL,FALSE
6014 },
6015 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6016 {
6017 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6018 },
6019 {FALSE},
6020 0,S_OK,FALSE,
6021 0,S_OK,FALSE,
6022 0,0,0,S_OK,FALSE,
6023 {
6024 {"file:///c:/dir/file.html",S_OK},
6025 {"",S_FALSE},
6026 {"file:///c:/dir/file.html",S_OK},
6027 {"",S_FALSE},
6028 {".html",S_OK},
6029 {"",S_FALSE},
6030 {"",S_FALSE},
6031 {"",S_FALSE},
6032 {"/c:/dir/file.html",S_OK},
6033 {"/c:/dir/file.html",S_OK},
6034 {"",S_FALSE},
6035 {"file:///c:/dir/file.html",S_OK},
6036 {"file",S_OK},
6037 {"",S_FALSE},
6038 {"",S_FALSE}
6039 },
6040 {
6041 {Uri_HOST_UNKNOWN,S_OK},
6042 {0,S_FALSE},
6043 {URL_SCHEME_FILE,S_OK},
6044 {URLZONE_INVALID,E_NOTIMPL}
6045 }
6046 },
6047 { "file:///c:/dir/file.html",0,S_OK,FALSE,
6048 {
6049 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
6050 },
6051 {FALSE},
6052 0,S_OK,FALSE,
6053 0,S_OK,FALSE,
6054 0,0,0,S_OK,FALSE,
6055 {
6056 {"file:///c:/dir/file.html#",S_OK},
6057 {"",S_FALSE},
6058 {"file:///c:/dir/file.html#",S_OK},
6059 {"",S_FALSE},
6060 {".html",S_OK},
6061 {"#",S_OK},
6062 {"",S_FALSE},
6063 {"",S_FALSE},
6064 {"/c:/dir/file.html",S_OK},
6065 {"/c:/dir/file.html",S_OK},
6066 {"",S_FALSE},
6067 {"file:///c:/dir/file.html#",S_OK},
6068 {"file",S_OK},
6069 {"",S_FALSE},
6070 {"",S_FALSE}
6071 },
6072 {
6073 {Uri_HOST_UNKNOWN,S_OK},
6074 {0,S_FALSE},
6075 {URL_SCHEME_FILE,S_OK},
6076 {URLZONE_INVALID,E_NOTIMPL}
6077 }
6078 }
6079 };
6080
6081 typedef struct _uri_builder_remove_test {
6082 const char *uri;
6083 DWORD create_flags;
6084 HRESULT create_builder_expected;
6085 BOOL create_builder_todo;
6086
6087 DWORD remove_properties;
6088 HRESULT remove_expected;
6089 BOOL remove_todo;
6090
6091 const char *expected_uri;
6092 DWORD expected_flags;
6093 HRESULT expected_hres;
6094 BOOL expected_todo;
6095 } uri_builder_remove_test;
6096
6097 static const uri_builder_remove_test uri_builder_remove_tests[] = {
6098 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
6099 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
6100 "http://google.com/",0,S_OK,FALSE
6101 },
6102 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
6103 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
6104 "http://winehq.org/",0,S_OK,FALSE
6105 },
6106 { "zip://google.com?Test=x",0,S_OK,FALSE,
6107 Uri_HAS_HOST,S_OK,FALSE,
6108 "zip:/?Test=x",0,S_OK,FALSE
6109 },
6110 /* Doesn't remove the whole userinfo component. */
6111 { "http://username:pass@google.com/",0,S_OK,FALSE,
6112 Uri_HAS_USER_INFO,S_OK,FALSE,
6113 "http://username:pass@google.com/",0,S_OK,FALSE
6114 },
6115 /* Doesn't remove the domain. */
6116 { "http://google.com/",0,S_OK,FALSE,
6117 Uri_HAS_DOMAIN,S_OK,FALSE,
6118 "http://google.com/",0,S_OK,FALSE
6119 },
6120 { "http://google.com:120/",0,S_OK,FALSE,
6121 Uri_HAS_AUTHORITY,S_OK,FALSE,
6122 "http://google.com:120/",0,S_OK,FALSE
6123 },
6124 { "http://google.com/test.com/",0,S_OK,FALSE,
6125 Uri_HAS_EXTENSION,S_OK,FALSE,
6126 "http://google.com/test.com/",0,S_OK,FALSE
6127 },
6128 { "http://google.com/?test=x",0,S_OK,FALSE,
6129 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6130 "http://google.com/?test=x",0,S_OK,FALSE
6131 },
6132 /* Can't remove the scheme name. */
6133 { "http://google.com/?test=x",0,S_OK,FALSE,
6134 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6135 "http://google.com/?test=x",0,S_OK,FALSE
6136 }
6137 };
6138
6139 typedef struct _uri_combine_str_property {
6140 const char *value;
6141 HRESULT expected;
6142 BOOL todo;
6143 const char *broken_value;
6144 const char *value_ex;
6145 } uri_combine_str_property;
6146
6147 typedef struct _uri_combine_test {
6148 const char *base_uri;
6149 DWORD base_create_flags;
6150 const char *relative_uri;
6151 DWORD relative_create_flags;
6152 DWORD combine_flags;
6153 HRESULT expected;
6154 BOOL todo;
6155
6156 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6157 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6158 } uri_combine_test;
6159
6160 static const uri_combine_test uri_combine_tests[] = {
6161 { "http://google.com/fun/stuff",0,
6162 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6163 0,S_OK,FALSE,
6164 {
6165 {"http://google.com/not/fun/stuff",S_OK},
6166 {"google.com",S_OK},
6167 {"http://google.com/not/fun/stuff",S_OK},
6168 {"google.com",S_OK},
6169 {"",S_FALSE},
6170 {"",S_FALSE},
6171 {"google.com",S_OK},
6172 {"",S_FALSE},
6173 {"/not/fun/stuff",S_OK},
6174 {"/not/fun/stuff",S_OK},
6175 {"",S_FALSE},
6176 {"http://google.com/not/fun/stuff",S_OK},
6177 {"http",S_OK},
6178 {"",S_FALSE},
6179 {"",S_FALSE}
6180 },
6181 {
6182 {Uri_HOST_DNS,S_OK},
6183 {80,S_OK},
6184 {URL_SCHEME_HTTP,S_OK},
6185 {URLZONE_INVALID,E_NOTIMPL}
6186 }
6187 },
6188 { "http://google.com/test",0,
6189 "zip://test.com/cool",0,
6190 0,S_OK,FALSE,
6191 {
6192 {"zip://test.com/cool",S_OK},
6193 {"test.com",S_OK},
6194 {"zip://test.com/cool",S_OK},
6195 {"test.com",S_OK},
6196 {"",S_FALSE},
6197 {"",S_FALSE},
6198 {"test.com",S_OK},
6199 {"",S_FALSE},
6200 {"/cool",S_OK},
6201 {"/cool",S_OK},
6202 {"",S_FALSE},
6203 {"zip://test.com/cool",S_OK},
6204 {"zip",S_OK},
6205 {"",S_FALSE},
6206 {"",S_FALSE}
6207 },
6208 {
6209 {Uri_HOST_DNS,S_OK},
6210 {0,S_FALSE},
6211 {URL_SCHEME_UNKNOWN,S_OK},
6212 {URLZONE_INVALID,E_NOTIMPL}
6213 }
6214 },
6215 { "http://google.com/use/base/path",0,
6216 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6217 0,S_OK,FALSE,
6218 {
6219 {"http://google.com/use/base/path?relative",S_OK},
6220 {"google.com",S_OK},
6221 {"http://google.com/use/base/path?relative",S_OK},
6222 {"google.com",S_OK},
6223 {"",S_FALSE},
6224 {"",S_FALSE},
6225 {"google.com",S_OK},
6226 {"",S_FALSE},
6227 {"/use/base/path",S_OK},
6228 {"/use/base/path?relative",S_OK},
6229 {"?relative",S_OK},
6230 {"http://google.com/use/base/path?relative",S_OK},
6231 {"http",S_OK},
6232 {"",S_FALSE},
6233 {"",S_FALSE}
6234 },
6235 {
6236 {Uri_HOST_DNS,S_OK},
6237 {80,S_OK},
6238 {URL_SCHEME_HTTP,S_OK},
6239 {URLZONE_INVALID,E_NOTIMPL}
6240 }
6241 },
6242 { "http://google.com/path",0,
6243 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6244 0,S_OK,FALSE,
6245 {
6246 {"http://google.com/testing",S_OK},
6247 {"google.com",S_OK},
6248 {"http://google.com/testing",S_OK},
6249 {"google.com",S_OK},
6250 {"",S_FALSE},
6251 {"",S_FALSE},
6252 {"google.com",S_OK},
6253 {"",S_FALSE},
6254 {"/testing",S_OK},
6255 {"/testing",S_OK},
6256 {"",S_FALSE},
6257 {"http://google.com/testing",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 URL_DONT_SIMPLIFY,S_OK,FALSE,
6272 {
6273 {"http://google.com:80/test/../test/.././testing",S_OK},
6274 {"google.com",S_OK},
6275 {"http://google.com:80/test/../test/.././testing",S_OK},
6276 {"google.com",S_OK},
6277 {"",S_FALSE},
6278 {"",S_FALSE},
6279 {"google.com",S_OK},
6280 {"",S_FALSE},
6281 {"/test/../test/.././testing",S_OK},
6282 {"/test/../test/.././testing",S_OK},
6283 {"",S_FALSE},
6284 {"http://google.com:80/test/../test/.././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://winehq.org/test/abc",0,
6297 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6298 0,S_OK,FALSE,
6299 {
6300 {"http://winehq.org/test/testing/test",S_OK},
6301 {"winehq.org",S_OK},
6302 {"http://winehq.org/test/testing/test",S_OK},
6303 {"winehq.org",S_OK},
6304 {"",S_FALSE},
6305 {"",S_FALSE},
6306 {"winehq.org",S_OK},
6307 {"",S_FALSE},
6308 {"/test/testing/test",S_OK},
6309 {"/test/testing/test",S_OK},
6310 {"",S_FALSE},
6311 {"http://winehq.org/test/testing/test",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 URL_DONT_SIMPLIFY,S_OK,FALSE,
6326 {
6327 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6328 /* Default port is hidden in the authority. */
6329 {"winehq.org",S_OK},
6330 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6331 {"winehq.org",S_OK},
6332 {"",S_FALSE},
6333 {"",S_FALSE},
6334 {"winehq.org",S_OK},
6335 {"",S_FALSE},
6336 {"/test/testing/abc/../test",S_OK},
6337 {"/test/testing/abc/../test",S_OK},
6338 {"",S_FALSE},
6339 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6340 {"http",S_OK},
6341 {"",S_FALSE},
6342 {"",S_FALSE}
6343 },
6344 {
6345 {Uri_HOST_DNS,S_OK},
6346 {80,S_OK},
6347 {URL_SCHEME_HTTP,S_OK},
6348 {URLZONE_INVALID,E_NOTIMPL}
6349 }
6350 },
6351 { "http://winehq.org/test?query",0,
6352 "testing",Uri_CREATE_ALLOW_RELATIVE,
6353 0,S_OK,FALSE,
6354 {
6355 {"http://winehq.org/testing",S_OK},
6356 {"winehq.org",S_OK},
6357 {"http://winehq.org/testing",S_OK},
6358 {"winehq.org",S_OK},
6359 {"",S_FALSE},
6360 {"",S_FALSE},
6361 {"winehq.org",S_OK},
6362 {"",S_FALSE},
6363 {"/testing",S_OK},
6364 {"/testing",S_OK},
6365 {"",S_FALSE},
6366 {"http://winehq.org/testing",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#frag",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 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6406 "test",Uri_CREATE_ALLOW_RELATIVE,
6407 0,S_OK,FALSE,
6408 {
6409 {"test",S_OK},
6410 {"",S_FALSE},
6411 {"test",S_OK},
6412 {"",S_FALSE},
6413 {"",S_FALSE},
6414 {"",S_FALSE},
6415 {"",S_FALSE},
6416 {"",S_FALSE},
6417 {"test",S_OK},
6418 {"test",S_OK},
6419 {"",S_FALSE},
6420 {"test",S_OK},
6421 {"",S_FALSE},
6422 {"",S_FALSE},
6423 {"",S_FALSE}
6424 },
6425 {
6426 {Uri_HOST_UNKNOWN,S_OK},
6427 {0,S_FALSE},
6428 {URL_SCHEME_UNKNOWN,S_OK},
6429 {URLZONE_INVALID,E_NOTIMPL}
6430 }
6431 },
6432 { "file:///c:/test/test",0,
6433 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6434 URL_FILE_USE_PATHURL,S_OK,FALSE,
6435 {
6436 {"file://c:\\testing.mp3",S_OK},
6437 {"",S_FALSE},
6438 {"file://c:\\testing.mp3",S_OK},
6439 {"",S_FALSE},
6440 {".mp3",S_OK},
6441 {"",S_FALSE},
6442 {"",S_FALSE},
6443 {"",S_FALSE},
6444 {"c:\\testing.mp3",S_OK},
6445 {"c:\\testing.mp3",S_OK},
6446 {"",S_FALSE},
6447 {"file://c:\\testing.mp3",S_OK},
6448 {"file",S_OK},
6449 {"",S_FALSE},
6450 {"",S_FALSE}
6451 },
6452 {
6453 {Uri_HOST_UNKNOWN,S_OK},
6454 {0,S_FALSE},
6455 {URL_SCHEME_FILE,S_OK},
6456 {URLZONE_INVALID,E_NOTIMPL}
6457 }
6458 },
6459 { "file:///c:/test/test",0,
6460 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6461 0,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://test.com/test/test",0,
6487 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6488 URL_FILE_USE_PATHURL,S_OK,FALSE,
6489 {
6490 {"file://\\\\test.com\\testing.mp3",S_OK},
6491 {"test.com",S_OK},
6492 {"file://\\\\test.com\\testing.mp3",S_OK},
6493 {"test.com",S_OK},
6494 {".mp3",S_OK},
6495 {"",S_FALSE},
6496 {"test.com",S_OK},
6497 {"",S_FALSE},
6498 {"\\testing.mp3",S_OK},
6499 {"\\testing.mp3",S_OK},
6500 {"",S_FALSE},
6501 {"file://\\\\test.com\\testing.mp3",S_OK},
6502 {"file",S_OK},
6503 {"",S_FALSE},
6504 {"",S_FALSE}
6505 },
6506 {
6507 {Uri_HOST_DNS,S_OK},
6508 {0,S_FALSE},
6509 {URL_SCHEME_FILE,S_OK},
6510 {URLZONE_INVALID,E_NOTIMPL}
6511 }
6512 },
6513 /* URL_DONT_SIMPLIFY has no effect. */
6514 { "http://google.com/test",0,
6515 "zip://test.com/cool/../cool/test",0,
6516 URL_DONT_SIMPLIFY,S_OK,FALSE,
6517 {
6518 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6519 {"test.com",S_OK},
6520 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6521 {"test.com",S_OK},
6522 {"",S_FALSE},
6523 {"",S_FALSE},
6524 {"test.com",S_OK},
6525 {"",S_FALSE},
6526 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6527 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6528 {"",S_FALSE},
6529 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6530 * On IE 7 it reduces the path in the Raw URI.
6531 */
6532 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6533 {"zip",S_OK},
6534 {"",S_FALSE},
6535 {"",S_FALSE}
6536 },
6537 {
6538 {Uri_HOST_DNS,S_OK},
6539 {0,S_FALSE},
6540 {URL_SCHEME_UNKNOWN,S_OK},
6541 {URLZONE_INVALID,E_NOTIMPL}
6542 }
6543 },
6544 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6545 * resulting URI is converted into a dos path.
6546 */
6547 { "http://google.com/test",0,
6548 "file:///c:/test/",0,
6549 URL_FILE_USE_PATHURL,S_OK,FALSE,
6550 {
6551 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6552 {"",S_FALSE},
6553 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6554 {"",S_FALSE},
6555 {"",S_FALSE},
6556 {"",S_FALSE},
6557 {"",S_FALSE},
6558 {"",S_FALSE},
6559 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6560 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6561 {"",S_FALSE},
6562 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6563 {"file",S_OK},
6564 {"",S_FALSE},
6565 {"",S_FALSE}
6566 },
6567 {
6568 {Uri_HOST_UNKNOWN,S_OK},
6569 {0,S_FALSE},
6570 {URL_SCHEME_FILE,S_OK},
6571 {URLZONE_INVALID,E_NOTIMPL}
6572 }
6573 },
6574 { "http://google.com/test",0,
6575 "http://test.com/test#%30test",0,
6576 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6577 {
6578 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6579 {"test.com",S_OK},
6580 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6581 {"test.com",S_OK},
6582 {"",S_FALSE},
6583 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6584 {"test.com",S_OK},
6585 {"",S_FALSE},
6586 {"/test",S_OK},
6587 {"/test",S_OK},
6588 {"",S_FALSE},
6589 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6590 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6591 {"http",S_OK},
6592 {"",S_FALSE},
6593 {"",S_FALSE}
6594 },
6595 {
6596 {Uri_HOST_DNS,S_OK},
6597 {80,S_OK},
6598 {URL_SCHEME_HTTP,S_OK},
6599 {URLZONE_INVALID,E_NOTIMPL}
6600 }
6601 },
6602 /* Windows validates the path component from the relative Uri. */
6603 { "http://google.com/test",0,
6604 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6605 0,E_INVALIDARG,FALSE
6606 },
6607 /* Windows doesn't validate the query from the relative Uri. */
6608 { "http://google.com/test",0,
6609 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6610 0,S_OK,FALSE,
6611 {
6612 {"http://google.com/test?Tes%XXt",S_OK},
6613 {"google.com",S_OK},
6614 {"http://google.com/test?Tes%XXt",S_OK},
6615 {"google.com",S_OK},
6616 {"",S_FALSE},
6617 {"",S_FALSE},
6618 {"google.com",S_OK},
6619 {"",S_FALSE},
6620 {"/test",S_OK},
6621 {"/test?Tes%XXt",S_OK},
6622 {"?Tes%XXt",S_OK},
6623 {"http://google.com/test?Tes%XXt",S_OK},
6624 {"http",S_OK},
6625 {"",S_FALSE},
6626 {"",S_FALSE}
6627 },
6628 {
6629 {Uri_HOST_DNS,S_OK},
6630 {80,S_OK},
6631 {URL_SCHEME_HTTP,S_OK},
6632 {URLZONE_INVALID,E_NOTIMPL}
6633 }
6634 },
6635 /* Windows doesn't validate the fragment from the relative Uri. */
6636 { "http://google.com/test",0,
6637 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6638 0,S_OK,FALSE,
6639 {
6640 {"http://google.com/test#Tes%XXt",S_OK},
6641 {"google.com",S_OK},
6642 {"http://google.com/test#Tes%XXt",S_OK},
6643 {"google.com",S_OK},
6644 {"",S_FALSE},
6645 {"#Tes%XXt",S_OK},
6646 {"google.com",S_OK},
6647 {"",S_FALSE},
6648 {"/test",S_OK},
6649 {"/test",S_OK},
6650 {"",S_FALSE},
6651 {"http://google.com/test#Tes%XXt",S_OK},
6652 {"http",S_OK},
6653 {"",S_FALSE},
6654 {"",S_FALSE}
6655 },
6656 {
6657 {Uri_HOST_DNS,S_OK},
6658 {80,S_OK},
6659 {URL_SCHEME_HTTP,S_OK},
6660 {URLZONE_INVALID,E_NOTIMPL}
6661 }
6662 },
6663 /* Creates an IUri which contains an invalid dos path char. */
6664 { "file:///c:/test",0,
6665 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6666 URL_FILE_USE_PATHURL,S_OK,FALSE,
6667 {
6668 {"file://c:\\test<ing",S_OK},
6669 {"",S_FALSE},
6670 {"file://c:\\test<ing",S_OK},
6671 {"",S_FALSE},
6672 {"",S_FALSE},
6673 {"",S_FALSE},
6674 {"",S_FALSE},
6675 {"",S_FALSE},
6676 {"c:\\test<ing",S_OK},
6677 {"c:\\test<ing",S_OK},
6678 {"",S_FALSE},
6679 {"file://c:\\test<ing",S_OK},
6680 {"file",S_OK},
6681 {"",S_FALSE},
6682 {"",S_FALSE}
6683 },
6684 {
6685 {Uri_HOST_UNKNOWN,S_OK},
6686 {0,S_FALSE},
6687 {URL_SCHEME_FILE,S_OK},
6688 {URLZONE_INVALID,E_NOTIMPL}
6689 }
6690 },
6691 /* Appends the path after the drive letter (if any). */
6692 { "file:///c:/test",0,
6693 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6694 0,S_OK,FALSE,
6695 {
6696 {"file:///c:/c:/testing",S_OK},
6697 {"",S_FALSE},
6698 {"file:///c:/c:/testing",S_OK},
6699 {"",S_FALSE},
6700 {"",S_FALSE},
6701 {"",S_FALSE},
6702 {"",S_FALSE},
6703 {"",S_FALSE},
6704 {"/c:/c:/testing",S_OK},
6705 {"/c:/c:/testing",S_OK},
6706 {"",S_FALSE},
6707 {"file:///c:/c:/testing",S_OK},
6708 {"file",S_OK},
6709 {"",S_FALSE},
6710 {"",S_FALSE}
6711 },
6712 {
6713 {Uri_HOST_UNKNOWN,S_OK},
6714 {0,S_FALSE},
6715 {URL_SCHEME_FILE,S_OK},
6716 {URLZONE_INVALID,E_NOTIMPL}
6717 }
6718 },
6719 /* A '/' is added if the base URI doesn't have a path and the
6720 * relative URI doesn't contain a path (since the base URI is
6721 * hierarchical.
6722 */
6723 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6724 "?test",Uri_CREATE_ALLOW_RELATIVE,
6725 0,S_OK,FALSE,
6726 {
6727 {"http://google.com/?test",S_OK},
6728 {"google.com",S_OK},
6729 {"http://google.com/?test",S_OK},
6730 {"google.com",S_OK},
6731 {"",S_FALSE},
6732 {"",S_FALSE},
6733 {"google.com",S_OK},
6734 {"",S_FALSE},
6735 {"/",S_OK},
6736 {"/?test",S_OK},
6737 {"?test",S_OK},
6738 {"http://google.com/?test",S_OK},
6739 {"http",S_OK},
6740 {"",S_FALSE},
6741 {"",S_FALSE}
6742 },
6743 {
6744 {Uri_HOST_DNS,S_OK},
6745 {80,S_OK},
6746 {URL_SCHEME_HTTP,S_OK},
6747 {URLZONE_INVALID,E_NOTIMPL}
6748 }
6749 },
6750 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6751 "?test",Uri_CREATE_ALLOW_RELATIVE,
6752 0,S_OK,FALSE,
6753 {
6754 {"zip://google.com/?test",S_OK},
6755 {"google.com",S_OK},
6756 {"zip://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 {"zip://google.com/?test",S_OK},
6766 {"zip",S_OK},
6767 {"",S_FALSE},
6768 {"",S_FALSE}
6769 },
6770 {
6771 {Uri_HOST_DNS,S_OK},
6772 {0,S_FALSE},
6773 {URL_SCHEME_UNKNOWN,S_OK},
6774 {URLZONE_INVALID,E_NOTIMPL}
6775 }
6776 },
6777 /* No path is appended since the base URI is opaque. */
6778 { "zip:?testing",0,
6779 "?test",Uri_CREATE_ALLOW_RELATIVE,
6780 0,S_OK,FALSE,
6781 {
6782 {"zip:?test",S_OK},
6783 {"",S_FALSE},
6784 {"zip:?test",S_OK},
6785 {"",S_FALSE},
6786 {"",S_FALSE},
6787 {"",S_FALSE},
6788 {"",S_FALSE},
6789 {"",S_FALSE},
6790 {"",S_OK},
6791 {"?test",S_OK},
6792 {"?test",S_OK},
6793 {"zip:?test",S_OK},
6794 {"zip",S_OK},
6795 {"",S_FALSE},
6796 {"",S_FALSE}
6797 },
6798 {
6799 {Uri_HOST_UNKNOWN,S_OK},
6800 {0,S_FALSE},
6801 {URL_SCHEME_UNKNOWN,S_OK},
6802 {URLZONE_INVALID,E_NOTIMPL}
6803 }
6804 },
6805 { "file:///c:/",0,
6806 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6807 0,S_OK,FALSE,
6808 {
6809 {"file:///c:/testing/test",S_OK},
6810 {"",S_FALSE},
6811 {"file:///c:/testing/test",S_OK},
6812 {"",S_FALSE},
6813 {"",S_FALSE},
6814 {"",S_FALSE},
6815 {"",S_FALSE},
6816 {"",S_FALSE},
6817 {"/c:/testing/test",S_OK},
6818 {"/c:/testing/test",S_OK},
6819 {"",S_FALSE},
6820 {"file:///c:/testing/test",S_OK},
6821 {"file",S_OK},
6822 {"",S_FALSE},
6823 {"",S_FALSE}
6824 },
6825 {
6826 {Uri_HOST_UNKNOWN,S_OK},
6827 {0,S_FALSE},
6828 {URL_SCHEME_FILE,S_OK},
6829 {URLZONE_INVALID,E_NOTIMPL}
6830 }
6831 },
6832 { "http://winehq.org/dir/testfile",0,
6833 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6834 0,S_OK,FALSE,
6835 {
6836 {"http://winehq.org/dir/test?querystring",S_OK},
6837 {"winehq.org",S_OK},
6838 {"http://winehq.org/dir/test?querystring",S_OK},
6839 {"winehq.org",S_OK},
6840 {"",S_FALSE},
6841 {"",S_FALSE},
6842 {"winehq.org",S_OK},
6843 {"",S_FALSE},
6844 {"/dir/test",S_OK},
6845 {"/dir/test?querystring",S_OK},
6846 {"?querystring",S_OK},
6847 {"http://winehq.org/dir/test?querystring",S_OK},
6848 {"http",S_OK},
6849 {"",S_FALSE},
6850 {"",S_FALSE}
6851 },
6852 {
6853 {Uri_HOST_DNS,S_OK},
6854 {80,S_OK},
6855 {URL_SCHEME_HTTP,S_OK},
6856 {URLZONE_INVALID,E_NOTIMPL}
6857 }
6858 },
6859 { "http://winehq.org/dir/test",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?querystring",0,
6887 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6888 0,S_OK,FALSE,
6889 {
6890 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6891 {"winehq.org",S_OK},
6892 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6893 {"winehq.org",S_OK},
6894 {"",S_FALSE},
6895 {"#hash",S_OK},
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#hash",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 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6914 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6915 0,S_OK,FALSE,
6916 {
6917 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6918 {"",S_FALSE},
6919 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6920 {"",S_FALSE},
6921 {".txt",S_OK},
6922 {"",S_FALSE},
6923 {"",S_FALSE},
6924 {"",S_FALSE},
6925 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6926 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6927 {"",S_FALSE},
6928 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6929 {"mk",S_OK},
6930 {"",S_FALSE},
6931 {"",S_FALSE}
6932 },
6933 {
6934 {Uri_HOST_UNKNOWN,S_OK},
6935 {0,S_FALSE},
6936 {URL_SCHEME_MK,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:\\dir\\file.chm::/subdir/file.txt",0,
6995 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6996 0,S_OK,FALSE,
6997 {
6998 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6999 {"",S_FALSE},
7000 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7001 {"",S_FALSE},
7002 {".txt",S_OK},
7003 {"",S_FALSE},
7004 {"",S_FALSE},
7005 {"",S_FALSE},
7006 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7007 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
7008 {"",S_FALSE},
7009 {"mk:@MSITSTORE:C:\\dir\\file.chm::/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:/relative/path.txt",S_OK},
7053 {"",S_FALSE},
7054 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
7055 {"",S_FALSE},
7056 {".txt",S_OK},
7057 {"",S_FALSE},
7058 {"",S_FALSE},
7059 {"",S_FALSE},
7060 {"@MSITSTORE:/relative/path.txt",S_OK},
7061 {"@MSITSTORE:/relative/path.txt",S_OK},
7062 {"",S_FALSE},
7063 {"mk:@MSITSTORE:/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:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7076 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7077 0,S_OK,FALSE,
7078 {
7079 {"mk:@xxx:/relative/path.txt",S_OK},
7080 {"",S_FALSE},
7081 {"mk:@xxx:/relative/path.txt",S_OK},
7082 {"",S_FALSE},
7083 {".txt",S_OK},
7084 {"",S_FALSE},
7085 {"",S_FALSE},
7086 {"",S_FALSE},
7087 {"@xxx:/relative/path.txt",S_OK},
7088 {"@xxx:/relative/path.txt",S_OK},
7089 {"",S_FALSE},
7090 {"mk:@xxx:/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:/relative/path.txt",S_OK},
7107 {"",S_FALSE},
7108 {"mk:/relative/path.txt",S_OK},
7109 {"",S_FALSE},
7110 {".txt",S_OK},
7111 {"",S_FALSE},
7112 {"",S_FALSE},
7113 {"",S_FALSE},
7114 {"/relative/path.txt",S_OK},
7115 {"/relative/path.txt",S_OK},
7116 {"",S_FALSE},
7117 {"mk:/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 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7130 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7131 0,S_OK,FALSE,
7132 {
7133 {"ml:/relative/path.txt",S_OK},
7134 {"",S_FALSE},
7135 {"ml:/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 {"ml:/relative/path.txt",S_OK},
7145 {"ml",S_OK},
7146 {"",S_FALSE},
7147 {"",S_FALSE}
7148 },
7149 {
7150 {Uri_HOST_UNKNOWN,S_OK},
7151 {0,S_FALSE},
7152 {URL_SCHEME_UNKNOWN,S_OK},
7153 {URLZONE_INVALID,E_NOTIMPL}
7154 }
7155 },
7156 { "http://winehq.org/dir/test?querystring",0,
7157 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7158 0,S_OK,FALSE,
7159 {
7160 {"http://winehq.com/#hash",S_OK},
7161 {"winehq.com",S_OK},
7162 {"http://winehq.com/#hash",S_OK},
7163 {"winehq.com",S_OK},
7164 {"",S_FALSE},
7165 {"#hash",S_OK},
7166 {"winehq.com",S_OK},
7167 {"",S_FALSE},
7168 {"/",S_OK},
7169 {"/",S_OK},
7170 {"",S_FALSE},
7171 {"http://winehq.com/#hash",S_OK},
7172 {"http",S_OK},
7173 {"",S_FALSE},
7174 {"",S_FALSE}
7175 },
7176 {
7177 {Uri_HOST_DNS,S_OK},
7178 {80,S_OK,FALSE,TRUE},
7179 {URL_SCHEME_HTTP,S_OK},
7180 {URLZONE_INVALID,E_NOTIMPL}
7181 }
7182 },
7183 { "http://winehq.org/dir/test?querystring",0,
7184 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7185 0,S_OK,FALSE,
7186 {
7187 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7188 {"winehq.com",S_OK},
7189 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7190 {"winehq.com",S_OK},
7191 {".txt",S_OK},
7192 {"#hash",S_OK},
7193 {"winehq.com",S_OK},
7194 {"",S_FALSE},
7195 {"/dir/file.txt",S_OK},
7196 {"/dir/file.txt?query",S_OK},
7197 {"?query",S_OK},
7198 {"http://winehq.com/dir/file.txt?query#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://google.com/test",0,
7211 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7212 0,S_OK,FALSE,
7213 {
7214 {"file:///c:/test/",S_OK},
7215 {"",S_FALSE},
7216 {"file:///c:/test/",S_OK},
7217 {"",S_FALSE},
7218 {"",S_FALSE},
7219 {"",S_FALSE},
7220 {"",S_FALSE},
7221 {"",S_FALSE},
7222 {"/c:/test/",S_OK},
7223 {"/c:/test/",S_OK},
7224 {"",S_FALSE},
7225 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7226 {"file",S_OK},
7227 {"",S_FALSE},
7228 {"",S_FALSE}
7229 },
7230 {
7231 {Uri_HOST_UNKNOWN,S_OK},
7232 {0,S_FALSE},
7233 {URL_SCHEME_FILE,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://winehq.org",0,
7265 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7266 0,S_OK,FALSE,
7267 {
7268 {"mailto:",S_OK},
7269 {"",S_FALSE},
7270 {"mailto:",S_OK},
7271 {"",S_FALSE},
7272 {"",S_FALSE},
7273 {"",S_FALSE},
7274 {"",S_FALSE},
7275 {"",S_FALSE},
7276 {"",S_FALSE},
7277 {"",S_FALSE},
7278 {"",S_FALSE},
7279 {"mailto://",S_OK,FALSE,"mailto:"},
7280 {"mailto",S_OK},
7281 {"",S_FALSE},
7282 {"",S_FALSE}
7283 },
7284 {
7285 {Uri_HOST_UNKNOWN,S_OK},
7286 {0,S_FALSE},
7287 {URL_SCHEME_MAILTO,S_OK},
7288 {URLZONE_INVALID,E_NOTIMPL}
7289 }
7290 },
7291 { "http://winehq.org",0,
7292 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7293 0,S_OK,FALSE,
7294 {
7295 {"mailto:a@b.com",S_OK},
7296 {"",S_FALSE},
7297 {"mailto:a@b.com",S_OK},
7298 {"",S_FALSE},
7299 {".com",S_OK},
7300 {"",S_FALSE},
7301 {"",S_FALSE},
7302 {"",S_FALSE},
7303 {"a@b.com",S_OK},
7304 {"a@b.com",S_OK},
7305 {"",S_FALSE},
7306 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
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 };
7319
7320 typedef struct _uri_parse_test {
7321 const char *uri;
7322 DWORD uri_flags;
7323 PARSEACTION action;
7324 DWORD flags;
7325 const char *property;
7326 HRESULT expected;
7327 BOOL todo;
7328 } uri_parse_test;
7329
7330 static const uri_parse_test uri_parse_tests[] = {
7331 /* PARSE_CANONICALIZE tests. */
7332 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7333 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7334 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7335 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7336 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7337 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7338 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7339 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7340 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7341 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7342 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7343 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7344
7345 /* PARSE_FRIENDLY tests. */
7346 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7347 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7348
7349 /* PARSE_ROOTDOCUMENT tests. */
7350 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7351 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7352 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7353 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7354 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7355 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7356
7357 /* PARSE_DOCUMENT tests. */
7358 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7359 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7360 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7361 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7362 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7363 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7364
7365 /* PARSE_PATH_FROM_URL tests. */
7366 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7367 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7368 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7369 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7370 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7371
7372 /* PARSE_URL_FROM_PATH tests. */
7373 /* This function almost seems to useless (just returns the absolute uri). */
7374 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7375 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7376 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7377 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7378 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7379
7380 /* PARSE_SCHEMA tests. */
7381 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7382 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7383
7384 /* PARSE_SITE tests. */
7385 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7386 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7387 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7388 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7389
7390 /* PARSE_DOMAIN tests. */
7391 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7392 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7393 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7394 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7395
7396 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7397 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7398 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7399 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7400 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7401 };
7402
7403 static inline LPWSTR a2w(LPCSTR str) {
7404 LPWSTR ret = NULL;
7405
7406 if(str) {
7407 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7408 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7409 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7410 }
7411
7412 return ret;
7413 }
7414
7415 static inline BOOL heap_free(void* mem) {
7416 return HeapFree(GetProcessHeap(), 0, mem);
7417 }
7418
7419 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7420 LPWSTR strAW = a2w(strA);
7421 DWORD ret = lstrcmpW(strAW, strB);
7422 heap_free(strAW);
7423 return ret;
7424 }
7425
7426 static inline ULONG get_refcnt(IUri *uri) {
7427 IUri_AddRef(uri);
7428 return IUri_Release(uri);
7429 }
7430
7431 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7432 DWORD test_index) {
7433 HRESULT hr;
7434 LPWSTR valueW;
7435
7436 valueW = a2w(prop->value);
7437 switch(prop->property) {
7438 case Uri_PROPERTY_FRAGMENT:
7439 hr = IUriBuilder_SetFragment(builder, valueW);
7440 if(prop->todo) {
7441 todo_wine {
7442 ok(hr == prop->expected,
7443 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7444 hr, prop->expected, test_index);
7445 }
7446 } else {
7447 ok(hr == prop->expected,
7448 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7449 hr, prop->expected, test_index);
7450 }
7451 break;
7452 case Uri_PROPERTY_HOST:
7453 hr = IUriBuilder_SetHost(builder, valueW);
7454 if(prop->todo) {
7455 todo_wine {
7456 ok(hr == prop->expected,
7457 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7458 hr, prop->expected, test_index);
7459 }
7460 } else {
7461 ok(hr == prop->expected,
7462 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7463 hr, prop->expected, test_index);
7464 }
7465 break;
7466 case Uri_PROPERTY_PASSWORD:
7467 hr = IUriBuilder_SetPassword(builder, valueW);
7468 if(prop->todo) {
7469 todo_wine {
7470 ok(hr == prop->expected,
7471 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7472 hr, prop->expected, test_index);
7473 }
7474 } else {
7475 ok(hr == prop->expected,
7476 "Error: IUriBuilder_SetPassword 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_PATH:
7481 hr = IUriBuilder_SetPath(builder, valueW);
7482 if(prop->todo) {
7483 todo_wine {
7484 ok(hr == prop->expected,
7485 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7486 hr, prop->expected, test_index);
7487 }
7488 } else {
7489 ok(hr == prop->expected,
7490 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7491 hr, prop->expected, test_index);
7492 }
7493 break;
7494 case Uri_PROPERTY_QUERY:
7495 hr = IUriBuilder_SetQuery(builder, valueW);
7496 if(prop->todo) {
7497 todo_wine {
7498 ok(hr == prop->expected,
7499 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7500 hr, prop->expected, test_index);
7501 }
7502 } else {
7503 ok(hr == prop->expected,
7504 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7505 hr, prop->expected, test_index);
7506 }
7507 break;
7508 case Uri_PROPERTY_SCHEME_NAME:
7509 hr = IUriBuilder_SetSchemeName(builder, valueW);
7510 if(prop->todo) {
7511 todo_wine {
7512 ok(hr == prop->expected,
7513 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7514 hr, prop->expected, test_index);
7515 }
7516 } else {
7517 ok(hr == prop->expected,
7518 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7519 hr, prop->expected, test_index);
7520 }
7521 break;
7522 case Uri_PROPERTY_USER_NAME:
7523 hr = IUriBuilder_SetUserName(builder, valueW);
7524 if(prop->todo) {
7525 todo_wine {
7526 ok(hr == prop->expected,
7527 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7528 hr, prop->expected, test_index);
7529 }
7530 } else {
7531 ok(hr == prop->expected,
7532 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7533 hr, prop->expected, test_index);
7534 }
7535 break;
7536 default:
7537 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7538 }
7539
7540 heap_free(valueW);
7541 }
7542
7543 /*
7544 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7545 * correctly.
7546 */
7547 static void test_CreateUri_InvalidFlags(void) {
7548 DWORD i;
7549
7550 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7551 HRESULT hr;
7552 IUri *uri = (void*) 0xdeadbeef;
7553
7554 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7555 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7556 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7557 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7558 }
7559 }
7560
7561 static void test_CreateUri_InvalidArgs(void) {
7562 HRESULT hr;
7563 IUri *uri = (void*) 0xdeadbeef;
7564
7565 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7566 static const WCHAR emptyW[] = {0};
7567
7568 hr = pCreateUri(http_urlW, 0, 0, NULL);
7569 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7570
7571 hr = pCreateUri(NULL, 0, 0, &uri);
7572 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7573 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7574
7575 uri = (void*) 0xdeadbeef;
7576 hr = pCreateUri(invalidW, 0, 0, &uri);
7577 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7578 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7579
7580 uri = (void*) 0xdeadbeef;
7581 hr = pCreateUri(emptyW, 0, 0, &uri);
7582 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7583 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7584 }
7585
7586 static void test_CreateUri_InvalidUri(void) {
7587 DWORD i;
7588
7589 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7590 invalid_uri test = invalid_uri_tests[i];
7591 IUri *uri = NULL;
7592 LPWSTR uriW;
7593 HRESULT hr;
7594
7595 uriW = a2w(test.uri);
7596 hr = pCreateUri(uriW, test.flags, 0, &uri);
7597 if(test.todo) {
7598 todo_wine {
7599 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7600 hr, E_INVALIDARG, i);
7601 }
7602 } else {
7603 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7604 hr, E_INVALIDARG, i);
7605 }
7606 if(uri) IUri_Release(uri);
7607
7608 heap_free(uriW);
7609 }
7610 }
7611
7612 static void test_IUri_GetPropertyBSTR(void) {
7613 IUri *uri = NULL;
7614 HRESULT hr;
7615 DWORD i;
7616
7617 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7618 hr = pCreateUri(http_urlW, 0, 0, &uri);
7619 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7620 if(SUCCEEDED(hr)) {
7621 BSTR received = NULL;
7622
7623 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7624 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7625
7626 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7627 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7628 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7629 if(SUCCEEDED(hr)) {
7630 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7631 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7632 SysFreeString(received);
7633 }else {
7634 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7635 }
7636
7637 /* Make sure it handles the ZONE property correctly. */
7638 received = NULL;
7639 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7640 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7641 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7642 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7643 SysFreeString(received);
7644 }
7645 if(uri) IUri_Release(uri);
7646
7647 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7648 uri_properties test = uri_tests[i];
7649 LPWSTR uriW;
7650 uri = NULL;
7651
7652 uriW = a2w(test.uri);
7653 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7654 if(test.create_todo) {
7655 todo_wine {
7656 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7657 hr, test.create_expected, i);
7658 }
7659 } else {
7660 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7661 hr, test.create_expected, i);
7662 }
7663
7664 if(SUCCEEDED(hr)) {
7665 DWORD j;
7666
7667 /* Checks all the string properties of the uri. */
7668 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7669 BSTR received = NULL;
7670 uri_str_property prop = test.str_props[j];
7671
7672 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7673 if(prop.todo) {
7674 todo_wine {
7675 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7676 hr, prop.expected, i, j);
7677 }
7678 todo_wine {
7679 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7680 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7681 prop.value, wine_dbgstr_w(received), i, j);
7682 }
7683 } else {
7684 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7685 hr, prop.expected, i, j);
7686 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7687 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7688 prop.value, wine_dbgstr_w(received), i, j);
7689 }
7690
7691 SysFreeString(received);
7692 }
7693 }
7694
7695 if(uri) IUri_Release(uri);
7696
7697 heap_free(uriW);
7698 }
7699 }
7700
7701 static void test_IUri_GetPropertyDWORD(void) {
7702 IUri *uri = NULL;
7703 HRESULT hr;
7704 DWORD i;
7705
7706 hr = pCreateUri(http_urlW, 0, 0, &uri);
7707 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7708 if(SUCCEEDED(hr)) {
7709 DWORD received = 0xdeadbeef;
7710
7711 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7712 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7713
7714 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7715 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7716 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7717 }
7718 if(uri) IUri_Release(uri);
7719
7720 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7721 uri_properties test = uri_tests[i];
7722 LPWSTR uriW;
7723 uri = NULL;
7724
7725 uriW = a2w(test.uri);
7726 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7727 if(test.create_todo) {
7728 todo_wine {
7729 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7730 hr, test.create_expected, i);
7731 }
7732 } else {
7733 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7734 hr, test.create_expected, i);
7735 }
7736
7737 if(SUCCEEDED(hr)) {
7738 DWORD j;
7739
7740 /* Checks all the DWORD properties of the uri. */
7741 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7742 DWORD received;
7743 uri_dword_property prop = test.dword_props[j];
7744
7745 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7746 if(prop.todo) {
7747 todo_wine {
7748 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7749 hr, prop.expected, i, j);
7750 }
7751 todo_wine {
7752 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7753 prop.value, received, i, j);
7754 }
7755 } else {
7756 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7757 hr, prop.expected, i, j);
7758 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7759 prop.value, received, i, j);
7760 }
7761 }
7762 }
7763
7764 if(uri) IUri_Release(uri);
7765
7766 heap_free(uriW);
7767 }
7768 }
7769
7770 /* Tests all the 'Get*' property functions which deal with strings. */
7771 static void test_IUri_GetStrProperties(void) {
7772 IUri *uri = NULL;
7773 HRESULT hr;
7774 DWORD i;
7775
7776 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7777 hr = pCreateUri(http_urlW, 0, 0, &uri);
7778 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7779 if(SUCCEEDED(hr)) {
7780 hr = IUri_GetAbsoluteUri(uri, NULL);
7781 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7782
7783 hr = IUri_GetAuthority(uri, NULL);
7784 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7785
7786 hr = IUri_GetDisplayUri(uri, NULL);
7787 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7788
7789 hr = IUri_GetDomain(uri, NULL);
7790 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7791
7792 hr = IUri_GetExtension(uri, NULL);
7793 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7794
7795 hr = IUri_GetFragment(uri, NULL);
7796 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7797
7798 hr = IUri_GetHost(uri, NULL);
7799 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7800
7801 hr = IUri_GetPassword(uri, NULL);
7802 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7803
7804 hr = IUri_GetPath(uri, NULL);
7805 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7806
7807 hr = IUri_GetPathAndQuery(uri, NULL);
7808 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7809
7810 hr = IUri_GetQuery(uri, NULL);
7811 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7812
7813 hr = IUri_GetRawUri(uri, NULL);
7814 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7815
7816 hr = IUri_GetSchemeName(uri, NULL);
7817 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7818
7819 hr = IUri_GetUserInfo(uri, NULL);
7820 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7821
7822 hr = IUri_GetUserName(uri, NULL);
7823 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7824 }
7825 if(uri) IUri_Release(uri);
7826
7827 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7828 uri_properties test = uri_tests[i];
7829 LPWSTR uriW;
7830 uri = NULL;
7831
7832 uriW = a2w(test.uri);
7833 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7834 if(test.create_todo) {
7835 todo_wine {
7836 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7837 hr, test.create_expected, i);
7838 }
7839 } else {
7840 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7841 hr, test.create_expected, i);
7842 }
7843
7844 if(SUCCEEDED(hr)) {
7845 uri_str_property prop;
7846 BSTR received = NULL;
7847
7848 /* GetAbsoluteUri() tests. */
7849 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7850 hr = IUri_GetAbsoluteUri(uri, &received);
7851 if(prop.todo) {
7852 todo_wine {
7853 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7854 hr, prop.expected, i);
7855 }
7856 todo_wine {
7857 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7858 "Error: Expected %s but got %s on uri_tests[%d].\n",
7859 prop.value, wine_dbgstr_w(received), i);
7860 }
7861 } else {
7862 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7863 hr, prop.expected, i);
7864 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7865 "Error: Expected %s but got %s on uri_tests[%d].\n",
7866 prop.value, wine_dbgstr_w(received), i);
7867 }
7868 SysFreeString(received);
7869 received = NULL;
7870
7871 /* GetAuthority() tests. */
7872 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7873 hr = IUri_GetAuthority(uri, &received);
7874 if(prop.todo) {
7875 todo_wine {
7876 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7877 hr, prop.expected, i);
7878 }
7879 todo_wine {
7880 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7881 prop.value, wine_dbgstr_w(received), i);
7882 }
7883 } else {
7884 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7885 hr, prop.expected, i);
7886 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7887 prop.value, wine_dbgstr_w(received), i);
7888 }
7889 SysFreeString(received);
7890 received = NULL;
7891
7892 /* GetDisplayUri() tests. */
7893 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7894 hr = IUri_GetDisplayUri(uri, &received);
7895 if(prop.todo) {
7896 todo_wine {
7897 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7898 hr, prop.expected, i);
7899 }
7900 todo_wine {
7901 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7902 "Error: Expected %s but got %s on uri_test[%d].\n",
7903 prop.value, wine_dbgstr_w(received), i);
7904 }
7905 } else {
7906 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7907 hr, prop.expected, i);
7908 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7909 "Error: Expected %s but got %s on uri_tests[%d].\n",
7910 prop.value, wine_dbgstr_w(received), i);
7911 }
7912 SysFreeString(received);
7913 received = NULL;
7914
7915 /* GetDomain() tests. */
7916 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7917 hr = IUri_GetDomain(uri, &received);
7918 if(prop.todo) {
7919 todo_wine {
7920 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7921 hr, prop.expected, i);
7922 }
7923 todo_wine {
7924 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7925 prop.value, wine_dbgstr_w(received), i);
7926 }
7927 } else {
7928 ok(hr == prop.expected, "Error: GetDomain 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 /* GetExtension() tests. */
7937 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7938 hr = IUri_GetExtension(uri, &received);
7939 if(prop.todo) {
7940 todo_wine {
7941 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7942 hr, prop.expected, i);
7943 }
7944 todo_wine {
7945 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7946 prop.value, wine_dbgstr_w(received), i);
7947 }
7948 } else {
7949 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7950 hr, prop.expected, i);
7951 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7952 prop.value, wine_dbgstr_w(received), i);
7953 }
7954 SysFreeString(received);
7955 received = NULL;
7956
7957 /* GetFragment() tests. */
7958 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7959 hr = IUri_GetFragment(uri, &received);
7960 if(prop.todo) {
7961 todo_wine {
7962 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7963 hr, prop.expected, i);
7964 }
7965 todo_wine {
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 } else {
7970 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7971 hr, prop.expected, i);
7972 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7973 prop.value, wine_dbgstr_w(received), i);
7974 }
7975 SysFreeString(received);
7976 received = NULL;
7977
7978 /* GetHost() tests. */
7979 prop = test.str_props[Uri_PROPERTY_HOST];
7980 hr = IUri_GetHost(uri, &received);
7981 if(prop.todo) {
7982 todo_wine {
7983 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7984 hr, prop.expected, i);
7985 }
7986 todo_wine {
7987 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7988 prop.value, wine_dbgstr_w(received), i);
7989 }
7990 } else {
7991 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7992 hr, prop.expected, i);
7993 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7994 prop.value, wine_dbgstr_w(received), i);
7995 }
7996 SysFreeString(received);
7997 received = NULL;
7998
7999 /* GetPassword() tests. */
8000 prop = test.str_props[Uri_PROPERTY_PASSWORD];
8001 hr = IUri_GetPassword(uri, &received);
8002 if(prop.todo) {
8003 todo_wine {
8004 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8005 hr, prop.expected, i);
8006 }
8007 todo_wine {
8008 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8009 prop.value, wine_dbgstr_w(received), i);
8010 }
8011 } else {
8012 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8013 hr, prop.expected, i);
8014 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8015 prop.value, wine_dbgstr_w(received), i);
8016 }
8017 SysFreeString(received);
8018 received = NULL;
8019
8020 /* GetPath() tests. */
8021 prop = test.str_props[Uri_PROPERTY_PATH];
8022 hr = IUri_GetPath(uri, &received);
8023 if(prop.todo) {
8024 todo_wine {
8025 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8026 hr, prop.expected, i);
8027 }
8028 todo_wine {
8029 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8030 prop.value, wine_dbgstr_w(received), i);
8031 }
8032 } else {
8033 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8034 hr, prop.expected, i);
8035 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8036 prop.value, wine_dbgstr_w(received), i);
8037 }
8038 SysFreeString(received);
8039 received = NULL;
8040
8041 /* GetPathAndQuery() tests. */
8042 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
8043 hr = IUri_GetPathAndQuery(uri, &received);
8044 if(prop.todo) {
8045 todo_wine {
8046 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8047 hr, prop.expected, i);
8048 }
8049 todo_wine {
8050 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8051 prop.value, wine_dbgstr_w(received), i);
8052 }
8053 } else {
8054 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8055 hr, prop.expected, i);
8056 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8057 prop.value, wine_dbgstr_w(received), i);
8058 }
8059 SysFreeString(received);
8060 received = NULL;
8061
8062 /* GetQuery() tests. */
8063 prop = test.str_props[Uri_PROPERTY_QUERY];
8064 hr = IUri_GetQuery(uri, &received);
8065 if(prop.todo) {
8066 todo_wine {
8067 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8068 hr, prop.expected, i);
8069 }
8070 todo_wine {
8071 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8072 prop.value, wine_dbgstr_w(received), i);
8073 }
8074 } else {
8075 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8076 hr, prop.expected, i);
8077 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8078 prop.value, wine_dbgstr_w(received), i);
8079 }
8080 SysFreeString(received);
8081 received = NULL;
8082
8083 /* GetRawUri() tests. */
8084 prop = test.str_props[Uri_PROPERTY_RAW_URI];
8085 hr = IUri_GetRawUri(uri, &received);
8086 if(prop.todo) {
8087 todo_wine {
8088 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8089 hr, prop.expected, i);
8090 }
8091 todo_wine {
8092 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8093 prop.value, wine_dbgstr_w(received), i);
8094 }
8095 } else {
8096 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8097 hr, prop.expected, i);
8098 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8099 prop.value, wine_dbgstr_w(received), i);
8100 }
8101 SysFreeString(received);
8102 received = NULL;
8103
8104 /* GetSchemeName() tests. */
8105 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
8106 hr = IUri_GetSchemeName(uri, &received);
8107 if(prop.todo) {
8108 todo_wine {
8109 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8110 hr, prop.expected, i);
8111 }
8112 todo_wine {
8113 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8114 prop.value, wine_dbgstr_w(received), i);
8115 }
8116 } else {
8117 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8118 hr, prop.expected, i);
8119 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8120 prop.value, wine_dbgstr_w(received), i);
8121 }
8122 SysFreeString(received);
8123 received = NULL;
8124
8125 /* GetUserInfo() tests. */
8126 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8127 hr = IUri_GetUserInfo(uri, &received);
8128 if(prop.todo) {
8129 todo_wine {
8130 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8131 hr, prop.expected, i);
8132 }
8133 todo_wine {
8134 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8135 prop.value, wine_dbgstr_w(received), i);
8136 }
8137 } else {
8138 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8139 hr, prop.expected, i);
8140 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8141 prop.value, wine_dbgstr_w(received), i);
8142 }
8143 SysFreeString(received);
8144 received = NULL;
8145
8146 /* GetUserName() tests. */
8147 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8148 hr = IUri_GetUserName(uri, &received);
8149 if(prop.todo) {
8150 todo_wine {
8151 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8152 hr, prop.expected, i);
8153 }
8154 todo_wine {
8155 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8156 prop.value, wine_dbgstr_w(received), i);
8157 }
8158 } else {
8159 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8160 hr, prop.expected, i);
8161 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8162 prop.value, wine_dbgstr_w(received), i);
8163 }
8164 SysFreeString(received);
8165 }
8166
8167 if(uri) IUri_Release(uri);
8168
8169 heap_free(uriW);
8170 }
8171 }
8172
8173 static void test_IUri_GetDwordProperties(void) {
8174 IUri *uri = NULL;
8175 HRESULT hr;
8176 DWORD i;
8177
8178 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8179 hr = pCreateUri(http_urlW, 0, 0, &uri);
8180 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8181 if(SUCCEEDED(hr)) {
8182 hr = IUri_GetHostType(uri, NULL);
8183 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8184
8185 hr = IUri_GetPort(uri, NULL);
8186 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8187
8188 hr = IUri_GetScheme(uri, NULL);
8189 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8190
8191 hr = IUri_GetZone(uri, NULL);
8192 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8193 }
8194 if(uri) IUri_Release(uri);
8195
8196 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8197 uri_properties test = uri_tests[i];
8198 LPWSTR uriW;
8199 uri = NULL;
8200
8201 uriW = a2w(test.uri);
8202 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8203 if(test.create_todo) {
8204 todo_wine {
8205 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8206 hr, test.create_expected, i);
8207 }
8208 } else {
8209 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8210 hr, test.create_expected, i);
8211 }
8212
8213 if(SUCCEEDED(hr)) {
8214 uri_dword_property prop;
8215 DWORD received;
8216
8217 /* Assign an insane value so tests don't accidentally pass when
8218 * they shouldn't!
8219 */
8220 received = -9999999;
8221
8222 /* GetHostType() tests. */
8223 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8224 hr = IUri_GetHostType(uri, &received);
8225 if(prop.todo) {
8226 todo_wine {
8227 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8228 hr, prop.expected, i);
8229 }
8230 todo_wine {
8231 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8232 }
8233 } else {
8234 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8235 hr, prop.expected, i);
8236 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8237 }
8238 received = -9999999;
8239
8240 /* GetPort() tests. */
8241 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8242 hr = IUri_GetPort(uri, &received);
8243 if(prop.todo) {
8244 todo_wine {
8245 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8246 hr, prop.expected, i);
8247 }
8248 todo_wine {
8249 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8250 }
8251 } else {
8252 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8253 hr, prop.expected, i);
8254 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8255 }
8256 received = -9999999;
8257
8258 /* GetScheme() tests. */
8259 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8260 hr = IUri_GetScheme(uri, &received);
8261 if(prop.todo) {
8262 todo_wine {
8263 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8264 hr, prop.expected, i);
8265 }
8266 todo_wine {
8267 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8268 }
8269 } else {
8270 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8271 hr, prop.expected, i);
8272 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8273 }
8274 received = -9999999;
8275
8276 /* GetZone() tests. */
8277 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8278 hr = IUri_GetZone(uri, &received);
8279 if(prop.todo) {
8280 todo_wine {
8281 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8282 hr, prop.expected, i);
8283 }
8284 todo_wine {
8285 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8286 }
8287 } else {
8288 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8289 hr, prop.expected, i);
8290 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8291 }
8292 }
8293
8294 if(uri) IUri_Release(uri);
8295
8296 heap_free(uriW);
8297 }
8298 }
8299
8300 static void test_IUri_GetPropertyLength(void) {
8301 IUri *uri = NULL;
8302 HRESULT hr;
8303 DWORD i;
8304
8305 /* Make sure it handles invalid args correctly. */
8306 hr = pCreateUri(http_urlW, 0, 0, &uri);
8307 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8308 if(SUCCEEDED(hr)) {
8309 DWORD received = 0xdeadbeef;
8310
8311 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8312 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8313
8314 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8315 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8316 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8317 }
8318 if(uri) IUri_Release(uri);
8319
8320 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8321 uri_properties test = uri_tests[i];
8322 LPWSTR uriW;
8323 uri = NULL;
8324
8325 uriW = a2w(test.uri);
8326 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8327 if(test.create_todo) {
8328 todo_wine {
8329 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8330 hr, test.create_expected, i);
8331 }
8332 } else {
8333 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8334 hr, test.create_expected, i);
8335 }
8336
8337 if(SUCCEEDED(hr)) {
8338 DWORD j;
8339
8340 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8341 DWORD expectedLen, receivedLen;
8342 uri_str_property prop = test.str_props[j];
8343
8344 expectedLen = lstrlenA(prop.value);
8345
8346 /* This won't be necessary once GetPropertyLength is implemented. */
8347 receivedLen = -1;
8348
8349 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8350 if(prop.todo) {
8351 todo_wine {
8352 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8353 hr, prop.expected, i, j);
8354 }
8355 todo_wine {
8356 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8357 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8358 expectedLen, receivedLen, i, j);
8359 }
8360 } else {
8361 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8362 hr, prop.expected, i, j);
8363 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8364 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8365 expectedLen, receivedLen, i, j);
8366 }
8367 }
8368 }
8369
8370 if(uri) IUri_Release(uri);
8371
8372 heap_free(uriW);
8373 }
8374 }
8375
8376 static DWORD compute_expected_props(uri_properties *test)
8377 {
8378 DWORD ret = 0, i;
8379
8380 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8381 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8382 ret |= 1<<i;
8383 }
8384
8385 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8386 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8387 ret |= 1<<i;
8388 }
8389
8390 return ret;
8391 }
8392
8393 static void test_IUri_GetProperties(void) {
8394 IUri *uri = NULL;
8395 HRESULT hr;
8396 DWORD i;
8397
8398 hr = pCreateUri(http_urlW, 0, 0, &uri);
8399 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8400 if(SUCCEEDED(hr)) {
8401 hr = IUri_GetProperties(uri, NULL);
8402 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8403 }
8404 if(uri) IUri_Release(uri);
8405
8406 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8407 uri_properties test = uri_tests[i];
8408 LPWSTR uriW;
8409 uri = NULL;
8410
8411 uriW = a2w(test.uri);
8412 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8413 if(test.create_todo) {
8414 todo_wine {
8415 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8416 }
8417 } else {
8418 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8419 }
8420
8421 if(SUCCEEDED(hr)) {
8422 DWORD received = 0, expected_props;
8423 DWORD j;
8424
8425 hr = IUri_GetProperties(uri, &received);
8426 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8427
8428 expected_props = compute_expected_props(&test);
8429
8430 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8431 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8432 if(expected_props & (1 << j))
8433 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8434 else
8435 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8436 }
8437 }
8438
8439 if(uri) IUri_Release(uri);
8440
8441 heap_free(uriW);
8442 }
8443 }
8444
8445 static void test_IUri_HasProperty(void) {
8446 IUri *uri = NULL;
8447 HRESULT hr;
8448 DWORD i;
8449
8450 hr = pCreateUri(http_urlW, 0, 0, &uri);
8451 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8452 if(SUCCEEDED(hr)) {
8453 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8454 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8455 }
8456 if(uri) IUri_Release(uri);
8457
8458 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8459 uri_properties test = uri_tests[i];
8460 LPWSTR uriW;
8461 uri = NULL;
8462
8463 uriW = a2w(test.uri);
8464
8465 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8466 if(test.create_todo) {
8467 todo_wine {
8468 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8469 }
8470 } else {
8471 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8472 }
8473
8474 if(SUCCEEDED(hr)) {
8475 DWORD expected_props, j;
8476
8477 expected_props = compute_expected_props(&test);
8478
8479 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8480 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8481 BOOL received = -1;
8482
8483 hr = IUri_HasProperty(uri, j, &received);
8484 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8485 hr, S_OK, j, i);
8486
8487 if(expected_props & (1 << j)) {
8488 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8489 } else {
8490 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8491 }
8492 }
8493 }
8494
8495 if(uri) IUri_Release(uri);
8496
8497 heap_free(uriW);
8498 }
8499 }
8500
8501 static void test_IUri_IsEqual(void) {
8502 IUri *uriA, *uriB;
8503 BOOL equal;
8504 HRESULT hres;
8505 DWORD i;
8506
8507 uriA = uriB = NULL;
8508
8509 /* Make sure IsEqual handles invalid args correctly. */
8510 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8511 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8512 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8513 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8514
8515 equal = -1;
8516 hres = IUri_IsEqual(uriA, NULL, &equal);
8517 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8518 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8519
8520 hres = IUri_IsEqual(uriA, uriB, NULL);
8521 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8522
8523 IUri_Release(uriA);
8524 IUri_Release(uriB);
8525
8526 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8527 uri_equality test = equality_tests[i];
8528 LPWSTR uriA_W, uriB_W;
8529
8530 uriA = uriB = NULL;
8531
8532 uriA_W = a2w(test.a);
8533 uriB_W = a2w(test.b);
8534
8535 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8536 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8537
8538 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8539 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8540
8541 equal = -1;
8542 hres = IUri_IsEqual(uriA, uriB, &equal);
8543 if(test.todo) todo_wine {
8544 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8545 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8546 } else {
8547 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8548 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8549 }
8550 if(uriA) IUri_Release(uriA);
8551 if(uriB) IUri_Release(uriB);
8552
8553 heap_free(uriA_W);
8554 heap_free(uriB_W);
8555 }
8556 }
8557
8558 static void test_CreateUriWithFragment_InvalidArgs(void) {
8559 HRESULT hr;
8560 IUri *uri = (void*) 0xdeadbeef;
8561 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8562
8563 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8564 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8565 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8566
8567 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8568 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8569
8570 /* Original URI can't already contain a fragment component. */
8571 uri = (void*) 0xdeadbeef;
8572 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8573 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8574 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8575 }
8576
8577 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8578 static void test_CreateUriWithFragment_InvalidFlags(void) {
8579 DWORD i;
8580
8581 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8582 HRESULT hr;
8583 IUri *uri = (void*) 0xdeadbeef;
8584
8585 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8586 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8587 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8588 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8589 }
8590 }
8591
8592 static void test_CreateUriWithFragment(void) {
8593 DWORD i;
8594
8595 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8596 HRESULT hr;
8597 IUri *uri = NULL;
8598 LPWSTR uriW, fragW;
8599 uri_with_fragment test = uri_fragment_tests[i];
8600
8601 uriW = a2w(test.uri);
8602 fragW = a2w(test.fragment);
8603
8604 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8605 if(test.expected_todo) {
8606 todo_wine {
8607 ok(hr == test.create_expected,
8608 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8609 hr, test.create_expected, i);
8610 }
8611 } else
8612 ok(hr == test.create_expected,
8613 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8614 hr, test.create_expected, i);
8615
8616 if(SUCCEEDED(hr)) {
8617 BSTR received = NULL;
8618
8619 hr = IUri_GetAbsoluteUri(uri, &received);
8620 if(test.expected_todo) {
8621 todo_wine {
8622 ok(hr == S_OK,
8623 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8624 hr, S_OK, i);
8625 }
8626 todo_wine {
8627 ok(!strcmp_aw(test.expected_uri, received),
8628 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8629 test.expected_uri, wine_dbgstr_w(received), i);
8630 }
8631 } else {
8632 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8633 hr, S_OK, i);
8634 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8635 test.expected_uri, wine_dbgstr_w(received), i);
8636 }
8637
8638 SysFreeString(received);
8639 }
8640
8641 if(uri) IUri_Release(uri);
8642 heap_free(uriW);
8643 heap_free(fragW);
8644 }
8645 }
8646
8647 static void test_CreateIUriBuilder(void) {
8648 HRESULT hr;
8649 IUriBuilder *builder = NULL;
8650 IUri *uri;
8651
8652 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8653 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8654 hr, E_POINTER);
8655
8656 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8657 hr = pCreateUri(http_urlW, 0, 0, &uri);
8658 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8659 if(SUCCEEDED(hr)) {
8660 ULONG cur_count, orig_count;
8661
8662 orig_count = get_refcnt(uri);
8663 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8664 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8665 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8666
8667 cur_count = get_refcnt(uri);
8668 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8669
8670 if(builder) IUriBuilder_Release(builder);
8671 cur_count = get_refcnt(uri);
8672 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8673 }
8674 if(uri) IUri_Release(uri);
8675 }
8676
8677 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8678 DWORD test_index) {
8679 HRESULT hr;
8680 IUri *uri = NULL;
8681
8682 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8683 if(test->uri_todo) {
8684 todo_wine {
8685 ok(hr == test->uri_hres,
8686 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8687 hr, test->uri_hres, test_index);
8688 }
8689 } else {
8690 ok(hr == test->uri_hres,
8691 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8692 hr, test->uri_hres, test_index);
8693 }
8694
8695 if(SUCCEEDED(hr)) {
8696 DWORD i;
8697
8698 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8699 uri_builder_str_property prop = test->expected_str_props[i];
8700 BSTR received = NULL;
8701
8702 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8703 if(prop.todo) {
8704 todo_wine {
8705 ok(hr == prop.result,
8706 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8707 hr, prop.result, test_index, i);
8708 }
8709 } else {
8710 ok(hr == prop.result,
8711 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8712 hr, prop.result, test_index, i);
8713 }
8714 if(SUCCEEDED(hr)) {
8715 if(prop.todo) {
8716 todo_wine {
8717 ok(!strcmp_aw(prop.expected, received),
8718 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8719 prop.expected, wine_dbgstr_w(received), test_index, i);
8720 }
8721 } else {
8722 ok(!strcmp_aw(prop.expected, received),
8723 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8724 prop.expected, wine_dbgstr_w(received), test_index, i);
8725 }
8726 }
8727 SysFreeString(received);
8728 }
8729
8730 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8731 uri_builder_dword_property prop = test->expected_dword_props[i];
8732 DWORD received = -2;
8733
8734 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8735 if(prop.todo) {
8736 todo_wine {
8737 ok(hr == prop.result,
8738 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8739 hr, prop.result, test_index, i);
8740 }
8741 } else {
8742 ok(hr == prop.result,
8743 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8744 hr, prop.result, test_index, i);
8745 }
8746 if(SUCCEEDED(hr)) {
8747 if(prop.todo) {
8748 todo_wine {
8749 ok(received == prop.expected,
8750 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8751 prop.expected, received, test_index, i);
8752 }
8753 } else {
8754 ok(received == prop.expected,
8755 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8756 prop.expected, received, test_index, i);
8757 }
8758 }
8759 }
8760 }
8761 if(uri) IUri_Release(uri);
8762 }
8763
8764 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8765 DWORD test_index) {
8766 HRESULT hr;
8767 IUri *uri = NULL;
8768
8769 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8770 if(test->uri_simple_todo) {
8771 todo_wine {
8772 ok(hr == test->uri_simple_hres,
8773 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8774 hr, test->uri_simple_hres, test_index);
8775 }
8776 } else {
8777 ok(hr == test->uri_simple_hres,
8778 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8779 hr, test->uri_simple_hres, test_index);
8780 }
8781
8782 if(SUCCEEDED(hr)) {
8783 DWORD i;
8784
8785 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8786 uri_builder_str_property prop = test->expected_str_props[i];
8787 BSTR received = NULL;
8788
8789 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8790 if(prop.todo) {
8791 todo_wine {
8792 ok(hr == prop.result,
8793 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8794 hr, prop.result, test_index, i);
8795 }
8796 } else {
8797 ok(hr == prop.result,
8798 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8799 hr, prop.result, test_index, i);
8800 }
8801 if(SUCCEEDED(hr)) {
8802 if(prop.todo) {
8803 todo_wine {
8804 ok(!strcmp_aw(prop.expected, received),
8805 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8806 prop.expected, wine_dbgstr_w(received), test_index, i);
8807 }
8808 } else {
8809 ok(!strcmp_aw(prop.expected, received),
8810 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8811 prop.expected, wine_dbgstr_w(received), test_index, i);
8812 }
8813 }
8814 SysFreeString(received);
8815 }
8816
8817 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8818 uri_builder_dword_property prop = test->expected_dword_props[i];
8819 DWORD received = -2;
8820
8821 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8822 if(prop.todo) {
8823 todo_wine {
8824 ok(hr == prop.result,
8825 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8826 hr, prop.result, test_index, i);
8827 }
8828 } else {
8829 ok(hr == prop.result,
8830 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8831 hr, prop.result, test_index, i);
8832 }
8833 if(SUCCEEDED(hr)) {
8834 if(prop.todo) {
8835 todo_wine {
8836 ok(received == prop.expected,
8837 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8838 prop.expected, received, test_index, i);
8839 }
8840 } else {
8841 ok(received == prop.expected,
8842 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8843 prop.expected, received, test_index, i);
8844 }
8845 }
8846 }
8847 }
8848 if(uri) IUri_Release(uri);
8849 }
8850
8851 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8852 DWORD test_index) {
8853 HRESULT hr;
8854 IUri *uri = NULL;
8855
8856 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8857 test->uri_with_encode_flags, 0, &uri);
8858 if(test->uri_with_todo) {
8859 todo_wine {
8860 ok(hr == test->uri_with_hres,
8861 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8862 hr, test->uri_with_hres, test_index);
8863 }
8864 } else {
8865 ok(hr == test->uri_with_hres,
8866 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8867 hr, test->uri_with_hres, test_index);
8868 }
8869
8870 if(SUCCEEDED(hr)) {
8871 DWORD i;
8872
8873 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8874 uri_builder_str_property prop = test->expected_str_props[i];
8875 BSTR received = NULL;
8876
8877 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8878 if(prop.todo) {
8879 todo_wine {
8880 ok(hr == prop.result,
8881 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8882 hr, prop.result, test_index, i);
8883 }
8884 } else {
8885 ok(hr == prop.result,
8886 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8887 hr, prop.result, test_index, i);
8888 }
8889 if(SUCCEEDED(hr)) {
8890 if(prop.todo) {
8891 todo_wine {
8892 ok(!strcmp_aw(prop.expected, received),
8893 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8894 prop.expected, wine_dbgstr_w(received), test_index, i);
8895 }
8896 } else {
8897 ok(!strcmp_aw(prop.expected, received),
8898 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8899 prop.expected, wine_dbgstr_w(received), test_index, i);
8900 }
8901 }
8902 SysFreeString(received);
8903 }
8904
8905 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8906 uri_builder_dword_property prop = test->expected_dword_props[i];
8907 DWORD received = -2;
8908
8909 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8910 if(prop.todo) {
8911 todo_wine {
8912 ok(hr == prop.result,
8913 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8914 hr, prop.result, test_index, i);
8915 }
8916 } else {
8917 ok(hr == prop.result,
8918 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8919 hr, prop.result, test_index, i);
8920 }
8921 if(SUCCEEDED(hr)) {
8922 if(prop.todo) {
8923 todo_wine {
8924 ok(received == prop.expected,
8925 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8926 prop.expected, received, test_index, i);
8927 }
8928 } else {
8929 ok(received == prop.expected,
8930 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8931 prop.expected, received, test_index, i);
8932 }
8933 }
8934 }
8935 }
8936 if(uri) IUri_Release(uri);
8937 }
8938
8939 static void test_IUriBuilder_CreateInvalidArgs(void) {
8940 IUriBuilder *builder;
8941 HRESULT hr;
8942
8943 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8944 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8945 if(SUCCEEDED(hr)) {
8946 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8947
8948 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8949 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8950 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8951
8952 uri = (void*) 0xdeadbeef;
8953 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8954 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8955 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8956
8957 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8958 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8959 hr, E_POINTER);
8960
8961 uri = (void*) 0xdeadbeef;
8962 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8963 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8964 hr, E_NOTIMPL);
8965 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8966
8967 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8968 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8969 hr, E_POINTER);
8970
8971 uri = (void*) 0xdeadbeef;
8972 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8973 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8974 hr, E_NOTIMPL);
8975 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8976
8977 hr = pCreateUri(http_urlW, 0, 0, &test);
8978 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8979 if(SUCCEEDED(hr)) {
8980 hr = IUriBuilder_SetIUri(builder, test);
8981 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8982
8983 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8984 uri = NULL;
8985 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8986 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8987 ok(uri != NULL, "Error: The uri was NULL.\n");
8988 if(uri) IUri_Release(uri);
8989
8990 uri = NULL;
8991 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8992 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8993 hr, S_OK);
8994 ok(uri != NULL, "Error: uri was NULL.\n");
8995 if(uri) IUri_Release(uri);
8996
8997 uri = NULL;
8998 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8999 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9000 hr, S_OK);
9001 ok(uri != NULL, "Error: uri was NULL.\n");
9002 if(uri) IUri_Release(uri);
9003
9004 hr = IUriBuilder_SetFragment(builder, NULL);
9005 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9006
9007 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9008 uri = (void*) 0xdeadbeef;
9009 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
9010 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9011 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
9012
9013 uri = (void*) 0xdeadbeef;
9014 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
9015 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9016 hr, S_OK);
9017 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9018
9019 uri = (void*) 0xdeadbeef;
9020 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
9021 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9022 hr, E_NOTIMPL);
9023 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
9024 }
9025 if(test) IUri_Release(test);
9026 }
9027 if(builder) IUriBuilder_Release(builder);
9028 }
9029
9030 /* Tests invalid args to the "Get*" functions. */
9031 static void test_IUriBuilder_GetInvalidArgs(void) {
9032 IUriBuilder *builder = NULL;
9033 HRESULT hr;
9034
9035 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9036 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9037 if(SUCCEEDED(hr)) {
9038 LPCWSTR received = (void*) 0xdeadbeef;
9039 DWORD len = -1, port = -1;
9040 BOOL set = -1;
9041
9042 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
9043 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9044 hr, E_POINTER);
9045 hr = IUriBuilder_GetFragment(builder, NULL, &received);
9046 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9047 hr, E_POINTER);
9048 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9049 hr = IUriBuilder_GetFragment(builder, &len, NULL);
9050 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9051 hr, E_POINTER);
9052 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9053
9054 hr = IUriBuilder_GetHost(builder, NULL, NULL);
9055 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9056 hr, E_POINTER);
9057 received = (void*) 0xdeadbeef;
9058 hr = IUriBuilder_GetHost(builder, NULL, &received);
9059 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9060 hr, E_POINTER);
9061 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9062 len = -1;
9063 hr = IUriBuilder_GetHost(builder, &len, NULL);
9064 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9065 hr, E_POINTER);
9066 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9067
9068 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
9069 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9070 hr, E_POINTER);
9071 received = (void*) 0xdeadbeef;
9072 hr = IUriBuilder_GetPassword(builder, NULL, &received);
9073 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9074 hr, E_POINTER);
9075 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9076 len = -1;
9077 hr = IUriBuilder_GetPassword(builder, &len, NULL);
9078 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9079 hr, E_POINTER);
9080 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9081
9082 hr = IUriBuilder_GetPath(builder, NULL, NULL);
9083 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9084 hr, E_POINTER);
9085 received = (void*) 0xdeadbeef;
9086 hr = IUriBuilder_GetPath(builder, NULL, &received);
9087 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9088 hr, E_POINTER);
9089 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9090 len = -1;
9091 hr = IUriBuilder_GetPath(builder, &len, NULL);
9092 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9093 hr, E_POINTER);
9094 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9095
9096 hr = IUriBuilder_GetPort(builder, NULL, NULL);
9097 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9098 hr, E_POINTER);
9099 hr = IUriBuilder_GetPort(builder, NULL, &port);
9100 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9101 hr, E_POINTER);
9102 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
9103 hr = IUriBuilder_GetPort(builder, &set, NULL);
9104 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9105 hr, E_POINTER);
9106 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9107
9108 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9109 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9110 hr, E_POINTER);
9111 received = (void*) 0xdeadbeef;
9112 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9113 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9114 hr, E_POINTER);
9115 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9116 len = -1;
9117 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9118 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9119 hr, E_POINTER);
9120 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9121
9122 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9123 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9124 hr, E_POINTER);
9125 received = (void*) 0xdeadbeef;
9126 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9127 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9128 hr, E_POINTER);
9129 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9130 len = -1;
9131 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9132 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9133 hr, E_POINTER);
9134 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9135
9136 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9137 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9138 hr, E_POINTER);
9139 received = (void*) 0xdeadbeef;
9140 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9141 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9142 hr, E_POINTER);
9143 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9144 len = -1;
9145 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9146 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9147 hr, E_POINTER);
9148 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9149 }
9150 if(builder) IUriBuilder_Release(builder);
9151 }
9152
9153 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
9154 DWORD test_index) {
9155 HRESULT hr;
9156 DWORD i;
9157 LPCWSTR received = NULL;
9158 DWORD len = -1;
9159 const uri_builder_property *prop = NULL;
9160
9161 /* Check if the property was set earlier. */
9162 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9163 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9164 prop = &(test->properties[i]);
9165 }
9166
9167 if(prop) {
9168 /* Use expected_value unless it's NULL, then use value. */
9169 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9170 DWORD expected_len = expected ? strlen(expected) : 0;
9171 hr = IUriBuilder_GetFragment(builder, &len, &received);
9172 if(prop->todo) {
9173 todo_wine {
9174 ok(hr == (expected ? S_OK : S_FALSE),
9175 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9176 hr, (expected ? S_OK : S_FALSE), test_index);
9177 }
9178 if(SUCCEEDED(hr)) {
9179 todo_wine {
9180 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9181 expected, wine_dbgstr_w(received), test_index);
9182 }
9183 todo_wine {
9184 ok(expected_len == len,
9185 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9186 expected_len, len, test_index);
9187 }
9188 }
9189 } else {
9190 ok(hr == (expected ? S_OK : S_FALSE),
9191 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9192 hr, (expected ? S_OK : S_FALSE), test_index);
9193 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9194 expected, wine_dbgstr_w(received), test_index);
9195 ok(expected_len == len,
9196 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9197 expected_len, len, test_index);
9198 }
9199 } else {
9200 /* The property wasn't set earlier, so it should return whatever
9201 * the base IUri contains (if anything).
9202 */
9203 IUri *uri = NULL;
9204 hr = IUriBuilder_GetIUri(builder, &uri);
9205 ok(hr == S_OK,
9206 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9207 hr, S_OK, test_index);
9208 if(SUCCEEDED(hr)) {
9209 if(!uri) {
9210 received = (void*) 0xdeadbeef;
9211 len = -1;
9212
9213 hr = IUriBuilder_GetFragment(builder, &len, &received);
9214 ok(hr == S_FALSE,
9215 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9216 hr, S_FALSE, test_index);
9217 if(SUCCEEDED(hr)) {
9218 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9219 len, test_index);
9220 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9221 received, test_index);
9222 }
9223 } else {
9224 BOOL has_prop = FALSE;
9225 BSTR expected = NULL;
9226
9227 hr = IUri_GetFragment(uri, &expected);
9228 ok(SUCCEEDED(hr),
9229 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9230 hr, test_index);
9231 has_prop = hr == S_OK;
9232
9233 hr = IUriBuilder_GetFragment(builder, &len, &received);
9234 if(has_prop) {
9235 ok(hr == S_OK,
9236 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9237 hr, S_OK, test_index);
9238 if(SUCCEEDED(hr)) {
9239 ok(!lstrcmpW(expected, received),
9240 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9241 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9242 ok(lstrlenW(expected) == len,
9243 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9244 lstrlenW(expected), len, test_index);
9245 }
9246 } else {
9247 ok(hr == S_FALSE,
9248 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9249 hr, S_FALSE, test_index);
9250 if(SUCCEEDED(hr)) {
9251 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9252 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9253 len, test_index);
9254 }
9255 }
9256 SysFreeString(expected);
9257 }
9258 }
9259 if(uri) IUri_Release(uri);
9260 }
9261 }
9262
9263 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9264 DWORD test_index) {
9265 HRESULT hr;
9266 DWORD i;
9267 LPCWSTR received = NULL;
9268 DWORD len = -1;
9269 const uri_builder_property *prop = NULL;
9270
9271 /* Check if the property was set earlier. */
9272 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9273 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9274 prop = &(test->properties[i]);
9275 }
9276
9277 if(prop) {
9278 /* Use expected_value unless it's NULL, then use value. */
9279 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9280 DWORD expected_len = expected ? strlen(expected) : 0;
9281 hr = IUriBuilder_GetHost(builder, &len, &received);
9282 if(prop->todo) {
9283 todo_wine {
9284 ok(hr == (expected ? S_OK : S_FALSE),
9285 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9286 hr, (expected ? S_OK : S_FALSE), test_index);
9287 }
9288 if(SUCCEEDED(hr)) {
9289 todo_wine {
9290 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9291 expected, wine_dbgstr_w(received), test_index);
9292 }
9293 todo_wine {
9294 ok(expected_len == len,
9295 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9296 expected_len, len, test_index);
9297 }
9298 }
9299 } else {
9300 ok(hr == (expected ? S_OK : S_FALSE),
9301 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9302 hr, (expected ? S_OK : S_FALSE), test_index);
9303 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9304 expected, wine_dbgstr_w(received), test_index);
9305 ok(expected_len == len,
9306 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9307 expected_len, len, test_index);
9308 }
9309 } else {
9310 /* The property wasn't set earlier, so it should return whatever
9311 * the base IUri contains (if anything).
9312 */
9313 IUri *uri = NULL;
9314 hr = IUriBuilder_GetIUri(builder, &uri);
9315 ok(hr == S_OK,
9316 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9317 hr, S_OK, test_index);
9318 if(SUCCEEDED(hr)) {
9319 if(!uri) {
9320 received = (void*) 0xdeadbeef;
9321 len = -1;
9322
9323 hr = IUriBuilder_GetHost(builder, &len, &received);
9324 ok(hr == S_FALSE,
9325 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9326 hr, S_FALSE, test_index);
9327 if(SUCCEEDED(hr)) {
9328 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9329 len, test_index);
9330 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9331 received, test_index);
9332 }
9333 } else {
9334 BOOL has_prop = FALSE;
9335 BSTR expected = NULL;
9336
9337 hr = IUri_GetHost(uri, &expected);
9338 ok(SUCCEEDED(hr),
9339 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9340 hr, test_index);
9341 has_prop = hr == S_OK;
9342
9343 hr = IUriBuilder_GetHost(builder, &len, &received);
9344 if(has_prop) {
9345 ok(hr == S_OK,
9346 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9347 hr, S_OK, test_index);
9348 if(SUCCEEDED(hr)) {
9349 ok(!lstrcmpW(expected, received),
9350 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9351 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9352 ok(lstrlenW(expected) == len,
9353 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9354 lstrlenW(expected), len, test_index);
9355 }
9356 } else {
9357 ok(hr == S_FALSE,
9358 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9359 hr, S_FALSE, test_index);
9360 if(SUCCEEDED(hr)) {
9361 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9362 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9363 len, test_index);
9364 }
9365 }
9366 SysFreeString(expected);
9367 }
9368 }
9369 if(uri) IUri_Release(uri);
9370 }
9371 }
9372
9373 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9374 DWORD test_index) {
9375 HRESULT hr;
9376 DWORD i;
9377 LPCWSTR received = NULL;
9378 DWORD len = -1;
9379 const uri_builder_property *prop = NULL;
9380
9381 /* Check if the property was set earlier. */
9382 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9383 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9384 prop = &(test->properties[i]);
9385 }
9386
9387 if(prop) {
9388 /* Use expected_value unless it's NULL, then use value. */
9389 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9390 DWORD expected_len = expected ? strlen(expected) : 0;
9391 hr = IUriBuilder_GetPassword(builder, &len, &received);
9392 if(prop->todo) {
9393 todo_wine {
9394 ok(hr == (expected ? S_OK : S_FALSE),
9395 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9396 hr, (expected ? S_OK : S_FALSE), test_index);
9397 }
9398 if(SUCCEEDED(hr)) {
9399 todo_wine {
9400 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9401 expected, wine_dbgstr_w(received), test_index);
9402 }
9403 todo_wine {
9404 ok(expected_len == len,
9405 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9406 expected_len, len, test_index);
9407 }
9408 }
9409 } else {
9410 ok(hr == (expected ? S_OK : S_FALSE),
9411 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9412 hr, (expected ? S_OK : S_FALSE), test_index);
9413 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9414 expected, wine_dbgstr_w(received), test_index);
9415 ok(expected_len == len,
9416 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9417 expected_len, len, test_index);
9418 }
9419 } else {
9420 /* The property wasn't set earlier, so it should return whatever
9421 * the base IUri contains (if anything).
9422 */
9423 IUri *uri = NULL;
9424 hr = IUriBuilder_GetIUri(builder, &uri);
9425 ok(hr == S_OK,
9426 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9427 hr, S_OK, test_index);
9428 if(SUCCEEDED(hr)) {
9429 if(!uri) {
9430 received = (void*) 0xdeadbeef;
9431 len = -1;
9432
9433 hr = IUriBuilder_GetPassword(builder, &len, &received);
9434 ok(hr == S_FALSE,
9435 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9436 hr, S_FALSE, test_index);
9437 if(SUCCEEDED(hr)) {
9438 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9439 len, test_index);
9440 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9441 received, test_index);
9442 }
9443 } else {
9444 BOOL has_prop = FALSE;
9445 BSTR expected = NULL;
9446
9447 hr = IUri_GetPassword(uri, &expected);
9448 ok(SUCCEEDED(hr),
9449 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9450 hr, test_index);
9451 has_prop = hr == S_OK;
9452
9453 hr = IUriBuilder_GetPassword(builder, &len, &received);
9454 if(has_prop) {
9455 ok(hr == S_OK,
9456 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9457 hr, S_OK, test_index);
9458 if(SUCCEEDED(hr)) {
9459 ok(!lstrcmpW(expected, received),
9460 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9461 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9462 ok(lstrlenW(expected) == len,
9463 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9464 lstrlenW(expected), len, test_index);
9465 }
9466 } else {
9467 ok(hr == S_FALSE,
9468 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9469 hr, S_FALSE, test_index);
9470 if(SUCCEEDED(hr)) {
9471 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9472 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9473 len, test_index);
9474 }
9475 }
9476 SysFreeString(expected);
9477 }
9478 }
9479 if(uri) IUri_Release(uri);
9480 }
9481 }
9482
9483 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9484 DWORD test_index) {
9485 HRESULT hr;
9486 DWORD i;
9487 LPCWSTR received = NULL;
9488 DWORD len = -1;
9489 const uri_builder_property *prop = NULL;
9490
9491 /* Check if the property was set earlier. */
9492 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9493 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9494 prop = &(test->properties[i]);
9495 }
9496
9497 if(prop) {
9498 /* Use expected_value unless it's NULL, then use value. */
9499 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9500 DWORD expected_len = expected ? strlen(expected) : 0;
9501 hr = IUriBuilder_GetPath(builder, &len, &received);
9502 if(prop->todo) {
9503 todo_wine {
9504 ok(hr == (expected ? S_OK : S_FALSE),
9505 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9506 hr, (expected ? S_OK : S_FALSE), test_index);
9507 }
9508 if(SUCCEEDED(hr)) {
9509 todo_wine {
9510 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9511 expected, wine_dbgstr_w(received), test_index);
9512 }
9513 todo_wine {
9514 ok(expected_len == len,
9515 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9516 expected_len, len, test_index);
9517 }
9518 }
9519 } else {
9520 ok(hr == (expected ? S_OK : S_FALSE),
9521 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9522 hr, (expected ? S_OK : S_FALSE), test_index);
9523 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9524 expected, wine_dbgstr_w(received), test_index);
9525 ok(expected_len == len,
9526 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9527 expected_len, len, test_index);
9528 }
9529 } else {
9530 /* The property wasn't set earlier, so it should return whatever
9531 * the base IUri contains (if anything).
9532 */
9533 IUri *uri = NULL;
9534 hr = IUriBuilder_GetIUri(builder, &uri);
9535 ok(hr == S_OK,
9536 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9537 hr, S_OK, test_index);
9538 if(SUCCEEDED(hr)) {
9539 if(!uri) {
9540 received = (void*) 0xdeadbeef;
9541 len = -1;
9542
9543 hr = IUriBuilder_GetPath(builder, &len, &received);
9544 ok(hr == S_FALSE,
9545 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9546 hr, S_FALSE, test_index);
9547 if(SUCCEEDED(hr)) {
9548 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9549 len, test_index);
9550 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9551 received, test_index);
9552 }
9553 } else {
9554 BOOL has_prop = FALSE;
9555 BSTR expected = NULL;
9556
9557 hr = IUri_GetPath(uri, &expected);
9558 ok(SUCCEEDED(hr),
9559 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9560 hr, test_index);
9561 has_prop = hr == S_OK;
9562
9563 hr = IUriBuilder_GetPath(builder, &len, &received);
9564 if(has_prop) {
9565 ok(hr == S_OK,
9566 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9567 hr, S_OK, test_index);
9568 if(SUCCEEDED(hr)) {
9569 ok(!lstrcmpW(expected, received),
9570 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9571 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9572 ok(lstrlenW(expected) == len,
9573 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9574 lstrlenW(expected), len, test_index);
9575 }
9576 } else {
9577 ok(hr == S_FALSE,
9578 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9579 hr, S_FALSE, test_index);
9580 if(SUCCEEDED(hr)) {
9581 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9582 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9583 len, test_index);
9584 }
9585 }
9586 SysFreeString(expected);
9587 }
9588 }
9589 if(uri) IUri_Release(uri);
9590 }
9591 }
9592
9593 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9594 DWORD test_index) {
9595 HRESULT hr;
9596 BOOL has_port = FALSE;
9597 DWORD received = -1;
9598
9599 if(test->port_prop.change) {
9600 DWORD expected = test->port_prop.value;
9601
9602 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9603 if(test->port_prop.todo) {
9604 todo_wine {
9605 ok(hr == S_OK,
9606 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9607 hr, S_OK, test_index);
9608 }
9609 if(SUCCEEDED(hr)) {
9610 todo_wine {
9611 ok(has_port == test->port_prop.set,
9612 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9613 test->port_prop.set, has_port, test_index);
9614 }
9615 todo_wine {
9616 ok(received == expected,
9617 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9618 expected, received, test_index);
9619 }
9620 }
9621 } else {
9622 ok(hr == S_OK,
9623 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9624 hr, S_OK, test_index);
9625 ok(has_port == test->port_prop.set,
9626 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9627 test->port_prop.set, has_port, test_index);
9628 ok(received == test->port_prop.value,
9629 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9630 test->port_prop.value, received, test_index);
9631 }
9632 } else {
9633 IUri *uri = NULL;
9634
9635 hr = IUriBuilder_GetIUri(builder, &uri);
9636 ok(hr == S_OK,
9637 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9638 hr, S_OK, test_index);
9639 if(SUCCEEDED(hr)) {
9640 if(!uri) {
9641 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9642 ok(hr == S_OK,
9643 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9644 hr, S_OK, test_index);
9645 if(SUCCEEDED(hr)) {
9646 ok(has_port == FALSE,
9647 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9648 has_port, test_index);
9649 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9650 received, test_index);
9651 }
9652 } else {
9653 DWORD expected;
9654
9655 hr = IUri_GetPort(uri, &expected);
9656 ok(SUCCEEDED(hr),
9657 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9658 hr, test_index);
9659
9660 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9661 ok(hr == S_OK,
9662 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9663 hr, S_OK, test_index);
9664 if(SUCCEEDED(hr)) {
9665 ok(!has_port,
9666 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9667 test_index);
9668 ok(received == expected,
9669 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9670 expected, received, test_index);
9671 }
9672 }
9673 }
9674 if(uri) IUri_Release(uri);
9675 }
9676 }
9677
9678 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9679 DWORD test_index) {
9680 HRESULT hr;
9681 DWORD i;
9682 LPCWSTR received = NULL;
9683 DWORD len = -1;
9684 const uri_builder_property *prop = NULL;
9685
9686 /* Check if the property was set earlier. */
9687 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9688 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9689 prop = &(test->properties[i]);
9690 }
9691
9692 if(prop) {
9693 /* Use expected_value unless it's NULL, then use value. */
9694 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9695 DWORD expected_len = expected ? strlen(expected) : 0;
9696 hr = IUriBuilder_GetQuery(builder, &len, &received);
9697 if(prop->todo) {
9698 todo_wine {
9699 ok(hr == (expected ? S_OK : S_FALSE),
9700 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9701 hr, (expected ? S_OK : S_FALSE), test_index);
9702 }
9703 if(SUCCEEDED(hr)) {
9704 todo_wine {
9705 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9706 expected, wine_dbgstr_w(received), test_index);
9707 }
9708 todo_wine {
9709 ok(expected_len == len,
9710 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9711 expected_len, len, test_index);
9712 }
9713 }
9714 } else {
9715 ok(hr == (expected ? S_OK : S_FALSE),
9716 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9717 hr, (expected ? S_OK : S_FALSE), test_index);
9718 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9719 expected, wine_dbgstr_w(received), test_index);
9720 ok(expected_len == len,
9721 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9722 expected_len, len, test_index);
9723 }
9724 } else {
9725 /* The property wasn't set earlier, so it should return whatever
9726 * the base IUri contains (if anything).
9727 */
9728 IUri *uri = NULL;
9729 hr = IUriBuilder_GetIUri(builder, &uri);
9730 ok(hr == S_OK,
9731 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9732 hr, S_OK, test_index);
9733 if(SUCCEEDED(hr)) {
9734 if(!uri) {
9735 received = (void*) 0xdeadbeef;
9736 len = -1;
9737
9738 hr = IUriBuilder_GetQuery(builder, &len, &received);
9739 ok(hr == S_FALSE,
9740 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9741 hr, S_FALSE, test_index);
9742 if(SUCCEEDED(hr)) {
9743 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9744 len, test_index);
9745 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9746 received, test_index);
9747 }
9748 } else {
9749 BOOL has_prop = FALSE;
9750 BSTR expected = NULL;
9751
9752 hr = IUri_GetQuery(uri, &expected);
9753 ok(SUCCEEDED(hr),
9754 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9755 hr, test_index);
9756 has_prop = hr == S_OK;
9757
9758 hr = IUriBuilder_GetQuery(builder, &len, &received);
9759 if(has_prop) {
9760 ok(hr == S_OK,
9761 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9762 hr, S_OK, test_index);
9763 if(SUCCEEDED(hr)) {
9764 ok(!lstrcmpW(expected, received),
9765 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9766 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9767 ok(lstrlenW(expected) == len,
9768 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9769 lstrlenW(expected), len, test_index);
9770 }
9771 } else {
9772 ok(hr == S_FALSE,
9773 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9774 hr, S_FALSE, test_index);
9775 if(SUCCEEDED(hr)) {
9776 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9777 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9778 len, test_index);
9779 }
9780 }
9781 SysFreeString(expected);
9782 }
9783 }
9784 if(uri) IUri_Release(uri);
9785 }
9786 }
9787
9788 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9789 DWORD test_index) {
9790 HRESULT hr;
9791 DWORD i;
9792 LPCWSTR received = NULL;
9793 DWORD len = -1;
9794 const uri_builder_property *prop = NULL;
9795
9796 /* Check if the property was set earlier. */
9797 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9798 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9799 prop = &(test->properties[i]);
9800 }
9801
9802 if(prop) {
9803 /* Use expected_value unless it's NULL, then use value. */
9804 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9805 DWORD expected_len = expected ? strlen(expected) : 0;
9806 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9807 if(prop->todo) {
9808 todo_wine {
9809 ok(hr == (expected ? S_OK : S_FALSE),
9810 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9811 hr, (expected ? S_OK : S_FALSE), test_index);
9812 }
9813 if(SUCCEEDED(hr)) {
9814 todo_wine {
9815 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9816 expected, wine_dbgstr_w(received), test_index);
9817 }
9818 todo_wine {
9819 ok(expected_len == len,
9820 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9821 expected_len, len, test_index);
9822 }
9823 }
9824 } else {
9825 ok(hr == (expected ? S_OK : S_FALSE),
9826 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9827 hr, (expected ? S_OK : S_FALSE), test_index);
9828 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9829 expected, wine_dbgstr_w(received), test_index);
9830 ok(expected_len == len,
9831 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9832 expected_len, len, test_index);
9833 }
9834 } else {
9835 /* The property wasn't set earlier, so it should return whatever
9836 * the base IUri contains (if anything).
9837 */
9838 IUri *uri = NULL;
9839 hr = IUriBuilder_GetIUri(builder, &uri);
9840 ok(hr == S_OK,
9841 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9842 hr, S_OK, test_index);
9843 if(SUCCEEDED(hr)) {
9844 if(!uri) {
9845 received = (void*) 0xdeadbeef;
9846 len = -1;
9847
9848 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9849 ok(hr == S_FALSE,
9850 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9851 hr, S_FALSE, test_index);
9852 if(SUCCEEDED(hr)) {
9853 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9854 len, test_index);
9855 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9856 received, test_index);
9857 }
9858 } else {
9859 BOOL has_prop = FALSE;
9860 BSTR expected = NULL;
9861
9862 hr = IUri_GetSchemeName(uri, &expected);
9863 ok(SUCCEEDED(hr),
9864 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9865 hr, test_index);
9866 has_prop = hr == S_OK;
9867
9868 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9869 if(has_prop) {
9870 ok(hr == S_OK,
9871 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9872 hr, S_OK, test_index);
9873 if(SUCCEEDED(hr)) {
9874 ok(!lstrcmpW(expected, received),
9875 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9876 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9877 ok(lstrlenW(expected) == len,
9878 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9879 lstrlenW(expected), len, test_index);
9880 }
9881 } else {
9882 ok(hr == S_FALSE,
9883 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9884 hr, S_FALSE, test_index);
9885 if(SUCCEEDED(hr)) {
9886 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9887 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9888 len, test_index);
9889 }
9890 }
9891 SysFreeString(expected);
9892 }
9893 }
9894 if(uri) IUri_Release(uri);
9895 }
9896 }
9897
9898 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9899 DWORD test_index) {
9900 HRESULT hr;
9901 DWORD i;
9902 LPCWSTR received = NULL;
9903 DWORD len = -1;
9904 const uri_builder_property *prop = NULL;
9905
9906 /* Check if the property was set earlier. */
9907 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9908 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9909 prop = &(test->properties[i]);
9910 }
9911
9912 if(prop && prop->value && *prop->value) {
9913 /* Use expected_value unless it's NULL, then use value. */
9914 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9915 DWORD expected_len = expected ? strlen(expected) : 0;
9916 hr = IUriBuilder_GetUserName(builder, &len, &received);
9917 if(prop->todo) {
9918 todo_wine {
9919 ok(hr == (expected ? S_OK : S_FALSE),
9920 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9921 hr, (expected ? S_OK : S_FALSE), test_index);
9922 }
9923 if(SUCCEEDED(hr)) {
9924 todo_wine {
9925 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9926 expected, wine_dbgstr_w(received), test_index);
9927 }
9928 todo_wine {
9929 ok(expected_len == len,
9930 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9931 expected_len, len, test_index);
9932 }
9933 }
9934 } else {
9935 ok(hr == (expected ? S_OK : S_FALSE),
9936 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9937 hr, (expected ? S_OK : S_FALSE), test_index);
9938 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9939 expected, wine_dbgstr_w(received), test_index);
9940 ok(expected_len == len,
9941 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9942 expected_len, len, test_index);
9943 }
9944 } else {
9945 /* The property wasn't set earlier, so it should return whatever
9946 * the base IUri contains (if anything).
9947 */
9948 IUri *uri = NULL;
9949 hr = IUriBuilder_GetIUri(builder, &uri);
9950 ok(hr == S_OK,
9951 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9952 hr, S_OK, test_index);
9953 if(SUCCEEDED(hr)) {
9954 if(!uri) {
9955 received = (void*) 0xdeadbeef;
9956 len = -1;
9957
9958 hr = IUriBuilder_GetUserName(builder, &len, &received);
9959 ok(hr == S_FALSE,
9960 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9961 hr, S_FALSE, test_index);
9962 if(SUCCEEDED(hr)) {
9963 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9964 len, test_index);
9965 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9966 received, test_index);
9967 }
9968 } else {
9969 BSTR expected = NULL;
9970 BOOL has_prop = FALSE;
9971
9972 hr = IUri_GetUserName(uri, &expected);
9973 ok(SUCCEEDED(hr),
9974 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9975 hr, test_index);
9976 has_prop = hr == S_OK;
9977
9978 hr = IUriBuilder_GetUserName(builder, &len, &received);
9979 if(has_prop) {
9980 ok(hr == S_OK,
9981 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9982 hr, S_OK, test_index);
9983 if(SUCCEEDED(hr)) {
9984 ok(!lstrcmpW(expected, received),
9985 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9986 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9987 ok(lstrlenW(expected) == len,
9988 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9989 lstrlenW(expected), len, test_index);
9990 }
9991 } else {
9992 ok(hr == S_FALSE,
9993 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9994 hr, S_FALSE, test_index);
9995 if(SUCCEEDED(hr)) {
9996 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9997 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9998 len, test_index);
9999 }
10000 }
10001 SysFreeString(expected);
10002 }
10003 }
10004 if(uri) IUri_Release(uri);
10005 }
10006 }
10007
10008 /* Tests IUriBuilder functions. */
10009 static void test_IUriBuilder(void) {
10010 HRESULT hr;
10011 IUriBuilder *builder;
10012 DWORD i;
10013
10014 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
10015 IUri *uri = NULL;
10016 uri_builder_test test = uri_builder_tests[i];
10017 LPWSTR uriW = NULL;
10018
10019 if(test.uri) {
10020 uriW = a2w(test.uri);
10021 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10022 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10023 hr, S_OK, i);
10024 if(FAILED(hr)) continue;
10025 }
10026 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10027 if(test.create_builder_todo) {
10028 todo_wine {
10029 ok(hr == test.create_builder_expected,
10030 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10031 hr, test.create_builder_expected, i);
10032 }
10033 } else {
10034 ok(hr == test.create_builder_expected,
10035 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10036 hr, test.create_builder_expected, i);
10037 }
10038 if(SUCCEEDED(hr)) {
10039 DWORD j;
10040 BOOL modified = FALSE, received = FALSE;
10041
10042 /* Perform all the string property changes. */
10043 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
10044 uri_builder_property prop = test.properties[j];
10045 if(prop.change) {
10046 change_property(builder, &prop, i);
10047 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
10048 prop.property != Uri_PROPERTY_HOST)
10049 modified = TRUE;
10050 else if(prop.value && *prop.value)
10051 modified = TRUE;
10052 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
10053 /* Host name property can't be NULL, but it can be empty. */
10054 modified = TRUE;
10055 }
10056 }
10057
10058 if(test.port_prop.change) {
10059 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
10060 modified = TRUE;
10061 if(test.port_prop.todo) {
10062 todo_wine {
10063 ok(hr == test.port_prop.expected,
10064 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10065 hr, test.port_prop.expected, i);
10066 }
10067 } else {
10068 ok(hr == test.port_prop.expected,
10069 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10070 hr, test.port_prop.expected, i);
10071 }
10072 }
10073
10074 hr = IUriBuilder_HasBeenModified(builder, &received);
10075 ok(hr == S_OK,
10076 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10077 hr, S_OK, i);
10078 if(SUCCEEDED(hr))
10079 ok(received == modified,
10080 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
10081 modified, received, i);
10082
10083 /* Test the "Get*" functions. */
10084 test_IUriBuilder_GetFragment(builder, &test, i);
10085 test_IUriBuilder_GetHost(builder, &test, i);
10086 test_IUriBuilder_GetPassword(builder, &test, i);
10087 test_IUriBuilder_GetPath(builder, &test, i);
10088 test_IUriBuilder_GetPort(builder, &test, i);
10089 test_IUriBuilder_GetQuery(builder, &test, i);
10090 test_IUriBuilder_GetSchemeName(builder, &test, i);
10091 test_IUriBuilder_GetUserName(builder, &test, i);
10092
10093 test_IUriBuilder_CreateUri(builder, &test, i);
10094 test_IUriBuilder_CreateUriSimple(builder, &test, i);
10095 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
10096 }
10097 if(builder) IUriBuilder_Release(builder);
10098 if(uri) IUri_Release(uri);
10099 heap_free(uriW);
10100 }
10101 }
10102
10103 static void test_IUriBuilder_HasBeenModified(void) {
10104 HRESULT hr;
10105 IUriBuilder *builder = NULL;
10106
10107 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10108 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10109 if(SUCCEEDED(hr)) {
10110 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10111 IUri *uri = NULL;
10112 BOOL received;
10113
10114 hr = IUriBuilder_HasBeenModified(builder, NULL);
10115 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10116 hr, E_POINTER);
10117
10118 hr = IUriBuilder_SetHost(builder, hostW);
10119 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10120 hr, S_OK);
10121
10122 hr = IUriBuilder_HasBeenModified(builder, &received);
10123 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10124 hr, S_OK);
10125 if(SUCCEEDED(hr))
10126 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10127
10128 hr = pCreateUri(http_urlW, 0, 0, &uri);
10129 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10130 if(SUCCEEDED(hr)) {
10131 LPCWSTR prop;
10132 DWORD len = -1;
10133
10134 hr = IUriBuilder_SetIUri(builder, uri);
10135 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10136 hr, S_OK);
10137
10138 hr = IUriBuilder_HasBeenModified(builder, &received);
10139 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10140 hr, S_OK);
10141 if(SUCCEEDED(hr))
10142 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10143
10144 /* Test what happens with you call SetIUri with the same IUri again. */
10145 hr = IUriBuilder_SetHost(builder, hostW);
10146 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10147
10148 hr = IUriBuilder_HasBeenModified(builder, &received);
10149 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10150 hr, S_OK);
10151 if(SUCCEEDED(hr))
10152 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10153
10154 hr = IUriBuilder_SetIUri(builder, uri);
10155 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10156
10157 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10158 * reset any of the changes that were made to the IUriBuilder.
10159 */
10160 hr = IUriBuilder_HasBeenModified(builder, &received);
10161 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10162 if(SUCCEEDED(hr))
10163 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10164
10165 hr = IUriBuilder_GetHost(builder, &len, &prop);
10166 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10167 if(SUCCEEDED(hr)) {
10168 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10169 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10170 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
10171 lstrlenW(hostW), len);
10172 }
10173
10174 hr = IUriBuilder_SetIUri(builder, NULL);
10175 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10176
10177 hr = IUriBuilder_SetHost(builder, hostW);
10178 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10179 hr = IUriBuilder_HasBeenModified(builder, &received);
10180 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10181 hr, S_OK);
10182 if(SUCCEEDED(hr))
10183 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10184
10185 hr = IUriBuilder_SetIUri(builder, NULL);
10186 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
10187
10188 hr = IUriBuilder_HasBeenModified(builder, &received);
10189 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10190 hr, S_OK);
10191 if(SUCCEEDED(hr))
10192 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10193
10194 hr = IUriBuilder_GetHost(builder, &len, &prop);
10195 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10196 if(SUCCEEDED(hr)) {
10197 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10198 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10199 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
10200 lstrlenW(hostW), len);
10201 }
10202 }
10203 if(uri) IUri_Release(uri);
10204 }
10205 if(builder) IUriBuilder_Release(builder);
10206 }
10207
10208 /* Test IUriBuilder {Get,Set}IUri functions. */
10209 static void test_IUriBuilder_IUriProperty(void) {
10210 IUriBuilder *builder = NULL;
10211 HRESULT hr;
10212
10213 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10214 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10215 if(SUCCEEDED(hr)) {
10216 IUri *uri = NULL;
10217
10218 hr = IUriBuilder_GetIUri(builder, NULL);
10219 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10220 hr, E_POINTER);
10221
10222 hr = pCreateUri(http_urlW, 0, 0, &uri);
10223 if(SUCCEEDED(hr)) {
10224 IUri *test = NULL;
10225 ULONG cur_count, orig_count;
10226
10227 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10228 orig_count = get_refcnt(uri);
10229 hr = IUriBuilder_SetIUri(builder, uri);
10230 cur_count = get_refcnt(uri);
10231 if(SUCCEEDED(hr))
10232 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10233 orig_count+1, cur_count);
10234
10235 hr = IUriBuilder_SetIUri(builder, NULL);
10236 cur_count = get_refcnt(uri);
10237 if(SUCCEEDED(hr))
10238 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10239 orig_count, cur_count);
10240
10241 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10242 hr = IUriBuilder_SetIUri(builder, uri);
10243 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10244 orig_count = get_refcnt(uri);
10245
10246 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10247 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10248 if(SUCCEEDED(hr)) {
10249 cur_count = get_refcnt(uri);
10250 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10251 orig_count+1, cur_count);
10252 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10253 uri, test);
10254 }
10255 if(test) IUri_Release(test);
10256
10257 test = NULL;
10258 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10259 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10260 if(SUCCEEDED(hr)) {
10261 cur_count = get_refcnt(uri);
10262 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10263 orig_count+1, cur_count);
10264 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10265 }
10266 if(test) IUri_Release(test);
10267
10268 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10269 * the base IUri.
10270 */
10271 test = NULL;
10272 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10273 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10274 if(SUCCEEDED(hr))
10275 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10276
10277 if(test) IUri_Release(test);
10278
10279 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10280 * explicitly set (because it's a default flag).
10281 */
10282 test = NULL;
10283 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10284 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10285 if(SUCCEEDED(hr)) {
10286 cur_count = get_refcnt(uri);
10287 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10288 orig_count+1, cur_count);
10289 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10290 }
10291 if(test) IUri_Release(test);
10292
10293 test = NULL;
10294 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10295 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10296 if(SUCCEEDED(hr)) {
10297 cur_count = get_refcnt(uri);
10298 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10299 orig_count+1, cur_count);
10300 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10301 }
10302 if(test) IUri_Release(test);
10303
10304 test = NULL;
10305 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10306 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10307 hr, S_OK);
10308 if(SUCCEEDED(hr)) {
10309 cur_count = get_refcnt(uri);
10310 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10311 orig_count+1, cur_count);
10312 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10313 }
10314 if(test) IUri_Release(test);
10315
10316 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10317 * the base IUri.
10318 */
10319 test = NULL;
10320 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10321 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10322 if(SUCCEEDED(hr))
10323 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10324
10325 if(test) IUri_Release(test);
10326
10327 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10328 * explicitly set (because it's a default flag).
10329 */
10330 test = NULL;
10331 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10332 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10333 if(SUCCEEDED(hr)) {
10334 cur_count = get_refcnt(uri);
10335 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10336 orig_count+1, cur_count);
10337 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10338 }
10339 if(test) IUri_Release(test);
10340 }
10341 if(uri) IUri_Release(uri);
10342 }
10343 if(builder) IUriBuilder_Release(builder);
10344 }
10345
10346 static void test_IUriBuilder_RemoveProperties(void) {
10347 IUriBuilder *builder = NULL;
10348 HRESULT hr;
10349 DWORD i;
10350
10351 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10352 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10353 if(SUCCEEDED(hr)) {
10354 /* Properties that can't be removed. */
10355 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10356 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10357
10358 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10359 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10360 if((i << 1) & invalid) {
10361 ok(hr == E_INVALIDARG,
10362 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10363 hr, E_INVALIDARG, i);
10364 } else {
10365 ok(hr == S_OK,
10366 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10367 hr, S_OK, i);
10368 }
10369 }
10370
10371 /* Also doesn't accept anything that's outside the range of the
10372 * Uri_HAS flags.
10373 */
10374 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10375 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10376 hr, E_INVALIDARG);
10377 }
10378 if(builder) IUriBuilder_Release(builder);
10379
10380 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
10381 uri_builder_remove_test test = uri_builder_remove_tests[i];
10382 IUri *uri = NULL;
10383 LPWSTR uriW;
10384
10385 uriW = a2w(test.uri);
10386 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10387 if(SUCCEEDED(hr)) {
10388 builder = NULL;
10389
10390 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10391 if(test.create_builder_todo) {
10392 todo_wine {
10393 ok(hr == test.create_builder_expected,
10394 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10395 hr, test.create_builder_expected, i);
10396 }
10397 } else {
10398 ok(hr == test.create_builder_expected,
10399 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10400 hr, test.create_builder_expected, i);
10401 }
10402 if(SUCCEEDED(hr)) {
10403 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10404 if(test.remove_todo) {
10405 todo_wine {
10406 ok(hr == test.remove_expected,
10407 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10408 hr, test.remove_expected, i);
10409 }
10410 } else {
10411 ok(hr == test.remove_expected,
10412 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10413 hr, test.remove_expected, i);
10414 }
10415 if(SUCCEEDED(hr)) {
10416 IUri *result = NULL;
10417
10418 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10419 if(test.expected_todo) {
10420 todo_wine {
10421 ok(hr == test.expected_hres,
10422 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10423 hr, test.expected_hres, i);
10424 }
10425 } else {
10426 ok(hr == test.expected_hres,
10427 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10428 hr, test.expected_hres, i);
10429 }
10430 if(SUCCEEDED(hr)) {
10431 BSTR received = NULL;
10432
10433 hr = IUri_GetAbsoluteUri(result, &received);
10434 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10435 ok(!strcmp_aw(test.expected_uri, received),
10436 "Error: Expected %s but got %s instead on test %d.\n",
10437 test.expected_uri, wine_dbgstr_w(received), i);
10438 SysFreeString(received);
10439 }
10440 if(result) IUri_Release(result);
10441 }
10442 }
10443 if(builder) IUriBuilder_Release(builder);
10444 }
10445 if(uri) IUri_Release(uri);
10446 heap_free(uriW);
10447 }
10448 }
10449
10450 static void test_IUriBuilder_Misc(void) {
10451 HRESULT hr;
10452 IUri *uri;
10453
10454 hr = pCreateUri(http_urlW, 0, 0, &uri);
10455 if(SUCCEEDED(hr)) {
10456 IUriBuilder *builder;
10457
10458 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10459 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10460 if(SUCCEEDED(hr)) {
10461 BOOL has = -1;
10462 DWORD port = -1;
10463
10464 hr = IUriBuilder_GetPort(builder, &has, &port);
10465 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10466 if(SUCCEEDED(hr)) {
10467 /* 'has' will be set to FALSE, even though uri had a port. */
10468 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10469 /* Still sets 'port' to 80. */
10470 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10471 }
10472 }
10473 if(builder) IUriBuilder_Release(builder);
10474 }
10475 if(uri) IUri_Release(uri);
10476 }
10477
10478 static void test_IUriBuilderFactory(void) {
10479 HRESULT hr;
10480 IUri *uri;
10481 IUriBuilderFactory *factory;
10482 IUriBuilder *builder;
10483
10484 hr = pCreateUri(http_urlW, 0, 0, &uri);
10485 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10486 if(SUCCEEDED(hr)) {
10487 factory = NULL;
10488 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10489 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10490 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10491
10492 if(SUCCEEDED(hr)) {
10493 builder = (void*) 0xdeadbeef;
10494 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10495 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10496 hr, E_INVALIDARG);
10497 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10498
10499 builder = (void*) 0xdeadbeef;
10500 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10501 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10502 hr, E_INVALIDARG);
10503 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10504
10505 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10506 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10507 hr, E_POINTER);
10508
10509 builder = NULL;
10510 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10511 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10512 hr, S_OK);
10513 if(SUCCEEDED(hr)) {
10514 IUri *tmp = (void*) 0xdeadbeef;
10515 LPCWSTR result;
10516 DWORD result_len;
10517
10518 hr = IUriBuilder_GetIUri(builder, &tmp);
10519 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10520 hr, S_OK);
10521 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10522
10523 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10524 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10525 hr, S_FALSE);
10526 }
10527 if(builder) IUriBuilder_Release(builder);
10528
10529 builder = (void*) 0xdeadbeef;
10530 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10531 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10532 hr, E_INVALIDARG);
10533 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10534
10535 builder = (void*) 0xdeadbeef;
10536 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10537 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10538 hr, E_INVALIDARG);
10539 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10540
10541 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10542 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10543 hr, E_POINTER);
10544
10545 builder = NULL;
10546 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10547 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10548 hr, S_OK);
10549 if(SUCCEEDED(hr)) {
10550 IUri *tmp = NULL;
10551
10552 hr = IUriBuilder_GetIUri(builder, &tmp);
10553 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10554 hr, S_OK);
10555 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10556 if(uri) IUri_Release(uri);
10557 }
10558 if(builder) IUriBuilder_Release(builder);
10559 }
10560 if(factory) IUriBuilderFactory_Release(factory);
10561 }
10562 if(uri) IUri_Release(uri);
10563 }
10564
10565 static void test_CoInternetCombineIUri(void) {
10566 HRESULT hr;
10567 IUri *base, *relative, *result;
10568 DWORD i;
10569
10570 base = NULL;
10571 hr = pCreateUri(http_urlW, 0, 0, &base);
10572 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10573 if(SUCCEEDED(hr)) {
10574 result = (void*) 0xdeadbeef;
10575 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10576 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10577 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10578 }
10579
10580 relative = NULL;
10581 hr = pCreateUri(http_urlW, 0, 0, &relative);
10582 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10583 if(SUCCEEDED(hr)) {
10584 result = (void*) 0xdeadbeef;
10585 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10586 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10587 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10588 }
10589
10590 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10591 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10592
10593 if(base) IUri_Release(base);
10594 if(relative) IUri_Release(relative);
10595
10596 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10597 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10598
10599 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10600 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10601 if(SUCCEEDED(hr)) {
10602 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10603
10604 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10605 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10606 if(SUCCEEDED(hr)) {
10607 result = NULL;
10608
10609 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10610 if(uri_combine_tests[i].todo) {
10611 todo_wine {
10612 ok(hr == uri_combine_tests[i].expected,
10613 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10614 hr, uri_combine_tests[i].expected, i);
10615 }
10616 } else {
10617 ok(hr == uri_combine_tests[i].expected,
10618 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10619 hr, uri_combine_tests[i]. expected, i);
10620 }
10621 if(SUCCEEDED(hr)) {
10622 DWORD j;
10623
10624 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10625 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10626 BSTR received;
10627
10628 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10629 if(prop.todo) {
10630 todo_wine {
10631 ok(hr == prop.expected,
10632 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10633 hr, prop.expected, i, j);
10634 }
10635 todo_wine {
10636 ok(!strcmp_aw(prop.value, received) ||
10637 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10638 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10639 prop.value, wine_dbgstr_w(received), i, j);
10640 }
10641 } else {
10642 ok(hr == prop.expected,
10643 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10644 hr, prop.expected, i, j);
10645 ok(!strcmp_aw(prop.value, received) ||
10646 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10647 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10648 prop.value, wine_dbgstr_w(received), i, j);
10649 }
10650 SysFreeString(received);
10651 }
10652
10653 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10654 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10655 DWORD received;
10656
10657 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10658 if(prop.todo) {
10659 todo_wine {
10660 ok(hr == prop.expected,
10661 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10662 hr, prop.expected, i, j);
10663 }
10664 todo_wine {
10665 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10666 prop.value, received, i, j);
10667 }
10668 } else {
10669 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10670 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10671 hr, prop.expected, i, j);
10672 if(!prop.broken_combine_hres || hr != S_FALSE)
10673 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10674 prop.value, received, i, j);
10675 }
10676 }
10677 }
10678 if(result) IUri_Release(result);
10679 }
10680 if(relative) IUri_Release(relative);
10681 heap_free(relativeW);
10682 }
10683 if(base) IUri_Release(base);
10684 heap_free(baseW);
10685 }
10686 }
10687
10688 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10689 REFIID riid, void **ppv)
10690 {
10691 ok(0, "unexpected call\n");
10692 return E_NOINTERFACE;
10693 }
10694
10695 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10696 {
10697 return 2;
10698 }
10699
10700 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10701 {
10702 return 1;
10703 }
10704
10705 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10706 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10707 DWORD *pcchResult, DWORD dwReserved)
10708 {
10709 CHECK_EXPECT(ParseUrl);
10710 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10711 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10712 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10713 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10714 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10715
10716 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10717 *pcchResult = lstrlenW(parse_resultW);
10718
10719 return S_OK;
10720 }
10721
10722 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10723 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10724 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10725 {
10726 CHECK_EXPECT(CombineUrl);
10727 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10728 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10729 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10730 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10731 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10732 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10733 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10734
10735 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10736 *pcchResult = lstrlenW(combine_resultW);
10737
10738 return S_OK;
10739 }
10740
10741 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10742 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10743 {
10744 ok(0, "unexpected call\n");
10745 return E_NOTIMPL;
10746 }
10747
10748 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10749 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10750 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10751 {
10752 ok(0, "unexpected call\n");
10753 return E_NOTIMPL;
10754 }
10755
10756 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10757 InternetProtocolInfo_QueryInterface,
10758 InternetProtocolInfo_AddRef,
10759 InternetProtocolInfo_Release,
10760 InternetProtocolInfo_ParseUrl,
10761 InternetProtocolInfo_CombineUrl,
10762 InternetProtocolInfo_CompareUrl,
10763 InternetProtocolInfo_QueryInfo
10764 };
10765
10766 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10767
10768 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10769 {
10770 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10771 *ppv = &protocol_info;
10772 return S_OK;
10773 }
10774
10775 ok(0, "unexpected call\n");
10776 return E_NOINTERFACE;
10777 }
10778
10779 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10780 {
10781 return 2;
10782 }
10783
10784 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10785 {
10786 return 1;
10787 }
10788
10789 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10790 REFIID riid, void **ppv)
10791 {
10792 ok(0, "unexpected call\n");
10793 return E_NOTIMPL;
10794 }
10795
10796 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10797 {
10798 ok(0, "unexpected call\n");
10799 return S_OK;
10800 }
10801
10802 static const IClassFactoryVtbl ClassFactoryVtbl = {
10803 ClassFactory_QueryInterface,
10804 ClassFactory_AddRef,
10805 ClassFactory_Release,
10806 ClassFactory_CreateInstance,
10807 ClassFactory_LockServer
10808 };
10809
10810 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10811
10812 static void register_protocols(void)
10813 {
10814 IInternetSession *session;
10815 HRESULT hres;
10816
10817 hres = pCoInternetGetSession(0, &session, 0);
10818 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10819 if(FAILED(hres))
10820 return;
10821
10822 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10823 winetestW, 0, NULL, 0);
10824 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10825
10826 IInternetSession_Release(session);
10827 }
10828
10829 static void unregister_protocols(void) {
10830 IInternetSession *session;
10831 HRESULT hr;
10832
10833 hr = pCoInternetGetSession(0, &session, 0);
10834 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10835 if(FAILED(hr))
10836 return;
10837
10838 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10839 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10840
10841 IInternetSession_Release(session);
10842 }
10843
10844 static void test_CoInternetCombineIUri_Pluggable(void) {
10845 HRESULT hr;
10846 IUri *base = NULL;
10847
10848 hr = pCreateUri(combine_baseW, 0, 0, &base);
10849 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10850 if(SUCCEEDED(hr)) {
10851 IUri *relative = NULL;
10852
10853 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10854 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10855 if(SUCCEEDED(hr)) {
10856 IUri *result = NULL;
10857
10858 SET_EXPECT(CombineUrl);
10859
10860 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10861 &result, 0);
10862 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10863
10864 CHECK_CALLED(CombineUrl);
10865
10866 if(SUCCEEDED(hr)) {
10867 BSTR received = NULL;
10868 hr = IUri_GetAbsoluteUri(result, &received);
10869 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10870 if(SUCCEEDED(hr)) {
10871 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10872 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10873 }
10874 SysFreeString(received);
10875 }
10876 if(result) IUri_Release(result);
10877 }
10878 if(relative) IUri_Release(relative);
10879 }
10880 if(base) IUri_Release(base);
10881 }
10882
10883 static void test_CoInternetCombineUrlEx(void) {
10884 HRESULT hr;
10885 IUri *base, *result;
10886 DWORD i;
10887
10888 base = NULL;
10889 hr = pCreateUri(http_urlW, 0, 0, &base);
10890 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10891 if(SUCCEEDED(hr)) {
10892 result = (void*) 0xdeadbeef;
10893 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10894 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10895 hr, E_UNEXPECTED);
10896 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10897 }
10898
10899 result = (void*) 0xdeadbeef;
10900 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10901 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10902 hr, E_INVALIDARG);
10903 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10904
10905 result = (void*) 0xdeadbeef;
10906 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10907 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10908 hr, E_UNEXPECTED);
10909 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10910
10911 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10912 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10913 hr, E_POINTER);
10914 if(base) IUri_Release(base);
10915
10916 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10917 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10918
10919 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10920 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10921 if(SUCCEEDED(hr)) {
10922 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10923
10924 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10925 &result, 0);
10926 if(uri_combine_tests[i].todo) {
10927 todo_wine {
10928 ok(hr == uri_combine_tests[i].expected,
10929 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10930 hr, uri_combine_tests[i].expected, i);
10931 }
10932 } else {
10933 ok(hr == uri_combine_tests[i].expected,
10934 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10935 hr, uri_combine_tests[i]. expected, i);
10936 }
10937 if(SUCCEEDED(hr)) {
10938 DWORD j;
10939
10940 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10941 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10942 BSTR received;
10943 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10944
10945 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10946 if(prop.todo) {
10947 todo_wine {
10948 ok(hr == prop.expected,
10949 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10950 hr, prop.expected, i, j);
10951 }
10952 todo_wine {
10953 ok(!strcmp_aw(value, received) ||
10954 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10955 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10956 value, wine_dbgstr_w(received), i, j);
10957 }
10958 } else {
10959 ok(hr == prop.expected,
10960 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10961 hr, prop.expected, i, j);
10962 ok(!strcmp_aw(value, received) ||
10963 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10964 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10965 value, wine_dbgstr_w(received), i, j);
10966 }
10967 SysFreeString(received);
10968 }
10969
10970 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10971 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10972 DWORD received;
10973
10974 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10975 if(prop.todo) {
10976 todo_wine {
10977 ok(hr == prop.expected,
10978 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10979 hr, prop.expected, i, j);
10980 }
10981 todo_wine {
10982 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10983 prop.value, received, i, j);
10984 }
10985 } else {
10986 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10987 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10988 hr, prop.expected, i, j);
10989 if(!prop.broken_combine_hres || hr != S_FALSE)
10990 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10991 prop.value, received, i, j);
10992 }
10993 }
10994 }
10995 if(result) IUri_Release(result);
10996 heap_free(relativeW);
10997 }
10998 if(base) IUri_Release(base);
10999 heap_free(baseW);
11000 }
11001 }
11002
11003 static void test_CoInternetCombineUrlEx_Pluggable(void) {
11004 HRESULT hr;
11005 IUri *base = NULL;
11006
11007 hr = pCreateUri(combine_baseW, 0, 0, &base);
11008 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11009 if(SUCCEEDED(hr)) {
11010 IUri *result = NULL;
11011
11012 SET_EXPECT(CombineUrl);
11013
11014 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
11015 &result, 0);
11016 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11017
11018 CHECK_CALLED(CombineUrl);
11019
11020 if(SUCCEEDED(hr)) {
11021 BSTR received = NULL;
11022 hr = IUri_GetAbsoluteUri(result, &received);
11023 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
11024 if(SUCCEEDED(hr)) {
11025 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
11026 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
11027 }
11028 SysFreeString(received);
11029 }
11030 if(result) IUri_Release(result);
11031 }
11032 if(base) IUri_Release(base);
11033 }
11034
11035 static void test_CoInternetParseIUri_InvalidArgs(void) {
11036 HRESULT hr;
11037 IUri *uri = NULL;
11038 WCHAR tmp[3];
11039 DWORD result = -1;
11040
11041 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11042 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11043 hr, E_INVALIDARG);
11044 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11045
11046 hr = pCreateUri(http_urlW, 0, 0, &uri);
11047 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
11048 if(SUCCEEDED(hr)) {
11049 DWORD expected_len;
11050
11051 result = -1;
11052 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
11053 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11054 hr, E_INVALIDARG);
11055 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11056
11057 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
11058 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11059 hr, E_POINTER);
11060
11061 result = -1;
11062 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
11063 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
11064 hr, E_FAIL);
11065 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11066
11067 result = -1;
11068 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
11069 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11070 hr, E_FAIL);
11071 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11072
11073 result = -1;
11074 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
11075 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11076 hr, E_FAIL);
11077 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11078
11079 result = -1;
11080 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
11081 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11082 hr, E_FAIL);
11083 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
11084
11085 expected_len = lstrlenW(http_urlW);
11086 result = -1;
11087 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
11088 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
11089 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11090 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
11091 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
11092 expected_len, result);
11093 }
11094 if(uri) IUri_Release(uri);
11095 }
11096
11097 static void test_CoInternetParseIUri(void) {
11098 DWORD i;
11099
11100 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
11101 HRESULT hr;
11102 IUri *uri;
11103 LPWSTR uriW;
11104 uri_parse_test test = uri_parse_tests[i];
11105
11106 uriW = a2w(test.uri);
11107 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11108 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
11109 if(SUCCEEDED(hr)) {
11110 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
11111 DWORD result_len = -1;
11112
11113 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11114 if(test.todo) {
11115 todo_wine {
11116 ok(hr == test.expected,
11117 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11118 hr, test.expected, i);
11119 }
11120 } else {
11121 ok(hr == test.expected,
11122 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11123 hr, test.expected, i);
11124 }
11125 if(SUCCEEDED(hr)) {
11126 DWORD len = lstrlenA(test.property);
11127 ok(!strcmp_aw(test.property, result),
11128 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
11129 test.property, wine_dbgstr_w(result), i);
11130 ok(len == result_len,
11131 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
11132 len, result_len, i);
11133 } else {
11134 ok(!result_len,
11135 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11136 result_len, i);
11137 }
11138 }
11139 if(uri) IUri_Release(uri);
11140 heap_free(uriW);
11141 }
11142 }
11143
11144 static void test_CoInternetParseIUri_Pluggable(void) {
11145 HRESULT hr;
11146 IUri *uri = NULL;
11147
11148 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11149 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
11150 if(SUCCEEDED(hr)) {
11151 WCHAR result[200];
11152 DWORD result_len;
11153
11154 SET_EXPECT(ParseUrl);
11155
11156 parse_action = PARSE_CANONICALIZE;
11157 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
11158
11159 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11160 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11161
11162 CHECK_CALLED(ParseUrl);
11163
11164 if(SUCCEEDED(hr)) {
11165 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
11166 lstrlenW(parse_resultW), result_len);
11167 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11168 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
11169 }
11170 }
11171 if(uri) IUri_Release(uri);
11172 }
11173
11174 typedef struct {
11175 const char *url;
11176 DWORD uri_flags;
11177 const char *base_url;
11178 DWORD base_uri_flags;
11179 const char *legacy_url;
11180 const char *uniform_url;
11181 const char *no_canon_url;
11182 const char *uri_url;
11183 } create_urlmon_test_t;
11184
11185 static const create_urlmon_test_t create_urlmon_tests[] = {
11186 {
11187 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
11188 NULL,0,
11189 "http://www.winehq.org/",
11190 "http://www.winehq.org/",
11191 "http://www.winehq.org",
11192 "http://www.winehq.org"
11193 },
11194 {
11195 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
11196 NULL,0,
11197 "file://c:\\dir\\file.txt",
11198 "file:///c:/dir/file.txt",
11199 "file:///c:/dir/file.txt",
11200 "file:///c:/dir/file.txt"
11201 },
11202 {
11203 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
11204 NULL,0,
11205 "file://c:\\dir\\file.txt",
11206 "file:///c:/dir/file.txt",
11207 "file:///c:/dir/file.txt",
11208 "file://c:\\dir\\file.txt"
11209 },
11210 {
11211 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11212 "http://www.winehq.org",0,
11213 "http://www.winehq.org/data",
11214 "http://www.winehq.org/data",
11215 "http://www.winehq.org:80/data",
11216 },
11217 {
11218 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11219 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11220 "file://c:\\dir\\file.txt",
11221 "file:///c:/dir/file.txt",
11222 "file:///c:/dir/file.txt",
11223 },
11224 {
11225 "",Uri_CREATE_ALLOW_RELATIVE,
11226 NULL,0,
11227 "",
11228 "",
11229 "",
11230 ""
11231 },
11232 {
11233 "test",Uri_CREATE_ALLOW_RELATIVE,
11234 NULL,0,
11235 "test",
11236 "test",
11237 "test",
11238 "test"
11239 },
11240 {
11241 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11242 NULL,0,
11243 "file://c:\\dir\\file.txt",
11244 "file:///c:/dir/file.txt",
11245 "file:///c:/dir/file.txt",
11246 "file:///c:/dir/file.txt",
11247 },
11248 {
11249 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11250 NULL,0,
11251 "file://c:\\dir\\file.txt#frag|part",
11252 "file:///c:/dir/file.txt#frag%7Cpart",
11253 "file:///c:/dir/file.txt#frag%7Cpart",
11254 "file:///c:/dir/file.txt#frag%7Cpart",
11255 }
11256 };
11257
11258 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11259 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11260 {
11261 WCHAR *display_name;
11262 HRESULT hres;
11263
11264 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11265 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11266 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11267 wine_dbgstr_w(display_name), exurl);
11268
11269 CoTaskMemFree(display_name);
11270 }
11271
11272 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11273 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11274 {
11275 IUriContainer *uri_container;
11276 IUri *uri;
11277 BSTR display_uri;
11278 HRESULT hres;
11279
11280 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11281 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11282
11283 uri = NULL;
11284 hres = IUriContainer_GetIUri(uri_container, &uri);
11285 IUriContainer_Release(uri_container);
11286 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11287 ok(uri != NULL, "uri == NULL\n");
11288
11289 hres = IUri_GetDisplayUri(uri, &display_uri);
11290 IUri_Release(uri);
11291 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11292 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11293 wine_dbgstr_w(display_uri), exurl);
11294 SysFreeString(display_uri);
11295 }
11296
11297 static void test_CreateURLMoniker(void)
11298 {
11299 const create_urlmon_test_t *test;
11300 IMoniker *mon, *base_mon;
11301 WCHAR *url, *base_url;
11302 IUri *uri, *base_uri;
11303 HRESULT hres;
11304
11305 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
11306 url = a2w(test->url);
11307 base_url = a2w(test->base_url);
11308
11309 if(base_url) {
11310 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11311 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11312
11313 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11314 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11315 }else {
11316 base_uri = NULL;
11317 base_mon = NULL;
11318 }
11319
11320 hres = CreateURLMoniker(base_mon, url, &mon);
11321 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11322 test_urlmon_display_name(mon, test->legacy_url);
11323 test_display_uri(mon, test->legacy_url);
11324 IMoniker_Release(mon);
11325
11326 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11327 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11328 test_urlmon_display_name(mon, test->legacy_url);
11329 test_display_uri(mon, test->legacy_url);
11330 IMoniker_Release(mon);
11331
11332 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11333 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11334 test_urlmon_display_name(mon, test->uniform_url);
11335 test_display_uri(mon, test->uniform_url);
11336 IMoniker_Release(mon);
11337
11338 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11339 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11340 test_urlmon_display_name(mon, test->no_canon_url);
11341 test_display_uri(mon, test->no_canon_url);
11342 IMoniker_Release(mon);
11343
11344 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11345 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11346
11347 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11348 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11349 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11350 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11351 IMoniker_Release(mon);
11352
11353 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11354 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11355 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11356 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11357 IMoniker_Release(mon);
11358
11359 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11360 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11361 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11362 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11363 IMoniker_Release(mon);
11364
11365 IUri_Release(uri);
11366 heap_free(url);
11367 heap_free(base_url);
11368 if(base_uri)
11369 IUri_Release(base_uri);
11370 if(base_mon)
11371 IMoniker_Release(base_mon);
11372 }
11373 }
11374
11375 static int add_default_flags(DWORD flags) {
11376 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11377 flags |= Uri_CREATE_CANONICALIZE;
11378 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11379 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11380 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11381 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11382 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11383 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11384 if(!(flags & Uri_CREATE_IE_SETTINGS))
11385 flags |= Uri_CREATE_NO_IE_SETTINGS;
11386
11387 return flags;
11388 }
11389
11390 static void test_IPersistStream(void)
11391 {
11392 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11393
11394 props_order[Uri_PROPERTY_RAW_URI] = 1;
11395 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11396 props_order[Uri_PROPERTY_HOST] = 3;
11397 props_order[Uri_PROPERTY_PASSWORD] = 4;
11398 props_order[Uri_PROPERTY_PATH] = 5;
11399 props_order[Uri_PROPERTY_PORT] = 6;
11400 props_order[Uri_PROPERTY_QUERY] = 7;
11401 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11402 props_order[Uri_PROPERTY_USER_NAME] = 9;
11403
11404 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
11405 const uri_properties *test = uri_tests+i;
11406 LPWSTR uriW;
11407 IUri *uri;
11408 IPersistStream *persist_stream;
11409 IStream *stream;
11410 IMarshal *marshal;
11411 DWORD props, props_no, dw_data[6];
11412 WCHAR str_data[1024];
11413 ULARGE_INTEGER size, max_size;
11414 LARGE_INTEGER no_off;
11415 CLSID curi;
11416 BSTR raw_uri;
11417 HRESULT hr;
11418
11419 if(test->create_todo || test->create_expected!=S_OK)
11420 continue;
11421
11422 uriW = a2w(test->uri);
11423 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11424 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11425
11426 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11427 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11428
11429 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11430 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11431 hr = IPersistStream_IsDirty(persist_stream);
11432 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11433 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11434 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11435 hr = IPersistStream_IsDirty(persist_stream);
11436 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11437 no_off.QuadPart = 0;
11438 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11439 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11440 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11441 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11442 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11443 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11444 ok(U(size).LowPart+2 == U(max_size).LowPart,
11445 "%d) Written data size is %d, max_size %d.\n",
11446 i, U(size).LowPart, U(max_size).LowPart);
11447
11448 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11449 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11450 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11451 i, dw_data[0]-2, U(size).LowPart);
11452 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11453 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11454 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11455 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11456 ok(dw_data[2] == add_default_flags(test->create_flags),
11457 "%d) Incorrect value %x, expected %x (creation flags).\n",
11458 i, dw_data[2], add_default_flags(test->create_flags));
11459 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11460 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11461 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11462
11463 props_no = 0;
11464 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11465 if(!props_order[props])
11466 continue;
11467
11468 if(props <= Uri_PROPERTY_STRING_LAST) {
11469 if(test->str_props[props].expected == S_OK)
11470 props_no++;
11471 } else {
11472 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11473 props_no++;
11474 }
11475 }
11476 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11477 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11478 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11479 props_no = 1;
11480
11481 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11482 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11483 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11484
11485 dw_data[2] = 0;
11486 dw_data[3] = -1;
11487 while(props) {
11488 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11489 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11490 props--;
11491 ok(dw_data[2]<props_order[dw_data[0]],
11492 "%d) Incorrect properties order (%d, %d)\n",
11493 i, dw_data[0], dw_data[3]);
11494 dw_data[2] = props_order[dw_data[0]];
11495 dw_data[3] = dw_data[0];
11496
11497 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11498 const uri_str_property *prop = test->str_props+dw_data[0];
11499 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11500 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11501 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11502 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11503 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11504 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11505 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11506 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11507 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11508 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11509 } else {
11510 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11511 break;
11512 }
11513 }
11514 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11515 i, props, dw_data[0]);
11516
11517 IUri_Release(uri);
11518
11519 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11520 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11521 hr = IPersistStream_GetClassID(persist_stream, &curi);
11522 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11523 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11524 IPersistStream_Release(persist_stream);
11525
11526 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11527 &IID_IUri, (void**)&uri);
11528 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11529 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11530 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11531 hr = IPersistStream_Load(persist_stream, stream);
11532 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11533 hr = IUri_GetRawUri(uri, &raw_uri);
11534 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11535 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11536 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11537 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11538 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11539 wine_dbgstr_w(raw_uri));
11540 SysFreeString(raw_uri);
11541 IPersistStream_Release(persist_stream);
11542
11543 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11544 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11545 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11546 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11547 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11548 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11549 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11550 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11551 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11552 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11553 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11554 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11555 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11556 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11557 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11558 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11559 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11560 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11561 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11562 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11563 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11564 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11565 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11566 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11567 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11568 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11569 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11570 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11571 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11572
11573 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11574 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11575 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11576 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11577 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11578 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11579 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11580 i, dw_data[0]-2, U(size).LowPart);
11581 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11582 i, dw_data[1]);
11583 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11584 i, dw_data[2], dw_data[0]-8);
11585 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11586 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11587 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11588 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11589 U(max_size).LowPart += 3*sizeof(DWORD);
11590 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11591 i, dw_data[2], U(max_size).LowPart);
11592 IMarshal_Release(marshal);
11593 IUri_Release(uri);
11594
11595 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11596 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11597 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11598 &IID_IUri, (void**)&uri);
11599 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11600 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11601 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11602 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11603 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11604 hr = IUri_GetRawUri(uri, &raw_uri);
11605 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11606 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11607 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11608 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11609 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11610 wine_dbgstr_w(raw_uri));
11611 SysFreeString(raw_uri);
11612
11613 IMarshal_Release(marshal);
11614 IStream_Release(stream);
11615 IUri_Release(uri);
11616 heap_free(uriW);
11617 }
11618 }
11619
11620 static void test_UninitializedUri(void)
11621 {
11622 IUri *uri;
11623 IUriBuilderFactory *ubf;
11624 IPersistStream *ps;
11625 IUriBuilder *ub;
11626 BSTR bstr;
11627 DWORD dword;
11628 BOOL eq;
11629 ULARGE_INTEGER ui;
11630 HRESULT hr;
11631
11632 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11633 &IID_IUri, (void**)&uri);
11634 if(FAILED(hr)) {
11635 win_skip("Skipping uninitialized Uri tests.\n");
11636 return;
11637 }
11638
11639 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11640 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11641 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11642 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11643
11644 hr = IUri_GetAbsoluteUri(uri, NULL);
11645 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11646 hr = IUri_GetAbsoluteUri(uri, &bstr);
11647 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11648 hr = IUri_GetAuthority(uri, &bstr);
11649 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11650 hr = IUri_GetDisplayUri(uri, &bstr);
11651 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11652 hr = IUri_GetDomain(uri, &bstr);
11653 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11654 hr = IUri_GetExtension(uri, &bstr);
11655 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11656 hr = IUri_GetFragment(uri, &bstr);
11657 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11658 hr = IUri_GetHost(uri, &bstr);
11659 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11660 hr = IUri_GetHostType(uri, &dword);
11661 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11662 hr = IUri_GetPassword(uri, &bstr);
11663 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11664 hr = IUri_GetPassword(uri, &bstr);
11665 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11666 hr = IUri_GetPathAndQuery(uri, &bstr);
11667 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11668 hr = IUri_GetPort(uri, &dword);
11669 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11670 hr = IUri_GetProperties(uri, &dword);
11671 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11672 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11673 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11674 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11675 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11676 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11677 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11678 hr = IUri_GetQuery(uri, &bstr);
11679 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11680 hr = IUri_GetRawUri(uri, &bstr);
11681 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11682 hr = IUri_GetScheme(uri, &dword);
11683 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11684 hr = IUri_GetSchemeName(uri, &bstr);
11685 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11686 hr = IUri_GetUserInfo(uri, &bstr);
11687 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11688 hr = IUri_GetUserName(uri, &bstr);
11689 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11690 hr = IUri_GetZone(uri, &dword);
11691 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11692 hr = IUri_IsEqual(uri, uri, &eq);
11693 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11694
11695 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11696 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11697 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11698 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11699 IUriBuilder_Release(ub);
11700
11701 hr = IPersistStream_GetSizeMax(ps, &ui);
11702 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11703 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11704 hr = IPersistStream_IsDirty(ps);
11705 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11706
11707 IPersistStream_Release(ps);
11708 IUriBuilderFactory_Release(ubf);
11709 IUri_Release(uri);
11710 }
11711
11712 START_TEST(uri) {
11713 HMODULE hurlmon;
11714
11715 hurlmon = GetModuleHandleA("urlmon.dll");
11716 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11717 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11718 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11719 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11720 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11721 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11722 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11723 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11724 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11725
11726 if(!pCreateUri) {
11727 win_skip("CreateUri is not present, skipping tests.\n");
11728 return;
11729 }
11730
11731 trace("test CreateUri invalid flags...\n");
11732 test_CreateUri_InvalidFlags();
11733
11734 trace("test CreateUri invalid args...\n");
11735 test_CreateUri_InvalidArgs();
11736
11737 trace("test CreateUri invalid URIs...\n");
11738 test_CreateUri_InvalidUri();
11739
11740 trace("test IUri_GetPropertyBSTR...\n");
11741 test_IUri_GetPropertyBSTR();
11742
11743 trace("test IUri_GetPropertyDWORD...\n");
11744 test_IUri_GetPropertyDWORD();
11745
11746 trace("test IUri_GetStrProperties...\n");
11747 test_IUri_GetStrProperties();
11748
11749 trace("test IUri_GetDwordProperties...\n");
11750 test_IUri_GetDwordProperties();
11751
11752 trace("test IUri_GetPropertyLength...\n");
11753 test_IUri_GetPropertyLength();
11754
11755 trace("test IUri_GetProperties...\n");
11756 test_IUri_GetProperties();
11757
11758 trace("test IUri_HasProperty...\n");
11759 test_IUri_HasProperty();
11760
11761 trace("test IUri_IsEqual...\n");
11762 test_IUri_IsEqual();
11763
11764 trace("test CreateUriWithFragment invalid args...\n");
11765 test_CreateUriWithFragment_InvalidArgs();
11766
11767 trace("test CreateUriWithFragment invalid flags...\n");
11768 test_CreateUriWithFragment_InvalidFlags();
11769
11770 trace("test CreateUriWithFragment...\n");
11771 test_CreateUriWithFragment();
11772
11773 trace("test CreateIUriBuilder...\n");
11774 test_CreateIUriBuilder();
11775
11776 trace("test IUriBuilder_CreateInvalidArgs...\n");
11777 test_IUriBuilder_CreateInvalidArgs();
11778
11779 trace("test IUriBuilder...\n");
11780 test_IUriBuilder();
11781
11782 trace("test IUriBuilder_GetInvalidArgs...\n");
11783 test_IUriBuilder_GetInvalidArgs();
11784
11785 trace("test IUriBuilder_HasBeenModified...\n");
11786 test_IUriBuilder_HasBeenModified();
11787
11788 trace("test IUriBuilder_IUriProperty...\n");
11789 test_IUriBuilder_IUriProperty();
11790
11791 trace("test IUriBuilder_RemoveProperties...\n");
11792 test_IUriBuilder_RemoveProperties();
11793
11794 trace("test IUriBuilder miscellaneous...\n");
11795 test_IUriBuilder_Misc();
11796
11797 trace("test IUriBuilderFactory...\n");
11798 test_IUriBuilderFactory();
11799
11800 trace("test CoInternetCombineIUri...\n");
11801 test_CoInternetCombineIUri();
11802
11803 trace("test CoInternetCombineUrlEx...\n");
11804 test_CoInternetCombineUrlEx();
11805
11806 trace("test CoInternetParseIUri Invalid Args...\n");
11807 test_CoInternetParseIUri_InvalidArgs();
11808
11809 trace("test CoInternetParseIUri...\n");
11810 test_CoInternetParseIUri();
11811
11812 register_protocols();
11813
11814 trace("test CoInternetCombineIUri pluggable...\n");
11815 test_CoInternetCombineIUri_Pluggable();
11816
11817 trace("test CoInternetCombineUrlEx Pluggable...\n");
11818 test_CoInternetCombineUrlEx_Pluggable();
11819
11820 trace("test CoInternetParseIUri pluggable...\n");
11821 test_CoInternetParseIUri_Pluggable();
11822
11823 trace("test CreateURLMoniker...\n");
11824 test_CreateURLMoniker();
11825
11826 CoInitialize(NULL);
11827
11828 trace("test IPersistStream...\n");
11829 test_IPersistStream();
11830
11831 trace("test uninitialized Uri...\n");
11832 test_UninitializedUri();
11833
11834 CoUninitialize();
11835 unregister_protocols();
11836 }