[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 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
396 {
397 {"urn:nothing:should:happen here",S_OK,FALSE},
398 {"",S_FALSE,FALSE},
399 {"urn:nothing:should:happen here",S_OK,FALSE},
400 {"",S_FALSE,FALSE},
401 {"",S_FALSE,FALSE},
402 {"",S_FALSE,FALSE},
403 {"",S_FALSE,FALSE},
404 {"",S_FALSE,FALSE},
405 {"nothing:should:happen here",S_OK,FALSE},
406 {"nothing:should:happen here",S_OK,FALSE},
407 {"",S_FALSE,FALSE},
408 {"urn:nothing:should:happen here",S_OK,FALSE},
409 {"urn",S_OK,FALSE},
410 {"",S_FALSE,FALSE},
411 {"",S_FALSE,FALSE}
412 },
413 {
414 {Uri_HOST_UNKNOWN,S_OK,FALSE},
415 {0,S_FALSE,FALSE},
416 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
417 {URLZONE_INVALID,E_NOTIMPL,FALSE}
418 }
419 },
420 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
421 {
422 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
423 {"127.0.0.1",S_OK,FALSE},
424 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {".txt",S_OK,FALSE},
427 {"",S_FALSE,FALSE},
428 {"127.0.0.1",S_OK,FALSE},
429 {"",S_FALSE,FALSE},
430 {"/test%20dir/test.txt",S_OK,FALSE},
431 {"/test%20dir/test.txt",S_OK,FALSE},
432 {"",S_FALSE,FALSE},
433 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
434 {"http",S_OK,FALSE},
435 {"",S_FALSE,FALSE},
436 {"",S_FALSE,FALSE}
437 },
438 {
439 {Uri_HOST_IPV4,S_OK,FALSE},
440 {80,S_OK,FALSE},
441 {URL_SCHEME_HTTP,S_OK,FALSE},
442 {URLZONE_INVALID,E_NOTIMPL,FALSE}
443 }
444 },
445 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
446 {
447 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
448 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
449 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"",S_FALSE,FALSE},
452 {"",S_FALSE,FALSE},
453 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
454 {"",S_FALSE,FALSE},
455 {"/",S_OK,FALSE},
456 {"/",S_OK,FALSE},
457 {"",S_FALSE,FALSE},
458 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
459 {"http",S_OK,FALSE},
460 {"",S_FALSE,FALSE},
461 {"",S_FALSE,FALSE}
462 },
463 {
464 {Uri_HOST_IPV6,S_OK,FALSE},
465 {80,S_OK,FALSE},
466 {URL_SCHEME_HTTP,S_OK,FALSE},
467 {URLZONE_INVALID,E_NOTIMPL,FALSE}
468 }
469 },
470 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
471 {
472 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
473 {"[::13.1.68.3]",S_OK,FALSE},
474 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"",S_FALSE,FALSE},
477 {"",S_FALSE,FALSE},
478 {"::13.1.68.3",S_OK,FALSE},
479 {"",S_FALSE,FALSE},
480 {"/",S_OK,FALSE},
481 {"/",S_OK,FALSE},
482 {"",S_FALSE,FALSE},
483 {"ftp://[::13.1.68.3]",S_OK,FALSE},
484 {"ftp",S_OK,FALSE},
485 {"",S_FALSE,FALSE},
486 {"",S_FALSE,FALSE}
487 },
488 {
489 {Uri_HOST_IPV6,S_OK,FALSE},
490 {21,S_OK,FALSE},
491 {URL_SCHEME_FTP,S_OK,FALSE},
492 {URLZONE_INVALID,E_NOTIMPL,FALSE}
493 }
494 },
495 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
496 {
497 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
498 {"[fedc:ba98::3210]",S_OK,FALSE},
499 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"",S_FALSE,FALSE},
502 {"",S_FALSE,FALSE},
503 {"fedc:ba98::3210",S_OK,FALSE},
504 {"",S_FALSE,FALSE},
505 {"/",S_OK,FALSE},
506 {"/",S_OK,FALSE},
507 {"",S_FALSE,FALSE},
508 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
509 {"http",S_OK,FALSE},
510 {"",S_FALSE,FALSE},
511 {"",S_FALSE,FALSE},
512 },
513 {
514 {Uri_HOST_IPV6,S_OK,FALSE},
515 {80,S_OK,FALSE},
516 {URL_SCHEME_HTTP,S_OK,FALSE},
517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
518 }
519 },
520 { "1234://www.winehq.org", 0, S_OK, FALSE,
521 {
522 {"1234://www.winehq.org/",S_OK,FALSE},
523 {"www.winehq.org",S_OK,FALSE},
524 {"1234://www.winehq.org/",S_OK,FALSE},
525 {"winehq.org",S_OK,FALSE},
526 {"",S_FALSE,FALSE},
527 {"",S_FALSE,FALSE},
528 {"www.winehq.org",S_OK,FALSE},
529 {"",S_FALSE,FALSE},
530 {"/",S_OK,FALSE},
531 {"/",S_OK,FALSE},
532 {"",S_FALSE,FALSE},
533 {"1234://www.winehq.org",S_OK,FALSE},
534 {"1234",S_OK,FALSE},
535 {"",S_FALSE,FALSE},
536 {"",S_FALSE,FALSE}
537 },
538 {
539 {Uri_HOST_DNS,S_OK,FALSE},
540 {0,S_FALSE,FALSE},
541 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
543 }
544 },
545 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
546 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
547 {
548 {"file:///C:/test/test.mp3",S_OK,FALSE},
549 {"",S_FALSE,FALSE},
550 {"file:///C:/test/test.mp3",S_OK,FALSE},
551 {"",S_FALSE,FALSE},
552 {".mp3",S_OK,FALSE},
553 {"",S_FALSE,FALSE},
554 {"",S_FALSE,FALSE},
555 {"",S_FALSE,FALSE},
556 {"/C:/test/test.mp3",S_OK,FALSE},
557 {"/C:/test/test.mp3",S_OK,FALSE},
558 {"",S_FALSE,FALSE},
559 {"C:/test/test.mp3",S_OK,FALSE},
560 {"file",S_OK,FALSE},
561 {"",S_FALSE,FALSE},
562 {"",S_FALSE,FALSE}
563 },
564 {
565 {Uri_HOST_UNKNOWN,S_OK,FALSE},
566 {0,S_FALSE,FALSE},
567 {URL_SCHEME_FILE,S_OK,FALSE},
568 {URLZONE_INVALID,E_NOTIMPL,FALSE}
569 }
570 },
571 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
572 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
573 {
574 {"file://server/test.mp3",S_OK,FALSE},
575 {"server",S_OK,FALSE},
576 {"file://server/test.mp3",S_OK,FALSE},
577 {"",S_FALSE,FALSE},
578 {".mp3",S_OK,FALSE},
579 {"",S_FALSE,FALSE},
580 {"server",S_OK,FALSE},
581 {"",S_FALSE,FALSE},
582 {"/test.mp3",S_OK,FALSE},
583 {"/test.mp3",S_OK,FALSE},
584 {"",S_FALSE,FALSE},
585 {"\\\\Server/test.mp3",S_OK,FALSE},
586 {"file",S_OK,FALSE},
587 {"",S_FALSE,FALSE},
588 {"",S_FALSE,FALSE}
589 },
590 {
591 {Uri_HOST_DNS,S_OK,FALSE},
592 {0,S_FALSE,FALSE},
593 {URL_SCHEME_FILE,S_OK,FALSE},
594 {URLZONE_INVALID,E_NOTIMPL,FALSE}
595 }
596 },
597 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
598 {
599 {"*:www.winehq.org/test",S_OK,FALSE},
600 {"www.winehq.org",S_OK,FALSE},
601 {"*:www.winehq.org/test",S_OK,FALSE},
602 {"winehq.org",S_OK,FALSE},
603 {"",S_FALSE,FALSE},
604 {"",S_FALSE,FALSE},
605 {"www.winehq.org",S_OK,FALSE},
606 {"",S_FALSE,FALSE},
607 {"/test",S_OK,FALSE},
608 {"/test",S_OK,FALSE},
609 {"",S_FALSE,FALSE},
610 {"www.winehq.org/test",S_OK,FALSE},
611 {"*",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_WILDCARD,S_OK,FALSE},
619 {URLZONE_INVALID,E_NOTIMPL,FALSE}
620 }
621 },
622 /* Valid since the '*' is the only character in the scheme name. */
623 { "*:www.winehq.org/test", 0, S_OK, FALSE,
624 {
625 {"*:www.winehq.org/test",S_OK,FALSE},
626 {"www.winehq.org",S_OK,FALSE},
627 {"*:www.winehq.org/test",S_OK,FALSE},
628 {"winehq.org",S_OK,FALSE},
629 {"",S_FALSE,FALSE},
630 {"",S_FALSE,FALSE},
631 {"www.winehq.org",S_OK,FALSE},
632 {"",S_FALSE,FALSE},
633 {"/test",S_OK,FALSE},
634 {"/test",S_OK,FALSE},
635 {"",S_FALSE,FALSE},
636 {"*:www.winehq.org/test",S_OK,FALSE},
637 {"*",S_OK,FALSE},
638 {"",S_FALSE,FALSE},
639 {"",S_FALSE,FALSE}
640 },
641 {
642 {Uri_HOST_DNS,S_OK,FALSE},
643 {0,S_FALSE,FALSE},
644 {URL_SCHEME_WILDCARD,S_OK,FALSE},
645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
646 }
647 },
648 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
649 {
650 {"/../some dir/test.ext",S_OK,FALSE},
651 {"",S_FALSE,FALSE},
652 {"/../some dir/test.ext",S_OK,FALSE},
653 {"",S_FALSE,FALSE},
654 {".ext",S_OK,FALSE},
655 {"",S_FALSE,FALSE},
656 {"",S_FALSE,FALSE},
657 {"",S_FALSE,FALSE},
658 {"/../some dir/test.ext",S_OK,FALSE},
659 {"/../some dir/test.ext",S_OK,FALSE},
660 {"",S_FALSE,FALSE},
661 {"/../some dir/test.ext",S_OK,FALSE},
662 {"",S_FALSE,FALSE},
663 {"",S_FALSE,FALSE},
664 {"",S_FALSE,FALSE}
665 },
666 {
667 {Uri_HOST_UNKNOWN,S_OK,FALSE},
668 {0,S_FALSE,FALSE},
669 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
671 }
672 },
673 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
674 {
675 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
676 {"",S_OK,FALSE},
677 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
678 {"",S_FALSE,FALSE},
679 {"",S_FALSE,FALSE},
680 {"",S_FALSE,FALSE},
681 {"",S_OK,FALSE},
682 {"",S_FALSE,FALSE},
683 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
684 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
685 {"",S_FALSE,FALSE},
686 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
687 {"*",S_OK,FALSE},
688 {"",S_FALSE,FALSE},
689 {"",S_FALSE,FALSE},
690 },
691 {
692 {Uri_HOST_UNKNOWN,S_OK,FALSE},
693 {0,S_FALSE,FALSE},
694 {URL_SCHEME_WILDCARD,S_OK,FALSE},
695 {URLZONE_INVALID,E_NOTIMPL,FALSE}
696 }
697 },
698 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
699 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
700 {
701 {"zip:/.//google.com",S_OK,FALSE},
702 {"",S_FALSE,FALSE},
703 {"zip:/.//google.com",S_OK,FALSE},
704 {"",S_FALSE,FALSE},
705 {".com",S_OK,FALSE},
706 {"",S_FALSE,FALSE},
707 {"",S_FALSE,FALSE},
708 {"",S_FALSE,FALSE},
709 {"/.//google.com",S_OK,FALSE},
710 {"/.//google.com",S_OK,FALSE},
711 {"",S_FALSE,FALSE},
712 {"zip://google.com",S_OK,FALSE},
713 {"zip",S_OK,FALSE},
714 {"",S_FALSE,FALSE},
715 {"",S_FALSE,FALSE}
716 },
717 {
718 {Uri_HOST_UNKNOWN,S_OK,FALSE},
719 {0,S_FALSE,FALSE},
720 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
721 {URLZONE_INVALID,E_NOTIMPL,FALSE}
722 }
723 },
724 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
725 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
726 {
727 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
728 {"user:pass:word@winehq.org",S_OK,FALSE},
729 {"ftp://winehq.org/",S_OK,FALSE},
730 {"winehq.org",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"",S_FALSE,FALSE},
733 {"winehq.org",S_OK,FALSE},
734 {"pass:word",S_OK,FALSE},
735 {"/",S_OK,FALSE},
736 {"/",S_OK,FALSE},
737 {"",S_FALSE,FALSE},
738 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
739 {"ftp",S_OK,FALSE},
740 {"user:pass:word",S_OK,FALSE},
741 {"user",S_OK,FALSE}
742 },
743 {
744 {Uri_HOST_DNS,S_OK,FALSE},
745 {21,S_OK,FALSE},
746 {URL_SCHEME_FTP,S_OK,FALSE},
747 {URLZONE_INVALID,E_NOTIMPL,FALSE}
748 }
749 },
750 /* Make sure % encoded unreserved characters are decoded. */
751 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
752 {
753 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
754 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
755 {"ftp://ftp.google.com/",S_OK,FALSE},
756 {"google.com",S_OK,FALSE},
757 {"",S_FALSE,FALSE},
758 {"",S_FALSE,FALSE},
759 {"ftp.google.com",S_OK,FALSE},
760 {"PASS",S_OK,FALSE},
761 {"/",S_OK,FALSE},
762 {"/",S_OK,FALSE},
763 {"",S_FALSE,FALSE},
764 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
765 {"ftp",S_OK,FALSE},
766 {"wINe:PASS",S_OK,FALSE},
767 {"wINe",S_OK,FALSE}
768 },
769 {
770 {Uri_HOST_DNS,S_OK,FALSE},
771 {21,S_OK,FALSE},
772 {URL_SCHEME_FTP,S_OK,FALSE},
773 {URLZONE_INVALID,E_NOTIMPL,FALSE}
774 }
775 },
776 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
777 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
778 {
779 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
780 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
781 {"ftp://ftp.google.com/",S_OK,FALSE},
782 {"google.com",S_OK,FALSE},
783 {"",S_FALSE,FALSE},
784 {"",S_FALSE,FALSE},
785 {"ftp.google.com",S_OK,FALSE},
786 {"PA%7B%7D",S_OK,FALSE},
787 {"/",S_OK,FALSE},
788 {"/",S_OK,FALSE},
789 {"",S_FALSE,FALSE},
790 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
791 {"ftp",S_OK,FALSE},
792 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
793 {"w%5D%5Be",S_OK,FALSE}
794 },
795 {
796 {Uri_HOST_DNS,S_OK,FALSE},
797 {21,S_OK,FALSE},
798 {URL_SCHEME_FTP,S_OK,FALSE},
799 {URLZONE_INVALID,E_NOTIMPL,FALSE}
800 }
801 },
802 /* You're allowed to have an empty password portion in the userinfo section. */
803 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
804 {
805 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
806 {"empty:@ftp.google.com",S_OK,FALSE},
807 {"ftp://ftp.google.com/",S_OK,FALSE},
808 {"google.com",S_OK,FALSE},
809 {"",S_FALSE,FALSE},
810 {"",S_FALSE,FALSE},
811 {"ftp.google.com",S_OK,FALSE},
812 {"",S_OK,FALSE},
813 {"/",S_OK,FALSE},
814 {"/",S_OK,FALSE},
815 {"",S_FALSE,FALSE},
816 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
817 {"ftp",S_OK,FALSE},
818 {"empty:",S_OK,FALSE},
819 {"empty",S_OK,FALSE}
820 },
821 {
822 {Uri_HOST_DNS,S_OK,FALSE},
823 {21,S_OK,FALSE},
824 {URL_SCHEME_FTP,S_OK,FALSE},
825 {URLZONE_INVALID,E_NOTIMPL,FALSE}
826 }
827 },
828 /* Make sure forbidden characters in "userinfo" get encoded. */
829 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
830 {
831 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
832 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
833 {"ftp://ftp.google.com/",S_OK,FALSE},
834 {"google.com",S_OK,FALSE},
835 {"",S_FALSE,FALSE},
836 {"",S_FALSE,FALSE},
837 {"ftp.google.com",S_OK,FALSE},
838 {"",S_FALSE,FALSE},
839 {"/",S_OK,FALSE},
840 {"/",S_OK,FALSE},
841 {"",S_FALSE,FALSE},
842 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
843 {"ftp",S_OK,FALSE},
844 {"%22%20%22weird",S_OK,FALSE},
845 {"%22%20%22weird",S_OK,FALSE}
846 },
847 {
848 {Uri_HOST_DNS,S_OK,FALSE},
849 {21,S_OK,FALSE},
850 {URL_SCHEME_FTP,S_OK,FALSE},
851 {URLZONE_INVALID,E_NOTIMPL,FALSE}
852 }
853 },
854 /* Make sure the forbidden characters don't get percent encoded. */
855 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
856 {
857 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
858 {"\" \"weird@ftp.google.com",S_OK,FALSE},
859 {"ftp://ftp.google.com/",S_OK,FALSE},
860 {"google.com",S_OK,FALSE},
861 {"",S_FALSE,FALSE},
862 {"",S_FALSE,FALSE},
863 {"ftp.google.com",S_OK,FALSE},
864 {"",S_FALSE,FALSE},
865 {"/",S_OK,FALSE},
866 {"/",S_OK,FALSE},
867 {"",S_FALSE,FALSE},
868 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
869 {"ftp",S_OK,FALSE},
870 {"\" \"weird",S_OK,FALSE},
871 {"\" \"weird",S_OK,FALSE}
872 },
873 {
874 {Uri_HOST_DNS,S_OK,FALSE},
875 {21,S_OK,FALSE},
876 {URL_SCHEME_FTP,S_OK,FALSE},
877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
878 }
879 },
880 /* Make sure already percent encoded characters don't get unencoded. */
881 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
882 {
883 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
884 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
885 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
886 {"google.com",S_OK,FALSE},
887 {"",S_FALSE,FALSE},
888 {"",S_FALSE,FALSE},
889 {"ftp.google.com",S_OK,FALSE},
890 {"",S_FALSE,FALSE},
891 {"/\"%20\"weird",S_OK,FALSE},
892 {"/\"%20\"weird",S_OK,FALSE},
893 {"",S_FALSE,FALSE},
894 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
895 {"ftp",S_OK,FALSE},
896 {"\"%20\"weird",S_OK,FALSE},
897 {"\"%20\"weird",S_OK,FALSE}
898 },
899 {
900 {Uri_HOST_DNS,S_OK,FALSE},
901 {21,S_OK,FALSE},
902 {URL_SCHEME_FTP,S_OK,FALSE},
903 {URLZONE_INVALID,E_NOTIMPL,FALSE}
904 }
905 },
906 /* Allowed to have invalid % encoded because its an unknown scheme type. */
907 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
908 {
909 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
910 {"%xy:word@winehq.org",S_OK,FALSE},
911 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
912 {"winehq.org",S_OK,FALSE},
913 {"",S_FALSE,FALSE},
914 {"",S_FALSE,FALSE},
915 {"winehq.org",S_OK,FALSE},
916 {"word",S_OK,FALSE},
917 {"/",S_OK,FALSE},
918 {"/",S_OK,FALSE},
919 {"",S_FALSE,FALSE},
920 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
921 {"zip",S_OK,FALSE},
922 {"%xy:word",S_OK,FALSE},
923 {"%xy",S_OK,FALSE}
924 },
925 {
926 {Uri_HOST_DNS,S_OK,FALSE},
927 {0,S_FALSE,FALSE},
928 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
929 {URLZONE_INVALID,E_NOTIMPL,FALSE}
930 }
931 },
932 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
933 * isn't known.
934 */
935 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
936 {
937 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
938 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
939 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
940 {"winehq.org",S_OK,FALSE},
941 {"",S_FALSE,FALSE},
942 {"",S_FALSE,FALSE},
943 {"winehq.org",S_OK,FALSE},
944 {"%52%53ord",S_OK,FALSE},
945 {"/",S_OK,FALSE},
946 {"/",S_OK,FALSE},
947 {"",S_FALSE,FALSE},
948 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
949 {"zip",S_OK,FALSE},
950 {"%2E:%52%53ord",S_OK,FALSE},
951 {"%2E",S_OK,FALSE}
952 },
953 {
954 {Uri_HOST_DNS,S_OK,FALSE},
955 {0,S_FALSE,FALSE},
956 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
957 {URLZONE_INVALID,E_NOTIMPL,FALSE}
958 }
959 },
960 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
961 {
962 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
963 {"[](),'test':word@winehq.org",S_OK,FALSE},
964 {"ftp://winehq.org/",S_OK,FALSE},
965 {"winehq.org",S_OK,FALSE},
966 {"",S_FALSE,FALSE},
967 {"",S_FALSE,FALSE},
968 {"winehq.org",S_OK,FALSE},
969 {"word",S_OK,FALSE},
970 {"/",S_OK,FALSE},
971 {"/",S_OK,FALSE},
972 {"",S_FALSE,FALSE},
973 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
974 {"ftp",S_OK,FALSE},
975 {"[](),'test':word",S_OK,FALSE},
976 {"[](),'test'",S_OK,FALSE}
977 },
978 {
979 {Uri_HOST_DNS,S_OK,FALSE},
980 {21,S_OK,FALSE},
981 {URL_SCHEME_FTP,S_OK,FALSE},
982 {URLZONE_INVALID,E_NOTIMPL,FALSE}
983 }
984 },
985 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
986 {
987 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
988 {"test",S_OK,FALSE},
989 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
990 {"",S_FALSE,FALSE},
991 {"",S_FALSE,FALSE},
992 {"",S_FALSE,FALSE},
993 {"test",S_OK,FALSE},
994 {"",S_FALSE,FALSE},
995 {"/",S_OK,FALSE},
996 {"/?:word@winehq.org/",S_OK,FALSE},
997 {"?:word@winehq.org/",S_OK,FALSE},
998 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
999 {"ftp",S_OK,FALSE},
1000 {"",S_FALSE,FALSE},
1001 {"",S_FALSE,FALSE}
1002 },
1003 {
1004 {Uri_HOST_DNS,S_OK,FALSE},
1005 {21,S_OK,FALSE},
1006 {URL_SCHEME_FTP,S_OK,FALSE},
1007 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1008 }
1009 },
1010 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1011 {
1012 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1013 {"test",S_OK,FALSE},
1014 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1015 {"",S_FALSE,FALSE},
1016 {"",S_FALSE,FALSE},
1017 {"#:word@winehq.org/",S_OK,FALSE},
1018 {"test",S_OK,FALSE},
1019 {"",S_FALSE,FALSE},
1020 {"/",S_OK,FALSE},
1021 {"/",S_OK,FALSE},
1022 {"",S_FALSE,FALSE},
1023 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1024 {"ftp",S_OK,FALSE},
1025 {"",S_FALSE,FALSE},
1026 {"",S_FALSE,FALSE}
1027 },
1028 {
1029 {Uri_HOST_DNS,S_OK,FALSE},
1030 {21,S_OK,FALSE},
1031 {URL_SCHEME_FTP,S_OK,FALSE},
1032 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1033 }
1034 },
1035 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1036 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1037 {
1038 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1039 {"test\\:word@winehq.org",S_OK,FALSE},
1040 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1041 {"winehq.org",S_OK,FALSE},
1042 {"",S_FALSE,FALSE},
1043 {"",S_FALSE,FALSE},
1044 {"winehq.org",S_OK,FALSE},
1045 {"word",S_OK,FALSE},
1046 {"/",S_OK,FALSE},
1047 {"/",S_OK,FALSE},
1048 {"",S_FALSE,FALSE},
1049 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1050 {"zip",S_OK,FALSE},
1051 {"test\\:word",S_OK,FALSE},
1052 {"test\\",S_OK,FALSE}
1053 },
1054 {
1055 {Uri_HOST_DNS,S_OK,FALSE},
1056 {0,S_FALSE,FALSE},
1057 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1058 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1059 }
1060 },
1061 /* It normalizes IPv4 addresses correctly. */
1062 { "http://127.000.000.100/", 0, S_OK, FALSE,
1063 {
1064 {"http://127.0.0.100/",S_OK,FALSE},
1065 {"127.0.0.100",S_OK,FALSE},
1066 {"http://127.0.0.100/",S_OK,FALSE},
1067 {"",S_FALSE,FALSE},
1068 {"",S_FALSE,FALSE},
1069 {"",S_FALSE,FALSE},
1070 {"127.0.0.100",S_OK,FALSE},
1071 {"",S_FALSE,FALSE},
1072 {"/",S_OK,FALSE},
1073 {"/",S_OK,FALSE},
1074 {"",S_FALSE,FALSE},
1075 {"http://127.000.000.100/",S_OK,FALSE},
1076 {"http",S_OK,FALSE},
1077 {"",S_FALSE,FALSE},
1078 {"",S_FALSE,FALSE}
1079 },
1080 {
1081 {Uri_HOST_IPV4,S_OK,FALSE},
1082 {80,S_OK,FALSE},
1083 {URL_SCHEME_HTTP,S_OK,FALSE},
1084 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1085 }
1086 },
1087 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1088 {
1089 {"http://127.0.0.1:8000/",S_OK},
1090 {"127.0.0.1:8000",S_OK},
1091 {"http://127.0.0.1:8000/",S_OK},
1092 {"",S_FALSE},
1093 {"",S_FALSE},
1094 {"",S_FALSE},
1095 {"127.0.0.1",S_OK},
1096 {"",S_FALSE},
1097 {"/",S_OK},
1098 {"/",S_OK},
1099 {"",S_FALSE},
1100 {"http://127.0.0.1:8000",S_OK},
1101 {"http",S_OK},
1102 {"",S_FALSE},
1103 {"",S_FALSE}
1104 },
1105 {
1106 {Uri_HOST_IPV4,S_OK,FALSE},
1107 {8000,S_OK,FALSE},
1108 {URL_SCHEME_HTTP,S_OK,FALSE},
1109 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1110 }
1111 },
1112 /* Make sure it normalizes partial IPv4 addresses correctly. */
1113 { "http://127.0/", 0, S_OK, FALSE,
1114 {
1115 {"http://127.0.0.0/",S_OK,FALSE},
1116 {"127.0.0.0",S_OK,FALSE},
1117 {"http://127.0.0.0/",S_OK,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"",S_FALSE,FALSE},
1120 {"",S_FALSE,FALSE},
1121 {"127.0.0.0",S_OK,FALSE},
1122 {"",S_FALSE,FALSE},
1123 {"/",S_OK,FALSE},
1124 {"/",S_OK,FALSE},
1125 {"",S_FALSE,FALSE},
1126 {"http://127.0/",S_OK,FALSE},
1127 {"http",S_OK,FALSE},
1128 {"",S_FALSE,FALSE},
1129 {"",S_FALSE,FALSE}
1130 },
1131 {
1132 {Uri_HOST_IPV4,S_OK,FALSE},
1133 {80,S_OK,FALSE},
1134 {URL_SCHEME_HTTP,S_OK,FALSE},
1135 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1136 }
1137 },
1138 /* Make sure it converts implicit IPv4's correctly. */
1139 { "http://123456/", 0, S_OK, FALSE,
1140 {
1141 {"http://0.1.226.64/",S_OK,FALSE},
1142 {"0.1.226.64",S_OK,FALSE},
1143 {"http://0.1.226.64/",S_OK,FALSE},
1144 {"",S_FALSE,FALSE},
1145 {"",S_FALSE,FALSE},
1146 {"",S_FALSE,FALSE},
1147 {"0.1.226.64",S_OK,FALSE},
1148 {"",S_FALSE,FALSE},
1149 {"/",S_OK,FALSE},
1150 {"/",S_OK,FALSE},
1151 {"",S_FALSE,FALSE},
1152 {"http://123456/",S_OK,FALSE},
1153 {"http",S_OK,FALSE},
1154 {"",S_FALSE,FALSE},
1155 {"",S_FALSE,FALSE}
1156 },
1157 {
1158 {Uri_HOST_IPV4,S_OK,FALSE},
1159 {80,S_OK,FALSE},
1160 {URL_SCHEME_HTTP,S_OK,FALSE},
1161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1162 }
1163 },
1164 /* UINT_MAX */
1165 { "http://4294967295/", 0, S_OK, FALSE,
1166 {
1167 {"http://255.255.255.255/",S_OK,FALSE},
1168 {"255.255.255.255",S_OK,FALSE},
1169 {"http://255.255.255.255/",S_OK,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"",S_FALSE,FALSE},
1172 {"",S_FALSE,FALSE},
1173 {"255.255.255.255",S_OK,FALSE},
1174 {"",S_FALSE,FALSE},
1175 {"/",S_OK,FALSE},
1176 {"/",S_OK,FALSE},
1177 {"",S_FALSE,FALSE},
1178 {"http://4294967295/",S_OK,FALSE},
1179 {"http",S_OK,FALSE},
1180 {"",S_FALSE,FALSE},
1181 {"",S_FALSE,FALSE}
1182 },
1183 {
1184 {Uri_HOST_IPV4,S_OK,FALSE},
1185 {80,S_OK,FALSE},
1186 {URL_SCHEME_HTTP,S_OK,FALSE},
1187 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1188 }
1189 },
1190 /* UINT_MAX+1 */
1191 { "http://4294967296/", 0, S_OK, FALSE,
1192 {
1193 {"http://4294967296/",S_OK,FALSE},
1194 {"4294967296",S_OK,FALSE},
1195 {"http://4294967296/",S_OK,FALSE},
1196 {"",S_FALSE,FALSE},
1197 {"",S_FALSE,FALSE},
1198 {"",S_FALSE,FALSE},
1199 {"4294967296",S_OK,FALSE},
1200 {"",S_FALSE,FALSE},
1201 {"/",S_OK,FALSE},
1202 {"/",S_OK,FALSE},
1203 {"",S_FALSE,FALSE},
1204 {"http://4294967296/",S_OK,FALSE},
1205 {"http",S_OK,FALSE},
1206 {"",S_FALSE,FALSE},
1207 {"",S_FALSE,FALSE}
1208 },
1209 {
1210 {Uri_HOST_DNS,S_OK,FALSE},
1211 {80,S_OK,FALSE},
1212 {URL_SCHEME_HTTP,S_OK,FALSE},
1213 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1214 }
1215 },
1216 /* Window's doesn't normalize IP address for unknown schemes. */
1217 { "1234://4294967295/", 0, S_OK, FALSE,
1218 {
1219 {"1234://4294967295/",S_OK,FALSE},
1220 {"4294967295",S_OK,FALSE},
1221 {"1234://4294967295/",S_OK,FALSE},
1222 {"",S_FALSE,FALSE},
1223 {"",S_FALSE,FALSE},
1224 {"",S_FALSE,FALSE},
1225 {"4294967295",S_OK,FALSE},
1226 {"",S_FALSE,FALSE},
1227 {"/",S_OK,FALSE},
1228 {"/",S_OK,FALSE},
1229 {"",S_FALSE,FALSE},
1230 {"1234://4294967295/",S_OK,FALSE},
1231 {"1234",S_OK,FALSE},
1232 {"",S_FALSE,FALSE},
1233 {"",S_FALSE,FALSE}
1234 },
1235 {
1236 {Uri_HOST_IPV4,S_OK,FALSE},
1237 {0,S_FALSE,FALSE},
1238 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1239 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1240 }
1241 },
1242 /* Window's doesn't normalize IP address for unknown schemes. */
1243 { "1234://127.001/", 0, S_OK, FALSE,
1244 {
1245 {"1234://127.001/",S_OK,FALSE},
1246 {"127.001",S_OK,FALSE},
1247 {"1234://127.001/",S_OK,FALSE},
1248 {"",S_FALSE,FALSE},
1249 {"",S_FALSE,FALSE},
1250 {"",S_FALSE,FALSE},
1251 {"127.001",S_OK,FALSE},
1252 {"",S_FALSE,FALSE},
1253 {"/",S_OK,FALSE},
1254 {"/",S_OK,FALSE},
1255 {"",S_FALSE,FALSE},
1256 {"1234://127.001/",S_OK,FALSE},
1257 {"1234",S_OK,FALSE},
1258 {"",S_FALSE,FALSE},
1259 {"",S_FALSE,FALSE}
1260 },
1261 {
1262 {Uri_HOST_IPV4,S_OK,FALSE},
1263 {0,S_FALSE,FALSE},
1264 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1265 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1266 }
1267 },
1268 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1269 {
1270 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1271 {"[fedc:ba98::3210]",S_OK,FALSE},
1272 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"",S_FALSE,FALSE},
1275 {"",S_FALSE,FALSE},
1276 {"fedc:ba98::3210",S_OK,FALSE},
1277 {"",S_FALSE,FALSE},
1278 {"/",S_OK,FALSE},
1279 {"/",S_OK,FALSE},
1280 {"",S_FALSE,FALSE},
1281 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1282 {"http",S_OK,FALSE},
1283 {"",S_FALSE,FALSE},
1284 {"",S_FALSE,FALSE},
1285 },
1286 {
1287 {Uri_HOST_IPV6,S_OK,FALSE},
1288 {80,S_OK,FALSE},
1289 {URL_SCHEME_HTTP,S_OK,FALSE},
1290 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1291 }
1292 },
1293 { "http://[::]", 0, S_OK, FALSE,
1294 {
1295 {"http://[::]/",S_OK,FALSE},
1296 {"[::]",S_OK,FALSE},
1297 {"http://[::]/",S_OK,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"",S_FALSE,FALSE},
1300 {"",S_FALSE,FALSE},
1301 {"::",S_OK,FALSE},
1302 {"",S_FALSE,FALSE},
1303 {"/",S_OK,FALSE},
1304 {"/",S_OK,FALSE},
1305 {"",S_FALSE,FALSE},
1306 {"http://[::]",S_OK,FALSE},
1307 {"http",S_OK,FALSE},
1308 {"",S_FALSE,FALSE},
1309 {"",S_FALSE,FALSE},
1310 },
1311 {
1312 {Uri_HOST_IPV6,S_OK,FALSE},
1313 {80,S_OK,FALSE},
1314 {URL_SCHEME_HTTP,S_OK,FALSE},
1315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1316 }
1317 },
1318 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1319 {
1320 {"http://[fedc:ba98::]/",S_OK,FALSE},
1321 {"[fedc:ba98::]",S_OK,FALSE},
1322 {"http://[fedc:ba98::]/",S_OK,FALSE},
1323 {"",S_FALSE,FALSE},
1324 {"",S_FALSE,FALSE},
1325 {"",S_FALSE,FALSE},
1326 {"fedc:ba98::",S_OK,FALSE},
1327 {"",S_FALSE,FALSE},
1328 {"/",S_OK,FALSE},
1329 {"/",S_OK,FALSE},
1330 {"",S_FALSE,FALSE},
1331 {"http://[FEDC:BA98::]",S_OK,FALSE},
1332 {"http",S_OK,FALSE},
1333 {"",S_FALSE,FALSE},
1334 {"",S_FALSE,FALSE},
1335 },
1336 {
1337 {Uri_HOST_IPV6,S_OK,FALSE},
1338 {80,S_OK,FALSE},
1339 {URL_SCHEME_HTTP,S_OK,FALSE},
1340 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1341 }
1342 },
1343 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1344 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1345 {
1346 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1347 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1348 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1349 {"",S_FALSE,FALSE},
1350 {"",S_FALSE,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1353 {"",S_FALSE,FALSE},
1354 {"/",S_OK,FALSE},
1355 {"/",S_OK,FALSE},
1356 {"",S_FALSE,FALSE},
1357 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1358 {"http",S_OK,FALSE},
1359 {"",S_FALSE,FALSE},
1360 {"",S_FALSE,FALSE},
1361 },
1362 {
1363 {Uri_HOST_IPV6,S_OK,FALSE},
1364 {80,S_OK,FALSE},
1365 {URL_SCHEME_HTTP,S_OK,FALSE},
1366 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1367 }
1368 },
1369 { "http://[v2.34]/", 0, S_OK, FALSE,
1370 {
1371 {"http://[v2.34]/",S_OK,FALSE},
1372 {"[v2.34]",S_OK,FALSE},
1373 {"http://[v2.34]/",S_OK,FALSE},
1374 {"",S_FALSE,FALSE},
1375 {"",S_FALSE,FALSE},
1376 {"",S_FALSE,FALSE},
1377 {"[v2.34]",S_OK,FALSE},
1378 {"",S_FALSE,FALSE},
1379 {"/",S_OK,FALSE},
1380 {"/",S_OK,FALSE},
1381 {"",S_FALSE,FALSE},
1382 {"http://[v2.34]/",S_OK,FALSE},
1383 {"http",S_OK,FALSE},
1384 {"",S_FALSE,FALSE},
1385 {"",S_FALSE,FALSE}
1386 },
1387 {
1388 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1389 {80,S_OK,FALSE},
1390 {URL_SCHEME_HTTP,S_OK,FALSE},
1391 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1392 }
1393 },
1394 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1395 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1396 {
1397 {"http://[xyz:12345.com/test",S_OK,FALSE},
1398 {"[xyz:12345.com",S_OK,FALSE},
1399 {"http://[xyz:12345.com/test",S_OK,FALSE},
1400 {"[xyz:12345.com",S_OK,FALSE},
1401 {"",S_FALSE,FALSE},
1402 {"",S_FALSE,FALSE},
1403 {"[xyz:12345.com",S_OK,FALSE},
1404 {"",S_FALSE,FALSE},
1405 {"/test",S_OK,FALSE},
1406 {"/test",S_OK,FALSE},
1407 {"",S_FALSE,FALSE},
1408 {"http://[xyz:12345.com/test",S_OK,FALSE},
1409 {"http",S_OK,FALSE},
1410 {"",S_FALSE,FALSE},
1411 {"",S_FALSE,FALSE}
1412 },
1413 {
1414 {Uri_HOST_DNS,S_OK,FALSE},
1415 {80,S_OK,FALSE},
1416 {URL_SCHEME_HTTP,S_OK,FALSE},
1417 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1418 }
1419 },
1420 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1421 * of the host name (respectively).
1422 */
1423 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1424 {
1425 {"ftp://www.[works].com/",S_OK,FALSE},
1426 {"www.[works].com",S_OK,FALSE},
1427 {"ftp://www.[works].com/",S_OK,FALSE},
1428 {"[works].com",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"",S_FALSE,FALSE},
1431 {"www.[works].com",S_OK,FALSE},
1432 {"",S_FALSE,FALSE},
1433 {"/",S_OK,FALSE},
1434 {"/",S_OK,FALSE},
1435 {"",S_FALSE,FALSE},
1436 {"ftp://www.[works].com/",S_OK,FALSE},
1437 {"ftp",S_OK,FALSE},
1438 {"",S_FALSE,FALSE},
1439 {"",S_FALSE,FALSE}
1440 },
1441 {
1442 {Uri_HOST_DNS,S_OK,FALSE},
1443 {21,S_OK,FALSE},
1444 {URL_SCHEME_FTP,S_OK,FALSE},
1445 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1446 }
1447 },
1448 /* Considers ':' a delimiter since it appears after the ']'. */
1449 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1450 {
1451 {"http://www.google.com]:12345/",S_OK,FALSE},
1452 {"www.google.com]:12345",S_OK,FALSE},
1453 {"http://www.google.com]:12345/",S_OK,FALSE},
1454 {"google.com]",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"",S_FALSE,FALSE},
1457 {"www.google.com]",S_OK,FALSE},
1458 {"",S_FALSE,FALSE},
1459 {"/",S_OK,FALSE},
1460 {"/",S_OK,FALSE},
1461 {"",S_FALSE,FALSE},
1462 {"http://www.google.com]:12345/",S_OK,FALSE},
1463 {"http",S_OK,FALSE},
1464 {"",S_FALSE,FALSE},
1465 {"",S_FALSE,FALSE}
1466 },
1467 {
1468 {Uri_HOST_DNS,S_OK,FALSE},
1469 {12345,S_OK,FALSE},
1470 {URL_SCHEME_HTTP,S_OK,FALSE},
1471 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1472 }
1473 },
1474 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1475 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1476 {
1477 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1478 {"w%XXw%GEw.google.com",S_OK,FALSE},
1479 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1480 {"google.com",S_OK,FALSE},
1481 {"",S_FALSE,FALSE},
1482 {"",S_FALSE,FALSE},
1483 {"w%XXw%GEw.google.com",S_OK,FALSE},
1484 {"",S_FALSE,FALSE},
1485 {"/",S_OK,FALSE},
1486 {"/",S_OK,FALSE},
1487 {"",S_FALSE,FALSE},
1488 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1489 {"zip",S_OK,FALSE},
1490 {"",S_FALSE,FALSE},
1491 {"",S_FALSE,FALSE}
1492 },
1493 {
1494 {Uri_HOST_DNS,S_OK,FALSE},
1495 {0,S_FALSE,FALSE},
1496 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1497 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1498 }
1499 },
1500 /* Unknown scheme types hostname doesn't get lower cased. */
1501 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1502 {
1503 {"zip://GOOGLE.com/",S_OK,FALSE},
1504 {"GOOGLE.com",S_OK,FALSE},
1505 {"zip://GOOGLE.com/",S_OK,FALSE},
1506 {"GOOGLE.com",S_OK,FALSE},
1507 {"",S_FALSE,FALSE},
1508 {"",S_FALSE,FALSE},
1509 {"GOOGLE.com",S_OK,FALSE},
1510 {"",S_FALSE,FALSE},
1511 {"/",S_OK,FALSE},
1512 {"/",S_OK,FALSE},
1513 {"",S_FALSE,FALSE},
1514 {"zip://GOOGLE.com/",S_OK,FALSE},
1515 {"zip",S_OK,FALSE},
1516 {"",S_FALSE,FALSE},
1517 {"",S_FALSE,FALSE}
1518 },
1519 {
1520 {Uri_HOST_DNS,S_OK,FALSE},
1521 {0,S_FALSE,FALSE},
1522 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1523 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1524 }
1525 },
1526 /* Hostname gets lower-cased for known scheme types. */
1527 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1528 {
1529 {"http://www.google.com/",S_OK,FALSE},
1530 {"www.google.com",S_OK,FALSE},
1531 {"http://www.google.com/",S_OK,FALSE},
1532 {"google.com",S_OK,FALSE},
1533 {"",S_FALSE,FALSE},
1534 {"",S_FALSE,FALSE},
1535 {"www.google.com",S_OK,FALSE},
1536 {"",S_FALSE,FALSE},
1537 {"/",S_OK,FALSE},
1538 {"/",S_OK,FALSE},
1539 {"",S_FALSE,FALSE},
1540 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1541 {"http",S_OK,FALSE},
1542 {"",S_FALSE,FALSE},
1543 {"",S_FALSE,FALSE}
1544 },
1545 {
1546 {Uri_HOST_DNS,S_OK,FALSE},
1547 {80,S_OK,FALSE},
1548 {URL_SCHEME_HTTP,S_OK,FALSE},
1549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1550 }
1551 },
1552 /* Characters that get % encoded in the hostname also have their percent
1553 * encoded forms lower cased.
1554 */
1555 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1556 {
1557 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1558 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1559 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1560 {"%7cgoogle%7c.com",S_OK,FALSE},
1561 {"",S_FALSE,FALSE},
1562 {"",S_FALSE,FALSE},
1563 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1564 {"",S_FALSE,FALSE},
1565 {"/",S_OK,FALSE},
1566 {"/",S_OK,FALSE},
1567 {"",S_FALSE,FALSE},
1568 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1569 {"http",S_OK,FALSE},
1570 {"",S_FALSE,FALSE},
1571 {"",S_FALSE,FALSE}
1572 },
1573 {
1574 {Uri_HOST_DNS,S_OK,FALSE},
1575 {80,S_OK,FALSE},
1576 {URL_SCHEME_HTTP,S_OK,FALSE},
1577 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1578 }
1579 },
1580 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1581 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1582 {
1583 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1584 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1585 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1586 {"",S_FALSE,FALSE},
1587 {"",S_FALSE,FALSE},
1588 {"",S_FALSE,FALSE},
1589 {"1:2:3:4:5:6::",S_OK,FALSE},
1590 {"",S_FALSE,FALSE},
1591 {"/",S_OK,FALSE},
1592 {"/",S_OK,FALSE},
1593 {"",S_FALSE,FALSE},
1594 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1595 {"http",S_OK,FALSE},
1596 {"",S_FALSE,FALSE},
1597 {"",S_FALSE,FALSE},
1598 },
1599 {
1600 {Uri_HOST_IPV6,S_OK,FALSE},
1601 {80,S_OK,FALSE},
1602 {URL_SCHEME_HTTP,S_OK,FALSE},
1603 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1604 }
1605 },
1606 /* IPv4 addresses get normalized. */
1607 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1608 {
1609 {"http://[::1.2.3.0]/",S_OK,FALSE},
1610 {"[::1.2.3.0]",S_OK,FALSE},
1611 {"http://[::1.2.3.0]/",S_OK,FALSE},
1612 {"",S_FALSE,FALSE},
1613 {"",S_FALSE,FALSE},
1614 {"",S_FALSE,FALSE},
1615 {"::1.2.3.0",S_OK,FALSE},
1616 {"",S_FALSE,FALSE},
1617 {"/",S_OK,FALSE},
1618 {"/",S_OK,FALSE},
1619 {"",S_FALSE,FALSE},
1620 {"http://[::001.002.003.000]",S_OK,FALSE},
1621 {"http",S_OK,FALSE},
1622 {"",S_FALSE,FALSE},
1623 {"",S_FALSE,FALSE},
1624 },
1625 {
1626 {Uri_HOST_IPV6,S_OK,FALSE},
1627 {80,S_OK,FALSE},
1628 {URL_SCHEME_HTTP,S_OK,FALSE},
1629 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1630 }
1631 },
1632 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1633 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1634 {
1635 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1636 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1637 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"",S_FALSE,FALSE},
1640 {"",S_FALSE,FALSE},
1641 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1642 {"",S_FALSE,FALSE},
1643 {"/",S_OK,FALSE},
1644 {"/",S_OK,FALSE},
1645 {"",S_FALSE,FALSE},
1646 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1647 {"zip",S_OK,FALSE},
1648 {"",S_FALSE,FALSE},
1649 {"",S_FALSE,FALSE},
1650 },
1651 {
1652 {Uri_HOST_IPV6,S_OK,FALSE},
1653 {0,S_FALSE,FALSE},
1654 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1655 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1656 }
1657 },
1658 /* IPv4 address is converted into 2 h16 components. */
1659 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1660 {
1661 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1662 {"[ffff::c0de:6f20]",S_OK,FALSE},
1663 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1664 {"",S_FALSE,FALSE},
1665 {"",S_FALSE,FALSE},
1666 {"",S_FALSE,FALSE},
1667 {"ffff::c0de:6f20",S_OK,FALSE},
1668 {"",S_FALSE,FALSE},
1669 {"/",S_OK,FALSE},
1670 {"/",S_OK,FALSE},
1671 {"",S_FALSE,FALSE},
1672 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1673 {"http",S_OK,FALSE},
1674 {"",S_FALSE,FALSE},
1675 {"",S_FALSE,FALSE},
1676 },
1677 {
1678 {Uri_HOST_IPV6,S_OK,FALSE},
1679 {80,S_OK,FALSE},
1680 {URL_SCHEME_HTTP,S_OK,FALSE},
1681 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1682 }
1683 },
1684 /* Max value for a port. */
1685 { "http://google.com:65535", 0, S_OK, FALSE,
1686 {
1687 {"http://google.com:65535/",S_OK,FALSE},
1688 {"google.com:65535",S_OK,FALSE},
1689 {"http://google.com:65535/",S_OK,FALSE},
1690 {"google.com",S_OK,FALSE},
1691 {"",S_FALSE,FALSE},
1692 {"",S_FALSE,FALSE},
1693 {"google.com",S_OK,FALSE},
1694 {"",S_FALSE,FALSE},
1695 {"/",S_OK,FALSE},
1696 {"/",S_OK,FALSE},
1697 {"",S_FALSE,FALSE},
1698 {"http://google.com:65535",S_OK,FALSE},
1699 {"http",S_OK,FALSE},
1700 {"",S_FALSE,FALSE},
1701 {"",S_FALSE,FALSE}
1702 },
1703 {
1704 {Uri_HOST_DNS,S_OK,FALSE},
1705 {65535,S_OK,FALSE},
1706 {URL_SCHEME_HTTP,S_OK,FALSE},
1707 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1708 }
1709 },
1710 { "zip://google.com:65536", 0, S_OK, FALSE,
1711 {
1712 {"zip://google.com:65536/",S_OK,FALSE},
1713 {"google.com:65536",S_OK,FALSE},
1714 {"zip://google.com:65536/",S_OK,FALSE},
1715 {"google.com:65536",S_OK,FALSE},
1716 {"",S_FALSE,FALSE},
1717 {"",S_FALSE,FALSE},
1718 {"google.com:65536",S_OK,FALSE},
1719 {"",S_FALSE,FALSE},
1720 {"/",S_OK,FALSE},
1721 {"/",S_OK,FALSE},
1722 {"",S_FALSE,FALSE},
1723 {"zip://google.com:65536",S_OK,FALSE},
1724 {"zip",S_OK,FALSE},
1725 {"",S_FALSE,FALSE},
1726 {"",S_FALSE,FALSE}
1727 },
1728 {
1729 {Uri_HOST_DNS,S_OK,FALSE},
1730 {0,S_FALSE,FALSE},
1731 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1732 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1733 }
1734 },
1735 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1736 {
1737 {"zip://google.com:65536:25/",S_OK,FALSE},
1738 {"google.com:65536:25",S_OK,FALSE},
1739 {"zip://google.com:65536:25/",S_OK,FALSE},
1740 {"google.com:65536:25",S_OK,FALSE},
1741 {"",S_FALSE,FALSE},
1742 {"",S_FALSE,FALSE},
1743 {"google.com:65536:25",S_OK,FALSE},
1744 {"",S_FALSE,FALSE},
1745 {"/",S_OK,FALSE},
1746 {"/",S_OK,FALSE},
1747 {"",S_FALSE,FALSE},
1748 {"zip://google.com:65536:25",S_OK,FALSE},
1749 {"zip",S_OK,FALSE},
1750 {"",S_FALSE,FALSE},
1751 {"",S_FALSE,FALSE}
1752 },
1753 {
1754 {Uri_HOST_DNS,S_OK,FALSE},
1755 {0,S_FALSE,FALSE},
1756 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1757 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1758 }
1759 },
1760 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1761 {
1762 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1763 {"[::ffff]:abcd",S_OK,FALSE},
1764 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"",S_FALSE,FALSE},
1767 {"",S_FALSE,FALSE},
1768 {"[::ffff]:abcd",S_OK,FALSE},
1769 {"",S_FALSE,FALSE},
1770 {"/",S_OK,FALSE},
1771 {"/",S_OK,FALSE},
1772 {"",S_FALSE,FALSE},
1773 {"zip://[::ffff]:abcd",S_OK,FALSE},
1774 {"zip",S_OK,FALSE},
1775 {"",S_FALSE,FALSE},
1776 {"",S_FALSE,FALSE}
1777 },
1778 {
1779 {Uri_HOST_DNS,S_OK,FALSE},
1780 {0,S_FALSE,FALSE},
1781 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1782 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1783 }
1784 },
1785 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1786 {
1787 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1788 {"127.0.0.1:abcd",S_OK,FALSE},
1789 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1790 {"0.1:abcd",S_OK,FALSE},
1791 {"",S_FALSE,FALSE},
1792 {"",S_FALSE,FALSE},
1793 {"127.0.0.1:abcd",S_OK,FALSE},
1794 {"",S_FALSE,FALSE},
1795 {"/",S_OK,FALSE},
1796 {"/",S_OK,FALSE},
1797 {"",S_FALSE,FALSE},
1798 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1799 {"zip",S_OK,FALSE},
1800 {"",S_FALSE,FALSE},
1801 {"",S_FALSE,FALSE}
1802 },
1803 {
1804 {Uri_HOST_DNS,S_OK,FALSE},
1805 {0,S_FALSE,FALSE},
1806 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1807 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1808 }
1809 },
1810 /* Port is just copied over. */
1811 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1812 {
1813 {"http://google.com:00035",S_OK,FALSE},
1814 {"google.com:00035",S_OK,FALSE},
1815 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1816 {"google.com",S_OK,FALSE},
1817 {"",S_FALSE,FALSE},
1818 {"",S_FALSE,FALSE},
1819 {"google.com",S_OK,FALSE},
1820 {"",S_FALSE,FALSE},
1821 {"",S_FALSE,FALSE},
1822 {"",S_FALSE,FALSE},
1823 {"",S_FALSE,FALSE},
1824 {"http://google.com:00035",S_OK,FALSE},
1825 {"http",S_OK,FALSE},
1826 {"",S_FALSE,FALSE},
1827 {"",S_FALSE,FALSE}
1828 },
1829 {
1830 {Uri_HOST_DNS,S_OK,FALSE},
1831 {35,S_OK,FALSE},
1832 {URL_SCHEME_HTTP,S_OK,FALSE},
1833 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1834 }
1835 },
1836 /* Default port is copied over. */
1837 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1838 {
1839 {"http://google.com:80",S_OK,FALSE},
1840 {"google.com:80",S_OK,FALSE},
1841 {"http://google.com:80",S_OK,FALSE},
1842 {"google.com",S_OK,FALSE},
1843 {"",S_FALSE,FALSE},
1844 {"",S_FALSE,FALSE},
1845 {"google.com",S_OK,FALSE},
1846 {"",S_FALSE,FALSE},
1847 {"",S_FALSE,FALSE},
1848 {"",S_FALSE,FALSE},
1849 {"",S_FALSE,FALSE},
1850 {"http://google.com:80",S_OK,FALSE},
1851 {"http",S_OK,FALSE},
1852 {"",S_FALSE,FALSE},
1853 {"",S_FALSE,FALSE}
1854 },
1855 {
1856 {Uri_HOST_DNS,S_OK,FALSE},
1857 {80,S_OK,FALSE},
1858 {URL_SCHEME_HTTP,S_OK,FALSE},
1859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1860 }
1861 },
1862 { "http://google.com.uk", 0, S_OK, FALSE,
1863 {
1864 {"http://google.com.uk/",S_OK,FALSE},
1865 {"google.com.uk",S_OK,FALSE},
1866 {"http://google.com.uk/",S_OK,FALSE},
1867 {"google.com.uk",S_OK,FALSE},
1868 {"",S_FALSE,FALSE},
1869 {"",S_FALSE,FALSE},
1870 {"google.com.uk",S_OK,FALSE},
1871 {"",S_FALSE,FALSE},
1872 {"/",S_OK,FALSE},
1873 {"/",S_OK,FALSE},
1874 {"",S_FALSE,FALSE},
1875 {"http://google.com.uk",S_OK,FALSE},
1876 {"http",S_OK,FALSE},
1877 {"",S_FALSE,FALSE},
1878 {"",S_FALSE,FALSE}
1879 },
1880 {
1881 {Uri_HOST_DNS,S_OK,FALSE},
1882 {80,S_OK,FALSE},
1883 {URL_SCHEME_HTTP,S_OK,FALSE},
1884 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1885 }
1886 },
1887 { "http://google.com.com", 0, S_OK, FALSE,
1888 {
1889 {"http://google.com.com/",S_OK,FALSE},
1890 {"google.com.com",S_OK,FALSE},
1891 {"http://google.com.com/",S_OK,FALSE},
1892 {"com.com",S_OK,FALSE},
1893 {"",S_FALSE,FALSE},
1894 {"",S_FALSE,FALSE},
1895 {"google.com.com",S_OK,FALSE},
1896 {"",S_FALSE,FALSE},
1897 {"/",S_OK,FALSE},
1898 {"/",S_OK,FALSE},
1899 {"",S_FALSE,FALSE},
1900 {"http://google.com.com",S_OK,FALSE},
1901 {"http",S_OK,FALSE},
1902 {"",S_FALSE,FALSE},
1903 {"",S_FALSE,FALSE}
1904 },
1905 {
1906 {Uri_HOST_DNS,S_OK,FALSE},
1907 {80,S_OK,FALSE},
1908 {URL_SCHEME_HTTP,S_OK,FALSE},
1909 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1910 }
1911 },
1912 { "http://google.uk.1", 0, S_OK, FALSE,
1913 {
1914 {"http://google.uk.1/",S_OK,FALSE},
1915 {"google.uk.1",S_OK,FALSE},
1916 {"http://google.uk.1/",S_OK,FALSE},
1917 {"google.uk.1",S_OK,FALSE},
1918 {"",S_FALSE,FALSE},
1919 {"",S_FALSE,FALSE},
1920 {"google.uk.1",S_OK,FALSE},
1921 {"",S_FALSE,FALSE},
1922 {"/",S_OK,FALSE},
1923 {"/",S_OK,FALSE},
1924 {"",S_FALSE,FALSE},
1925 {"http://google.uk.1",S_OK,FALSE},
1926 {"http",S_OK,FALSE},
1927 {"",S_FALSE,FALSE},
1928 {"",S_FALSE,FALSE}
1929 },
1930 {
1931 {Uri_HOST_DNS,S_OK,FALSE},
1932 {80,S_OK,FALSE},
1933 {URL_SCHEME_HTTP,S_OK,FALSE},
1934 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1935 }
1936 },
1937 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1938 { "http://google.foo.uk", 0, S_OK, FALSE,
1939 {
1940 {"http://google.foo.uk/",S_OK,FALSE},
1941 {"google.foo.uk",S_OK,FALSE},
1942 {"http://google.foo.uk/",S_OK,FALSE},
1943 {"foo.uk",S_OK,FALSE},
1944 {"",S_FALSE,FALSE},
1945 {"",S_FALSE,FALSE},
1946 {"google.foo.uk",S_OK,FALSE},
1947 {"",S_FALSE,FALSE},
1948 {"/",S_OK,FALSE},
1949 {"/",S_OK,FALSE},
1950 {"",S_FALSE,FALSE},
1951 {"http://google.foo.uk",S_OK,FALSE},
1952 {"http",S_OK,FALSE},
1953 {"",S_FALSE,FALSE},
1954 {"",S_FALSE,FALSE}
1955 },
1956 {
1957 {Uri_HOST_DNS,S_OK,FALSE},
1958 {80,S_OK,FALSE},
1959 {URL_SCHEME_HTTP,S_OK,FALSE},
1960 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1961 }
1962 },
1963 { "http://.com", 0, S_OK, FALSE,
1964 {
1965 {"http://.com/",S_OK,FALSE},
1966 {".com",S_OK,FALSE},
1967 {"http://.com/",S_OK,FALSE},
1968 {".com",S_OK,FALSE},
1969 {"",S_FALSE,FALSE},
1970 {"",S_FALSE,FALSE},
1971 {".com",S_OK,FALSE},
1972 {"",S_FALSE,FALSE},
1973 {"/",S_OK,FALSE},
1974 {"/",S_OK,FALSE},
1975 {"",S_FALSE,FALSE},
1976 {"http://.com",S_OK,FALSE},
1977 {"http",S_OK,FALSE},
1978 {"",S_FALSE,FALSE},
1979 {"",S_FALSE,FALSE}
1980 },
1981 {
1982 {Uri_HOST_DNS,S_OK,FALSE},
1983 {80,S_OK,FALSE},
1984 {URL_SCHEME_HTTP,S_OK,FALSE},
1985 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1986 }
1987 },
1988 { "http://.uk", 0, S_OK, FALSE,
1989 {
1990 {"http://.uk/",S_OK,FALSE},
1991 {".uk",S_OK,FALSE},
1992 {"http://.uk/",S_OK,FALSE},
1993 {"",S_FALSE,FALSE},
1994 {"",S_FALSE,FALSE},
1995 {"",S_FALSE,FALSE},
1996 {".uk",S_OK,FALSE},
1997 {"",S_FALSE,FALSE},
1998 {"/",S_OK,FALSE},
1999 {"/",S_OK,FALSE},
2000 {"",S_FALSE,FALSE},
2001 {"http://.uk",S_OK,FALSE},
2002 {"http",S_OK,FALSE},
2003 {"",S_FALSE,FALSE},
2004 {"",S_FALSE,FALSE}
2005 },
2006 {
2007 {Uri_HOST_DNS,S_OK,FALSE},
2008 {80,S_OK,FALSE},
2009 {URL_SCHEME_HTTP,S_OK,FALSE},
2010 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2011 }
2012 },
2013 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2014 {
2015 {"http://www.co.google.com.[]/",S_OK,FALSE},
2016 {"www.co.google.com.[]",S_OK,FALSE},
2017 {"http://www.co.google.com.[]/",S_OK,FALSE},
2018 {"google.com.[]",S_OK,FALSE},
2019 {"",S_FALSE,FALSE},
2020 {"",S_FALSE,FALSE},
2021 {"www.co.google.com.[]",S_OK,FALSE},
2022 {"",S_FALSE,FALSE},
2023 {"/",S_OK,FALSE},
2024 {"/",S_OK,FALSE},
2025 {"",S_FALSE,FALSE},
2026 {"http://www.co.google.com.[]",S_OK,FALSE},
2027 {"http",S_OK,FALSE},
2028 {"",S_FALSE,FALSE},
2029 {"",S_FALSE,FALSE}
2030 },
2031 {
2032 {Uri_HOST_DNS,S_OK,FALSE},
2033 {80,S_OK,FALSE},
2034 {URL_SCHEME_HTTP,S_OK,FALSE},
2035 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2036 }
2037 },
2038 { "http://co.uk", 0, S_OK, FALSE,
2039 {
2040 {"http://co.uk/",S_OK,FALSE},
2041 {"co.uk",S_OK,FALSE},
2042 {"http://co.uk/",S_OK,FALSE},
2043 {"",S_FALSE,FALSE},
2044 {"",S_FALSE,FALSE},
2045 {"",S_FALSE,FALSE},
2046 {"co.uk",S_OK,FALSE},
2047 {"",S_FALSE,FALSE},
2048 {"/",S_OK,FALSE},
2049 {"/",S_OK,FALSE},
2050 {"",S_FALSE,FALSE},
2051 {"http://co.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://www.co.google.us.test", 0, S_OK, FALSE,
2064 {
2065 {"http://www.co.google.us.test/",S_OK,FALSE},
2066 {"www.co.google.us.test",S_OK,FALSE},
2067 {"http://www.co.google.us.test/",S_OK,FALSE},
2068 {"us.test",S_OK,FALSE},
2069 {"",S_FALSE,FALSE},
2070 {"",S_FALSE,FALSE},
2071 {"www.co.google.us.test",S_OK,FALSE},
2072 {"",S_FALSE,FALSE},
2073 {"/",S_OK,FALSE},
2074 {"/",S_OK,FALSE},
2075 {"",S_FALSE,FALSE},
2076 {"http://www.co.google.us.test",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://gov.uk", 0, S_OK, FALSE,
2089 {
2090 {"http://gov.uk/",S_OK,FALSE},
2091 {"gov.uk",S_OK,FALSE},
2092 {"http://gov.uk/",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"",S_FALSE,FALSE},
2095 {"",S_FALSE,FALSE},
2096 {"gov.uk",S_OK,FALSE},
2097 {"",S_FALSE,FALSE},
2098 {"/",S_OK,FALSE},
2099 {"/",S_OK,FALSE},
2100 {"",S_FALSE,FALSE},
2101 {"http://gov.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 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2114 {
2115 {"zip://www.google.com\\test",S_OK,FALSE},
2116 {"www.google.com\\test",S_OK,FALSE},
2117 {"zip://www.google.com\\test",S_OK,FALSE},
2118 {"google.com\\test",S_OK,FALSE},
2119 {"",S_FALSE,FALSE},
2120 {"",S_FALSE,FALSE},
2121 {"www.google.com\\test",S_OK,FALSE},
2122 {"",S_FALSE,FALSE},
2123 {"",S_FALSE,FALSE},
2124 {"",S_FALSE,FALSE},
2125 {"",S_FALSE,FALSE},
2126 {"zip://www.google.com\\test",S_OK,FALSE},
2127 {"zip",S_OK,FALSE},
2128 {"",S_FALSE,FALSE},
2129 {"",S_FALSE,FALSE}
2130 },
2131 {
2132 {Uri_HOST_DNS,S_OK,FALSE},
2133 {0,S_FALSE,FALSE},
2134 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2135 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2136 }
2137 },
2138 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2139 {
2140 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2141 {"",S_FALSE,FALSE},
2142 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"",S_FALSE,FALSE},
2145 {"",S_FALSE,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"",S_FALSE,FALSE},
2148 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2149 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2150 {"",S_FALSE,FALSE},
2151 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2152 {"urn",S_OK,FALSE},
2153 {"",S_FALSE,FALSE},
2154 {"",S_FALSE,FALSE}
2155 },
2156 {
2157 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2158 {0,S_FALSE,FALSE},
2159 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2160 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2161 }
2162 },
2163 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2164 * are decoded and all '%' are encoded.
2165 */
2166 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2167 {
2168 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2169 {"",S_FALSE,FALSE},
2170 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {".mp3",S_OK,FALSE},
2173 {"",S_FALSE,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"",S_FALSE,FALSE},
2176 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2177 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2178 {"",S_FALSE,FALSE},
2179 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2180 {"file",S_OK,FALSE},
2181 {"",S_FALSE,FALSE},
2182 {"",S_FALSE,FALSE}
2183 },
2184 {
2185 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2186 {0,S_FALSE,FALSE},
2187 {URL_SCHEME_FILE,S_OK,FALSE},
2188 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2189 }
2190 },
2191 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2192 * is decoded and only %'s in front of invalid hex digits are encoded.
2193 */
2194 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2195 {
2196 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2197 {"",S_FALSE,FALSE},
2198 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2199 {"",S_FALSE,FALSE},
2200 {".mp3",S_OK,FALSE},
2201 {"",S_FALSE,FALSE},
2202 {"",S_FALSE,FALSE},
2203 {"",S_FALSE,FALSE},
2204 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2205 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2206 {"",S_FALSE,FALSE},
2207 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2208 {"file",S_OK,FALSE},
2209 {"",S_FALSE,FALSE},
2210 {"",S_FALSE,FALSE}
2211 },
2212 {
2213 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2214 {0,S_FALSE,FALSE},
2215 {URL_SCHEME_FILE,S_OK,FALSE},
2216 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2217 }
2218 },
2219 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2220 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2221 {
2222 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2223 {"[::1.2.3.0]",S_OK,FALSE},
2224 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2225 {"",S_FALSE,FALSE},
2226 {"",S_FALSE,FALSE},
2227 {"",S_FALSE,FALSE},
2228 {"::1.2.3.0",S_OK,FALSE},
2229 {"",S_FALSE,FALSE},
2230 {"/%3F%23.T/test",S_OK,FALSE},
2231 {"/%3F%23.T/test",S_OK,FALSE},
2232 {"",S_FALSE,FALSE},
2233 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2234 {"http",S_OK,FALSE},
2235 {"",S_FALSE,FALSE},
2236 {"",S_FALSE,FALSE},
2237 },
2238 {
2239 {Uri_HOST_IPV6,S_OK,FALSE},
2240 {80,S_OK,FALSE},
2241 {URL_SCHEME_HTTP,S_OK,FALSE},
2242 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2243 }
2244 },
2245 /* Forbidden characters are always encoded for file URIs. */
2246 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2247 {
2248 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2249 {"",S_FALSE,FALSE},
2250 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2251 {"",S_FALSE,FALSE},
2252 {".mp3",S_OK,FALSE},
2253 {"",S_FALSE,FALSE},
2254 {"",S_FALSE,FALSE},
2255 {"",S_FALSE,FALSE},
2256 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2257 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2258 {"",S_FALSE,FALSE},
2259 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2260 {"file",S_OK,FALSE},
2261 {"",S_FALSE,FALSE},
2262 {"",S_FALSE,FALSE}
2263 },
2264 {
2265 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2266 {0,S_FALSE,FALSE},
2267 {URL_SCHEME_FILE,S_OK,FALSE},
2268 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2269 }
2270 },
2271 /* Forbidden characters are never encoded for unknown scheme types. */
2272 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2273 {
2274 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2275 {"4294967295",S_OK,FALSE},
2276 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2277 {"",S_FALSE,FALSE},
2278 {"",S_FALSE,FALSE},
2279 {"",S_FALSE,FALSE},
2280 {"4294967295",S_OK,FALSE},
2281 {"",S_FALSE,FALSE},
2282 {"/<|>\" test<|>",S_OK,FALSE},
2283 {"/<|>\" test<|>",S_OK,FALSE},
2284 {"",S_FALSE,FALSE},
2285 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2286 {"1234",S_OK,FALSE},
2287 {"",S_FALSE,FALSE},
2288 {"",S_FALSE,FALSE}
2289 },
2290 {
2291 {Uri_HOST_IPV4,S_OK,FALSE},
2292 {0,S_FALSE,FALSE},
2293 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2294 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2295 }
2296 },
2297 /* Make sure forbidden characters are percent encoded. */
2298 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2299 {
2300 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2301 {"gov.uk",S_OK,FALSE},
2302 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2303 {"",S_FALSE,FALSE},
2304 {"",S_FALSE,FALSE},
2305 {"",S_FALSE,FALSE},
2306 {"gov.uk",S_OK,FALSE},
2307 {"",S_FALSE,FALSE},
2308 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2309 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2310 {"",S_FALSE,FALSE},
2311 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2312 {"http",S_OK,FALSE},
2313 {"",S_FALSE,FALSE},
2314 {"",S_FALSE,FALSE}
2315 },
2316 {
2317 {Uri_HOST_DNS,S_OK,FALSE},
2318 {80,S_OK,FALSE},
2319 {URL_SCHEME_HTTP,S_OK,FALSE},
2320 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2321 }
2322 },
2323 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2324 {
2325 {"http://gov.uk/",S_OK,FALSE},
2326 {"gov.uk",S_OK,FALSE},
2327 {"http://gov.uk/",S_OK,FALSE},
2328 {"",S_FALSE,FALSE},
2329 {"",S_FALSE,FALSE},
2330 {"",S_FALSE,FALSE},
2331 {"gov.uk",S_OK,FALSE},
2332 {"",S_FALSE,FALSE},
2333 {"/",S_OK,FALSE},
2334 {"/",S_OK,FALSE},
2335 {"",S_FALSE,FALSE},
2336 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2337 {"http",S_OK,FALSE},
2338 {"",S_FALSE,FALSE},
2339 {"",S_FALSE,FALSE}
2340 },
2341 {
2342 {Uri_HOST_DNS,S_OK,FALSE},
2343 {80,S_OK,FALSE},
2344 {URL_SCHEME_HTTP,S_OK,FALSE},
2345 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2346 }
2347 },
2348 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2349 {
2350 {"http://gov.uk/",S_OK,FALSE},
2351 {"gov.uk",S_OK,FALSE},
2352 {"http://gov.uk/",S_OK,FALSE},
2353 {"",S_FALSE,FALSE},
2354 {"",S_FALSE,FALSE},
2355 {"",S_FALSE,FALSE},
2356 {"gov.uk",S_OK,FALSE},
2357 {"",S_FALSE,FALSE},
2358 {"/",S_OK,FALSE},
2359 {"/",S_OK,FALSE},
2360 {"",S_FALSE,FALSE},
2361 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2362 {"http",S_OK,FALSE},
2363 {"",S_FALSE,FALSE},
2364 {"",S_FALSE,FALSE}
2365 },
2366 {
2367 {Uri_HOST_DNS,S_OK,FALSE},
2368 {80,S_OK,FALSE},
2369 {URL_SCHEME_HTTP,S_OK,FALSE},
2370 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2371 }
2372 },
2373 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2374 {
2375 {"http://gov.uk/",S_OK,FALSE},
2376 {"gov.uk",S_OK,FALSE},
2377 {"http://gov.uk/",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"",S_FALSE,FALSE},
2380 {"",S_FALSE,FALSE},
2381 {"gov.uk",S_OK,FALSE},
2382 {"",S_FALSE,FALSE},
2383 {"/",S_OK,FALSE},
2384 {"/",S_OK,FALSE},
2385 {"",S_FALSE,FALSE},
2386 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2387 {"http",S_OK,FALSE},
2388 {"",S_FALSE,FALSE},
2389 {"",S_FALSE,FALSE}
2390 },
2391 {
2392 {Uri_HOST_DNS,S_OK,FALSE},
2393 {80,S_OK,FALSE},
2394 {URL_SCHEME_HTTP,S_OK,FALSE},
2395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2396 }
2397 },
2398 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2399 {
2400 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2401 {"",S_FALSE,FALSE},
2402 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2403 {"",S_FALSE,FALSE},
2404 {".mp3",S_OK,FALSE},
2405 {"",S_FALSE,FALSE},
2406 {"",S_FALSE,FALSE},
2407 {"",S_FALSE,FALSE},
2408 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2409 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2410 {"",S_FALSE,FALSE},
2411 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2412 {"file",S_OK,FALSE},
2413 {"",S_FALSE,FALSE},
2414 {"",S_FALSE,FALSE}
2415 },
2416 {
2417 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2418 {0,S_FALSE,FALSE},
2419 {URL_SCHEME_FILE,S_OK,FALSE},
2420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2421 }
2422 },
2423 /* Dot removal happens for unknown scheme types. */
2424 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2425 {
2426 {"zip://gov.uk/",S_OK,FALSE},
2427 {"gov.uk",S_OK,FALSE},
2428 {"zip://gov.uk/",S_OK,FALSE},
2429 {"",S_FALSE,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"",S_FALSE,FALSE},
2432 {"gov.uk",S_OK,FALSE},
2433 {"",S_FALSE,FALSE},
2434 {"/",S_OK,FALSE},
2435 {"/",S_OK,FALSE},
2436 {"",S_FALSE,FALSE},
2437 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2438 {"zip",S_OK,FALSE},
2439 {"",S_FALSE,FALSE},
2440 {"",S_FALSE,FALSE}
2441 },
2442 {
2443 {Uri_HOST_DNS,S_OK,FALSE},
2444 {0,S_FALSE,FALSE},
2445 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2446 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2447 }
2448 },
2449 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2450 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2451 {
2452 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2453 {"gov.uk",S_OK,FALSE},
2454 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {".",S_OK,FALSE},
2457 {"",S_FALSE,FALSE},
2458 {"gov.uk",S_OK,FALSE},
2459 {"",S_FALSE,FALSE},
2460 {"/test/test2/../../.",S_OK,FALSE},
2461 {"/test/test2/../../.",S_OK,FALSE},
2462 {"",S_FALSE,FALSE},
2463 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2464 {"http",S_OK,FALSE},
2465 {"",S_FALSE,FALSE},
2466 {"",S_FALSE,FALSE}
2467 },
2468 {
2469 {Uri_HOST_DNS,S_OK,FALSE},
2470 {80,S_OK,FALSE},
2471 {URL_SCHEME_HTTP,S_OK,FALSE},
2472 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2473 }
2474 },
2475 /* Dot removal doesn't happen for wildcard scheme types. */
2476 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2477 {
2478 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2479 {"gov.uk",S_OK,FALSE},
2480 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {".",S_OK,FALSE},
2483 {"",S_FALSE,FALSE},
2484 {"gov.uk",S_OK,FALSE},
2485 {"",S_FALSE,FALSE},
2486 {"/test/test2/../../.",S_OK,FALSE},
2487 {"/test/test2/../../.",S_OK,FALSE},
2488 {"",S_FALSE,FALSE},
2489 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2490 {"*",S_OK,FALSE},
2491 {"",S_FALSE,FALSE},
2492 {"",S_FALSE,FALSE}
2493 },
2494 {
2495 {Uri_HOST_DNS,S_OK,FALSE},
2496 {0,S_FALSE,FALSE},
2497 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2498 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2499 }
2500 },
2501 /* Forbidden characters are encoded for opaque known scheme types. */
2502 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2503 {
2504 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2505 {"",S_FALSE,FALSE},
2506 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {".com%22",S_OK,FALSE},
2509 {"",S_FALSE,FALSE},
2510 {"",S_FALSE,FALSE},
2511 {"",S_FALSE,FALSE},
2512 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2513 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2514 {"",S_FALSE,FALSE},
2515 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2516 {"mailto",S_OK,FALSE},
2517 {"",S_FALSE,FALSE},
2518 {"",S_FALSE,FALSE}
2519 },
2520 {
2521 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2522 {0,S_FALSE,FALSE},
2523 {URL_SCHEME_MAILTO,S_OK,FALSE},
2524 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2525 }
2526 },
2527 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2528 {
2529 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2532 {"",S_FALSE,FALSE},
2533 {".com",S_OK,FALSE},
2534 {"",S_FALSE,FALSE},
2535 {"",S_FALSE,FALSE},
2536 {"",S_FALSE,FALSE},
2537 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2538 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2539 {"",S_FALSE,FALSE},
2540 {"news:test.tes<|>t.com",S_OK,FALSE},
2541 {"news",S_OK,FALSE},
2542 {"",S_FALSE,FALSE},
2543 {"",S_FALSE,FALSE}
2544 },
2545 {
2546 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2547 {0,S_FALSE,FALSE},
2548 {URL_SCHEME_NEWS,S_OK,FALSE},
2549 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2550 }
2551 },
2552 /* Don't encode forbidden characters. */
2553 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2554 {
2555 {"news:test.tes<|>t.com",S_OK,FALSE},
2556 {"",S_FALSE,FALSE},
2557 {"news:test.tes<|>t.com",S_OK,FALSE},
2558 {"",S_FALSE,FALSE},
2559 {".com",S_OK,FALSE},
2560 {"",S_FALSE,FALSE},
2561 {"",S_FALSE,FALSE},
2562 {"",S_FALSE,FALSE},
2563 {"test.tes<|>t.com",S_OK,FALSE},
2564 {"test.tes<|>t.com",S_OK,FALSE},
2565 {"",S_FALSE,FALSE},
2566 {"news:test.tes<|>t.com",S_OK,FALSE},
2567 {"news",S_OK,FALSE},
2568 {"",S_FALSE,FALSE},
2569 {"",S_FALSE,FALSE}
2570 },
2571 {
2572 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2573 {0,S_FALSE,FALSE},
2574 {URL_SCHEME_NEWS,S_OK,FALSE},
2575 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2576 }
2577 },
2578 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2579 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2580 {
2581 {"urn:test.tes<|>t.com",S_OK,FALSE},
2582 {"",S_FALSE,FALSE},
2583 {"urn:test.tes<|>t.com",S_OK,FALSE},
2584 {"",S_FALSE,FALSE},
2585 {".com",S_OK,FALSE},
2586 {"",S_FALSE,FALSE},
2587 {"",S_FALSE,FALSE},
2588 {"",S_FALSE,FALSE},
2589 {"test.tes<|>t.com",S_OK,FALSE},
2590 {"test.tes<|>t.com",S_OK,FALSE},
2591 {"",S_FALSE,FALSE},
2592 {"urn:test.tes<|>t.com",S_OK,FALSE},
2593 {"urn",S_OK,FALSE},
2594 {"",S_FALSE,FALSE},
2595 {"",S_FALSE,FALSE}
2596 },
2597 {
2598 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2599 {0,S_FALSE,FALSE},
2600 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2601 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2602 }
2603 },
2604 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2605 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2606 {
2607 {"news:test.test.com",S_OK,FALSE},
2608 {"",S_FALSE,FALSE},
2609 {"news:test.test.com",S_OK,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {".com",S_OK,FALSE},
2612 {"",S_FALSE,FALSE},
2613 {"",S_FALSE,FALSE},
2614 {"",S_FALSE,FALSE},
2615 {"test.test.com",S_OK,FALSE},
2616 {"test.test.com",S_OK,FALSE},
2617 {"",S_FALSE,FALSE},
2618 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2619 {"news",S_OK,FALSE},
2620 {"",S_FALSE,FALSE},
2621 {"",S_FALSE,FALSE}
2622 },
2623 {
2624 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2625 {0,S_FALSE,FALSE},
2626 {URL_SCHEME_NEWS,S_OK,FALSE},
2627 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2628 }
2629 },
2630 /* Percent encoded characters are still decoded for known scheme types. */
2631 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2632 {
2633 {"news:test.test.com",S_OK,FALSE},
2634 {"",S_FALSE,FALSE},
2635 {"news:test.test.com",S_OK,FALSE},
2636 {"",S_FALSE,FALSE},
2637 {".com",S_OK,FALSE},
2638 {"",S_FALSE,FALSE},
2639 {"",S_FALSE,FALSE},
2640 {"",S_FALSE,FALSE},
2641 {"test.test.com",S_OK,FALSE},
2642 {"test.test.com",S_OK,FALSE},
2643 {"",S_FALSE,FALSE},
2644 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2645 {"news",S_OK,FALSE},
2646 {"",S_FALSE,FALSE},
2647 {"",S_FALSE,FALSE}
2648 },
2649 {
2650 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2651 {0,S_FALSE,FALSE},
2652 {URL_SCHEME_NEWS,S_OK,FALSE},
2653 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2654 }
2655 },
2656 /* Percent encoded characters aren't decoded for unknown scheme types. */
2657 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2658 {
2659 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2660 {"",S_FALSE,FALSE},
2661 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2662 {"",S_FALSE,FALSE},
2663 {".com",S_OK,FALSE},
2664 {"",S_FALSE,FALSE},
2665 {"",S_FALSE,FALSE},
2666 {"",S_FALSE,FALSE},
2667 {"test.%74%65%73%74.com",S_OK,FALSE},
2668 {"test.%74%65%73%74.com",S_OK,FALSE},
2669 {"",S_FALSE,FALSE},
2670 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2671 {"urn",S_OK,FALSE},
2672 {"",S_FALSE,FALSE},
2673 {"",S_FALSE,FALSE}
2674 },
2675 {
2676 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2677 {0,S_FALSE,FALSE},
2678 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2679 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2680 }
2681 },
2682 /* Unknown scheme types can have invalid % encoded data in query string. */
2683 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2684 {
2685 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2686 {"www.winehq.org",S_OK,FALSE},
2687 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2688 {"winehq.org",S_OK,FALSE},
2689 {"",S_FALSE,FALSE},
2690 {"",S_FALSE,FALSE},
2691 {"www.winehq.org",S_OK,FALSE},
2692 {"",S_FALSE,FALSE},
2693 {"/",S_OK,FALSE},
2694 {"/?query=%xx&return=y",S_OK,FALSE},
2695 {"?query=%xx&return=y",S_OK,FALSE},
2696 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2697 {"zip",S_OK,FALSE},
2698 {"",S_FALSE,FALSE},
2699 {"",S_FALSE,FALSE}
2700 },
2701 {
2702 {Uri_HOST_DNS,S_OK,FALSE},
2703 {0,S_FALSE,FALSE},
2704 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2705 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2706 }
2707 },
2708 /* Known scheme types can have invalid % encoded data with the right flags. */
2709 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2710 {
2711 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2712 {"www.winehq.org",S_OK,FALSE},
2713 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2714 {"winehq.org",S_OK,FALSE},
2715 {"",S_FALSE,FALSE},
2716 {"",S_FALSE,FALSE},
2717 {"www.winehq.org",S_OK,FALSE},
2718 {"",S_FALSE,FALSE},
2719 {"/",S_OK,FALSE},
2720 {"/?query=%xx&return=y",S_OK,FALSE},
2721 {"?query=%xx&return=y",S_OK,FALSE},
2722 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2723 {"http",S_OK,FALSE},
2724 {"",S_FALSE,FALSE},
2725 {"",S_FALSE,FALSE}
2726 },
2727 {
2728 {Uri_HOST_DNS,S_OK,FALSE},
2729 {80,S_OK,FALSE},
2730 {URL_SCHEME_HTTP,S_OK,FALSE},
2731 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2732 }
2733 },
2734 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2735 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2736 {
2737 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2738 {"www.winehq.org",S_OK,FALSE},
2739 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2740 {"winehq.org",S_OK,FALSE},
2741 {"",S_FALSE,FALSE},
2742 {"",S_FALSE,FALSE},
2743 {"www.winehq.org",S_OK,FALSE},
2744 {"",S_FALSE,FALSE},
2745 {"/",S_OK,FALSE},
2746 {"/?query=<|>&return=y",S_OK,FALSE},
2747 {"?query=<|>&return=y",S_OK,FALSE},
2748 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2749 {"http",S_OK,FALSE},
2750 {"",S_FALSE,FALSE},
2751 {"",S_FALSE,FALSE}
2752 },
2753 {
2754 {Uri_HOST_DNS,S_OK,FALSE},
2755 {80,S_OK,FALSE},
2756 {URL_SCHEME_HTTP,S_OK,FALSE},
2757 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2758 }
2759 },
2760 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2761 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2762 {
2763 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2764 {"www.winehq.org",S_OK,FALSE},
2765 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2766 {"winehq.org",S_OK,FALSE},
2767 {"",S_FALSE,FALSE},
2768 {"",S_FALSE,FALSE},
2769 {"www.winehq.org",S_OK,FALSE},
2770 {"",S_FALSE,FALSE},
2771 {"/",S_OK,FALSE},
2772 {"/?query=<|>&return=y",S_OK,FALSE},
2773 {"?query=<|>&return=y",S_OK,FALSE},
2774 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2775 {"http",S_OK,FALSE},
2776 {"",S_FALSE,FALSE},
2777 {"",S_FALSE,FALSE}
2778 },
2779 {
2780 {Uri_HOST_DNS,S_OK,FALSE},
2781 {80,S_OK,FALSE},
2782 {URL_SCHEME_HTTP,S_OK,FALSE},
2783 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2784 }
2785 },
2786 /* Forbidden characters are encoded for known scheme types. */
2787 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2788 {
2789 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2790 {"www.winehq.org",S_OK,FALSE},
2791 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2792 {"winehq.org",S_OK,FALSE},
2793 {"",S_FALSE,FALSE},
2794 {"",S_FALSE,FALSE},
2795 {"www.winehq.org",S_OK,FALSE},
2796 {"",S_FALSE,FALSE},
2797 {"/",S_OK,FALSE},
2798 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2799 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2800 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2801 {"http",S_OK,FALSE},
2802 {"",S_FALSE,FALSE},
2803 {"",S_FALSE,FALSE}
2804 },
2805 {
2806 {Uri_HOST_DNS,S_OK,FALSE},
2807 {80,S_OK,FALSE},
2808 {URL_SCHEME_HTTP,S_OK,FALSE},
2809 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2810 }
2811 },
2812 /* Forbidden characters are not encoded for unknown scheme types. */
2813 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2814 {
2815 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2816 {"www.winehq.org",S_OK,FALSE},
2817 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2818 {"winehq.org",S_OK,FALSE},
2819 {"",S_FALSE,FALSE},
2820 {"",S_FALSE,FALSE},
2821 {"www.winehq.org",S_OK,FALSE},
2822 {"",S_FALSE,FALSE},
2823 {"/",S_OK,FALSE},
2824 {"/?query=<|>&return=y",S_OK,FALSE},
2825 {"?query=<|>&return=y",S_OK,FALSE},
2826 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2827 {"zip",S_OK,FALSE},
2828 {"",S_FALSE,FALSE},
2829 {"",S_FALSE,FALSE}
2830 },
2831 {
2832 {Uri_HOST_DNS,S_OK,FALSE},
2833 {0,S_FALSE,FALSE},
2834 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2835 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2836 }
2837 },
2838 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2839 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2840 {
2841 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2842 {"www.winehq.org",S_OK,FALSE},
2843 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2844 {"winehq.org",S_OK,FALSE},
2845 {"",S_FALSE,FALSE},
2846 {"",S_FALSE,FALSE},
2847 {"www.winehq.org",S_OK,FALSE},
2848 {"",S_FALSE,FALSE},
2849 {"/",S_OK,FALSE},
2850 {"/?query=01&return=y",S_OK,FALSE},
2851 {"?query=01&return=y",S_OK,FALSE},
2852 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2853 {"http",S_OK,FALSE},
2854 {"",S_FALSE,FALSE},
2855 {"",S_FALSE,FALSE}
2856 },
2857 {
2858 {Uri_HOST_DNS,S_OK,FALSE},
2859 {80,S_OK,FALSE},
2860 {URL_SCHEME_HTTP,S_OK,FALSE},
2861 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2862 }
2863 },
2864 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2865 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2866 {
2867 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2868 {"www.winehq.org",S_OK,FALSE},
2869 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2870 {"winehq.org",S_OK,FALSE},
2871 {"",S_FALSE,FALSE},
2872 {"",S_FALSE,FALSE},
2873 {"www.winehq.org",S_OK,FALSE},
2874 {"",S_FALSE,FALSE},
2875 {"/",S_OK,FALSE},
2876 {"/?query=%30%31&return=y",S_OK,FALSE},
2877 {"?query=%30%31&return=y",S_OK,FALSE},
2878 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2879 {"zip",S_OK,FALSE},
2880 {"",S_FALSE,FALSE},
2881 {"",S_FALSE,FALSE}
2882 },
2883 {
2884 {Uri_HOST_DNS,S_OK,FALSE},
2885 {0,S_FALSE,FALSE},
2886 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2887 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2888 }
2889 },
2890 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2891 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2892 {
2893 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2894 {"www.winehq.org",S_OK,FALSE},
2895 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2896 {"winehq.org",S_OK,FALSE},
2897 {"",S_FALSE,FALSE},
2898 {"",S_FALSE,FALSE},
2899 {"www.winehq.org",S_OK,FALSE},
2900 {"",S_FALSE,FALSE},
2901 {"/",S_OK,FALSE},
2902 {"/?query=%30%31&return=y",S_OK,FALSE},
2903 {"?query=%30%31&return=y",S_OK,FALSE},
2904 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2905 {"http",S_OK,FALSE},
2906 {"",S_FALSE,FALSE},
2907 {"",S_FALSE,FALSE}
2908 },
2909 {
2910 {Uri_HOST_DNS,S_OK,FALSE},
2911 {80,S_OK,FALSE},
2912 {URL_SCHEME_HTTP,S_OK,FALSE},
2913 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2914 }
2915 },
2916 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2917 {
2918 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2919 {"www.winehq.org",S_OK,FALSE},
2920 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2921 {"winehq.org",S_OK,FALSE},
2922 {"",S_FALSE,FALSE},
2923 {"",S_FALSE,FALSE},
2924 {"www.winehq.org",S_OK,FALSE},
2925 {"",S_FALSE,FALSE},
2926 {"",S_FALSE,FALSE},
2927 {"?query=12&return=y",S_OK,FALSE},
2928 {"?query=12&return=y",S_OK,FALSE},
2929 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2930 {"http",S_OK,FALSE},
2931 {"",S_FALSE,FALSE},
2932 {"",S_FALSE,FALSE}
2933 },
2934 {
2935 {Uri_HOST_DNS,S_OK,FALSE},
2936 {80,S_OK,FALSE},
2937 {URL_SCHEME_HTTP,S_OK,FALSE},
2938 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2939 }
2940 },
2941 /* Unknown scheme types can have invalid % encoded data in fragments. */
2942 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2943 {
2944 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2945 {"www.winehq.org",S_OK,FALSE},
2946 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2947 {"winehq.org",S_OK,FALSE},
2948 {"",S_FALSE,FALSE},
2949 {"#Te%xx",S_OK,FALSE},
2950 {"www.winehq.org",S_OK,FALSE},
2951 {"",S_FALSE,FALSE},
2952 {"/tests/",S_OK,FALSE},
2953 {"/tests/",S_OK,FALSE},
2954 {"",S_FALSE,FALSE},
2955 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2956 {"zip",S_OK,FALSE},
2957 {"",S_FALSE,FALSE},
2958 {"",S_FALSE,FALSE}
2959 },
2960 {
2961 {Uri_HOST_DNS,S_OK,FALSE},
2962 {0,S_FALSE,FALSE},
2963 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2964 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2965 }
2966 },
2967 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2968 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2969 {
2970 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2971 {"www.winehq.org",S_OK,FALSE},
2972 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2973 {"winehq.org",S_OK,FALSE},
2974 {"",S_FALSE,FALSE},
2975 {"#Te<|>",S_OK,FALSE},
2976 {"www.winehq.org",S_OK,FALSE},
2977 {"",S_FALSE,FALSE},
2978 {"/tests/",S_OK,FALSE},
2979 {"/tests/",S_OK,FALSE},
2980 {"",S_FALSE,FALSE},
2981 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2982 {"zip",S_OK,FALSE},
2983 {"",S_FALSE,FALSE},
2984 {"",S_FALSE,FALSE}
2985 },
2986 {
2987 {Uri_HOST_DNS,S_OK,FALSE},
2988 {0,S_FALSE,FALSE},
2989 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2990 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2991 }
2992 },
2993 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2994 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2995 {
2996 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2997 {"www.winehq.org",S_OK,FALSE},
2998 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2999 {"winehq.org",S_OK,FALSE},
3000 {"",S_FALSE,FALSE},
3001 {"#Te%3C%7C%3E",S_OK,FALSE},
3002 {"www.winehq.org",S_OK,FALSE},
3003 {"",S_FALSE,FALSE},
3004 {"/tests/",S_OK,FALSE},
3005 {"/tests/",S_OK,FALSE},
3006 {"",S_FALSE,FALSE},
3007 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3008 {"http",S_OK,FALSE},
3009 {"",S_FALSE,FALSE},
3010 {"",S_FALSE,FALSE}
3011 },
3012 {
3013 {Uri_HOST_DNS,S_OK,FALSE},
3014 {80,S_OK,FALSE},
3015 {URL_SCHEME_HTTP,S_OK,FALSE},
3016 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3017 }
3018 },
3019 /* Forbidden characters aren't encoded in the fragment with this flag. */
3020 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3021 {
3022 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3023 {"www.winehq.org",S_OK,FALSE},
3024 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3025 {"winehq.org",S_OK,FALSE},
3026 {"",S_FALSE,FALSE},
3027 {"#Te<|>",S_OK,FALSE},
3028 {"www.winehq.org",S_OK,FALSE},
3029 {"",S_FALSE,FALSE},
3030 {"/tests/",S_OK,FALSE},
3031 {"/tests/",S_OK,FALSE},
3032 {"",S_FALSE,FALSE},
3033 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3034 {"http",S_OK,FALSE},
3035 {"",S_FALSE,FALSE},
3036 {"",S_FALSE,FALSE}
3037 },
3038 {
3039 {Uri_HOST_DNS,S_OK,FALSE},
3040 {80,S_OK,FALSE},
3041 {URL_SCHEME_HTTP,S_OK,FALSE},
3042 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3043 }
3044 },
3045 /* Forbidden characters aren't encoded in the fragment with this flag. */
3046 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3047 {
3048 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3049 {"www.winehq.org",S_OK,FALSE},
3050 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3051 {"winehq.org",S_OK,FALSE},
3052 {"",S_FALSE,FALSE},
3053 {"#Te<|>",S_OK,FALSE},
3054 {"www.winehq.org",S_OK,FALSE},
3055 {"",S_FALSE,FALSE},
3056 {"/tests/",S_OK,FALSE},
3057 {"/tests/",S_OK,FALSE},
3058 {"",S_FALSE,FALSE},
3059 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3060 {"http",S_OK,FALSE},
3061 {"",S_FALSE,FALSE},
3062 {"",S_FALSE,FALSE}
3063 },
3064 {
3065 {Uri_HOST_DNS,S_OK,FALSE},
3066 {80,S_OK,FALSE},
3067 {URL_SCHEME_HTTP,S_OK,FALSE},
3068 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3069 }
3070 },
3071 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3072 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3073 {
3074 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3075 {"www.winehq.org",S_OK,FALSE},
3076 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3077 {"winehq.org",S_OK,FALSE},
3078 {"",S_FALSE,FALSE},
3079 {"#Te%30%31%32",S_OK,FALSE},
3080 {"www.winehq.org",S_OK,FALSE},
3081 {"",S_FALSE,FALSE},
3082 {"/tests/",S_OK,FALSE},
3083 {"/tests/",S_OK,FALSE},
3084 {"",S_FALSE,FALSE},
3085 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3086 {"zip",S_OK,FALSE},
3087 {"",S_FALSE,FALSE},
3088 {"",S_FALSE,FALSE}
3089 },
3090 {
3091 {Uri_HOST_DNS,S_OK,FALSE},
3092 {0,S_FALSE,FALSE},
3093 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3094 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3095 }
3096 },
3097 /* Percent encoded, unreserved characters are decoded for known schemes. */
3098 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3099 {
3100 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3101 {"www.winehq.org",S_OK,FALSE},
3102 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3103 {"winehq.org",S_OK,FALSE},
3104 {"",S_FALSE,FALSE},
3105 {"#Te012",S_OK,FALSE},
3106 {"www.winehq.org",S_OK,FALSE},
3107 {"",S_FALSE,FALSE},
3108 {"/tests/",S_OK,FALSE},
3109 {"/tests/",S_OK,FALSE},
3110 {"",S_FALSE,FALSE},
3111 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3112 {"http",S_OK,FALSE},
3113 {"",S_FALSE,FALSE},
3114 {"",S_FALSE,FALSE}
3115 },
3116 {
3117 {Uri_HOST_DNS,S_OK,FALSE},
3118 {80,S_OK,FALSE},
3119 {URL_SCHEME_HTTP,S_OK,FALSE},
3120 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3121 }
3122 },
3123 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3124 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3125 {
3126 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3127 {"www.winehq.org",S_OK,FALSE},
3128 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3129 {"winehq.org",S_OK,FALSE},
3130 {"",S_FALSE,FALSE},
3131 {"#Te012",S_OK,FALSE},
3132 {"www.winehq.org",S_OK,FALSE},
3133 {"",S_FALSE,FALSE},
3134 {"/tests/",S_OK,FALSE},
3135 {"/tests/",S_OK,FALSE},
3136 {"",S_FALSE,FALSE},
3137 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3138 {"http",S_OK,FALSE},
3139 {"",S_FALSE,FALSE},
3140 {"",S_FALSE,FALSE}
3141 },
3142 {
3143 {Uri_HOST_DNS,S_OK,FALSE},
3144 {80,S_OK,FALSE},
3145 {URL_SCHEME_HTTP,S_OK,FALSE},
3146 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3147 }
3148 },
3149 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3150 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3151 {
3152 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3153 {"www.winehq.org",S_OK,FALSE},
3154 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3155 {"winehq.org",S_OK,FALSE},
3156 {"",S_FALSE,FALSE},
3157 {"#Te%30%31%32",S_OK,FALSE},
3158 {"www.winehq.org",S_OK,FALSE},
3159 {"",S_FALSE,FALSE},
3160 {"/tests/",S_OK,FALSE},
3161 {"/tests/",S_OK,FALSE},
3162 {"",S_FALSE,FALSE},
3163 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3164 {"http",S_OK,FALSE},
3165 {"",S_FALSE,FALSE},
3166 {"",S_FALSE,FALSE}
3167 },
3168 {
3169 {Uri_HOST_DNS,S_OK,FALSE},
3170 {80,S_OK,FALSE},
3171 {URL_SCHEME_HTTP,S_OK,FALSE},
3172 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3173 }
3174 },
3175 /* Leading/Trailing whitespace is removed. */
3176 { " http://google.com/ ", 0, S_OK, FALSE,
3177 {
3178 {"http://google.com/",S_OK,FALSE},
3179 {"google.com",S_OK,FALSE},
3180 {"http://google.com/",S_OK,FALSE},
3181 {"google.com",S_OK,FALSE},
3182 {"",S_FALSE,FALSE},
3183 {"",S_FALSE,FALSE},
3184 {"google.com",S_OK,FALSE},
3185 {"",S_FALSE,FALSE},
3186 {"/",S_OK,FALSE},
3187 {"/",S_OK,FALSE},
3188 {"",S_FALSE,FALSE},
3189 {"http://google.com/",S_OK,FALSE},
3190 {"http",S_OK,FALSE},
3191 {"",S_FALSE,FALSE},
3192 {"",S_FALSE,FALSE}
3193 },
3194 {
3195 {Uri_HOST_DNS,S_OK,FALSE},
3196 {80,S_OK,FALSE},
3197 {URL_SCHEME_HTTP,S_OK,FALSE},
3198 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3199 }
3200 },
3201 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3202 {
3203 {"http://google.com/",S_OK,FALSE},
3204 {"google.com",S_OK,FALSE},
3205 {"http://google.com/",S_OK,FALSE},
3206 {"google.com",S_OK,FALSE},
3207 {"",S_FALSE,FALSE},
3208 {"",S_FALSE,FALSE},
3209 {"google.com",S_OK,FALSE},
3210 {"",S_FALSE,FALSE},
3211 {"/",S_OK,FALSE},
3212 {"/",S_OK,FALSE},
3213 {"",S_FALSE,FALSE},
3214 {"http://google.com/",S_OK,FALSE},
3215 {"http",S_OK,FALSE},
3216 {"",S_FALSE,FALSE},
3217 {"",S_FALSE,FALSE}
3218 },
3219 {
3220 {Uri_HOST_DNS,S_OK,FALSE},
3221 {80,S_OK,FALSE},
3222 {URL_SCHEME_HTTP,S_OK,FALSE},
3223 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3224 }
3225 },
3226 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3227 {
3228 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3229 {"g%0aoogle.co%0dm",S_OK,FALSE},
3230 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3231 {"g%0aoogle.co%0dm",S_OK,FALSE},
3232 {"",S_FALSE,FALSE},
3233 {"",S_FALSE,FALSE},
3234 {"g%0aoogle.co%0dm",S_OK,FALSE},
3235 {"",S_FALSE,FALSE},
3236 {"/%0A%0A%0A",S_OK,FALSE},
3237 {"/%0A%0A%0A",S_OK,FALSE},
3238 {"",S_FALSE,FALSE},
3239 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3240 {"http",S_OK,FALSE},
3241 {"",S_FALSE,FALSE},
3242 {"",S_FALSE,FALSE}
3243 },
3244 {
3245 {Uri_HOST_DNS,S_OK,FALSE},
3246 {80,S_OK,FALSE},
3247 {URL_SCHEME_HTTP,S_OK,FALSE},
3248 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3249 }
3250 },
3251 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3252 {
3253 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3254 {"g\noogle.co\rm",S_OK,FALSE},
3255 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3256 {"g\noogle.co\rm",S_OK,FALSE},
3257 {"",S_FALSE,FALSE},
3258 {"",S_FALSE,FALSE},
3259 {"g\noogle.co\rm",S_OK,FALSE},
3260 {"",S_FALSE,FALSE},
3261 {"/\n\n\n",S_OK,FALSE},
3262 {"/\n\n\n",S_OK,FALSE},
3263 {"",S_FALSE,FALSE},
3264 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3265 {"zip",S_OK,FALSE},
3266 {"",S_FALSE,FALSE},
3267 {"",S_FALSE,FALSE}
3268 },
3269 {
3270 {Uri_HOST_DNS,S_OK,FALSE},
3271 {0,S_FALSE,FALSE},
3272 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3273 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3274 }
3275 },
3276 /* Since file URLs are usually hierarchical, it returns an empty string
3277 * for the absolute URI property since it was declared as an opaque URI.
3278 */
3279 { "file:index.html", 0, S_OK, FALSE,
3280 {
3281 {"",S_FALSE,FALSE},
3282 {"",S_FALSE,FALSE},
3283 {"file:index.html",S_OK,FALSE},
3284 {"",S_FALSE,FALSE},
3285 {".html",S_OK,FALSE},
3286 {"",S_FALSE,FALSE},
3287 {"",S_FALSE,FALSE},
3288 {"",S_FALSE,FALSE},
3289 {"index.html",S_OK,FALSE},
3290 {"index.html",S_OK,FALSE},
3291 {"",S_FALSE,FALSE},
3292 {"file:index.html",S_OK,FALSE},
3293 {"file",S_OK,FALSE},
3294 {"",S_FALSE,FALSE},
3295 {"",S_FALSE,FALSE}
3296 },
3297 {
3298 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3299 {0,S_FALSE,FALSE},
3300 {URL_SCHEME_FILE,S_OK,FALSE},
3301 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3302 }
3303 },
3304 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3305 { "http:test.com/index.html", 0, S_OK, FALSE,
3306 {
3307 {"",S_FALSE,FALSE},
3308 {"",S_FALSE,FALSE},
3309 {"http:test.com/index.html",S_OK,FALSE},
3310 {"",S_FALSE,FALSE},
3311 {".html",S_OK,FALSE},
3312 {"",S_FALSE,FALSE},
3313 {"",S_FALSE,FALSE},
3314 {"",S_FALSE,FALSE},
3315 {"test.com/index.html",S_OK,FALSE},
3316 {"test.com/index.html",S_OK,FALSE},
3317 {"",S_FALSE,FALSE},
3318 {"http:test.com/index.html",S_OK,FALSE},
3319 {"http",S_OK,FALSE},
3320 {"",S_FALSE,FALSE},
3321 {"",S_FALSE,FALSE}
3322 },
3323 {
3324 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3325 {80,S_OK,FALSE},
3326 {URL_SCHEME_HTTP,S_OK,FALSE},
3327 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3328 }
3329 },
3330 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3331 {
3332 {"",S_FALSE,FALSE},
3333 {"",S_FALSE,FALSE},
3334 {"ftp:test.com/index.html",S_OK,FALSE},
3335 {"",S_FALSE,FALSE},
3336 {".html",S_OK,FALSE},
3337 {"",S_FALSE,FALSE},
3338 {"",S_FALSE,FALSE},
3339 {"",S_FALSE,FALSE},
3340 {"test.com/index.html",S_OK,FALSE},
3341 {"test.com/index.html",S_OK,FALSE},
3342 {"",S_FALSE,FALSE},
3343 {"ftp:test.com/index.html",S_OK,FALSE},
3344 {"ftp",S_OK,FALSE},
3345 {"",S_FALSE,FALSE},
3346 {"",S_FALSE,FALSE}
3347 },
3348 {
3349 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3350 {21,S_OK,FALSE},
3351 {URL_SCHEME_FTP,S_OK,FALSE},
3352 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3353 }
3354 },
3355 { "file://C|/test.mp3", 0, S_OK, FALSE,
3356 {
3357 {"file:///C:/test.mp3",S_OK,FALSE},
3358 {"",S_FALSE,FALSE},
3359 {"file:///C:/test.mp3",S_OK,FALSE},
3360 {"",S_FALSE,FALSE},
3361 {".mp3",S_OK,FALSE},
3362 {"",S_FALSE,FALSE},
3363 {"",S_FALSE,FALSE},
3364 {"",S_FALSE,FALSE},
3365 {"/C:/test.mp3",S_OK,FALSE},
3366 {"/C:/test.mp3",S_OK,FALSE},
3367 {"",S_FALSE,FALSE},
3368 {"file://C|/test.mp3",S_OK,FALSE},
3369 {"file",S_OK,FALSE},
3370 {"",S_FALSE,FALSE},
3371 {"",S_FALSE,FALSE}
3372 },
3373 {
3374 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3375 {0,S_FALSE,FALSE},
3376 {URL_SCHEME_FILE,S_OK,FALSE},
3377 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3378 }
3379 },
3380 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3381 {
3382 {"file:///C:/test.mp3",S_OK,FALSE},
3383 {"",S_FALSE,FALSE},
3384 {"file:///C:/test.mp3",S_OK,FALSE},
3385 {"",S_FALSE,FALSE},
3386 {".mp3",S_OK,FALSE},
3387 {"",S_FALSE,FALSE},
3388 {"",S_FALSE,FALSE},
3389 {"",S_FALSE,FALSE},
3390 {"/C:/test.mp3",S_OK,FALSE},
3391 {"/C:/test.mp3",S_OK,FALSE},
3392 {"",S_FALSE,FALSE},
3393 {"file:///C|/test.mp3",S_OK,FALSE},
3394 {"file",S_OK,FALSE},
3395 {"",S_FALSE,FALSE},
3396 {"",S_FALSE,FALSE}
3397 },
3398 {
3399 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3400 {0,S_FALSE,FALSE},
3401 {URL_SCHEME_FILE,S_OK,FALSE},
3402 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3403 }
3404 },
3405 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3406 * to '\\'.
3407 */
3408 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3409 {
3410 {"file://c:\\dir\\index.html",S_OK,FALSE},
3411 {"",S_FALSE,FALSE},
3412 {"file://c:\\dir\\index.html",S_OK,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {".html",S_OK,FALSE},
3415 {"",S_FALSE,FALSE},
3416 {"",S_FALSE,FALSE},
3417 {"",S_FALSE,FALSE},
3418 {"c:\\dir\\index.html",S_OK,FALSE},
3419 {"c:\\dir\\index.html",S_OK,FALSE},
3420 {"",S_FALSE,FALSE},
3421 {"file://c:/dir/index.html",S_OK,FALSE},
3422 {"file",S_OK,FALSE},
3423 {"",S_FALSE,FALSE},
3424 {"",S_FALSE,FALSE}
3425 },
3426 {
3427 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3428 {0,S_FALSE,FALSE},
3429 {URL_SCHEME_FILE,S_OK,FALSE},
3430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3431 }
3432 },
3433 /* Extra '/' after "file://" is removed. */
3434 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3435 {
3436 {"file://c:\\dir\\index.html",S_OK,FALSE},
3437 {"",S_FALSE,FALSE},
3438 {"file://c:\\dir\\index.html",S_OK,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {".html",S_OK,FALSE},
3441 {"",S_FALSE,FALSE},
3442 {"",S_FALSE,FALSE},
3443 {"",S_FALSE,FALSE},
3444 {"c:\\dir\\index.html",S_OK,FALSE},
3445 {"c:\\dir\\index.html",S_OK,FALSE},
3446 {"",S_FALSE,FALSE},
3447 {"file:///c:/dir/index.html",S_OK,FALSE},
3448 {"file",S_OK,FALSE},
3449 {"",S_FALSE,FALSE},
3450 {"",S_FALSE,FALSE}
3451 },
3452 {
3453 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3454 {0,S_FALSE,FALSE},
3455 {URL_SCHEME_FILE,S_OK,FALSE},
3456 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3457 }
3458 },
3459 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3460 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3461 {
3462 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3463 {"",S_FALSE,FALSE},
3464 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3465 {"",S_FALSE,FALSE},
3466 {".html",S_OK,FALSE},
3467 {"",S_FALSE,FALSE},
3468 {"",S_FALSE,FALSE},
3469 {"",S_FALSE,FALSE},
3470 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3471 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3472 {"",S_FALSE,FALSE},
3473 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3474 {"file",S_OK,FALSE},
3475 {"",S_FALSE,FALSE},
3476 {"",S_FALSE,FALSE}
3477 },
3478 {
3479 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3480 {0,S_FALSE,FALSE},
3481 {URL_SCHEME_FILE,S_OK,FALSE},
3482 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3483 }
3484 },
3485 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3486 {
3487 {"file://c:\\dir\\index.html",S_OK,FALSE},
3488 {"",S_FALSE,FALSE},
3489 {"file://c:\\dir\\index.html",S_OK,FALSE},
3490 {"",S_FALSE,FALSE},
3491 {".html",S_OK,FALSE},
3492 {"",S_FALSE,FALSE},
3493 {"",S_FALSE,FALSE},
3494 {"",S_FALSE,FALSE},
3495 {"c:\\dir\\index.html",S_OK,FALSE},
3496 {"c:\\dir\\index.html",S_OK,FALSE},
3497 {"",S_FALSE,FALSE},
3498 {"file://c|/dir\\index.html",S_OK,FALSE},
3499 {"file",S_OK,FALSE},
3500 {"",S_FALSE,FALSE},
3501 {"",S_FALSE,FALSE}
3502 },
3503 {
3504 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3505 {0,S_FALSE,FALSE},
3506 {URL_SCHEME_FILE,S_OK,FALSE},
3507 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3508 }
3509 },
3510 /* The backslashes after the scheme name are converted to forward slashes. */
3511 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3512 {
3513 {"file://c:\\dir\\index.html",S_OK,FALSE},
3514 {"",S_FALSE,FALSE},
3515 {"file://c:\\dir\\index.html",S_OK,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {".html",S_OK,FALSE},
3518 {"",S_FALSE,FALSE},
3519 {"",S_FALSE,FALSE},
3520 {"",S_FALSE,FALSE},
3521 {"c:\\dir\\index.html",S_OK,FALSE},
3522 {"c:\\dir\\index.html",S_OK,FALSE},
3523 {"",S_FALSE,FALSE},
3524 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3525 {"file",S_OK,FALSE},
3526 {"",S_FALSE,FALSE},
3527 {"",S_FALSE,FALSE}
3528 },
3529 {
3530 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3531 {0,S_FALSE,FALSE},
3532 {URL_SCHEME_FILE,S_OK,FALSE},
3533 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3534 }
3535 },
3536 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3537 {
3538 {"file:///c:/dir/index.html",S_OK,FALSE},
3539 {"",S_FALSE,FALSE},
3540 {"file:///c:/dir/index.html",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {".html",S_OK,FALSE},
3543 {"",S_FALSE,FALSE},
3544 {"",S_FALSE,FALSE},
3545 {"",S_FALSE,FALSE},
3546 {"/c:/dir/index.html",S_OK,FALSE},
3547 {"/c:/dir/index.html",S_OK,FALSE},
3548 {"",S_FALSE,FALSE},
3549 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3550 {"file",S_OK,FALSE},
3551 {"",S_FALSE,FALSE},
3552 {"",S_FALSE,FALSE}
3553 },
3554 {
3555 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3556 {0,S_FALSE,FALSE},
3557 {URL_SCHEME_FILE,S_OK,FALSE},
3558 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3559 }
3560 },
3561 { "http:\\\\google.com", 0, S_OK, FALSE,
3562 {
3563 {"http://google.com/",S_OK,FALSE},
3564 {"google.com",S_OK,FALSE},
3565 {"http://google.com/",S_OK,FALSE},
3566 {"google.com",S_OK,FALSE},
3567 {"",S_FALSE,FALSE},
3568 {"",S_FALSE,FALSE},
3569 {"google.com",S_OK,FALSE},
3570 {"",S_FALSE,FALSE},
3571 {"/",S_OK,FALSE},
3572 {"/",S_OK,FALSE},
3573 {"",S_FALSE,FALSE},
3574 {"http:\\\\google.com",S_OK,FALSE},
3575 {"http",S_OK,FALSE},
3576 {"",S_FALSE,FALSE},
3577 {"",S_FALSE,FALSE}
3578 },
3579 {
3580 {Uri_HOST_DNS,S_OK,FALSE},
3581 {80,S_OK,FALSE},
3582 {URL_SCHEME_HTTP,S_OK,FALSE},
3583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3584 }
3585 },
3586 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3587 { "zip:\\\\google.com", 0, S_OK, FALSE,
3588 {
3589 {"zip:\\\\google.com",S_OK,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {"zip:\\\\google.com",S_OK,FALSE},
3592 {"",S_FALSE,FALSE},
3593 {".com",S_OK,FALSE},
3594 {"",S_FALSE,FALSE},
3595 {"",S_FALSE,FALSE},
3596 {"",S_FALSE,FALSE},
3597 {"\\\\google.com",S_OK,FALSE},
3598 {"\\\\google.com",S_OK,FALSE},
3599 {"",S_FALSE,FALSE},
3600 {"zip:\\\\google.com",S_OK,FALSE},
3601 {"zip",S_OK,FALSE},
3602 {"",S_FALSE,FALSE},
3603 {"",S_FALSE,FALSE}
3604 },
3605 {
3606 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3607 {0,S_FALSE,FALSE},
3608 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3609 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3610 }
3611 },
3612 /* Dot segments aren't removed. */
3613 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3614 {
3615 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3616 {"",S_FALSE,FALSE},
3617 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3618 {"",S_FALSE,FALSE},
3619 {".html",S_OK,FALSE},
3620 {"",S_FALSE,FALSE},
3621 {"",S_FALSE,FALSE},
3622 {"",S_FALSE,FALSE},
3623 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3624 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3625 {"",S_FALSE,FALSE},
3626 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3627 {"file",S_OK,FALSE},
3628 {"",S_FALSE,FALSE},
3629 {"",S_FALSE,FALSE}
3630 },
3631 {
3632 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3633 {0,S_FALSE,FALSE},
3634 {URL_SCHEME_FILE,S_OK,FALSE},
3635 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3636 }
3637 },
3638 /* Forbidden characters aren't percent encoded. */
3639 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3640 {
3641 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3642 {"",S_FALSE,FALSE},
3643 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3644 {"",S_FALSE,FALSE},
3645 {".html",S_OK,FALSE},
3646 {"",S_FALSE,FALSE},
3647 {"",S_FALSE,FALSE},
3648 {"",S_FALSE,FALSE},
3649 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3650 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3651 {"",S_FALSE,FALSE},
3652 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3653 {"file",S_OK,FALSE},
3654 {"",S_FALSE,FALSE},
3655 {"",S_FALSE,FALSE}
3656 },
3657 {
3658 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3659 {0,S_FALSE,FALSE},
3660 {URL_SCHEME_FILE,S_OK,FALSE},
3661 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3662 }
3663 },
3664 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3665 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3666 {
3667 {"",S_FALSE,FALSE},
3668 {"",S_FALSE,FALSE},
3669 {"file:c:/dir/../../index.html",S_OK,FALSE},
3670 {"",S_FALSE,FALSE},
3671 {".html",S_OK,FALSE},
3672 {"",S_FALSE,FALSE},
3673 {"",S_FALSE,FALSE},
3674 {"",S_FALSE,FALSE},
3675 {"c:/dir/../../index.html",S_OK,FALSE},
3676 {"c:/dir/../../index.html",S_OK,FALSE},
3677 {"",S_FALSE,FALSE},
3678 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3679 {"file",S_OK,FALSE},
3680 {"",S_FALSE,FALSE},
3681 {"",S_FALSE,FALSE}
3682 },
3683 {
3684 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3685 {0,S_FALSE,FALSE},
3686 {URL_SCHEME_FILE,S_OK,FALSE},
3687 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3688 }
3689 },
3690 /* '/' are still converted to '\' even though it's an opaque URI. */
3691 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3692 {
3693 {"",S_FALSE,FALSE},
3694 {"",S_FALSE,FALSE},
3695 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3696 {"",S_FALSE,FALSE},
3697 {".html",S_OK,FALSE},
3698 {"",S_FALSE,FALSE},
3699 {"",S_FALSE,FALSE},
3700 {"",S_FALSE,FALSE},
3701 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3702 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3703 {"",S_FALSE,FALSE},
3704 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3705 {"file",S_OK,FALSE},
3706 {"",S_FALSE,FALSE},
3707 {"",S_FALSE,FALSE}
3708 },
3709 {
3710 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3711 {0,S_FALSE,FALSE},
3712 {URL_SCHEME_FILE,S_OK,FALSE},
3713 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3714 }
3715 },
3716 /* Forbidden characters aren't percent encoded. */
3717 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3718 {
3719 {"",S_FALSE,FALSE},
3720 {"",S_FALSE,FALSE},
3721 {"file:c:\\in^|dex.html",S_OK,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {".html",S_OK,FALSE},
3724 {"",S_FALSE,FALSE},
3725 {"",S_FALSE,FALSE},
3726 {"",S_FALSE,FALSE},
3727 {"c:\\in^|dex.html",S_OK,FALSE},
3728 {"c:\\in^|dex.html",S_OK,FALSE},
3729 {"",S_FALSE,FALSE},
3730 {"file:c:\\in^|dex.html",S_OK,FALSE},
3731 {"file",S_OK,FALSE},
3732 {"",S_FALSE,FALSE},
3733 {"",S_FALSE,FALSE}
3734 },
3735 {
3736 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3737 {0,S_FALSE,FALSE},
3738 {URL_SCHEME_FILE,S_OK,FALSE},
3739 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3740 }
3741 },
3742 /* Doesn't have a UserName since the ':' appears at the beginning of the
3743 * userinfo section.
3744 */
3745 { "http://:password@gov.uk", 0, S_OK, FALSE,
3746 {
3747 {"http://:password@gov.uk/",S_OK,FALSE},
3748 {":password@gov.uk",S_OK,FALSE},
3749 {"http://gov.uk/",S_OK,FALSE},
3750 {"",S_FALSE,FALSE},
3751 {"",S_FALSE,FALSE},
3752 {"",S_FALSE,FALSE},
3753 {"gov.uk",S_OK,FALSE},
3754 {"password",S_OK,FALSE},
3755 {"/",S_OK,FALSE},
3756 {"/",S_OK,FALSE},
3757 {"",S_FALSE,FALSE},
3758 {"http://:password@gov.uk",S_OK,FALSE},
3759 {"http",S_OK,FALSE},
3760 {":password",S_OK,FALSE},
3761 {"",S_FALSE,FALSE}
3762 },
3763 {
3764 {Uri_HOST_DNS,S_OK,FALSE},
3765 {80,S_OK,FALSE},
3766 {URL_SCHEME_HTTP,S_OK,FALSE},
3767 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3768 }
3769 },
3770 /* Has a UserName since the userinfo section doesn't contain a password. */
3771 { "http://@gov.uk", 0, S_OK, FALSE,
3772 {
3773 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3774 {"@gov.uk",S_OK,FALSE},
3775 {"http://gov.uk/",S_OK,FALSE},
3776 {"",S_FALSE,FALSE},
3777 {"",S_FALSE,FALSE},
3778 {"",S_FALSE,FALSE},
3779 {"gov.uk",S_OK,FALSE},
3780 {"",S_FALSE,FALSE},
3781 {"/",S_OK,FALSE},
3782 {"/",S_OK,FALSE},
3783 {"",S_FALSE,FALSE},
3784 {"http://@gov.uk",S_OK,FALSE},
3785 {"http",S_OK,FALSE},
3786 {"",S_OK,FALSE},
3787 {"",S_OK,FALSE}
3788 },
3789 {
3790 {Uri_HOST_DNS,S_OK,FALSE},
3791 {80,S_OK,FALSE},
3792 {URL_SCHEME_HTTP,S_OK,FALSE},
3793 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3794 }
3795 },
3796 /* ":@" not included in the absolute URI. */
3797 { "http://:@gov.uk", 0, S_OK, FALSE,
3798 {
3799 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3800 {":@gov.uk",S_OK,FALSE},
3801 {"http://gov.uk/",S_OK,FALSE},
3802 {"",S_FALSE,FALSE},
3803 {"",S_FALSE,FALSE},
3804 {"",S_FALSE,FALSE},
3805 {"gov.uk",S_OK,FALSE},
3806 {"",S_OK,FALSE},
3807 {"/",S_OK,FALSE},
3808 {"/",S_OK,FALSE},
3809 {"",S_FALSE,FALSE},
3810 {"http://:@gov.uk",S_OK,FALSE},
3811 {"http",S_OK,FALSE},
3812 {":",S_OK,FALSE},
3813 {"",S_FALSE,FALSE}
3814 },
3815 {
3816 {Uri_HOST_DNS,S_OK,FALSE},
3817 {80,S_OK,FALSE},
3818 {URL_SCHEME_HTTP,S_OK,FALSE},
3819 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3820 }
3821 },
3822 /* '@' is included because it's an unknown scheme type. */
3823 { "zip://@gov.uk", 0, S_OK, FALSE,
3824 {
3825 {"zip://@gov.uk/",S_OK,FALSE},
3826 {"@gov.uk",S_OK,FALSE},
3827 {"zip://@gov.uk/",S_OK,FALSE},
3828 {"",S_FALSE,FALSE},
3829 {"",S_FALSE,FALSE},
3830 {"",S_FALSE,FALSE},
3831 {"gov.uk",S_OK,FALSE},
3832 {"",S_FALSE,FALSE},
3833 {"/",S_OK,FALSE},
3834 {"/",S_OK,FALSE},
3835 {"",S_FALSE,FALSE},
3836 {"zip://@gov.uk",S_OK,FALSE},
3837 {"zip",S_OK,FALSE},
3838 {"",S_OK,FALSE},
3839 {"",S_OK,FALSE}
3840 },
3841 {
3842 {Uri_HOST_DNS,S_OK,FALSE},
3843 {0,S_FALSE,FALSE},
3844 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3845 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3846 }
3847 },
3848 /* ":@" are included because it's an unknown scheme type. */
3849 { "zip://:@gov.uk", 0, S_OK, FALSE,
3850 {
3851 {"zip://:@gov.uk/",S_OK,FALSE},
3852 {":@gov.uk",S_OK,FALSE},
3853 {"zip://:@gov.uk/",S_OK,FALSE},
3854 {"",S_FALSE,FALSE},
3855 {"",S_FALSE,FALSE},
3856 {"",S_FALSE,FALSE},
3857 {"gov.uk",S_OK,FALSE},
3858 {"",S_OK,FALSE},
3859 {"/",S_OK,FALSE},
3860 {"/",S_OK,FALSE},
3861 {"",S_FALSE,FALSE},
3862 {"zip://:@gov.uk",S_OK,FALSE},
3863 {"zip",S_OK,FALSE},
3864 {":",S_OK,FALSE},
3865 {"",S_FALSE,FALSE}
3866 },
3867 {
3868 {Uri_HOST_DNS,S_OK,FALSE},
3869 {0,S_FALSE,FALSE},
3870 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3871 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3872 }
3873 },
3874 { "about:blank", 0, S_OK, FALSE,
3875 {
3876 {"about:blank",S_OK,FALSE},
3877 {"",S_FALSE,FALSE},
3878 {"about:blank",S_OK,FALSE},
3879 {"",S_FALSE,FALSE},
3880 {"",S_FALSE,FALSE},
3881 {"",S_FALSE,FALSE},
3882 {"",S_FALSE,FALSE},
3883 {"",S_FALSE,FALSE},
3884 {"blank",S_OK,FALSE},
3885 {"blank",S_OK,FALSE},
3886 {"",S_FALSE,FALSE},
3887 {"about:blank",S_OK,FALSE},
3888 {"about",S_OK,FALSE},
3889 {"",S_FALSE,FALSE},
3890 {"",S_FALSE,FALSE}
3891 },
3892 {
3893 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3894 {0,S_FALSE,FALSE},
3895 {URL_SCHEME_ABOUT,S_OK,FALSE},
3896 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3897 }
3898 },
3899 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3900 {
3901 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3902 {"",S_FALSE,FALSE},
3903 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3904 {"",S_FALSE,FALSE},
3905 {".htm",S_OK,FALSE},
3906 {"",S_FALSE,FALSE},
3907 {"",S_FALSE,FALSE},
3908 {"",S_FALSE,FALSE},
3909 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3910 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3911 {"",S_FALSE,FALSE},
3912 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3913 {"mk",S_OK,FALSE},
3914 {"",S_FALSE,FALSE},
3915 {"",S_FALSE,FALSE}
3916 },
3917 {
3918 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3919 {0,S_FALSE,FALSE},
3920 {URL_SCHEME_MK,S_OK,FALSE},
3921 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3922 }
3923 },
3924 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3925 {
3926 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3927 {"",S_FALSE,FALSE},
3928 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {".htm",S_OK,FALSE},
3931 {"",S_FALSE,FALSE},
3932 {"",S_FALSE,FALSE},
3933 {"",S_FALSE,FALSE},
3934 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3935 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3936 {"",S_FALSE,FALSE},
3937 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3938 {"mk",S_OK,FALSE},
3939 {"",S_FALSE,FALSE},
3940 {"",S_FALSE,FALSE}
3941 },
3942 {
3943 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3944 {0,S_FALSE,FALSE},
3945 {URL_SCHEME_MK,S_OK,FALSE},
3946 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3947 }
3948 },
3949 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3950 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3951 {
3952 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3953 {"server",S_OK,FALSE},
3954 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {".html",S_OK,FALSE},
3957 {"",S_FALSE,FALSE},
3958 {"server",S_OK,FALSE},
3959 {"",S_FALSE,FALSE},
3960 {"\\dir\\index.html",S_OK,FALSE},
3961 {"\\dir\\index.html",S_OK,FALSE},
3962 {"",S_FALSE,FALSE},
3963 {"file://server/dir/index.html",S_OK,FALSE},
3964 {"file",S_OK,FALSE},
3965 {"",S_FALSE,FALSE},
3966 {"",S_FALSE,FALSE}
3967 },
3968 {
3969 {Uri_HOST_DNS,S_OK,FALSE},
3970 {0,S_FALSE,FALSE},
3971 {URL_SCHEME_FILE,S_OK,FALSE},
3972 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3973 }
3974 },
3975 /* When CreateUri generates an IUri, it still displays the default port in the
3976 * authority.
3977 */
3978 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3979 {
3980 {"http://google.com:80/",S_OK,FALSE},
3981 {"google.com:80",S_OK,FALSE},
3982 {"http://google.com:80/",S_OK,FALSE},
3983 {"google.com",S_OK,FALSE},
3984 {"",S_FALSE,FALSE},
3985 {"",S_FALSE,FALSE},
3986 {"google.com",S_OK,FALSE},
3987 {"",S_FALSE,FALSE},
3988 {"/",S_OK,FALSE},
3989 {"/",S_OK,FALSE},
3990 {"",S_FALSE,FALSE},
3991 {"http://google.com:80/",S_OK,FALSE},
3992 {"http",S_OK,FALSE},
3993 {"",S_FALSE,FALSE},
3994 {"",S_FALSE,FALSE}
3995 },
3996 {
3997 {Uri_HOST_DNS,S_OK,FALSE},
3998 {80,S_OK,FALSE},
3999 {URL_SCHEME_HTTP,S_OK,FALSE},
4000 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4001 }
4002 },
4003 /* For res URIs the host is everything up until the first '/'. */
4004 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
4005 {
4006 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4007 {"C:\\dir\\file.exe",S_OK,FALSE},
4008 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4009 {"",S_FALSE,FALSE},
4010 {".html",S_OK,FALSE},
4011 {"",S_FALSE,FALSE},
4012 {"C:\\dir\\file.exe",S_OK,FALSE},
4013 {"",S_FALSE,FALSE},
4014 {"/DATA/test.html",S_OK,FALSE},
4015 {"/DATA/test.html",S_OK,FALSE},
4016 {"",S_FALSE,FALSE},
4017 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4018 {"res",S_OK,FALSE},
4019 {"",S_FALSE,FALSE},
4020 {"",S_FALSE,FALSE}
4021 },
4022 {
4023 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4024 {0,S_FALSE,FALSE},
4025 {URL_SCHEME_RES,S_OK,FALSE},
4026 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4027 }
4028 },
4029 /* Res URI can contain a '|' in the host name. */
4030 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4031 {
4032 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4033 {"c:\\di|r\\file.exe",S_OK,FALSE},
4034 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4035 {"",S_FALSE,FALSE},
4036 {"",S_FALSE,FALSE},
4037 {"",S_FALSE,FALSE},
4038 {"c:\\di|r\\file.exe",S_OK,FALSE},
4039 {"",S_FALSE,FALSE},
4040 {"/test",S_OK,FALSE},
4041 {"/test",S_OK,FALSE},
4042 {"",S_FALSE,FALSE},
4043 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4044 {"res",S_OK,FALSE},
4045 {"",S_FALSE,FALSE},
4046 {"",S_FALSE,FALSE}
4047 },
4048 {
4049 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4050 {0,S_FALSE,FALSE},
4051 {URL_SCHEME_RES,S_OK,FALSE},
4052 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4053 }
4054 },
4055 /* Res URIs can have invalid percent encoded values. */
4056 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4057 {
4058 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4059 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4060 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4061 {"",S_FALSE,FALSE},
4062 {"",S_FALSE,FALSE},
4063 {"",S_FALSE,FALSE},
4064 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4065 {"",S_FALSE,FALSE},
4066 {"/test",S_OK,FALSE},
4067 {"/test",S_OK,FALSE},
4068 {"",S_FALSE,FALSE},
4069 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4070 {"res",S_OK,FALSE},
4071 {"",S_FALSE,FALSE},
4072 {"",S_FALSE,FALSE}
4073 },
4074 {
4075 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4076 {0,S_FALSE,FALSE},
4077 {URL_SCHEME_RES,S_OK,FALSE},
4078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4079 }
4080 },
4081 /* Res doesn't get forbidden characters percent encoded in it's path. */
4082 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4083 {
4084 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4085 {"c:\\test",S_OK,FALSE},
4086 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4087 {"",S_FALSE,FALSE},
4088 {"",S_FALSE,FALSE},
4089 {"",S_FALSE,FALSE},
4090 {"c:\\test",S_OK,FALSE},
4091 {"",S_FALSE,FALSE},
4092 {"/tes<|>t",S_OK,FALSE},
4093 {"/tes<|>t",S_OK,FALSE},
4094 {"",S_FALSE,FALSE},
4095 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4096 {"res",S_OK,FALSE},
4097 {"",S_FALSE,FALSE},
4098 {"",S_FALSE,FALSE}
4099 },
4100 {
4101 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4102 {0,S_FALSE,FALSE},
4103 {URL_SCHEME_RES,S_OK,FALSE},
4104 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4105 }
4106 },
4107 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4108 {
4109 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4110 {"",S_FALSE,FALSE},
4111 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4112 {"",S_FALSE,FALSE},
4113 {".jpg",S_OK,FALSE},
4114 {"",S_FALSE,FALSE},
4115 {"",S_FALSE,FALSE},
4116 {"",S_FALSE,FALSE},
4117 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4118 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4119 {"",S_FALSE,FALSE},
4120 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4121 {"mk",S_OK,FALSE},
4122 {"",S_FALSE,FALSE},
4123 {"",S_FALSE,FALSE}
4124 },
4125 {
4126 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4127 {0,S_FALSE,FALSE},
4128 {URL_SCHEME_MK,S_OK,FALSE},
4129 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4130 }
4131 },
4132 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4133 {
4134 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4135 {"",S_FALSE,FALSE},
4136 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4137 {"",S_FALSE,FALSE},
4138 {".jpg",S_OK,FALSE},
4139 {"",S_FALSE,FALSE},
4140 {"",S_FALSE,FALSE},
4141 {"",S_FALSE,FALSE},
4142 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4143 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4144 {"",S_FALSE,FALSE},
4145 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4146 {"mk",S_OK,FALSE},
4147 {"",S_FALSE,FALSE},
4148 {"",S_FALSE,FALSE}
4149 },
4150 {
4151 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4152 {0,S_FALSE,FALSE},
4153 {URL_SCHEME_MK,S_OK,FALSE},
4154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4155 }
4156 },
4157 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4158 {
4159 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4160 {"",S_FALSE,FALSE},
4161 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {".jpg",S_OK,FALSE},
4164 {"",S_FALSE,FALSE},
4165 {"",S_FALSE,FALSE},
4166 {"",S_FALSE,FALSE},
4167 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4168 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4169 {"",S_FALSE,FALSE},
4170 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4171 {"xx",S_OK,FALSE},
4172 {"",S_FALSE,FALSE},
4173 {"",S_FALSE,FALSE}
4174 },
4175 {
4176 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4177 {0,S_FALSE,FALSE},
4178 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4179 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4180 }
4181 },
4182 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4183 {
4184 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4185 {"",S_FALSE,FALSE},
4186 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4187 {"",S_FALSE,FALSE},
4188 {".jpg",S_OK,FALSE},
4189 {"",S_FALSE,FALSE},
4190 {"",S_FALSE,FALSE},
4191 {"",S_FALSE,FALSE},
4192 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4193 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4194 {"",S_FALSE,FALSE},
4195 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4196 {"mk",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_MK,S_OK,FALSE},
4204 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4205 }
4206 },
4207 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4208 {
4209 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4210 {"",S_FALSE,FALSE},
4211 {"mk:@MSITStore:Z:\\dir\\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\\images/xxx.jpg",S_OK,FALSE},
4218 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4219 {"",S_FALSE,FALSE},
4220 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\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", 0, S_OK, FALSE,
4233 {
4234 {"mk:images/xxx.jpg",S_OK,FALSE},
4235 {"",S_FALSE,FALSE},
4236 {"mk: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 {"images/xxx.jpg",S_OK,FALSE},
4243 {"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 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4258 {
4259 {"",S_OK,FALSE},
4260 {"",S_FALSE,FALSE},
4261 {"",S_OK,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {"",S_FALSE,FALSE},
4264 {"",S_FALSE,FALSE},
4265 {"",S_FALSE,FALSE},
4266 {"",S_FALSE,FALSE},
4267 {"",S_OK,FALSE},
4268 {"",S_OK,FALSE},
4269 {"",S_FALSE,FALSE},
4270 {"",S_OK,FALSE},
4271 {"",S_FALSE,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 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4283 {
4284 {"",S_OK,FALSE},
4285 {"",S_FALSE,FALSE},
4286 {"",S_OK,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {"",S_FALSE,FALSE},
4289 {"",S_FALSE,FALSE},
4290 {"",S_FALSE,FALSE},
4291 {"",S_FALSE,FALSE},
4292 {"",S_OK,FALSE},
4293 {"",S_OK,FALSE},
4294 {"",S_FALSE,FALSE},
4295 {"",S_OK,FALSE},
4296 {"",S_FALSE,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_UNKNOWN,S_OK,FALSE},
4304 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4305 }
4306 },
4307 { "javascript:void", 0, S_OK, FALSE,
4308 {
4309 {"javascript:void",S_OK},
4310 {"",S_FALSE},
4311 {"javascript:void",S_OK},
4312 {"",S_FALSE},
4313 {"",S_FALSE},
4314 {"",S_FALSE},
4315 {"",S_FALSE},
4316 {"",S_FALSE},
4317 {"void",S_OK},
4318 {"void",S_OK},
4319 {"",S_FALSE},
4320 {"javascript:void",S_OK},
4321 {"javascript",S_OK},
4322 {"",S_FALSE},
4323 {"",S_FALSE}
4324 },
4325 {
4326 {Uri_HOST_UNKNOWN,S_OK},
4327 {0,S_FALSE},
4328 {URL_SCHEME_JAVASCRIPT,S_OK},
4329 {URLZONE_INVALID,E_NOTIMPL}
4330 }
4331 },
4332 { "javascript://undefined", 0, S_OK, FALSE,
4333 {
4334 {"javascript://undefined",S_OK},
4335 {"",S_FALSE},
4336 {"javascript://undefined",S_OK},
4337 {"",S_FALSE},
4338 {"",S_FALSE},
4339 {"",S_FALSE},
4340 {"",S_FALSE},
4341 {"",S_FALSE},
4342 {"//undefined",S_OK},
4343 {"//undefined",S_OK},
4344 {"",S_FALSE},
4345 {"javascript://undefined",S_OK},
4346 {"javascript",S_OK},
4347 {"",S_FALSE},
4348 {"",S_FALSE}
4349 },
4350 {
4351 {Uri_HOST_UNKNOWN,S_OK},
4352 {0,S_FALSE},
4353 {URL_SCHEME_JAVASCRIPT,S_OK},
4354 {URLZONE_INVALID,E_NOTIMPL}
4355 }
4356 },
4357 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4358 {
4359 {"javascript:escape('/\\?#?')",S_OK},
4360 {"",S_FALSE},
4361 {"javascript:escape('/\\?#?')",S_OK},
4362 {"",S_FALSE},
4363 {"",S_FALSE},
4364 {"",S_FALSE},
4365 {"",S_FALSE},
4366 {"",S_FALSE},
4367 {"escape('/\\?#?')",S_OK},
4368 {"escape('/\\?#?')",S_OK},
4369 {"",S_FALSE},
4370 {"JavaSCript:escape('/\\?#?')",S_OK},
4371 {"javascript",S_OK},
4372 {"",S_FALSE},
4373 {"",S_FALSE}
4374 },
4375 {
4376 {Uri_HOST_UNKNOWN,S_OK},
4377 {0,S_FALSE},
4378 {URL_SCHEME_JAVASCRIPT,S_OK},
4379 {URLZONE_INVALID,E_NOTIMPL}
4380 }
4381 },
4382 { "*://google.com", 0, S_OK, FALSE,
4383 {
4384 {"*:google.com/",S_OK,FALSE},
4385 {"google.com",S_OK},
4386 {"*:google.com/",S_OK,FALSE},
4387 {"google.com",S_OK,FALSE},
4388 {"",S_FALSE,FALSE},
4389 {"",S_FALSE,FALSE},
4390 {"google.com",S_OK,FALSE},
4391 {"",S_FALSE,FALSE},
4392 {"/",S_OK,FALSE},
4393 {"/",S_OK,FALSE},
4394 {"",S_FALSE,FALSE},
4395 {"*://google.com",S_OK,FALSE},
4396 {"*",S_OK,FALSE},
4397 {"",S_FALSE,FALSE},
4398 {"",S_FALSE,FALSE}
4399 },
4400 {
4401 {Uri_HOST_DNS,S_OK,FALSE},
4402 {0,S_FALSE,FALSE},
4403 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4404 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4405 }
4406 },
4407 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4408 {
4409 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4410 {"",S_FALSE},
4411 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4412 {"",S_FALSE},
4413 {".txt",S_OK},
4414 {"",S_FALSE},
4415 {"",S_FALSE},
4416 {"",S_FALSE},
4417 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4418 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4419 {"",S_FALSE},
4420 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4421 {"mk",S_OK},
4422 {"",S_FALSE},
4423 {"",S_FALSE}
4424 },
4425 {
4426 {Uri_HOST_UNKNOWN,S_OK},
4427 {0,S_FALSE},
4428 {URL_SCHEME_MK,S_OK},
4429 {URLZONE_INVALID,E_NOTIMPL}
4430 }
4431 },
4432 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4433 {
4434 {"gopher://test.winehq.org:151/file.txt",S_OK},
4435 {"test.winehq.org:151",S_OK},
4436 {"gopher://test.winehq.org:151/file.txt",S_OK},
4437 {"winehq.org",S_OK},
4438 {".txt",S_OK},
4439 {"",S_FALSE},
4440 {"test.winehq.org",S_OK},
4441 {"",S_FALSE},
4442 {"/file.txt",S_OK},
4443 {"/file.txt",S_OK},
4444 {"",S_FALSE},
4445 {"gopher://test.winehq.org:151/file.txt",S_OK},
4446 {"gopher",S_OK},
4447 {"",S_FALSE},
4448 {"",S_FALSE}
4449 },
4450 {
4451 {Uri_HOST_DNS,S_OK},
4452 {151,S_OK},
4453 {URL_SCHEME_GOPHER,S_OK},
4454 {URLZONE_INVALID,E_NOTIMPL}
4455 }
4456 },
4457 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4458 {
4459 {"//host.com/path/file.txt?query",S_OK},
4460 {"host.com",S_OK},
4461 {"//host.com/path/file.txt?query",S_OK},
4462 {"host.com",S_OK},
4463 {".txt",S_OK},
4464 {"",S_FALSE},
4465 {"host.com",S_OK},
4466 {"",S_FALSE},
4467 {"/path/file.txt",S_OK},
4468 {"/path/file.txt?query",S_OK},
4469 {"?query",S_OK},
4470 {"//host.com/path/file.txt?query",S_OK},
4471 {"",S_FALSE},
4472 {"",S_FALSE},
4473 {"",S_FALSE},
4474 },
4475 {
4476 {Uri_HOST_DNS,S_OK},
4477 {0,S_FALSE},
4478 {URL_SCHEME_UNKNOWN,S_OK},
4479 {URLZONE_INVALID,E_NOTIMPL}
4480 }
4481 },
4482 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4483 {
4484 {"//host/path/file.txt?query",S_OK},
4485 {"host",S_OK},
4486 {"//host/path/file.txt?query",S_OK},
4487 {"",S_FALSE},
4488 {".txt",S_OK},
4489 {"",S_FALSE},
4490 {"host",S_OK},
4491 {"",S_FALSE},
4492 {"/path/file.txt",S_OK},
4493 {"/path/file.txt?query",S_OK},
4494 {"?query",S_OK},
4495 {"//host/path/file.txt?query",S_OK},
4496 {"",S_FALSE},
4497 {"",S_FALSE},
4498 {"",S_FALSE},
4499 },
4500 {
4501 {Uri_HOST_DNS,S_OK},
4502 {0,S_FALSE},
4503 {URL_SCHEME_UNKNOWN,S_OK},
4504 {URLZONE_INVALID,E_NOTIMPL}
4505 }
4506 },
4507 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4508 {
4509 {"//host/",S_OK},
4510 {"host",S_OK},
4511 {"//host/",S_OK},
4512 {"",S_FALSE},
4513 {"",S_FALSE},
4514 {"",S_FALSE},
4515 {"host",S_OK},
4516 {"",S_FALSE},
4517 {"/",S_OK},
4518 {"/",S_OK},
4519 {"",S_FALSE},
4520 {"//host",S_OK},
4521 {"",S_FALSE},
4522 {"",S_FALSE},
4523 {"",S_FALSE},
4524 },
4525 {
4526 {Uri_HOST_DNS,S_OK},
4527 {0,S_FALSE},
4528 {URL_SCHEME_UNKNOWN,S_OK},
4529 {URLZONE_INVALID,E_NOTIMPL}
4530 }
4531 },
4532 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4533 {
4534 {"mailto:",S_OK},
4535 {"",S_FALSE},
4536 {"mailto:",S_OK},
4537 {"",S_FALSE},
4538 {"",S_FALSE},
4539 {"",S_FALSE},
4540 {"",S_FALSE},
4541 {"",S_FALSE},
4542 {"",S_FALSE},
4543 {"",S_FALSE},
4544 {"",S_FALSE},
4545 {"mailto://",S_OK,FALSE,"mailto:"},
4546 {"mailto",S_OK},
4547 {"",S_FALSE},
4548 {"",S_FALSE}
4549 },
4550 {
4551 {Uri_HOST_UNKNOWN,S_OK},
4552 {0,S_FALSE},
4553 {URL_SCHEME_MAILTO,S_OK},
4554 {URLZONE_INVALID,E_NOTIMPL}
4555 }
4556 },
4557 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4558 {
4559 {"mailto:a@b.com",S_OK},
4560 {"",S_FALSE},
4561 {"mailto:a@b.com",S_OK},
4562 {"",S_FALSE},
4563 {".com",S_OK},
4564 {"",S_FALSE},
4565 {"",S_FALSE},
4566 {"",S_FALSE},
4567 {"a@b.com",S_OK},
4568 {"a@b.com",S_OK},
4569 {"",S_FALSE},
4570 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4571 {"mailto",S_OK},
4572 {"",S_FALSE},
4573 {"",S_FALSE}
4574 },
4575 {
4576 {Uri_HOST_UNKNOWN,S_OK},
4577 {0,S_FALSE},
4578 {URL_SCHEME_MAILTO,S_OK},
4579 {URLZONE_INVALID,E_NOTIMPL}
4580 }
4581 }
4582 };
4583
4584 typedef struct _invalid_uri {
4585 const char* uri;
4586 DWORD flags;
4587 BOOL todo;
4588 } invalid_uri;
4589
4590 static const invalid_uri invalid_uri_tests[] = {
4591 /* Has to have a scheme name. */
4592 {"://www.winehq.org",0,FALSE},
4593 /* Window's doesn't like URI's which are implicitly file paths without the
4594 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4595 */
4596 {"C:/test/test.mp3",0,FALSE},
4597 {"\\\\Server/test/test.mp3",0,FALSE},
4598 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4599 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4600 /* Invalid schemes. */
4601 {"*abcd://not.valid.com",0,FALSE},
4602 {"*a*b*c*d://not.valid.com",0,FALSE},
4603 /* Not allowed to have invalid % encoded data. */
4604 {"ftp://google.co%XX/",0,FALSE},
4605 /* To many h16 components. */
4606 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4607 /* Not enough room for IPv4 address. */
4608 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4609 /* Not enough h16 components. */
4610 {"http://[1:2:3:4]",0,FALSE},
4611 /* Not enough components including IPv4. */
4612 {"http://[1:192.0.1.0]",0,FALSE},
4613 /* Not allowed to have partial IPv4 in IPv6. */
4614 {"http://[::192.0]",0,FALSE},
4615 /* Can't have elision of 1 h16 at beginning of address. */
4616 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4617 /* Can't have elision of 1 h16 at end of address. */
4618 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4619 /* Expects a valid IP Literal. */
4620 {"ftp://[not.valid.uri]/",0,FALSE},
4621 /* Expects valid port for a known scheme type. */
4622 {"ftp://www.winehq.org:123fgh",0,FALSE},
4623 /* Port exceeds USHORT_MAX for known scheme type. */
4624 {"ftp://www.winehq.org:65536",0,FALSE},
4625 /* Invalid port with IPv4 address. */
4626 {"http://www.winehq.org:1abcd",0,FALSE},
4627 /* Invalid port with IPv6 address. */
4628 {"http://[::ffff]:32xy",0,FALSE},
4629 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4630 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4631 /* Not allowed to have invalid % encoded data in opaque URI path. */
4632 {"news:test%XX",0,FALSE},
4633 {"mailto:wine@winehq%G8.com",0,FALSE},
4634 /* Known scheme types can't have invalid % encoded data in query string. */
4635 {"http://google.com/?query=te%xx",0,FALSE},
4636 /* Invalid % encoded data in fragment of know scheme type. */
4637 {"ftp://google.com/#Test%xx",0,FALSE},
4638 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4639 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4640 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4641 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4642 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4643 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4644 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4645 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4646 /* res URIs aren't allowed to have forbidden dos path characters in the
4647 * hostname.
4648 */
4649 {"res://c:\\te<st\\test/test",0,FALSE},
4650 {"res://c:\\te>st\\test/test",0,FALSE},
4651 {"res://c:\\te\"st\\test/test",0,FALSE},
4652 {"res://c:\\test/te%xxst",0,FALSE}
4653 };
4654
4655 typedef struct _uri_equality {
4656 const char* a;
4657 DWORD create_flags_a;
4658 const char* b;
4659 DWORD create_flags_b;
4660 BOOL equal;
4661 BOOL todo;
4662 } uri_equality;
4663
4664 static const uri_equality equality_tests[] = {
4665 {
4666 "HTTP://www.winehq.org/test dir/./",0,
4667 "http://www.winehq.org/test dir/../test dir/",0,
4668 TRUE
4669 },
4670 {
4671 /* http://www.winehq.org/test%20dir */
4672 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4673 "http://www.winehq.org/test dir",0,
4674 TRUE
4675 },
4676 {
4677 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4678 "file:///c:/test.mp3",0,
4679 TRUE
4680 },
4681 {
4682 "ftp://ftp.winehq.org/",0,
4683 "ftp://ftp.winehq.org",0,
4684 TRUE
4685 },
4686 {
4687 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4688 "ftp://ftp.winehq.org/t%45stB/",0,
4689 FALSE
4690 },
4691 {
4692 "http://google.com/TEST",0,
4693 "http://google.com/test",0,
4694 FALSE
4695 },
4696 {
4697 "http://GOOGLE.com/",0,
4698 "http://google.com/",0,
4699 TRUE
4700 },
4701 /* Performs case insensitive compare of host names (for known scheme types). */
4702 {
4703 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4704 "ftp://google.com/",0,
4705 TRUE
4706 },
4707 {
4708 "zip://GOOGLE.com/",0,
4709 "zip://google.com/",0,
4710 FALSE
4711 },
4712 {
4713 "file:///c:/TEST/TeST/",0,
4714 "file:///c:/test/test/",0,
4715 TRUE
4716 },
4717 {
4718 "file:///server/TEST",0,
4719 "file:///SERVER/TEST",0,
4720 TRUE
4721 },
4722 {
4723 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4724 "http://google.com/",0,
4725 TRUE
4726 },
4727 {
4728 "ftp://google.com:21/",0,
4729 "ftp://google.com/",0,
4730 TRUE
4731 },
4732 {
4733 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4734 "http://google.com/",0,
4735 TRUE
4736 },
4737 {
4738 "http://google.com:70/",0,
4739 "http://google.com:71/",0,
4740 FALSE
4741 },
4742 {
4743 "file:///c:/dir/file.txt", 0,
4744 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4745 TRUE
4746 },
4747 {
4748 "file:///c:/dir/file.txt", 0,
4749 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4750 TRUE
4751 },
4752 {
4753 "file:///c:/dir/file.txt", 0,
4754 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4755 TRUE
4756 },
4757 {
4758 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4759 "file:///c:/%20dir/file.txt", 0,
4760 TRUE
4761 },
4762 {
4763 "file:///c:/Dir/file.txt", 0,
4764 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4765 TRUE
4766 },
4767 {
4768 "file:///c:/dir/file.txt", 0,
4769 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4770 TRUE
4771 },
4772 {
4773 "file:///c:/dir/file.txt#a", 0,
4774 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4775 FALSE
4776 },
4777 /* Tests of an empty hash/fragment part */
4778 {
4779 "http://google.com/test",0,
4780 "http://google.com/test#",0,
4781 FALSE
4782 },
4783 {
4784 "ftp://ftp.winehq.org/",0,
4785 "ftp://ftp.winehq.org/#",0,
4786 FALSE
4787 },
4788 {
4789 "file:///c:/dir/file.txt#", 0,
4790 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4791 FALSE
4792 }
4793 };
4794
4795 typedef struct _uri_with_fragment {
4796 const char* uri;
4797 const char* fragment;
4798 DWORD create_flags;
4799 HRESULT create_expected;
4800 BOOL create_todo;
4801
4802 const char* expected_uri;
4803 BOOL expected_todo;
4804 } uri_with_fragment;
4805
4806 static const uri_with_fragment uri_fragment_tests[] = {
4807 {
4808 "http://google.com/","#fragment",0,S_OK,FALSE,
4809 "http://google.com/#fragment",FALSE
4810 },
4811 {
4812 "http://google.com/","fragment",0,S_OK,FALSE,
4813 "http://google.com/#fragment",FALSE
4814 },
4815 {
4816 "zip://test.com/","?test",0,S_OK,FALSE,
4817 "zip://test.com/#?test",FALSE
4818 },
4819 /* The fragment can be empty. */
4820 {
4821 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4822 "ftp://ftp.google.com/#",FALSE
4823 }
4824 };
4825
4826 typedef struct _uri_builder_property {
4827 BOOL change;
4828 const char *value;
4829 const char *expected_value;
4830 Uri_PROPERTY property;
4831 HRESULT expected;
4832 BOOL todo;
4833 } uri_builder_property;
4834
4835 typedef struct _uri_builder_port {
4836 BOOL change;
4837 BOOL set;
4838 DWORD value;
4839 HRESULT expected;
4840 BOOL todo;
4841 } uri_builder_port;
4842
4843 typedef struct _uri_builder_str_property {
4844 const char* expected;
4845 HRESULT result;
4846 BOOL todo;
4847 } uri_builder_str_property;
4848
4849 typedef struct _uri_builder_dword_property {
4850 DWORD expected;
4851 HRESULT result;
4852 BOOL todo;
4853 } uri_builder_dword_property;
4854
4855 typedef struct _uri_builder_test {
4856 const char *uri;
4857 DWORD create_flags;
4858 HRESULT create_builder_expected;
4859 BOOL create_builder_todo;
4860
4861 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4862
4863 uri_builder_port port_prop;
4864
4865 DWORD uri_flags;
4866 HRESULT uri_hres;
4867 BOOL uri_todo;
4868
4869 DWORD uri_simple_encode_flags;
4870 HRESULT uri_simple_hres;
4871 BOOL uri_simple_todo;
4872
4873 DWORD uri_with_flags;
4874 DWORD uri_with_builder_flags;
4875 DWORD uri_with_encode_flags;
4876 HRESULT uri_with_hres;
4877 BOOL uri_with_todo;
4878
4879 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4880 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4881 } uri_builder_test;
4882
4883 static const uri_builder_test uri_builder_tests[] = {
4884 { "http://google.com/",0,S_OK,FALSE,
4885 {
4886 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4887 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4888 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4889 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4890 },
4891 {FALSE},
4892 0,S_OK,FALSE,
4893 0,S_OK,FALSE,
4894 0,0,0,S_OK,FALSE,
4895 {
4896 {"http://username:password@google.com/?query=x#fragment",S_OK},
4897 {"username:password@google.com",S_OK},
4898 {"http://google.com/?query=x#fragment",S_OK},
4899 {"google.com",S_OK},
4900 {"",S_FALSE},
4901 {"#fragment",S_OK},
4902 {"google.com",S_OK},
4903 {"password",S_OK},
4904 {"/",S_OK},
4905 {"/?query=x",S_OK},
4906 {"?query=x",S_OK},
4907 {"http://username:password@google.com/?query=x#fragment",S_OK},
4908 {"http",S_OK},
4909 {"username:password",S_OK},
4910 {"username",S_OK}
4911 },
4912 {
4913 {Uri_HOST_DNS,S_OK},
4914 {80,S_OK},
4915 {URL_SCHEME_HTTP,S_OK},
4916 {URLZONE_INVALID,E_NOTIMPL}
4917 }
4918 },
4919 { "http://google.com/",0,S_OK,FALSE,
4920 {
4921 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4922 },
4923 {TRUE,TRUE,120,S_OK,FALSE},
4924 0,S_OK,FALSE,
4925 0,S_OK,FALSE,
4926 0,0,0,S_OK,FALSE,
4927 {
4928 {"test://google.com:120/",S_OK},
4929 {"google.com:120",S_OK},
4930 {"test://google.com:120/",S_OK},
4931 {"google.com",S_OK},
4932 {"",S_FALSE},
4933 {"",S_FALSE},
4934 {"google.com",S_OK},
4935 {"",S_FALSE},
4936 {"/",S_OK},
4937 {"/",S_OK},
4938 {"",S_FALSE},
4939 {"test://google.com:120/",S_OK},
4940 {"test",S_OK},
4941 {"",S_FALSE},
4942 {"",S_FALSE}
4943 },
4944 {
4945 {Uri_HOST_DNS,S_OK},
4946 {120,S_OK},
4947 {URL_SCHEME_UNKNOWN,S_OK},
4948 {URLZONE_INVALID,E_NOTIMPL}
4949 }
4950 },
4951 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4952 {
4953 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4954 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4955 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4956 },
4957 {FALSE},
4958 0,S_OK,FALSE,
4959 0,S_OK,FALSE,
4960 0,0,0,S_OK,FALSE,
4961 {
4962 {"http://[::192.2.3.4]/",S_OK},
4963 {"[::192.2.3.4]",S_OK},
4964 {"http://[::192.2.3.4]/",S_OK},
4965 {"",S_FALSE},
4966 {"",S_FALSE},
4967 {"",S_FALSE},
4968 {"::192.2.3.4",S_OK},
4969 {"",S_FALSE},
4970 {"/",S_OK},
4971 {"/",S_OK},
4972 {"",S_FALSE},
4973 {"http://[::192.2.3.4]/",S_OK},
4974 {"http",S_OK},
4975 {"",S_FALSE},
4976 {"",S_FALSE}
4977 },
4978 {
4979 {Uri_HOST_IPV6,S_OK},
4980 {80,S_OK},
4981 {URL_SCHEME_HTTP,S_OK},
4982 {URLZONE_INVALID,E_NOTIMPL}
4983 }
4984 },
4985 { "http://google.com/",0,S_OK,FALSE,
4986 {
4987 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4988 },
4989 {FALSE},
4990 0,S_OK,FALSE,
4991 0,S_OK,FALSE,
4992 0,0,0,S_OK,FALSE,
4993 {
4994 {"http://google.com/#Frag",S_OK},
4995 {"google.com",S_OK},
4996 {"http://google.com/#Frag",S_OK},
4997 {"google.com",S_OK},
4998 {"",S_FALSE},
4999 {"#Frag",S_OK},
5000 {"google.com",S_OK},
5001 {"",S_FALSE},
5002 {"/",S_OK},
5003 {"/",S_OK},
5004 {"",S_FALSE},
5005 {"http://google.com/#Frag",S_OK},
5006 {"http",S_OK},
5007 {"",S_FALSE},
5008 {"",S_FALSE}
5009 },
5010 {
5011 {Uri_HOST_DNS,S_OK},
5012 {80,S_OK},
5013 {URL_SCHEME_HTTP,S_OK},
5014 {URLZONE_INVALID,E_NOTIMPL}
5015 }
5016 },
5017 { "http://google.com/",0,S_OK,FALSE,
5018 {
5019 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5020 },
5021 {FALSE},
5022 0,S_OK,FALSE,
5023 0,S_OK,FALSE,
5024 0,0,0,S_OK,FALSE,
5025 {
5026 {"http://google.com/#",S_OK},
5027 {"google.com",S_OK},
5028 {"http://google.com/#",S_OK},
5029 {"google.com",S_OK},
5030 {"",S_FALSE},
5031 {"#",S_OK},
5032 {"google.com",S_OK},
5033 {"",S_FALSE},
5034 {"/",S_OK},
5035 {"/",S_OK},
5036 {"",S_FALSE},
5037 {"http://google.com/#",S_OK},
5038 {"http",S_OK},
5039 {"",S_FALSE},
5040 {"",S_FALSE}
5041 },
5042 {
5043 {Uri_HOST_DNS,S_OK},
5044 {80,S_OK},
5045 {URL_SCHEME_HTTP,S_OK},
5046 {URLZONE_INVALID,E_NOTIMPL}
5047 }
5048 },
5049 { "http://google.com/",0,S_OK,FALSE,
5050 {
5051 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5052 },
5053 {FALSE},
5054 0,S_OK,FALSE,
5055 0,S_OK,FALSE,
5056 0,0,0,S_OK,FALSE,
5057 {
5058 {"http://::password@google.com/",S_OK},
5059 {"::password@google.com",S_OK},
5060 {"http://google.com/",S_OK},
5061 {"google.com",S_OK},
5062 {"",S_FALSE},
5063 {"",S_FALSE},
5064 {"google.com",S_OK},
5065 {":password",S_OK},
5066 {"/",S_OK},
5067 {"/",S_OK},
5068 {"",S_FALSE},
5069 {"http://::password@google.com/",S_OK},
5070 {"http",S_OK},
5071 {"::password",S_OK},
5072 {"",S_FALSE}
5073 },
5074 {
5075 {Uri_HOST_DNS,S_OK},
5076 {80,S_OK},
5077 {URL_SCHEME_HTTP,S_OK},
5078 {URLZONE_INVALID,E_NOTIMPL}
5079 }
5080 },
5081 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5082 {
5083 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5084 },
5085 {FALSE},
5086 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5087 0,S_OK,FALSE,
5088 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5089 {
5090 {":password@test/test",S_OK},
5091 {":password@",S_OK},
5092 {":password@test/test",S_OK},
5093 {"",S_FALSE},
5094 {"",S_FALSE},
5095 {"",S_FALSE},
5096 {"",S_FALSE},
5097 {"password",S_OK},
5098 {"test/test",S_OK},
5099 {"test/test",S_OK},
5100 {"",S_FALSE},
5101 {":password@test/test",S_OK},
5102 {"",S_FALSE},
5103 {":password",S_OK},
5104 {"",S_FALSE}
5105 },
5106 {
5107 {Uri_HOST_UNKNOWN,S_OK},
5108 {0,S_FALSE},
5109 {URL_SCHEME_UNKNOWN,S_OK},
5110 {URLZONE_INVALID,E_NOTIMPL}
5111 }
5112 },
5113 { "http://google.com/",0,S_OK,FALSE,
5114 {
5115 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5116 },
5117 {FALSE},
5118 0,S_OK,FALSE,
5119 0,S_OK,FALSE,
5120 0,0,0,S_OK,FALSE,
5121 {
5122 {"http://google.com/test/test",S_OK},
5123 {"google.com",S_OK},
5124 {"http://google.com/test/test",S_OK},
5125 {"google.com",S_OK},
5126 {"",S_FALSE},
5127 {"",S_FALSE},
5128 {"google.com",S_OK},
5129 {"",S_FALSE},
5130 {"/test/test",S_OK},
5131 {"/test/test",S_OK},
5132 {"",S_FALSE},
5133 {"http://google.com/test/test",S_OK},
5134 {"http",S_OK},
5135 {"",S_FALSE},
5136 {"",S_FALSE}
5137 },
5138 {
5139 {Uri_HOST_DNS,S_OK},
5140 {80,S_OK},
5141 {URL_SCHEME_HTTP,S_OK},
5142 {URLZONE_INVALID,E_NOTIMPL}
5143 }
5144 },
5145 { "zip:testing/test",0,S_OK,FALSE,
5146 {
5147 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5148 },
5149 {FALSE},
5150 0,S_OK,FALSE,
5151 0,S_OK,FALSE,
5152 0,0,0,S_OK,FALSE,
5153 {
5154 {"zip:test",S_OK},
5155 {"",S_FALSE},
5156 {"zip:test",S_OK},
5157 {"",S_FALSE},
5158 {"",S_FALSE},
5159 {"",S_FALSE},
5160 {"",S_FALSE},
5161 {"",S_FALSE},
5162 {"test",S_OK},
5163 {"test",S_OK},
5164 {"",S_FALSE},
5165 {"zip:test",S_OK},
5166 {"zip",S_OK},
5167 {"",S_FALSE},
5168 {"",S_FALSE}
5169 },
5170 {
5171 {Uri_HOST_UNKNOWN,S_OK},
5172 {0,S_FALSE},
5173 {URL_SCHEME_UNKNOWN,S_OK},
5174 {URLZONE_INVALID,E_NOTIMPL}
5175 }
5176 },
5177 { "http://google.com/",0,S_OK,FALSE,
5178 {
5179 {FALSE},
5180 },
5181 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5182 {TRUE,FALSE,555,S_OK,FALSE},
5183 0,S_OK,FALSE,
5184 0,S_OK,FALSE,
5185 0,0,0,S_OK,FALSE,
5186 {
5187 {"http://google.com/",S_OK},
5188 {"google.com",S_OK},
5189 {"http://google.com/",S_OK},
5190 {"google.com",S_OK},
5191 {"",S_FALSE},
5192 {"",S_FALSE},
5193 {"google.com",S_OK},
5194 {"",S_FALSE},
5195 {"/",S_OK},
5196 {"/",S_OK},
5197 {"",S_FALSE},
5198 {"http://google.com/",S_OK},
5199 {"http",S_OK},
5200 {"",S_FALSE},
5201 {"",S_FALSE}
5202 },
5203 {
5204 {Uri_HOST_DNS,S_OK},
5205 /* Still returns 80, even though earlier the port was disabled. */
5206 {80,S_OK},
5207 {URL_SCHEME_HTTP,S_OK},
5208 {URLZONE_INVALID,E_NOTIMPL}
5209 }
5210 },
5211 { "http://google.com/",0,S_OK,FALSE,
5212 {
5213 {FALSE},
5214 },
5215 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5216 * you'll get 122345 instead.
5217 */
5218 {TRUE,122345,222,S_OK,FALSE},
5219 0,S_OK,FALSE,
5220 0,S_OK,FALSE,
5221 0,0,0,S_OK,FALSE,
5222 {
5223 {"http://google.com:222/",S_OK},
5224 {"google.com:222",S_OK},
5225 {"http://google.com:222/",S_OK},
5226 {"google.com",S_OK},
5227 {"",S_FALSE},
5228 {"",S_FALSE},
5229 {"google.com",S_OK},
5230 {"",S_FALSE},
5231 {"/",S_OK},
5232 {"/",S_OK},
5233 {"",S_FALSE},
5234 {"http://google.com:222/",S_OK},
5235 {"http",S_OK},
5236 {"",S_FALSE},
5237 {"",S_FALSE}
5238 },
5239 {
5240 {Uri_HOST_DNS,S_OK},
5241 {222,S_OK},
5242 {URL_SCHEME_HTTP,S_OK},
5243 {URLZONE_INVALID,E_NOTIMPL}
5244 }
5245 },
5246 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5247 { "http://google.com/",0,S_OK,FALSE,
5248 {
5249 {FALSE},
5250 },
5251 {TRUE,TRUE,999999,S_OK,FALSE},
5252 0,S_OK,FALSE,
5253 0,S_OK,FALSE,
5254 0,0,0,S_OK,FALSE,
5255 {
5256 {"http://google.com:999999/",S_OK},
5257 {"google.com:999999",S_OK},
5258 {"http://google.com:999999/",S_OK},
5259 {"google.com",S_OK},
5260 {"",S_FALSE},
5261 {"",S_FALSE},
5262 {"google.com",S_OK},
5263 {"",S_FALSE},
5264 {"/",S_OK},
5265 {"/",S_OK},
5266 {"",S_FALSE},
5267 {"http://google.com:999999/",S_OK},
5268 {"http",S_OK},
5269 {"",S_FALSE},
5270 {"",S_FALSE}
5271 },
5272 {
5273 {Uri_HOST_DNS,S_OK},
5274 {999999,S_OK},
5275 {URL_SCHEME_HTTP,S_OK},
5276 {URLZONE_INVALID,E_NOTIMPL}
5277 }
5278 },
5279 { "http://google.com/",0,S_OK,FALSE,
5280 {
5281 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5282 },
5283
5284 {FALSE},
5285 0,S_OK,FALSE,
5286 0,S_OK,FALSE,
5287 0,0,0,S_OK,FALSE,
5288 {
5289 {"http://google.com/?test",S_OK},
5290 {"google.com",S_OK},
5291 {"http://google.com/?test",S_OK},
5292 {"google.com",S_OK},
5293 {"",S_FALSE},
5294 {"",S_FALSE},
5295 {"google.com",S_OK},
5296 {"",S_FALSE},
5297 {"/",S_OK},
5298 {"/?test",S_OK},
5299 {"?test",S_OK},
5300 {"http://google.com/?test",S_OK},
5301 {"http",S_OK},
5302 {"",S_FALSE},
5303 {"",S_FALSE}
5304 },
5305 {
5306 {Uri_HOST_DNS,S_OK},
5307 {80,S_OK},
5308 {URL_SCHEME_HTTP,S_OK},
5309 {URLZONE_INVALID,E_NOTIMPL}
5310 }
5311 },
5312 { "http://:password@google.com/",0,S_OK,FALSE,
5313 {
5314 {FALSE},
5315 },
5316 {FALSE},
5317 0,S_OK,FALSE,
5318 0,S_OK,FALSE,
5319 0,0,0,S_OK,FALSE,
5320 {
5321 {"http://:password@google.com/",S_OK},
5322 {":password@google.com",S_OK},
5323 {"http://google.com/",S_OK},
5324 {"google.com",S_OK},
5325 {"",S_FALSE},
5326 {"",S_FALSE},
5327 {"google.com",S_OK},
5328 {"password",S_OK},
5329 {"/",S_OK},
5330 {"/",S_OK},
5331 {"",S_FALSE},
5332 {"http://:password@google.com/",S_OK},
5333 {"http",S_OK},
5334 {":password",S_OK},
5335 {"",S_FALSE}
5336 },
5337 {
5338 {Uri_HOST_DNS,S_OK},
5339 {80,S_OK},
5340 {URL_SCHEME_HTTP,S_OK},
5341 {URLZONE_INVALID,E_NOTIMPL}
5342 }
5343 },
5344 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5345 { NULL,0,S_OK,FALSE,
5346 {
5347 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5348 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5349 },
5350 {FALSE},
5351 0,S_OK,FALSE,
5352 0,S_OK,FALSE,
5353 0,0,0,S_OK,FALSE,
5354 {
5355 {"http://google.com/",S_OK},
5356 {"google.com",S_OK},
5357 {"http://google.com/",S_OK},
5358 {"google.com",S_OK},
5359 {"",S_FALSE},
5360 {"",S_FALSE},
5361 {"google.com",S_OK},
5362 {"",S_FALSE},
5363 {"/",S_OK},
5364 {"/",S_OK},
5365 {"",S_FALSE},
5366 {"http://google.com/",S_OK},
5367 {"http",S_OK},
5368 {"",S_FALSE},
5369 {"",S_FALSE}
5370 },
5371 {
5372 {Uri_HOST_DNS,S_OK},
5373 {80,S_OK},
5374 {URL_SCHEME_HTTP,S_OK},
5375 {URLZONE_INVALID,E_NOTIMPL}
5376 }
5377 },
5378 /* Can't set the scheme name to NULL. */
5379 { "zip://google.com/",0,S_OK,FALSE,
5380 {
5381 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5382 },
5383 {FALSE},
5384 0,S_OK,FALSE,
5385 0,S_OK,FALSE,
5386 0,0,0,S_OK,FALSE,
5387 {
5388 {"zip://google.com/",S_OK},
5389 {"google.com",S_OK},
5390 {"zip://google.com/",S_OK},
5391 {"google.com",S_OK},
5392 {"",S_FALSE},
5393 {"",S_FALSE},
5394 {"google.com",S_OK},
5395 {"",S_FALSE},
5396 {"/",S_OK},
5397 {"/",S_OK},
5398 {"",S_FALSE},
5399 {"zip://google.com/",S_OK},
5400 {"zip",S_OK},
5401 {"",S_FALSE},
5402 {"",S_FALSE}
5403 },
5404 {
5405 {Uri_HOST_DNS,S_OK},
5406 {0,S_FALSE},
5407 {URL_SCHEME_UNKNOWN,S_OK},
5408 {URLZONE_INVALID,E_NOTIMPL}
5409 }
5410 },
5411 /* Can't set the scheme name to an empty string. */
5412 { "zip://google.com/",0,S_OK,FALSE,
5413 {
5414 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5415 },
5416 {FALSE},
5417 0,S_OK,FALSE,
5418 0,S_OK,FALSE,
5419 0,0,0,S_OK,FALSE,
5420 {
5421 {"zip://google.com/",S_OK},
5422 {"google.com",S_OK},
5423 {"zip://google.com/",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 {"zip://google.com/",S_OK},
5433 {"zip",S_OK},
5434 {"",S_FALSE},
5435 {"",S_FALSE}
5436 },
5437 {
5438 {Uri_HOST_DNS,S_OK},
5439 {0,S_FALSE},
5440 {URL_SCHEME_UNKNOWN,S_OK},
5441 {URLZONE_INVALID,E_NOTIMPL}
5442 }
5443 },
5444 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5445 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5446 */
5447 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5448 {{FALSE}},
5449 {FALSE},
5450 -1,S_OK,FALSE,
5451 0,S_OK,FALSE,
5452 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5453 {
5454 {"http://google.com/../../",S_OK},
5455 {"google.com",S_OK},
5456 {"http://google.com/../../",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/../../",S_OK},
5466 {"http",S_OK},
5467 {"",S_FALSE},
5468 {"",S_FALSE}
5469 },
5470 {
5471 {Uri_HOST_DNS,S_OK},
5472 {80,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,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5480 },
5481 {FALSE},
5482 -1,S_OK,FALSE,
5483 0,S_OK,FALSE,
5484 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5485 {
5486 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5487 {"google.com",S_OK},
5488 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5489 {"google.com",S_OK},
5490 {"",S_FALSE},
5491 {"#Fr%3C%7C%3Eg",S_OK},
5492 {"google.com",S_OK},
5493 {"",S_FALSE},
5494 {"/",S_OK},
5495 {"/",S_OK},
5496 {"",S_FALSE},
5497 {"http://google.com/#Fr<|>g",S_OK},
5498 {"http",S_OK},
5499 {"",S_FALSE},
5500 {"",S_FALSE}
5501 },
5502 {
5503 {Uri_HOST_DNS,S_OK},
5504 {80,S_OK},
5505 {URL_SCHEME_HTTP,S_OK},
5506 {URLZONE_INVALID,E_NOTIMPL}
5507 }
5508 },
5509 { "http://google.com/",0,S_OK,FALSE,
5510 {
5511 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5512 },
5513 {FALSE},
5514 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5515 0,S_OK,FALSE,
5516 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5517 {
5518 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5519 {"google.com",S_OK},
5520 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5521 {"google.com",S_OK},
5522 {"",S_FALSE},
5523 {"#Fr%3C%7C%3Eg",S_OK},
5524 {"google.com",S_OK},
5525 {"",S_FALSE},
5526 {"/",S_OK},
5527 {"/",S_OK},
5528 {"",S_FALSE},
5529 {"http://google.com/#Fr<|>g",S_OK},
5530 {"http",S_OK},
5531 {"",S_FALSE},
5532 {"",S_FALSE}
5533 },
5534 {
5535 {Uri_HOST_DNS,S_OK},
5536 {80,S_OK},
5537 {URL_SCHEME_HTTP,S_OK},
5538 {URLZONE_INVALID,E_NOTIMPL}
5539 }
5540 },
5541 { NULL,0,S_OK,FALSE,
5542 {
5543 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5544 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5545 },
5546 {FALSE},
5547 0,INET_E_INVALID_URL,FALSE,
5548 0,INET_E_INVALID_URL,FALSE,
5549 0,0,0,INET_E_INVALID_URL,FALSE
5550 },
5551 { "http://google.com/",0,S_OK,FALSE,
5552 {
5553 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5554 },
5555 {FALSE},
5556 0,INET_E_INVALID_URL,FALSE,
5557 0,INET_E_INVALID_URL,FALSE,
5558 0,0,0,INET_E_INVALID_URL,FALSE
5559 },
5560 /* File scheme's can't have a username set. */
5561 { "file://google.com/",0,S_OK,FALSE,
5562 {
5563 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5564 },
5565 {FALSE},
5566 0,INET_E_INVALID_URL,FALSE,
5567 0,INET_E_INVALID_URL,FALSE,
5568 0,0,0,INET_E_INVALID_URL,FALSE
5569 },
5570 /* File schemes can't have a password set. */
5571 { "file://google.com/",0,S_OK,FALSE,
5572 {
5573 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5574 },
5575 {FALSE},
5576 0,INET_E_INVALID_URL,FALSE,
5577 0,INET_E_INVALID_URL,FALSE,
5578 0,0,0,INET_E_INVALID_URL,FALSE
5579 },
5580 /* UserName can't contain any character that is a delimeter for another
5581 * component that appears after it in a normal URI.
5582 */
5583 { "http://google.com/",0,S_OK,FALSE,
5584 {
5585 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5586 },
5587 {FALSE},
5588 0,INET_E_INVALID_URL,FALSE,
5589 0,INET_E_INVALID_URL,FALSE,
5590 0,0,0,INET_E_INVALID_URL,FALSE
5591 },
5592 { "http://google.com/",0,S_OK,FALSE,
5593 {
5594 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5595 },
5596 {FALSE},
5597 0,INET_E_INVALID_URL,FALSE,
5598 0,INET_E_INVALID_URL,FALSE,
5599 0,0,0,INET_E_INVALID_URL,FALSE
5600 },
5601 { "http://google.com/",0,S_OK,FALSE,
5602 {
5603 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5604 },
5605 {FALSE},
5606 0,INET_E_INVALID_URL,FALSE,
5607 0,INET_E_INVALID_URL,FALSE,
5608 0,0,0,INET_E_INVALID_URL,FALSE
5609 },
5610 { "http://google.com/",0,S_OK,FALSE,
5611 {
5612 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5613 },
5614 {FALSE},
5615 0,INET_E_INVALID_URL,FALSE,
5616 0,INET_E_INVALID_URL,FALSE,
5617 0,0,0,INET_E_INVALID_URL,FALSE
5618 },
5619 { "http://google.com/",0,S_OK,FALSE,
5620 {
5621 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5622 },
5623 {FALSE},
5624 0,INET_E_INVALID_URL,FALSE,
5625 0,INET_E_INVALID_URL,FALSE,
5626 0,0,0,INET_E_INVALID_URL,FALSE
5627 },
5628 { "http://google.com/",0,S_OK,FALSE,
5629 {
5630 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5631 },
5632 {FALSE},
5633 0,INET_E_INVALID_URL,FALSE,
5634 0,INET_E_INVALID_URL,FALSE,
5635 0,0,0,INET_E_INVALID_URL,FALSE
5636 },
5637 { "http://google.com/",0,S_OK,FALSE,
5638 {
5639 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5640 },
5641 {FALSE},
5642 0,INET_E_INVALID_URL,FALSE,
5643 0,INET_E_INVALID_URL,FALSE,
5644 0,0,0,INET_E_INVALID_URL,FALSE
5645 },
5646 { "http://google.com/",0,S_OK,FALSE,
5647 {
5648 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5649 },
5650 {FALSE},
5651 0,INET_E_INVALID_URL,FALSE,
5652 0,INET_E_INVALID_URL,FALSE,
5653 0,0,0,INET_E_INVALID_URL,FALSE
5654 },
5655 { "http://google.com/",0,S_OK,FALSE,
5656 {
5657 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5658 },
5659 {FALSE},
5660 0,INET_E_INVALID_URL,FALSE,
5661 0,INET_E_INVALID_URL,FALSE,
5662 0,0,0,INET_E_INVALID_URL,FALSE
5663 },
5664 { "http://google.com/",0,S_OK,FALSE,
5665 {
5666 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5667 },
5668 {FALSE},
5669 0,INET_E_INVALID_URL,FALSE,
5670 0,INET_E_INVALID_URL,FALSE,
5671 0,0,0,INET_E_INVALID_URL,FALSE
5672 },
5673 { "http://google.com/",0,S_OK,FALSE,
5674 {
5675 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5676 },
5677 {FALSE},
5678 0,INET_E_INVALID_URL,FALSE,
5679 0,INET_E_INVALID_URL,FALSE,
5680 0,0,0,INET_E_INVALID_URL,FALSE
5681 },
5682 { "http://google.com/",0,S_OK,FALSE,
5683 {
5684 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5685 },
5686 {FALSE},
5687 0,INET_E_INVALID_URL,FALSE,
5688 0,INET_E_INVALID_URL,FALSE,
5689 0,0,0,INET_E_INVALID_URL,FALSE
5690 },
5691 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5692 { "http://google.com/",0,S_OK,FALSE,
5693 {
5694 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5695 },
5696 {FALSE},
5697 0,S_OK,FALSE,
5698 0,S_OK,FALSE,
5699 0,0,0,S_OK,FALSE,
5700 {
5701 {"http://winehq.org:test/",S_OK},
5702 {"winehq.org:test",S_OK},
5703 {"http://winehq.org:test/",S_OK},
5704 {"winehq.org:test",S_OK},
5705 {"",S_FALSE},
5706 {"",S_FALSE},
5707 {"winehq.org:test",S_OK},
5708 {"",S_FALSE},
5709 {"/",S_OK},
5710 {"/",S_OK},
5711 {"",S_FALSE},
5712 {"http://winehq.org:test/",S_OK},
5713 {"http",S_OK},
5714 {"",S_FALSE},
5715 {"",S_FALSE}
5716 },
5717 {
5718 {Uri_HOST_DNS,S_OK},
5719 {80,S_OK},
5720 {URL_SCHEME_HTTP,S_OK},
5721 {URLZONE_INVALID,E_NOTIMPL}
5722 }
5723 },
5724 /* Can't set the host name to NULL. */
5725 { "http://google.com/",0,S_OK,FALSE,
5726 {
5727 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5728 },
5729 {FALSE},
5730 0,S_OK,FALSE,
5731 0,S_OK,FALSE,
5732 0,0,0,S_OK,FALSE,
5733 {
5734 {"http://google.com/",S_OK},
5735 {"google.com",S_OK},
5736 {"http://google.com/",S_OK},
5737 {"google.com",S_OK},
5738 {"",S_FALSE},
5739 {"",S_FALSE},
5740 {"google.com",S_OK},
5741 {"",S_FALSE},
5742 {"/",S_OK},
5743 {"/",S_OK},
5744 {"",S_FALSE},
5745 {"http://google.com/",S_OK},
5746 {"http",S_OK},
5747 {"",S_FALSE},
5748 {"",S_FALSE}
5749 },
5750 {
5751 {Uri_HOST_DNS,S_OK},
5752 {80,S_OK},
5753 {URL_SCHEME_HTTP,S_OK},
5754 {URLZONE_INVALID,E_NOTIMPL}
5755 }
5756 },
5757 /* Can set the host name to an empty string. */
5758 { "http://google.com/",0,S_OK,FALSE,
5759 {
5760 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5761 },
5762 {FALSE},
5763 0,S_OK,FALSE,
5764 0,S_OK,FALSE,
5765 0,0,0,S_OK,FALSE,
5766 {
5767 {"http:///",S_OK},
5768 {"",S_OK},
5769 {"http:///",S_OK},
5770 {"",S_FALSE},
5771 {"",S_FALSE},
5772 {"",S_FALSE},
5773 {"",S_OK},
5774 {"",S_FALSE},
5775 {"/",S_OK},
5776 {"/",S_OK},
5777 {"",S_FALSE},
5778 {"http:///",S_OK},
5779 {"http",S_OK},
5780 {"",S_FALSE},
5781 {"",S_FALSE}
5782 },
5783 {
5784 {Uri_HOST_UNKNOWN,S_OK},
5785 {80,S_OK},
5786 {URL_SCHEME_HTTP,S_OK},
5787 {URLZONE_INVALID,E_NOTIMPL}
5788 }
5789 },
5790 { "http://google.com/",0,S_OK,FALSE,
5791 {
5792 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,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,"/path#test",NULL,Uri_PROPERTY_PATH,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,"?path#test",NULL,Uri_PROPERTY_QUERY,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 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5818 {
5819 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5820 },
5821 {FALSE},
5822 0,S_OK,FALSE,
5823 0,S_OK,FALSE,
5824 0,0,0,S_OK,FALSE,
5825 {
5826 {"file:///c:/dir/file.html",S_OK},
5827 {"",S_FALSE},
5828 {"file:///c:/dir/file.html",S_OK},
5829 {"",S_FALSE},
5830 {".html",S_OK},
5831 {"",S_FALSE},
5832 {"",S_FALSE},
5833 {"",S_FALSE},
5834 {"/c:/dir/file.html",S_OK},
5835 {"/c:/dir/file.html",S_OK},
5836 {"",S_FALSE},
5837 {"file:///c:/dir/file.html",S_OK},
5838 {"file",S_OK},
5839 {"",S_FALSE},
5840 {"",S_FALSE}
5841 },
5842 {
5843 {Uri_HOST_UNKNOWN,S_OK},
5844 {0,S_FALSE},
5845 {URL_SCHEME_FILE,S_OK},
5846 {URLZONE_INVALID,E_NOTIMPL}
5847 }
5848 },
5849 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5850 {
5851 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5852 },
5853 {FALSE},
5854 0,S_OK,FALSE,
5855 0,S_OK,FALSE,
5856 0,0,0,S_OK,FALSE,
5857 {
5858 {"file:///c:/dir/file.html#",S_OK},
5859 {"",S_FALSE},
5860 {"file:///c:/dir/file.html#",S_OK},
5861 {"",S_FALSE},
5862 {".html",S_OK},
5863 {"#",S_OK},
5864 {"",S_FALSE},
5865 {"",S_FALSE},
5866 {"/c:/dir/file.html",S_OK},
5867 {"/c:/dir/file.html",S_OK},
5868 {"",S_FALSE},
5869 {"file:///c:/dir/file.html#",S_OK},
5870 {"file",S_OK},
5871 {"",S_FALSE},
5872 {"",S_FALSE}
5873 },
5874 {
5875 {Uri_HOST_UNKNOWN,S_OK},
5876 {0,S_FALSE},
5877 {URL_SCHEME_FILE,S_OK},
5878 {URLZONE_INVALID,E_NOTIMPL}
5879 }
5880 }
5881 };
5882
5883 typedef struct _uri_builder_remove_test {
5884 const char *uri;
5885 DWORD create_flags;
5886 HRESULT create_builder_expected;
5887 BOOL create_builder_todo;
5888
5889 DWORD remove_properties;
5890 HRESULT remove_expected;
5891 BOOL remove_todo;
5892
5893 const char *expected_uri;
5894 DWORD expected_flags;
5895 HRESULT expected_hres;
5896 BOOL expected_todo;
5897 } uri_builder_remove_test;
5898
5899 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5900 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5901 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5902 "http://google.com/",0,S_OK,FALSE
5903 },
5904 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5905 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5906 "http://winehq.org/",0,S_OK,FALSE
5907 },
5908 { "zip://google.com?Test=x",0,S_OK,FALSE,
5909 Uri_HAS_HOST,S_OK,FALSE,
5910 "zip:/?Test=x",0,S_OK,FALSE
5911 },
5912 /* Doesn't remove the whole userinfo component. */
5913 { "http://username:pass@google.com/",0,S_OK,FALSE,
5914 Uri_HAS_USER_INFO,S_OK,FALSE,
5915 "http://username:pass@google.com/",0,S_OK,FALSE
5916 },
5917 /* Doesn't remove the domain. */
5918 { "http://google.com/",0,S_OK,FALSE,
5919 Uri_HAS_DOMAIN,S_OK,FALSE,
5920 "http://google.com/",0,S_OK,FALSE
5921 },
5922 { "http://google.com:120/",0,S_OK,FALSE,
5923 Uri_HAS_AUTHORITY,S_OK,FALSE,
5924 "http://google.com:120/",0,S_OK,FALSE
5925 },
5926 { "http://google.com/test.com/",0,S_OK,FALSE,
5927 Uri_HAS_EXTENSION,S_OK,FALSE,
5928 "http://google.com/test.com/",0,S_OK,FALSE
5929 },
5930 { "http://google.com/?test=x",0,S_OK,FALSE,
5931 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5932 "http://google.com/?test=x",0,S_OK,FALSE
5933 },
5934 /* Can't remove the scheme name. */
5935 { "http://google.com/?test=x",0,S_OK,FALSE,
5936 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5937 "http://google.com/?test=x",0,S_OK,FALSE
5938 }
5939 };
5940
5941 typedef struct _uri_combine_str_property {
5942 const char *value;
5943 HRESULT expected;
5944 BOOL todo;
5945 const char *broken_value;
5946 const char *value_ex;
5947 } uri_combine_str_property;
5948
5949 typedef struct _uri_combine_test {
5950 const char *base_uri;
5951 DWORD base_create_flags;
5952 const char *relative_uri;
5953 DWORD relative_create_flags;
5954 DWORD combine_flags;
5955 HRESULT expected;
5956 BOOL todo;
5957
5958 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5959 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5960 } uri_combine_test;
5961
5962 static const uri_combine_test uri_combine_tests[] = {
5963 { "http://google.com/fun/stuff",0,
5964 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5965 0,S_OK,FALSE,
5966 {
5967 {"http://google.com/not/fun/stuff",S_OK},
5968 {"google.com",S_OK},
5969 {"http://google.com/not/fun/stuff",S_OK},
5970 {"google.com",S_OK},
5971 {"",S_FALSE},
5972 {"",S_FALSE},
5973 {"google.com",S_OK},
5974 {"",S_FALSE},
5975 {"/not/fun/stuff",S_OK},
5976 {"/not/fun/stuff",S_OK},
5977 {"",S_FALSE},
5978 {"http://google.com/not/fun/stuff",S_OK},
5979 {"http",S_OK},
5980 {"",S_FALSE},
5981 {"",S_FALSE}
5982 },
5983 {
5984 {Uri_HOST_DNS,S_OK},
5985 {80,S_OK},
5986 {URL_SCHEME_HTTP,S_OK},
5987 {URLZONE_INVALID,E_NOTIMPL}
5988 }
5989 },
5990 { "http://google.com/test",0,
5991 "zip://test.com/cool",0,
5992 0,S_OK,FALSE,
5993 {
5994 {"zip://test.com/cool",S_OK},
5995 {"test.com",S_OK},
5996 {"zip://test.com/cool",S_OK},
5997 {"test.com",S_OK},
5998 {"",S_FALSE},
5999 {"",S_FALSE},
6000 {"test.com",S_OK},
6001 {"",S_FALSE},
6002 {"/cool",S_OK},
6003 {"/cool",S_OK},
6004 {"",S_FALSE},
6005 {"zip://test.com/cool",S_OK},
6006 {"zip",S_OK},
6007 {"",S_FALSE},
6008 {"",S_FALSE}
6009 },
6010 {
6011 {Uri_HOST_DNS,S_OK},
6012 {0,S_FALSE},
6013 {URL_SCHEME_UNKNOWN,S_OK},
6014 {URLZONE_INVALID,E_NOTIMPL}
6015 }
6016 },
6017 { "http://google.com/use/base/path",0,
6018 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6019 0,S_OK,FALSE,
6020 {
6021 {"http://google.com/use/base/path?relative",S_OK},
6022 {"google.com",S_OK},
6023 {"http://google.com/use/base/path?relative",S_OK},
6024 {"google.com",S_OK},
6025 {"",S_FALSE},
6026 {"",S_FALSE},
6027 {"google.com",S_OK},
6028 {"",S_FALSE},
6029 {"/use/base/path",S_OK},
6030 {"/use/base/path?relative",S_OK},
6031 {"?relative",S_OK},
6032 {"http://google.com/use/base/path?relative",S_OK},
6033 {"http",S_OK},
6034 {"",S_FALSE},
6035 {"",S_FALSE}
6036 },
6037 {
6038 {Uri_HOST_DNS,S_OK},
6039 {80,S_OK},
6040 {URL_SCHEME_HTTP,S_OK},
6041 {URLZONE_INVALID,E_NOTIMPL}
6042 }
6043 },
6044 { "http://google.com/path",0,
6045 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6046 0,S_OK,FALSE,
6047 {
6048 {"http://google.com/testing",S_OK},
6049 {"google.com",S_OK},
6050 {"http://google.com/testing",S_OK},
6051 {"google.com",S_OK},
6052 {"",S_FALSE},
6053 {"",S_FALSE},
6054 {"google.com",S_OK},
6055 {"",S_FALSE},
6056 {"/testing",S_OK},
6057 {"/testing",S_OK},
6058 {"",S_FALSE},
6059 {"http://google.com/testing",S_OK},
6060 {"http",S_OK},
6061 {"",S_FALSE},
6062 {"",S_FALSE}
6063 },
6064 {
6065 {Uri_HOST_DNS,S_OK},
6066 {80,S_OK},
6067 {URL_SCHEME_HTTP,S_OK},
6068 {URLZONE_INVALID,E_NOTIMPL}
6069 }
6070 },
6071 { "http://google.com/path",0,
6072 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6073 URL_DONT_SIMPLIFY,S_OK,FALSE,
6074 {
6075 {"http://google.com:80/test/../test/.././testing",S_OK},
6076 {"google.com",S_OK},
6077 {"http://google.com:80/test/../test/.././testing",S_OK},
6078 {"google.com",S_OK},
6079 {"",S_FALSE},
6080 {"",S_FALSE},
6081 {"google.com",S_OK},
6082 {"",S_FALSE},
6083 {"/test/../test/.././testing",S_OK},
6084 {"/test/../test/.././testing",S_OK},
6085 {"",S_FALSE},
6086 {"http://google.com:80/test/../test/.././testing",S_OK},
6087 {"http",S_OK},
6088 {"",S_FALSE},
6089 {"",S_FALSE}
6090 },
6091 {
6092 {Uri_HOST_DNS,S_OK},
6093 {80,S_OK},
6094 {URL_SCHEME_HTTP,S_OK},
6095 {URLZONE_INVALID,E_NOTIMPL}
6096 }
6097 },
6098 { "http://winehq.org/test/abc",0,
6099 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6100 0,S_OK,FALSE,
6101 {
6102 {"http://winehq.org/test/testing/test",S_OK},
6103 {"winehq.org",S_OK},
6104 {"http://winehq.org/test/testing/test",S_OK},
6105 {"winehq.org",S_OK},
6106 {"",S_FALSE},
6107 {"",S_FALSE},
6108 {"winehq.org",S_OK},
6109 {"",S_FALSE},
6110 {"/test/testing/test",S_OK},
6111 {"/test/testing/test",S_OK},
6112 {"",S_FALSE},
6113 {"http://winehq.org/test/testing/test",S_OK},
6114 {"http",S_OK},
6115 {"",S_FALSE},
6116 {"",S_FALSE}
6117 },
6118 {
6119 {Uri_HOST_DNS,S_OK},
6120 {80,S_OK},
6121 {URL_SCHEME_HTTP,S_OK},
6122 {URLZONE_INVALID,E_NOTIMPL}
6123 }
6124 },
6125 { "http://winehq.org/test/abc",0,
6126 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6127 URL_DONT_SIMPLIFY,S_OK,FALSE,
6128 {
6129 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6130 /* Default port is hidden in the authority. */
6131 {"winehq.org",S_OK},
6132 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6133 {"winehq.org",S_OK},
6134 {"",S_FALSE},
6135 {"",S_FALSE},
6136 {"winehq.org",S_OK},
6137 {"",S_FALSE},
6138 {"/test/testing/abc/../test",S_OK},
6139 {"/test/testing/abc/../test",S_OK},
6140 {"",S_FALSE},
6141 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6142 {"http",S_OK},
6143 {"",S_FALSE},
6144 {"",S_FALSE}
6145 },
6146 {
6147 {Uri_HOST_DNS,S_OK},
6148 {80,S_OK},
6149 {URL_SCHEME_HTTP,S_OK},
6150 {URLZONE_INVALID,E_NOTIMPL}
6151 }
6152 },
6153 { "http://winehq.org/test?query",0,
6154 "testing",Uri_CREATE_ALLOW_RELATIVE,
6155 0,S_OK,FALSE,
6156 {
6157 {"http://winehq.org/testing",S_OK},
6158 {"winehq.org",S_OK},
6159 {"http://winehq.org/testing",S_OK},
6160 {"winehq.org",S_OK},
6161 {"",S_FALSE},
6162 {"",S_FALSE},
6163 {"winehq.org",S_OK},
6164 {"",S_FALSE},
6165 {"/testing",S_OK},
6166 {"/testing",S_OK},
6167 {"",S_FALSE},
6168 {"http://winehq.org/testing",S_OK},
6169 {"http",S_OK},
6170 {"",S_FALSE},
6171 {"",S_FALSE}
6172 },
6173 {
6174 {Uri_HOST_DNS,S_OK},
6175 {80,S_OK},
6176 {URL_SCHEME_HTTP,S_OK},
6177 {URLZONE_INVALID,E_NOTIMPL}
6178 }
6179 },
6180 { "http://winehq.org/test#frag",0,
6181 "testing",Uri_CREATE_ALLOW_RELATIVE,
6182 0,S_OK,FALSE,
6183 {
6184 {"http://winehq.org/testing",S_OK},
6185 {"winehq.org",S_OK},
6186 {"http://winehq.org/testing",S_OK},
6187 {"winehq.org",S_OK},
6188 {"",S_FALSE},
6189 {"",S_FALSE},
6190 {"winehq.org",S_OK},
6191 {"",S_FALSE},
6192 {"/testing",S_OK},
6193 {"/testing",S_OK},
6194 {"",S_FALSE},
6195 {"http://winehq.org/testing",S_OK},
6196 {"http",S_OK},
6197 {"",S_FALSE},
6198 {"",S_FALSE}
6199 },
6200 {
6201 {Uri_HOST_DNS,S_OK},
6202 {80,S_OK},
6203 {URL_SCHEME_HTTP,S_OK},
6204 {URLZONE_INVALID,E_NOTIMPL}
6205 }
6206 },
6207 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6208 "test",Uri_CREATE_ALLOW_RELATIVE,
6209 0,S_OK,FALSE,
6210 {
6211 {"test",S_OK},
6212 {"",S_FALSE},
6213 {"test",S_OK},
6214 {"",S_FALSE},
6215 {"",S_FALSE},
6216 {"",S_FALSE},
6217 {"",S_FALSE},
6218 {"",S_FALSE},
6219 {"test",S_OK},
6220 {"test",S_OK},
6221 {"",S_FALSE},
6222 {"test",S_OK},
6223 {"",S_FALSE},
6224 {"",S_FALSE},
6225 {"",S_FALSE}
6226 },
6227 {
6228 {Uri_HOST_UNKNOWN,S_OK},
6229 {0,S_FALSE},
6230 {URL_SCHEME_UNKNOWN,S_OK},
6231 {URLZONE_INVALID,E_NOTIMPL}
6232 }
6233 },
6234 { "file:///c:/test/test",0,
6235 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6236 URL_FILE_USE_PATHURL,S_OK,FALSE,
6237 {
6238 {"file://c:\\testing.mp3",S_OK},
6239 {"",S_FALSE},
6240 {"file://c:\\testing.mp3",S_OK},
6241 {"",S_FALSE},
6242 {".mp3",S_OK},
6243 {"",S_FALSE},
6244 {"",S_FALSE},
6245 {"",S_FALSE},
6246 {"c:\\testing.mp3",S_OK},
6247 {"c:\\testing.mp3",S_OK},
6248 {"",S_FALSE},
6249 {"file://c:\\testing.mp3",S_OK},
6250 {"file",S_OK},
6251 {"",S_FALSE},
6252 {"",S_FALSE}
6253 },
6254 {
6255 {Uri_HOST_UNKNOWN,S_OK},
6256 {0,S_FALSE},
6257 {URL_SCHEME_FILE,S_OK},
6258 {URLZONE_INVALID,E_NOTIMPL}
6259 }
6260 },
6261 { "file:///c:/test/test",0,
6262 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6263 0,S_OK,FALSE,
6264 {
6265 {"file:///c:/testing.mp3",S_OK},
6266 {"",S_FALSE},
6267 {"file:///c:/testing.mp3",S_OK},
6268 {"",S_FALSE},
6269 {".mp3",S_OK},
6270 {"",S_FALSE},
6271 {"",S_FALSE},
6272 {"",S_FALSE},
6273 {"/c:/testing.mp3",S_OK},
6274 {"/c:/testing.mp3",S_OK},
6275 {"",S_FALSE},
6276 {"file:///c:/testing.mp3",S_OK},
6277 {"file",S_OK},
6278 {"",S_FALSE},
6279 {"",S_FALSE}
6280 },
6281 {
6282 {Uri_HOST_UNKNOWN,S_OK},
6283 {0,S_FALSE},
6284 {URL_SCHEME_FILE,S_OK},
6285 {URLZONE_INVALID,E_NOTIMPL}
6286 }
6287 },
6288 { "file://test.com/test/test",0,
6289 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6290 URL_FILE_USE_PATHURL,S_OK,FALSE,
6291 {
6292 {"file://\\\\test.com\\testing.mp3",S_OK},
6293 {"test.com",S_OK},
6294 {"file://\\\\test.com\\testing.mp3",S_OK},
6295 {"test.com",S_OK},
6296 {".mp3",S_OK},
6297 {"",S_FALSE},
6298 {"test.com",S_OK},
6299 {"",S_FALSE},
6300 {"\\testing.mp3",S_OK},
6301 {"\\testing.mp3",S_OK},
6302 {"",S_FALSE},
6303 {"file://\\\\test.com\\testing.mp3",S_OK},
6304 {"file",S_OK},
6305 {"",S_FALSE},
6306 {"",S_FALSE}
6307 },
6308 {
6309 {Uri_HOST_DNS,S_OK},
6310 {0,S_FALSE},
6311 {URL_SCHEME_FILE,S_OK},
6312 {URLZONE_INVALID,E_NOTIMPL}
6313 }
6314 },
6315 /* URL_DONT_SIMPLIFY has no effect. */
6316 { "http://google.com/test",0,
6317 "zip://test.com/cool/../cool/test",0,
6318 URL_DONT_SIMPLIFY,S_OK,FALSE,
6319 {
6320 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6321 {"test.com",S_OK},
6322 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6323 {"test.com",S_OK},
6324 {"",S_FALSE},
6325 {"",S_FALSE},
6326 {"test.com",S_OK},
6327 {"",S_FALSE},
6328 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6329 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6330 {"",S_FALSE},
6331 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6332 * On IE 7 it reduces the path in the Raw URI.
6333 */
6334 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6335 {"zip",S_OK},
6336 {"",S_FALSE},
6337 {"",S_FALSE}
6338 },
6339 {
6340 {Uri_HOST_DNS,S_OK},
6341 {0,S_FALSE},
6342 {URL_SCHEME_UNKNOWN,S_OK},
6343 {URLZONE_INVALID,E_NOTIMPL}
6344 }
6345 },
6346 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6347 * resulting URI is converted into a dos path.
6348 */
6349 { "http://google.com/test",0,
6350 "file:///c:/test/",0,
6351 URL_FILE_USE_PATHURL,S_OK,FALSE,
6352 {
6353 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6354 {"",S_FALSE},
6355 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6356 {"",S_FALSE},
6357 {"",S_FALSE},
6358 {"",S_FALSE},
6359 {"",S_FALSE},
6360 {"",S_FALSE},
6361 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6362 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6363 {"",S_FALSE},
6364 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6365 {"file",S_OK},
6366 {"",S_FALSE},
6367 {"",S_FALSE}
6368 },
6369 {
6370 {Uri_HOST_UNKNOWN,S_OK},
6371 {0,S_FALSE},
6372 {URL_SCHEME_FILE,S_OK},
6373 {URLZONE_INVALID,E_NOTIMPL}
6374 }
6375 },
6376 { "http://google.com/test",0,
6377 "http://test.com/test#%30test",0,
6378 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6379 {
6380 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6381 {"test.com",S_OK},
6382 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6383 {"test.com",S_OK},
6384 {"",S_FALSE},
6385 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6386 {"test.com",S_OK},
6387 {"",S_FALSE},
6388 {"/test",S_OK},
6389 {"/test",S_OK},
6390 {"",S_FALSE},
6391 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6392 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6393 {"http",S_OK},
6394 {"",S_FALSE},
6395 {"",S_FALSE}
6396 },
6397 {
6398 {Uri_HOST_DNS,S_OK},
6399 {80,S_OK},
6400 {URL_SCHEME_HTTP,S_OK},
6401 {URLZONE_INVALID,E_NOTIMPL}
6402 }
6403 },
6404 /* Windows validates the path component from the relative Uri. */
6405 { "http://google.com/test",0,
6406 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6407 0,E_INVALIDARG,FALSE
6408 },
6409 /* Windows doesn't validate the query from the relative Uri. */
6410 { "http://google.com/test",0,
6411 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6412 0,S_OK,FALSE,
6413 {
6414 {"http://google.com/test?Tes%XXt",S_OK},
6415 {"google.com",S_OK},
6416 {"http://google.com/test?Tes%XXt",S_OK},
6417 {"google.com",S_OK},
6418 {"",S_FALSE},
6419 {"",S_FALSE},
6420 {"google.com",S_OK},
6421 {"",S_FALSE},
6422 {"/test",S_OK},
6423 {"/test?Tes%XXt",S_OK},
6424 {"?Tes%XXt",S_OK},
6425 {"http://google.com/test?Tes%XXt",S_OK},
6426 {"http",S_OK},
6427 {"",S_FALSE},
6428 {"",S_FALSE}
6429 },
6430 {
6431 {Uri_HOST_DNS,S_OK},
6432 {80,S_OK},
6433 {URL_SCHEME_HTTP,S_OK},
6434 {URLZONE_INVALID,E_NOTIMPL}
6435 }
6436 },
6437 /* Windows doesn't validate the fragment from the relative Uri. */
6438 { "http://google.com/test",0,
6439 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6440 0,S_OK,FALSE,
6441 {
6442 {"http://google.com/test#Tes%XXt",S_OK},
6443 {"google.com",S_OK},
6444 {"http://google.com/test#Tes%XXt",S_OK},
6445 {"google.com",S_OK},
6446 {"",S_FALSE},
6447 {"#Tes%XXt",S_OK},
6448 {"google.com",S_OK},
6449 {"",S_FALSE},
6450 {"/test",S_OK},
6451 {"/test",S_OK},
6452 {"",S_FALSE},
6453 {"http://google.com/test#Tes%XXt",S_OK},
6454 {"http",S_OK},
6455 {"",S_FALSE},
6456 {"",S_FALSE}
6457 },
6458 {
6459 {Uri_HOST_DNS,S_OK},
6460 {80,S_OK},
6461 {URL_SCHEME_HTTP,S_OK},
6462 {URLZONE_INVALID,E_NOTIMPL}
6463 }
6464 },
6465 /* Creates an IUri which contains an invalid dos path char. */
6466 { "file:///c:/test",0,
6467 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6468 URL_FILE_USE_PATHURL,S_OK,FALSE,
6469 {
6470 {"file://c:\\test<ing",S_OK},
6471 {"",S_FALSE},
6472 {"file://c:\\test<ing",S_OK},
6473 {"",S_FALSE},
6474 {"",S_FALSE},
6475 {"",S_FALSE},
6476 {"",S_FALSE},
6477 {"",S_FALSE},
6478 {"c:\\test<ing",S_OK},
6479 {"c:\\test<ing",S_OK},
6480 {"",S_FALSE},
6481 {"file://c:\\test<ing",S_OK},
6482 {"file",S_OK},
6483 {"",S_FALSE},
6484 {"",S_FALSE}
6485 },
6486 {
6487 {Uri_HOST_UNKNOWN,S_OK},
6488 {0,S_FALSE},
6489 {URL_SCHEME_FILE,S_OK},
6490 {URLZONE_INVALID,E_NOTIMPL}
6491 }
6492 },
6493 /* Appends the path after the drive letter (if any). */
6494 { "file:///c:/test",0,
6495 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6496 0,S_OK,FALSE,
6497 {
6498 {"file:///c:/c:/testing",S_OK},
6499 {"",S_FALSE},
6500 {"file:///c:/c:/testing",S_OK},
6501 {"",S_FALSE},
6502 {"",S_FALSE},
6503 {"",S_FALSE},
6504 {"",S_FALSE},
6505 {"",S_FALSE},
6506 {"/c:/c:/testing",S_OK},
6507 {"/c:/c:/testing",S_OK},
6508 {"",S_FALSE},
6509 {"file:///c:/c:/testing",S_OK},
6510 {"file",S_OK},
6511 {"",S_FALSE},
6512 {"",S_FALSE}
6513 },
6514 {
6515 {Uri_HOST_UNKNOWN,S_OK},
6516 {0,S_FALSE},
6517 {URL_SCHEME_FILE,S_OK},
6518 {URLZONE_INVALID,E_NOTIMPL}
6519 }
6520 },
6521 /* A '/' is added if the base URI doesn't have a path and the
6522 * relative URI doesn't contain a path (since the base URI is
6523 * hierarchical.
6524 */
6525 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6526 "?test",Uri_CREATE_ALLOW_RELATIVE,
6527 0,S_OK,FALSE,
6528 {
6529 {"http://google.com/?test",S_OK},
6530 {"google.com",S_OK},
6531 {"http://google.com/?test",S_OK},
6532 {"google.com",S_OK},
6533 {"",S_FALSE},
6534 {"",S_FALSE},
6535 {"google.com",S_OK},
6536 {"",S_FALSE},
6537 {"/",S_OK},
6538 {"/?test",S_OK},
6539 {"?test",S_OK},
6540 {"http://google.com/?test",S_OK},
6541 {"http",S_OK},
6542 {"",S_FALSE},
6543 {"",S_FALSE}
6544 },
6545 {
6546 {Uri_HOST_DNS,S_OK},
6547 {80,S_OK},
6548 {URL_SCHEME_HTTP,S_OK},
6549 {URLZONE_INVALID,E_NOTIMPL}
6550 }
6551 },
6552 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6553 "?test",Uri_CREATE_ALLOW_RELATIVE,
6554 0,S_OK,FALSE,
6555 {
6556 {"zip://google.com/?test",S_OK},
6557 {"google.com",S_OK},
6558 {"zip://google.com/?test",S_OK},
6559 {"google.com",S_OK},
6560 {"",S_FALSE},
6561 {"",S_FALSE},
6562 {"google.com",S_OK},
6563 {"",S_FALSE},
6564 {"/",S_OK},
6565 {"/?test",S_OK},
6566 {"?test",S_OK},
6567 {"zip://google.com/?test",S_OK},
6568 {"zip",S_OK},
6569 {"",S_FALSE},
6570 {"",S_FALSE}
6571 },
6572 {
6573 {Uri_HOST_DNS,S_OK},
6574 {0,S_FALSE},
6575 {URL_SCHEME_UNKNOWN,S_OK},
6576 {URLZONE_INVALID,E_NOTIMPL}
6577 }
6578 },
6579 /* No path is appended since the base URI is opaque. */
6580 { "zip:?testing",0,
6581 "?test",Uri_CREATE_ALLOW_RELATIVE,
6582 0,S_OK,FALSE,
6583 {
6584 {"zip:?test",S_OK},
6585 {"",S_FALSE},
6586 {"zip:?test",S_OK},
6587 {"",S_FALSE},
6588 {"",S_FALSE},
6589 {"",S_FALSE},
6590 {"",S_FALSE},
6591 {"",S_FALSE},
6592 {"",S_OK},
6593 {"?test",S_OK},
6594 {"?test",S_OK},
6595 {"zip:?test",S_OK},
6596 {"zip",S_OK},
6597 {"",S_FALSE},
6598 {"",S_FALSE}
6599 },
6600 {
6601 {Uri_HOST_UNKNOWN,S_OK},
6602 {0,S_FALSE},
6603 {URL_SCHEME_UNKNOWN,S_OK},
6604 {URLZONE_INVALID,E_NOTIMPL}
6605 }
6606 },
6607 { "file:///c:/",0,
6608 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6609 0,S_OK,FALSE,
6610 {
6611 {"file:///c:/testing/test",S_OK},
6612 {"",S_FALSE},
6613 {"file:///c:/testing/test",S_OK},
6614 {"",S_FALSE},
6615 {"",S_FALSE},
6616 {"",S_FALSE},
6617 {"",S_FALSE},
6618 {"",S_FALSE},
6619 {"/c:/testing/test",S_OK},
6620 {"/c:/testing/test",S_OK},
6621 {"",S_FALSE},
6622 {"file:///c:/testing/test",S_OK},
6623 {"file",S_OK},
6624 {"",S_FALSE},
6625 {"",S_FALSE}
6626 },
6627 {
6628 {Uri_HOST_UNKNOWN,S_OK},
6629 {0,S_FALSE},
6630 {URL_SCHEME_FILE,S_OK},
6631 {URLZONE_INVALID,E_NOTIMPL}
6632 }
6633 },
6634 { "http://winehq.org/dir/testfile",0,
6635 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6636 0,S_OK,FALSE,
6637 {
6638 {"http://winehq.org/dir/test?querystring",S_OK},
6639 {"winehq.org",S_OK},
6640 {"http://winehq.org/dir/test?querystring",S_OK},
6641 {"winehq.org",S_OK},
6642 {"",S_FALSE},
6643 {"",S_FALSE},
6644 {"winehq.org",S_OK},
6645 {"",S_FALSE},
6646 {"/dir/test",S_OK},
6647 {"/dir/test?querystring",S_OK},
6648 {"?querystring",S_OK},
6649 {"http://winehq.org/dir/test?querystring",S_OK},
6650 {"http",S_OK},
6651 {"",S_FALSE},
6652 {"",S_FALSE}
6653 },
6654 {
6655 {Uri_HOST_DNS,S_OK},
6656 {80,S_OK},
6657 {URL_SCHEME_HTTP,S_OK},
6658 {URLZONE_INVALID,E_NOTIMPL}
6659 }
6660 },
6661 { "http://winehq.org/dir/test",0,
6662 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6663 0,S_OK,FALSE,
6664 {
6665 {"http://winehq.org/dir/test?querystring",S_OK},
6666 {"winehq.org",S_OK},
6667 {"http://winehq.org/dir/test?querystring",S_OK},
6668 {"winehq.org",S_OK},
6669 {"",S_FALSE},
6670 {"",S_FALSE},
6671 {"winehq.org",S_OK},
6672 {"",S_FALSE},
6673 {"/dir/test",S_OK},
6674 {"/dir/test?querystring",S_OK},
6675 {"?querystring",S_OK},
6676 {"http://winehq.org/dir/test?querystring",S_OK},
6677 {"http",S_OK},
6678 {"",S_FALSE},
6679 {"",S_FALSE}
6680 },
6681 {
6682 {Uri_HOST_DNS,S_OK},
6683 {80,S_OK},
6684 {URL_SCHEME_HTTP,S_OK},
6685 {URLZONE_INVALID,E_NOTIMPL}
6686 }
6687 },
6688 { "http://winehq.org/dir/test?querystring",0,
6689 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6690 0,S_OK,FALSE,
6691 {
6692 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6693 {"winehq.org",S_OK},
6694 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6695 {"winehq.org",S_OK},
6696 {"",S_FALSE},
6697 {"#hash",S_OK},
6698 {"winehq.org",S_OK},
6699 {"",S_FALSE},
6700 {"/dir/test",S_OK},
6701 {"/dir/test?querystring",S_OK},
6702 {"?querystring",S_OK},
6703 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6704 {"http",S_OK},
6705 {"",S_FALSE},
6706 {"",S_FALSE}
6707 },
6708 {
6709 {Uri_HOST_DNS,S_OK},
6710 {80,S_OK},
6711 {URL_SCHEME_HTTP,S_OK},
6712 {URLZONE_INVALID,E_NOTIMPL}
6713 }
6714 },
6715 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6716 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6717 0,S_OK,FALSE,
6718 {
6719 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6720 {"",S_FALSE},
6721 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6722 {"",S_FALSE},
6723 {".txt",S_OK},
6724 {"",S_FALSE},
6725 {"",S_FALSE},
6726 {"",S_FALSE},
6727 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6728 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6729 {"",S_FALSE},
6730 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6731 {"mk",S_OK},
6732 {"",S_FALSE},
6733 {"",S_FALSE}
6734 },
6735 {
6736 {Uri_HOST_UNKNOWN,S_OK},
6737 {0,S_FALSE},
6738 {URL_SCHEME_MK,S_OK},
6739 {URLZONE_INVALID,E_NOTIMPL}
6740 }
6741 },
6742 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6743 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6744 0,S_OK,FALSE,
6745 {
6746 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6747 {"",S_FALSE},
6748 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6749 {"",S_FALSE},
6750 {".txt",S_OK},
6751 {"",S_FALSE},
6752 {"",S_FALSE},
6753 {"",S_FALSE},
6754 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6755 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6756 {"",S_FALSE},
6757 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6758 {"mk",S_OK},
6759 {"",S_FALSE},
6760 {"",S_FALSE}
6761 },
6762 {
6763 {Uri_HOST_UNKNOWN,S_OK},
6764 {0,S_FALSE},
6765 {URL_SCHEME_MK,S_OK},
6766 {URLZONE_INVALID,E_NOTIMPL}
6767 }
6768 },
6769 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6770 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6771 0,S_OK,FALSE,
6772 {
6773 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6774 {"",S_FALSE},
6775 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6776 {"",S_FALSE},
6777 {".txt",S_OK},
6778 {"",S_FALSE},
6779 {"",S_FALSE},
6780 {"",S_FALSE},
6781 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6782 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6783 {"",S_FALSE},
6784 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6785 {"mk",S_OK},
6786 {"",S_FALSE},
6787 {"",S_FALSE}
6788 },
6789 {
6790 {Uri_HOST_UNKNOWN,S_OK},
6791 {0,S_FALSE},
6792 {URL_SCHEME_MK,S_OK},
6793 {URLZONE_INVALID,E_NOTIMPL}
6794 }
6795 },
6796 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6797 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6798 0,S_OK,FALSE,
6799 {
6800 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6801 {"",S_FALSE},
6802 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6803 {"",S_FALSE},
6804 {".txt",S_OK},
6805 {"",S_FALSE},
6806 {"",S_FALSE},
6807 {"",S_FALSE},
6808 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6809 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6810 {"",S_FALSE},
6811 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6812 {"mk",S_OK},
6813 {"",S_FALSE},
6814 {"",S_FALSE}
6815 },
6816 {
6817 {Uri_HOST_UNKNOWN,S_OK},
6818 {0,S_FALSE},
6819 {URL_SCHEME_MK,S_OK},
6820 {URLZONE_INVALID,E_NOTIMPL}
6821 }
6822 },
6823 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6824 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6825 0,S_OK,FALSE,
6826 {
6827 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6828 {"",S_FALSE},
6829 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6830 {"",S_FALSE},
6831 {".txt",S_OK},
6832 {"",S_FALSE},
6833 {"",S_FALSE},
6834 {"",S_FALSE},
6835 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6836 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6837 {"",S_FALSE},
6838 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6839 {"mk",S_OK},
6840 {"",S_FALSE},
6841 {"",S_FALSE}
6842 },
6843 {
6844 {Uri_HOST_UNKNOWN,S_OK},
6845 {0,S_FALSE},
6846 {URL_SCHEME_MK,S_OK},
6847 {URLZONE_INVALID,E_NOTIMPL}
6848 }
6849 },
6850 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6851 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6852 0,S_OK,FALSE,
6853 {
6854 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6855 {"",S_FALSE},
6856 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6857 {"",S_FALSE},
6858 {".txt",S_OK},
6859 {"",S_FALSE},
6860 {"",S_FALSE},
6861 {"",S_FALSE},
6862 {"@MSITSTORE:/relative/path.txt",S_OK},
6863 {"@MSITSTORE:/relative/path.txt",S_OK},
6864 {"",S_FALSE},
6865 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6866 {"mk",S_OK},
6867 {"",S_FALSE},
6868 {"",S_FALSE}
6869 },
6870 {
6871 {Uri_HOST_UNKNOWN,S_OK},
6872 {0,S_FALSE},
6873 {URL_SCHEME_MK,S_OK},
6874 {URLZONE_INVALID,E_NOTIMPL}
6875 }
6876 },
6877 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6878 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6879 0,S_OK,FALSE,
6880 {
6881 {"mk:@xxx:/relative/path.txt",S_OK},
6882 {"",S_FALSE},
6883 {"mk:@xxx:/relative/path.txt",S_OK},
6884 {"",S_FALSE},
6885 {".txt",S_OK},
6886 {"",S_FALSE},
6887 {"",S_FALSE},
6888 {"",S_FALSE},
6889 {"@xxx:/relative/path.txt",S_OK},
6890 {"@xxx:/relative/path.txt",S_OK},
6891 {"",S_FALSE},
6892 {"mk:@xxx:/relative/path.txt",S_OK},
6893 {"mk",S_OK},
6894 {"",S_FALSE},
6895 {"",S_FALSE}
6896 },
6897 {
6898 {Uri_HOST_UNKNOWN,S_OK},
6899 {0,S_FALSE},
6900 {URL_SCHEME_MK,S_OK},
6901 {URLZONE_INVALID,E_NOTIMPL}
6902 }
6903 },
6904 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6905 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6906 0,S_OK,FALSE,
6907 {
6908 {"mk:/relative/path.txt",S_OK},
6909 {"",S_FALSE},
6910 {"mk:/relative/path.txt",S_OK},
6911 {"",S_FALSE},
6912 {".txt",S_OK},
6913 {"",S_FALSE},
6914 {"",S_FALSE},
6915 {"",S_FALSE},
6916 {"/relative/path.txt",S_OK},
6917 {"/relative/path.txt",S_OK},
6918 {"",S_FALSE},
6919 {"mk:/relative/path.txt",S_OK},
6920 {"mk",S_OK},
6921 {"",S_FALSE},
6922 {"",S_FALSE}
6923 },
6924 {
6925 {Uri_HOST_UNKNOWN,S_OK},
6926 {0,S_FALSE},
6927 {URL_SCHEME_MK,S_OK},
6928 {URLZONE_INVALID,E_NOTIMPL}
6929 }
6930 },
6931 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6932 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6933 0,S_OK,FALSE,
6934 {
6935 {"ml:/relative/path.txt",S_OK},
6936 {"",S_FALSE},
6937 {"ml:/relative/path.txt",S_OK},
6938 {"",S_FALSE},
6939 {".txt",S_OK},
6940 {"",S_FALSE},
6941 {"",S_FALSE},
6942 {"",S_FALSE},
6943 {"/relative/path.txt",S_OK},
6944 {"/relative/path.txt",S_OK},
6945 {"",S_FALSE},
6946 {"ml:/relative/path.txt",S_OK},
6947 {"ml",S_OK},
6948 {"",S_FALSE},
6949 {"",S_FALSE}
6950 },
6951 {
6952 {Uri_HOST_UNKNOWN,S_OK},
6953 {0,S_FALSE},
6954 {URL_SCHEME_UNKNOWN,S_OK},
6955 {URLZONE_INVALID,E_NOTIMPL}
6956 }
6957 },
6958 { "http://winehq.org/dir/test?querystring",0,
6959 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
6960 0,S_OK,FALSE,
6961 {
6962 {"http://winehq.com/#hash",S_OK},
6963 {"winehq.com",S_OK},
6964 {"http://winehq.com/#hash",S_OK},
6965 {"winehq.com",S_OK},
6966 {"",S_FALSE},
6967 {"#hash",S_OK},
6968 {"winehq.com",S_OK},
6969 {"",S_FALSE},
6970 {"/",S_OK},
6971 {"/",S_OK},
6972 {"",S_FALSE},
6973 {"http://winehq.com/#hash",S_OK},
6974 {"http",S_OK},
6975 {"",S_FALSE},
6976 {"",S_FALSE}
6977 },
6978 {
6979 {Uri_HOST_DNS,S_OK},
6980 {80,S_OK,FALSE,TRUE},
6981 {URL_SCHEME_HTTP,S_OK},
6982 {URLZONE_INVALID,E_NOTIMPL}
6983 }
6984 },
6985 { "http://winehq.org/dir/test?querystring",0,
6986 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
6987 0,S_OK,FALSE,
6988 {
6989 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6990 {"winehq.com",S_OK},
6991 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6992 {"winehq.com",S_OK},
6993 {".txt",S_OK},
6994 {"#hash",S_OK},
6995 {"winehq.com",S_OK},
6996 {"",S_FALSE},
6997 {"/dir/file.txt",S_OK},
6998 {"/dir/file.txt?query",S_OK},
6999 {"?query",S_OK},
7000 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7001 {"http",S_OK},
7002 {"",S_FALSE},
7003 {"",S_FALSE}
7004 },
7005 {
7006 {Uri_HOST_DNS,S_OK},
7007 {80,S_OK,FALSE,TRUE},
7008 {URL_SCHEME_HTTP,S_OK},
7009 {URLZONE_INVALID,E_NOTIMPL}
7010 }
7011 },
7012 { "http://google.com/test",0,
7013 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7014 0,S_OK,FALSE,
7015 {
7016 {"file:///c:/test/",S_OK},
7017 {"",S_FALSE},
7018 {"file:///c:/test/",S_OK},
7019 {"",S_FALSE},
7020 {"",S_FALSE},
7021 {"",S_FALSE},
7022 {"",S_FALSE},
7023 {"",S_FALSE},
7024 {"/c:/test/",S_OK},
7025 {"/c:/test/",S_OK},
7026 {"",S_FALSE},
7027 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7028 {"file",S_OK},
7029 {"",S_FALSE},
7030 {"",S_FALSE}
7031 },
7032 {
7033 {Uri_HOST_UNKNOWN,S_OK},
7034 {0,S_FALSE},
7035 {URL_SCHEME_FILE,S_OK},
7036 {URLZONE_INVALID,E_NOTIMPL}
7037 }
7038 },
7039 { "http://google.com/test",0,
7040 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7041 0,S_OK,FALSE,
7042 {
7043 {"file:///c:/test/",S_OK},
7044 {"",S_FALSE},
7045 {"file:///c:/test/",S_OK},
7046 {"",S_FALSE},
7047 {"",S_FALSE},
7048 {"",S_FALSE},
7049 {"",S_FALSE},
7050 {"",S_FALSE},
7051 {"/c:/test/",S_OK},
7052 {"/c:/test/",S_OK},
7053 {"",S_FALSE},
7054 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7055 {"file",S_OK},
7056 {"",S_FALSE},
7057 {"",S_FALSE}
7058 },
7059 {
7060 {Uri_HOST_UNKNOWN,S_OK},
7061 {0,S_FALSE},
7062 {URL_SCHEME_FILE,S_OK},
7063 {URLZONE_INVALID,E_NOTIMPL}
7064 }
7065 },
7066 { "http://winehq.org",0,
7067 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7068 0,S_OK,FALSE,
7069 {
7070 {"mailto:",S_OK},
7071 {"",S_FALSE},
7072 {"mailto:",S_OK},
7073 {"",S_FALSE},
7074 {"",S_FALSE},
7075 {"",S_FALSE},
7076 {"",S_FALSE},
7077 {"",S_FALSE},
7078 {"",S_FALSE},
7079 {"",S_FALSE},
7080 {"",S_FALSE},
7081 {"mailto://",S_OK,FALSE,"mailto:"},
7082 {"mailto",S_OK},
7083 {"",S_FALSE},
7084 {"",S_FALSE}
7085 },
7086 {
7087 {Uri_HOST_UNKNOWN,S_OK},
7088 {0,S_FALSE},
7089 {URL_SCHEME_MAILTO,S_OK},
7090 {URLZONE_INVALID,E_NOTIMPL}
7091 }
7092 },
7093 { "http://winehq.org",0,
7094 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7095 0,S_OK,FALSE,
7096 {
7097 {"mailto:a@b.com",S_OK},
7098 {"",S_FALSE},
7099 {"mailto:a@b.com",S_OK},
7100 {"",S_FALSE},
7101 {".com",S_OK},
7102 {"",S_FALSE},
7103 {"",S_FALSE},
7104 {"",S_FALSE},
7105 {"a@b.com",S_OK},
7106 {"a@b.com",S_OK},
7107 {"",S_FALSE},
7108 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7109 {"mailto",S_OK},
7110 {"",S_FALSE},
7111 {"",S_FALSE}
7112 },
7113 {
7114 {Uri_HOST_UNKNOWN,S_OK},
7115 {0,S_FALSE},
7116 {URL_SCHEME_MAILTO,S_OK},
7117 {URLZONE_INVALID,E_NOTIMPL}
7118 }
7119 }
7120 };
7121
7122 typedef struct _uri_parse_test {
7123 const char *uri;
7124 DWORD uri_flags;
7125 PARSEACTION action;
7126 DWORD flags;
7127 const char *property;
7128 HRESULT expected;
7129 BOOL todo;
7130 } uri_parse_test;
7131
7132 static const uri_parse_test uri_parse_tests[] = {
7133 /* PARSE_CANONICALIZE tests. */
7134 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7135 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7136 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7137 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7138 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7139 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7140 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7141 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7142 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7143 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7144 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7145 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7146
7147 /* PARSE_FRIENDLY tests. */
7148 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7149 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7150
7151 /* PARSE_ROOTDOCUMENT tests. */
7152 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7153 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7154 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7155 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7156 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7157 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7158
7159 /* PARSE_DOCUMENT tests. */
7160 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7161 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7162 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7163 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7164 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7165 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7166
7167 /* PARSE_PATH_FROM_URL tests. */
7168 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7169 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7170 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7171 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7172 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7173
7174 /* PARSE_URL_FROM_PATH tests. */
7175 /* This function almost seems to useless (just returns the absolute uri). */
7176 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7177 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7178 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7179 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7180 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7181
7182 /* PARSE_SCHEMA tests. */
7183 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7184 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7185
7186 /* PARSE_SITE tests. */
7187 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7188 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7189 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7190 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7191
7192 /* PARSE_DOMAIN tests. */
7193 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7194 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7195 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7196 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7197
7198 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7199 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7200 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7201 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7202 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7203 };
7204
7205 static inline LPWSTR a2w(LPCSTR str) {
7206 LPWSTR ret = NULL;
7207
7208 if(str) {
7209 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7210 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7211 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7212 }
7213
7214 return ret;
7215 }
7216
7217 static inline BOOL heap_free(void* mem) {
7218 return HeapFree(GetProcessHeap(), 0, mem);
7219 }
7220
7221 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7222 LPWSTR strAW = a2w(strA);
7223 DWORD ret = lstrcmpW(strAW, strB);
7224 heap_free(strAW);
7225 return ret;
7226 }
7227
7228 static inline ULONG get_refcnt(IUri *uri) {
7229 IUri_AddRef(uri);
7230 return IUri_Release(uri);
7231 }
7232
7233 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7234 DWORD test_index) {
7235 HRESULT hr;
7236 LPWSTR valueW;
7237
7238 valueW = a2w(prop->value);
7239 switch(prop->property) {
7240 case Uri_PROPERTY_FRAGMENT:
7241 hr = IUriBuilder_SetFragment(builder, valueW);
7242 if(prop->todo) {
7243 todo_wine {
7244 ok(hr == prop->expected,
7245 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7246 hr, prop->expected, test_index);
7247 }
7248 } else {
7249 ok(hr == prop->expected,
7250 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7251 hr, prop->expected, test_index);
7252 }
7253 break;
7254 case Uri_PROPERTY_HOST:
7255 hr = IUriBuilder_SetHost(builder, valueW);
7256 if(prop->todo) {
7257 todo_wine {
7258 ok(hr == prop->expected,
7259 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7260 hr, prop->expected, test_index);
7261 }
7262 } else {
7263 ok(hr == prop->expected,
7264 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7265 hr, prop->expected, test_index);
7266 }
7267 break;
7268 case Uri_PROPERTY_PASSWORD:
7269 hr = IUriBuilder_SetPassword(builder, valueW);
7270 if(prop->todo) {
7271 todo_wine {
7272 ok(hr == prop->expected,
7273 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7274 hr, prop->expected, test_index);
7275 }
7276 } else {
7277 ok(hr == prop->expected,
7278 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7279 hr, prop->expected, test_index);
7280 }
7281 break;
7282 case Uri_PROPERTY_PATH:
7283 hr = IUriBuilder_SetPath(builder, valueW);
7284 if(prop->todo) {
7285 todo_wine {
7286 ok(hr == prop->expected,
7287 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7288 hr, prop->expected, test_index);
7289 }
7290 } else {
7291 ok(hr == prop->expected,
7292 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7293 hr, prop->expected, test_index);
7294 }
7295 break;
7296 case Uri_PROPERTY_QUERY:
7297 hr = IUriBuilder_SetQuery(builder, valueW);
7298 if(prop->todo) {
7299 todo_wine {
7300 ok(hr == prop->expected,
7301 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7302 hr, prop->expected, test_index);
7303 }
7304 } else {
7305 ok(hr == prop->expected,
7306 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7307 hr, prop->expected, test_index);
7308 }
7309 break;
7310 case Uri_PROPERTY_SCHEME_NAME:
7311 hr = IUriBuilder_SetSchemeName(builder, valueW);
7312 if(prop->todo) {
7313 todo_wine {
7314 ok(hr == prop->expected,
7315 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7316 hr, prop->expected, test_index);
7317 }
7318 } else {
7319 ok(hr == prop->expected,
7320 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7321 hr, prop->expected, test_index);
7322 }
7323 break;
7324 case Uri_PROPERTY_USER_NAME:
7325 hr = IUriBuilder_SetUserName(builder, valueW);
7326 if(prop->todo) {
7327 todo_wine {
7328 ok(hr == prop->expected,
7329 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7330 hr, prop->expected, test_index);
7331 }
7332 } else {
7333 ok(hr == prop->expected,
7334 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7335 hr, prop->expected, test_index);
7336 }
7337 break;
7338 default:
7339 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7340 }
7341
7342 heap_free(valueW);
7343 }
7344
7345 /*
7346 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7347 * correctly.
7348 */
7349 static void test_CreateUri_InvalidFlags(void) {
7350 DWORD i;
7351
7352 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7353 HRESULT hr;
7354 IUri *uri = (void*) 0xdeadbeef;
7355
7356 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7357 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7358 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7359 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7360 }
7361 }
7362
7363 static void test_CreateUri_InvalidArgs(void) {
7364 HRESULT hr;
7365 IUri *uri = (void*) 0xdeadbeef;
7366
7367 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7368 static const WCHAR emptyW[] = {0};
7369
7370 hr = pCreateUri(http_urlW, 0, 0, NULL);
7371 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7372
7373 hr = pCreateUri(NULL, 0, 0, &uri);
7374 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7375 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7376
7377 uri = (void*) 0xdeadbeef;
7378 hr = pCreateUri(invalidW, 0, 0, &uri);
7379 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7380 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7381
7382 uri = (void*) 0xdeadbeef;
7383 hr = pCreateUri(emptyW, 0, 0, &uri);
7384 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7385 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7386 }
7387
7388 static void test_CreateUri_InvalidUri(void) {
7389 DWORD i;
7390
7391 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7392 invalid_uri test = invalid_uri_tests[i];
7393 IUri *uri = NULL;
7394 LPWSTR uriW;
7395 HRESULT hr;
7396
7397 uriW = a2w(test.uri);
7398 hr = pCreateUri(uriW, test.flags, 0, &uri);
7399 if(test.todo) {
7400 todo_wine {
7401 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7402 hr, E_INVALIDARG, i);
7403 }
7404 } else {
7405 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7406 hr, E_INVALIDARG, i);
7407 }
7408 if(uri) IUri_Release(uri);
7409
7410 heap_free(uriW);
7411 }
7412 }
7413
7414 static void test_IUri_GetPropertyBSTR(void) {
7415 IUri *uri = NULL;
7416 HRESULT hr;
7417 DWORD i;
7418
7419 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7420 hr = pCreateUri(http_urlW, 0, 0, &uri);
7421 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7422 if(SUCCEEDED(hr)) {
7423 BSTR received = NULL;
7424
7425 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7426 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7427
7428 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
7429 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7430 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7431 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7432 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7433 SysFreeString(received);
7434
7435 /* Make sure it handles the ZONE property correctly. */
7436 received = NULL;
7437 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7438 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7439 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7440 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7441 SysFreeString(received);
7442 }
7443 if(uri) IUri_Release(uri);
7444
7445 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7446 uri_properties test = uri_tests[i];
7447 LPWSTR uriW;
7448 uri = NULL;
7449
7450 uriW = a2w(test.uri);
7451 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7452 if(test.create_todo) {
7453 todo_wine {
7454 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7455 hr, test.create_expected, i);
7456 }
7457 } else {
7458 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7459 hr, test.create_expected, i);
7460 }
7461
7462 if(SUCCEEDED(hr)) {
7463 DWORD j;
7464
7465 /* Checks all the string properties of the uri. */
7466 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7467 BSTR received = NULL;
7468 uri_str_property prop = test.str_props[j];
7469
7470 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7471 if(prop.todo) {
7472 todo_wine {
7473 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7474 hr, prop.expected, i, j);
7475 }
7476 todo_wine {
7477 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7478 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7479 prop.value, wine_dbgstr_w(received), i, j);
7480 }
7481 } else {
7482 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7483 hr, prop.expected, i, j);
7484 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7485 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7486 prop.value, wine_dbgstr_w(received), i, j);
7487 }
7488
7489 SysFreeString(received);
7490 }
7491 }
7492
7493 if(uri) IUri_Release(uri);
7494
7495 heap_free(uriW);
7496 }
7497 }
7498
7499 static void test_IUri_GetPropertyDWORD(void) {
7500 IUri *uri = NULL;
7501 HRESULT hr;
7502 DWORD i;
7503
7504 hr = pCreateUri(http_urlW, 0, 0, &uri);
7505 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7506 if(SUCCEEDED(hr)) {
7507 DWORD received = 0xdeadbeef;
7508
7509 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7510 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7511
7512 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7513 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7514 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7515 }
7516 if(uri) IUri_Release(uri);
7517
7518 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7519 uri_properties test = uri_tests[i];
7520 LPWSTR uriW;
7521 uri = NULL;
7522
7523 uriW = a2w(test.uri);
7524 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7525 if(test.create_todo) {
7526 todo_wine {
7527 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7528 hr, test.create_expected, i);
7529 }
7530 } else {
7531 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7532 hr, test.create_expected, i);
7533 }
7534
7535 if(SUCCEEDED(hr)) {
7536 DWORD j;
7537
7538 /* Checks all the DWORD properties of the uri. */
7539 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7540 DWORD received;
7541 uri_dword_property prop = test.dword_props[j];
7542
7543 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7544 if(prop.todo) {
7545 todo_wine {
7546 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7547 hr, prop.expected, i, j);
7548 }
7549 todo_wine {
7550 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7551 prop.value, received, i, j);
7552 }
7553 } else {
7554 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7555 hr, prop.expected, i, j);
7556 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7557 prop.value, received, i, j);
7558 }
7559 }
7560 }
7561
7562 if(uri) IUri_Release(uri);
7563
7564 heap_free(uriW);
7565 }
7566 }
7567
7568 /* Tests all the 'Get*' property functions which deal with strings. */
7569 static void test_IUri_GetStrProperties(void) {
7570 IUri *uri = NULL;
7571 HRESULT hr;
7572 DWORD i;
7573
7574 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7575 hr = pCreateUri(http_urlW, 0, 0, &uri);
7576 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7577 if(SUCCEEDED(hr)) {
7578 hr = IUri_GetAbsoluteUri(uri, NULL);
7579 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7580
7581 hr = IUri_GetAuthority(uri, NULL);
7582 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7583
7584 hr = IUri_GetDisplayUri(uri, NULL);
7585 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7586
7587 hr = IUri_GetDomain(uri, NULL);
7588 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7589
7590 hr = IUri_GetExtension(uri, NULL);
7591 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7592
7593 hr = IUri_GetFragment(uri, NULL);
7594 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7595
7596 hr = IUri_GetHost(uri, NULL);
7597 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7598
7599 hr = IUri_GetPassword(uri, NULL);
7600 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7601
7602 hr = IUri_GetPath(uri, NULL);
7603 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7604
7605 hr = IUri_GetPathAndQuery(uri, NULL);
7606 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7607
7608 hr = IUri_GetQuery(uri, NULL);
7609 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7610
7611 hr = IUri_GetRawUri(uri, NULL);
7612 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7613
7614 hr = IUri_GetSchemeName(uri, NULL);
7615 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7616
7617 hr = IUri_GetUserInfo(uri, NULL);
7618 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7619
7620 hr = IUri_GetUserName(uri, NULL);
7621 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7622 }
7623 if(uri) IUri_Release(uri);
7624
7625 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7626 uri_properties test = uri_tests[i];
7627 LPWSTR uriW;
7628 uri = NULL;
7629
7630 uriW = a2w(test.uri);
7631 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7632 if(test.create_todo) {
7633 todo_wine {
7634 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7635 hr, test.create_expected, i);
7636 }
7637 } else {
7638 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7639 hr, test.create_expected, i);
7640 }
7641
7642 if(SUCCEEDED(hr)) {
7643 uri_str_property prop;
7644 BSTR received = NULL;
7645
7646 /* GetAbsoluteUri() tests. */
7647 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7648 hr = IUri_GetAbsoluteUri(uri, &received);
7649 if(prop.todo) {
7650 todo_wine {
7651 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7652 hr, prop.expected, i);
7653 }
7654 todo_wine {
7655 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7656 "Error: Expected %s but got %s on uri_tests[%d].\n",
7657 prop.value, wine_dbgstr_w(received), i);
7658 }
7659 } else {
7660 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7661 hr, prop.expected, i);
7662 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7663 "Error: Expected %s but got %s on uri_tests[%d].\n",
7664 prop.value, wine_dbgstr_w(received), i);
7665 }
7666 SysFreeString(received);
7667 received = NULL;
7668
7669 /* GetAuthority() tests. */
7670 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7671 hr = IUri_GetAuthority(uri, &received);
7672 if(prop.todo) {
7673 todo_wine {
7674 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7675 hr, prop.expected, i);
7676 }
7677 todo_wine {
7678 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7679 prop.value, wine_dbgstr_w(received), i);
7680 }
7681 } else {
7682 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7683 hr, prop.expected, i);
7684 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7685 prop.value, wine_dbgstr_w(received), i);
7686 }
7687 SysFreeString(received);
7688 received = NULL;
7689
7690 /* GetDisplayUri() tests. */
7691 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7692 hr = IUri_GetDisplayUri(uri, &received);
7693 if(prop.todo) {
7694 todo_wine {
7695 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7696 hr, prop.expected, i);
7697 }
7698 todo_wine {
7699 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7700 "Error: Expected %s but got %s on uri_test[%d].\n",
7701 prop.value, wine_dbgstr_w(received), i);
7702 }
7703 } else {
7704 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7705 hr, prop.expected, i);
7706 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7707 "Error: Expected %s but got %s on uri_tests[%d].\n",
7708 prop.value, wine_dbgstr_w(received), i);
7709 }
7710 SysFreeString(received);
7711 received = NULL;
7712
7713 /* GetDomain() tests. */
7714 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7715 hr = IUri_GetDomain(uri, &received);
7716 if(prop.todo) {
7717 todo_wine {
7718 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7719 hr, prop.expected, i);
7720 }
7721 todo_wine {
7722 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7723 prop.value, wine_dbgstr_w(received), i);
7724 }
7725 } else {
7726 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7727 hr, prop.expected, i);
7728 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7729 prop.value, wine_dbgstr_w(received), i);
7730 }
7731 SysFreeString(received);
7732 received = NULL;
7733
7734 /* GetExtension() tests. */
7735 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7736 hr = IUri_GetExtension(uri, &received);
7737 if(prop.todo) {
7738 todo_wine {
7739 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7740 hr, prop.expected, i);
7741 }
7742 todo_wine {
7743 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7744 prop.value, wine_dbgstr_w(received), i);
7745 }
7746 } else {
7747 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7748 hr, prop.expected, i);
7749 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7750 prop.value, wine_dbgstr_w(received), i);
7751 }
7752 SysFreeString(received);
7753 received = NULL;
7754
7755 /* GetFragment() tests. */
7756 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7757 hr = IUri_GetFragment(uri, &received);
7758 if(prop.todo) {
7759 todo_wine {
7760 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7761 hr, prop.expected, i);
7762 }
7763 todo_wine {
7764 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7765 prop.value, wine_dbgstr_w(received), i);
7766 }
7767 } else {
7768 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7769 hr, prop.expected, i);
7770 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7771 prop.value, wine_dbgstr_w(received), i);
7772 }
7773 SysFreeString(received);
7774 received = NULL;
7775
7776 /* GetHost() tests. */
7777 prop = test.str_props[Uri_PROPERTY_HOST];
7778 hr = IUri_GetHost(uri, &received);
7779 if(prop.todo) {
7780 todo_wine {
7781 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7782 hr, prop.expected, i);
7783 }
7784 todo_wine {
7785 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7786 prop.value, wine_dbgstr_w(received), i);
7787 }
7788 } else {
7789 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7790 hr, prop.expected, i);
7791 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7792 prop.value, wine_dbgstr_w(received), i);
7793 }
7794 SysFreeString(received);
7795 received = NULL;
7796
7797 /* GetPassword() tests. */
7798 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7799 hr = IUri_GetPassword(uri, &received);
7800 if(prop.todo) {
7801 todo_wine {
7802 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7803 hr, prop.expected, i);
7804 }
7805 todo_wine {
7806 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7807 prop.value, wine_dbgstr_w(received), i);
7808 }
7809 } else {
7810 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7811 hr, prop.expected, i);
7812 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7813 prop.value, wine_dbgstr_w(received), i);
7814 }
7815 SysFreeString(received);
7816 received = NULL;
7817
7818 /* GetPath() tests. */
7819 prop = test.str_props[Uri_PROPERTY_PATH];
7820 hr = IUri_GetPath(uri, &received);
7821 if(prop.todo) {
7822 todo_wine {
7823 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7824 hr, prop.expected, i);
7825 }
7826 todo_wine {
7827 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7828 prop.value, wine_dbgstr_w(received), i);
7829 }
7830 } else {
7831 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7832 hr, prop.expected, i);
7833 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7834 prop.value, wine_dbgstr_w(received), i);
7835 }
7836 SysFreeString(received);
7837 received = NULL;
7838
7839 /* GetPathAndQuery() tests. */
7840 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7841 hr = IUri_GetPathAndQuery(uri, &received);
7842 if(prop.todo) {
7843 todo_wine {
7844 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7845 hr, prop.expected, i);
7846 }
7847 todo_wine {
7848 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7849 prop.value, wine_dbgstr_w(received), i);
7850 }
7851 } else {
7852 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7853 hr, prop.expected, i);
7854 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7855 prop.value, wine_dbgstr_w(received), i);
7856 }
7857 SysFreeString(received);
7858 received = NULL;
7859
7860 /* GetQuery() tests. */
7861 prop = test.str_props[Uri_PROPERTY_QUERY];
7862 hr = IUri_GetQuery(uri, &received);
7863 if(prop.todo) {
7864 todo_wine {
7865 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7866 hr, prop.expected, i);
7867 }
7868 todo_wine {
7869 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7870 prop.value, wine_dbgstr_w(received), i);
7871 }
7872 } else {
7873 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7874 hr, prop.expected, i);
7875 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7876 prop.value, wine_dbgstr_w(received), i);
7877 }
7878 SysFreeString(received);
7879 received = NULL;
7880
7881 /* GetRawUri() tests. */
7882 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7883 hr = IUri_GetRawUri(uri, &received);
7884 if(prop.todo) {
7885 todo_wine {
7886 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7887 hr, prop.expected, i);
7888 }
7889 todo_wine {
7890 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7891 prop.value, wine_dbgstr_w(received), i);
7892 }
7893 } else {
7894 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7895 hr, prop.expected, i);
7896 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7897 prop.value, wine_dbgstr_w(received), i);
7898 }
7899 SysFreeString(received);
7900 received = NULL;
7901
7902 /* GetSchemeName() tests. */
7903 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7904 hr = IUri_GetSchemeName(uri, &received);
7905 if(prop.todo) {
7906 todo_wine {
7907 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7908 hr, prop.expected, i);
7909 }
7910 todo_wine {
7911 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7912 prop.value, wine_dbgstr_w(received), i);
7913 }
7914 } else {
7915 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7916 hr, prop.expected, i);
7917 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7918 prop.value, wine_dbgstr_w(received), i);
7919 }
7920 SysFreeString(received);
7921 received = NULL;
7922
7923 /* GetUserInfo() tests. */
7924 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7925 hr = IUri_GetUserInfo(uri, &received);
7926 if(prop.todo) {
7927 todo_wine {
7928 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7929 hr, prop.expected, i);
7930 }
7931 todo_wine {
7932 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7933 prop.value, wine_dbgstr_w(received), i);
7934 }
7935 } else {
7936 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7937 hr, prop.expected, i);
7938 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7939 prop.value, wine_dbgstr_w(received), i);
7940 }
7941 SysFreeString(received);
7942 received = NULL;
7943
7944 /* GetUserName() tests. */
7945 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7946 hr = IUri_GetUserName(uri, &received);
7947 if(prop.todo) {
7948 todo_wine {
7949 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7950 hr, prop.expected, i);
7951 }
7952 todo_wine {
7953 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7954 prop.value, wine_dbgstr_w(received), i);
7955 }
7956 } else {
7957 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7958 hr, prop.expected, i);
7959 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7960 prop.value, wine_dbgstr_w(received), i);
7961 }
7962 SysFreeString(received);
7963 }
7964
7965 if(uri) IUri_Release(uri);
7966
7967 heap_free(uriW);
7968 }
7969 }
7970
7971 static void test_IUri_GetDwordProperties(void) {
7972 IUri *uri = NULL;
7973 HRESULT hr;
7974 DWORD i;
7975
7976 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7977 hr = pCreateUri(http_urlW, 0, 0, &uri);
7978 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7979 if(SUCCEEDED(hr)) {
7980 hr = IUri_GetHostType(uri, NULL);
7981 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7982
7983 hr = IUri_GetPort(uri, NULL);
7984 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7985
7986 hr = IUri_GetScheme(uri, NULL);
7987 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7988
7989 hr = IUri_GetZone(uri, NULL);
7990 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7991 }
7992 if(uri) IUri_Release(uri);
7993
7994 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7995 uri_properties test = uri_tests[i];
7996 LPWSTR uriW;
7997 uri = NULL;
7998
7999 uriW = a2w(test.uri);
8000 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8001 if(test.create_todo) {
8002 todo_wine {
8003 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8004 hr, test.create_expected, i);
8005 }
8006 } else {
8007 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8008 hr, test.create_expected, i);
8009 }
8010
8011 if(SUCCEEDED(hr)) {
8012 uri_dword_property prop;
8013 DWORD received;
8014
8015 /* Assign an insane value so tests don't accidentally pass when
8016 * they shouldn't!
8017 */
8018 received = -9999999;
8019
8020 /* GetHostType() tests. */
8021 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8022 hr = IUri_GetHostType(uri, &received);
8023 if(prop.todo) {
8024 todo_wine {
8025 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8026 hr, prop.expected, i);
8027 }
8028 todo_wine {
8029 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8030 }
8031 } else {
8032 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8033 hr, prop.expected, i);
8034 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8035 }
8036 received = -9999999;
8037
8038 /* GetPort() tests. */
8039 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8040 hr = IUri_GetPort(uri, &received);
8041 if(prop.todo) {
8042 todo_wine {
8043 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8044 hr, prop.expected, i);
8045 }
8046 todo_wine {
8047 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8048 }
8049 } else {
8050 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8051 hr, prop.expected, i);
8052 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8053 }
8054 received = -9999999;
8055
8056 /* GetScheme() tests. */
8057 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8058 hr = IUri_GetScheme(uri, &received);
8059 if(prop.todo) {
8060 todo_wine {
8061 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8062 hr, prop.expected, i);
8063 }
8064 todo_wine {
8065 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8066 }
8067 } else {
8068 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8069 hr, prop.expected, i);
8070 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8071 }
8072 received = -9999999;
8073
8074 /* GetZone() tests. */
8075 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8076 hr = IUri_GetZone(uri, &received);
8077 if(prop.todo) {
8078 todo_wine {
8079 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8080 hr, prop.expected, i);
8081 }
8082 todo_wine {
8083 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8084 }
8085 } else {
8086 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8087 hr, prop.expected, i);
8088 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8089 }
8090 }
8091
8092 if(uri) IUri_Release(uri);
8093
8094 heap_free(uriW);
8095 }
8096 }
8097
8098 static void test_IUri_GetPropertyLength(void) {
8099 IUri *uri = NULL;
8100 HRESULT hr;
8101 DWORD i;
8102
8103 /* Make sure it handles invalid args correctly. */
8104 hr = pCreateUri(http_urlW, 0, 0, &uri);
8105 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8106 if(SUCCEEDED(hr)) {
8107 DWORD received = 0xdeadbeef;
8108
8109 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8110 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8111
8112 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8113 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8114 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8115 }
8116 if(uri) IUri_Release(uri);
8117
8118 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8119 uri_properties test = uri_tests[i];
8120 LPWSTR uriW;
8121 uri = NULL;
8122
8123 uriW = a2w(test.uri);
8124 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8125 if(test.create_todo) {
8126 todo_wine {
8127 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8128 hr, test.create_expected, i);
8129 }
8130 } else {
8131 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8132 hr, test.create_expected, i);
8133 }
8134
8135 if(SUCCEEDED(hr)) {
8136 DWORD j;
8137
8138 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8139 DWORD expectedLen, brokenLen, receivedLen;
8140 uri_str_property prop = test.str_props[j];
8141
8142 expectedLen = lstrlen(prop.value);
8143 brokenLen = lstrlen(prop.broken_value);
8144
8145 /* This won't be necessary once GetPropertyLength is implemented. */
8146 receivedLen = -1;
8147
8148 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8149 if(prop.todo) {
8150 todo_wine {
8151 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8152 hr, prop.expected, i, j);
8153 }
8154 todo_wine {
8155 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
8156 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8157 expectedLen, receivedLen, i, j);
8158 }
8159 } else {
8160 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8161 hr, prop.expected, i, j);
8162 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
8163 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8164 expectedLen, receivedLen, i, j);
8165 }
8166 }
8167 }
8168
8169 if(uri) IUri_Release(uri);
8170
8171 heap_free(uriW);
8172 }
8173 }
8174
8175 static DWORD compute_expected_props(uri_properties *test)
8176 {
8177 DWORD ret = 0, i;
8178
8179 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8180 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8181 ret |= 1<<i;
8182 }
8183
8184 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8185 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8186 ret |= 1<<i;
8187 }
8188
8189 return ret;
8190 }
8191
8192 static void test_IUri_GetProperties(void) {
8193 IUri *uri = NULL;
8194 HRESULT hr;
8195 DWORD i;
8196
8197 hr = pCreateUri(http_urlW, 0, 0, &uri);
8198 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8199 if(SUCCEEDED(hr)) {
8200 hr = IUri_GetProperties(uri, NULL);
8201 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8202 }
8203 if(uri) IUri_Release(uri);
8204
8205 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8206 uri_properties test = uri_tests[i];
8207 LPWSTR uriW;
8208 uri = NULL;
8209
8210 uriW = a2w(test.uri);
8211 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8212 if(test.create_todo) {
8213 todo_wine {
8214 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8215 }
8216 } else {
8217 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8218 }
8219
8220 if(SUCCEEDED(hr)) {
8221 DWORD received = 0, expected_props;
8222 DWORD j;
8223
8224 hr = IUri_GetProperties(uri, &received);
8225 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8226
8227 expected_props = compute_expected_props(&test);
8228
8229 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8230 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8231 if(expected_props & (1 << j))
8232 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8233 else
8234 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8235 }
8236 }
8237
8238 if(uri) IUri_Release(uri);
8239
8240 heap_free(uriW);
8241 }
8242 }
8243
8244 static void test_IUri_HasProperty(void) {
8245 IUri *uri = NULL;
8246 HRESULT hr;
8247 DWORD i;
8248
8249 hr = pCreateUri(http_urlW, 0, 0, &uri);
8250 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8251 if(SUCCEEDED(hr)) {
8252 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8253 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8254 }
8255 if(uri) IUri_Release(uri);
8256
8257 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8258 uri_properties test = uri_tests[i];
8259 LPWSTR uriW;
8260 uri = NULL;
8261
8262 uriW = a2w(test.uri);
8263
8264 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8265 if(test.create_todo) {
8266 todo_wine {
8267 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8268 }
8269 } else {
8270 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8271 }
8272
8273 if(SUCCEEDED(hr)) {
8274 DWORD expected_props, j;
8275
8276 expected_props = compute_expected_props(&test);
8277
8278 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8279 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8280 BOOL received = -1;
8281
8282 hr = IUri_HasProperty(uri, j, &received);
8283 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8284 hr, S_OK, j, i);
8285
8286 if(expected_props & (1 << j)) {
8287 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8288 } else {
8289 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8290 }
8291 }
8292 }
8293
8294 if(uri) IUri_Release(uri);
8295
8296 heap_free(uriW);
8297 }
8298 }
8299
8300 static void test_IUri_IsEqual(void) {
8301 IUri *uriA, *uriB;
8302 BOOL equal;
8303 HRESULT hres;
8304 DWORD i;
8305
8306 uriA = uriB = NULL;
8307
8308 /* Make sure IsEqual handles invalid args correctly. */
8309 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8310 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8311 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8312 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8313
8314 equal = -1;
8315 hres = IUri_IsEqual(uriA, NULL, &equal);
8316 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8317 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8318
8319 hres = IUri_IsEqual(uriA, uriB, NULL);
8320 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8321
8322 IUri_Release(uriA);
8323 IUri_Release(uriB);
8324
8325 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8326 uri_equality test = equality_tests[i];
8327 LPWSTR uriA_W, uriB_W;
8328
8329 uriA = uriB = NULL;
8330
8331 uriA_W = a2w(test.a);
8332 uriB_W = a2w(test.b);
8333
8334 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8335 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8336
8337 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8338 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8339
8340 equal = -1;
8341 hres = IUri_IsEqual(uriA, uriB, &equal);
8342 if(test.todo) todo_wine {
8343 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8344 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8345 } else {
8346 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8347 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8348 }
8349 if(uriA) IUri_Release(uriA);
8350 if(uriB) IUri_Release(uriB);
8351
8352 heap_free(uriA_W);
8353 heap_free(uriB_W);
8354 }
8355 }
8356
8357 static void test_CreateUriWithFragment_InvalidArgs(void) {
8358 HRESULT hr;
8359 IUri *uri = (void*) 0xdeadbeef;
8360 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8361
8362 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8363 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8364 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8365
8366 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8367 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8368
8369 /* Original URI can't already contain a fragment component. */
8370 uri = (void*) 0xdeadbeef;
8371 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8372 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8373 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8374 }
8375
8376 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8377 static void test_CreateUriWithFragment_InvalidFlags(void) {
8378 DWORD i;
8379
8380 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8381 HRESULT hr;
8382 IUri *uri = (void*) 0xdeadbeef;
8383
8384 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8385 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8386 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8387 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8388 }
8389 }
8390
8391 static void test_CreateUriWithFragment(void) {
8392 DWORD i;
8393
8394 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8395 HRESULT hr;
8396 IUri *uri = NULL;
8397 LPWSTR uriW, fragW;
8398 uri_with_fragment test = uri_fragment_tests[i];
8399
8400 uriW = a2w(test.uri);
8401 fragW = a2w(test.fragment);
8402
8403 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8404 if(test.expected_todo) {
8405 todo_wine {
8406 ok(hr == test.create_expected,
8407 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8408 hr, test.create_expected, i);
8409 }
8410 } else
8411 ok(hr == test.create_expected,
8412 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8413 hr, test.create_expected, i);
8414
8415 if(SUCCEEDED(hr)) {
8416 BSTR received = NULL;
8417
8418 hr = IUri_GetAbsoluteUri(uri, &received);
8419 if(test.expected_todo) {
8420 todo_wine {
8421 ok(hr == S_OK,
8422 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8423 hr, S_OK, i);
8424 }
8425 todo_wine {
8426 ok(!strcmp_aw(test.expected_uri, received),
8427 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8428 test.expected_uri, wine_dbgstr_w(received), i);
8429 }
8430 } else {
8431 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8432 hr, S_OK, i);
8433 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8434 test.expected_uri, wine_dbgstr_w(received), i);
8435 }
8436
8437 SysFreeString(received);
8438 }
8439
8440 if(uri) IUri_Release(uri);
8441 heap_free(uriW);
8442 heap_free(fragW);
8443 }
8444 }
8445
8446 static void test_CreateIUriBuilder(void) {
8447 HRESULT hr;
8448 IUriBuilder *builder = NULL;
8449 IUri *uri;
8450
8451 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8452 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8453 hr, E_POINTER);
8454
8455 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8456 hr = pCreateUri(http_urlW, 0, 0, &uri);
8457 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8458 if(SUCCEEDED(hr)) {
8459 ULONG cur_count, orig_count;
8460
8461 orig_count = get_refcnt(uri);
8462 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8463 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8464 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8465
8466 cur_count = get_refcnt(uri);
8467 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8468
8469 if(builder) IUriBuilder_Release(builder);
8470 cur_count = get_refcnt(uri);
8471 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8472 }
8473 if(uri) IUri_Release(uri);
8474 }
8475
8476 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8477 DWORD test_index) {
8478 HRESULT hr;
8479 IUri *uri = NULL;
8480
8481 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8482 if(test->uri_todo) {
8483 todo_wine {
8484 ok(hr == test->uri_hres,
8485 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8486 hr, test->uri_hres, test_index);
8487 }
8488 } else {
8489 ok(hr == test->uri_hres,
8490 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8491 hr, test->uri_hres, test_index);
8492 }
8493
8494 if(SUCCEEDED(hr)) {
8495 DWORD i;
8496
8497 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8498 uri_builder_str_property prop = test->expected_str_props[i];
8499 BSTR received = NULL;
8500
8501 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8502 if(prop.todo) {
8503 todo_wine {
8504 ok(hr == prop.result,
8505 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8506 hr, prop.result, test_index, i);
8507 }
8508 } else {
8509 ok(hr == prop.result,
8510 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8511 hr, prop.result, test_index, i);
8512 }
8513 if(SUCCEEDED(hr)) {
8514 if(prop.todo) {
8515 todo_wine {
8516 ok(!strcmp_aw(prop.expected, received),
8517 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8518 prop.expected, wine_dbgstr_w(received), test_index, i);
8519 }
8520 } else {
8521 ok(!strcmp_aw(prop.expected, received),
8522 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8523 prop.expected, wine_dbgstr_w(received), test_index, i);
8524 }
8525 }
8526 SysFreeString(received);
8527 }
8528
8529 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8530 uri_builder_dword_property prop = test->expected_dword_props[i];
8531 DWORD received = -2;
8532
8533 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8534 if(prop.todo) {
8535 todo_wine {
8536 ok(hr == prop.result,
8537 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8538 hr, prop.result, test_index, i);
8539 }
8540 } else {
8541 ok(hr == prop.result,
8542 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8543 hr, prop.result, test_index, i);
8544 }
8545 if(SUCCEEDED(hr)) {
8546 if(prop.todo) {
8547 todo_wine {
8548 ok(received == prop.expected,
8549 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8550 prop.expected, received, test_index, i);
8551 }
8552 } else {
8553 ok(received == prop.expected,
8554 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8555 prop.expected, received, test_index, i);
8556 }
8557 }
8558 }
8559 }
8560 if(uri) IUri_Release(uri);
8561 }
8562
8563 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8564 DWORD test_index) {
8565 HRESULT hr;
8566 IUri *uri = NULL;
8567
8568 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8569 if(test->uri_simple_todo) {
8570 todo_wine {
8571 ok(hr == test->uri_simple_hres,
8572 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8573 hr, test->uri_simple_hres, test_index);
8574 }
8575 } else {
8576 ok(hr == test->uri_simple_hres,
8577 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8578 hr, test->uri_simple_hres, test_index);
8579 }
8580
8581 if(SUCCEEDED(hr)) {
8582 DWORD i;
8583
8584 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8585 uri_builder_str_property prop = test->expected_str_props[i];
8586 BSTR received = NULL;
8587
8588 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8589 if(prop.todo) {
8590 todo_wine {
8591 ok(hr == prop.result,
8592 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8593 hr, prop.result, test_index, i);
8594 }
8595 } else {
8596 ok(hr == prop.result,
8597 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8598 hr, prop.result, test_index, i);
8599 }
8600 if(SUCCEEDED(hr)) {
8601 if(prop.todo) {
8602 todo_wine {
8603 ok(!strcmp_aw(prop.expected, received),
8604 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8605 prop.expected, wine_dbgstr_w(received), test_index, i);
8606 }
8607 } else {
8608 ok(!strcmp_aw(prop.expected, received),
8609 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8610 prop.expected, wine_dbgstr_w(received), test_index, i);
8611 }
8612 }
8613 SysFreeString(received);
8614 }
8615
8616 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8617 uri_builder_dword_property prop = test->expected_dword_props[i];
8618 DWORD received = -2;
8619
8620 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8621 if(prop.todo) {
8622 todo_wine {
8623 ok(hr == prop.result,
8624 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8625 hr, prop.result, test_index, i);
8626 }
8627 } else {
8628 ok(hr == prop.result,
8629 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8630 hr, prop.result, test_index, i);
8631 }
8632 if(SUCCEEDED(hr)) {
8633 if(prop.todo) {
8634 todo_wine {
8635 ok(received == prop.expected,
8636 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8637 prop.expected, received, test_index, i);
8638 }
8639 } else {
8640 ok(received == prop.expected,
8641 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8642 prop.expected, received, test_index, i);
8643 }
8644 }
8645 }
8646 }
8647 if(uri) IUri_Release(uri);
8648 }
8649
8650 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8651 DWORD test_index) {
8652 HRESULT hr;
8653 IUri *uri = NULL;
8654
8655 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8656 test->uri_with_encode_flags, 0, &uri);
8657 if(test->uri_with_todo) {
8658 todo_wine {
8659 ok(hr == test->uri_with_hres,
8660 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8661 hr, test->uri_with_hres, test_index);
8662 }
8663 } else {
8664 ok(hr == test->uri_with_hres,
8665 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8666 hr, test->uri_with_hres, test_index);
8667 }
8668
8669 if(SUCCEEDED(hr)) {
8670 DWORD i;
8671
8672 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8673 uri_builder_str_property prop = test->expected_str_props[i];
8674 BSTR received = NULL;
8675
8676 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8677 if(prop.todo) {
8678 todo_wine {
8679 ok(hr == prop.result,
8680 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8681 hr, prop.result, test_index, i);
8682 }
8683 } else {
8684 ok(hr == prop.result,
8685 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8686 hr, prop.result, test_index, i);
8687 }
8688 if(SUCCEEDED(hr)) {
8689 if(prop.todo) {
8690 todo_wine {
8691 ok(!strcmp_aw(prop.expected, received),
8692 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8693 prop.expected, wine_dbgstr_w(received), test_index, i);
8694 }
8695 } else {
8696 ok(!strcmp_aw(prop.expected, received),
8697 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8698 prop.expected, wine_dbgstr_w(received), test_index, i);
8699 }
8700 }
8701 SysFreeString(received);
8702 }
8703
8704 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8705 uri_builder_dword_property prop = test->expected_dword_props[i];
8706 DWORD received = -2;
8707
8708 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8709 if(prop.todo) {
8710 todo_wine {
8711 ok(hr == prop.result,
8712 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8713 hr, prop.result, test_index, i);
8714 }
8715 } else {
8716 ok(hr == prop.result,
8717 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8718 hr, prop.result, test_index, i);
8719 }
8720 if(SUCCEEDED(hr)) {
8721 if(prop.todo) {
8722 todo_wine {
8723 ok(received == prop.expected,
8724 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8725 prop.expected, received, test_index, i);
8726 }
8727 } else {
8728 ok(received == prop.expected,
8729 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8730 prop.expected, received, test_index, i);
8731 }
8732 }
8733 }
8734 }
8735 if(uri) IUri_Release(uri);
8736 }
8737
8738 static void test_IUriBuilder_CreateInvalidArgs(void) {
8739 IUriBuilder *builder;
8740 HRESULT hr;
8741
8742 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8743 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8744 if(SUCCEEDED(hr)) {
8745 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8746
8747 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8748 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8749 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8750
8751 uri = (void*) 0xdeadbeef;
8752 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8753 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8754 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8755
8756 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8757 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8758 hr, E_POINTER);
8759
8760 uri = (void*) 0xdeadbeef;
8761 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8762 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8763 hr, E_NOTIMPL);
8764 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8765
8766 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8767 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8768 hr, E_POINTER);
8769
8770 uri = (void*) 0xdeadbeef;
8771 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8772 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8773 hr, E_NOTIMPL);
8774 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8775
8776 hr = pCreateUri(http_urlW, 0, 0, &test);
8777 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8778 if(SUCCEEDED(hr)) {
8779 hr = IUriBuilder_SetIUri(builder, test);
8780 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8781
8782 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8783 uri = NULL;
8784 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8785 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8786 ok(uri != NULL, "Error: The uri was NULL.\n");
8787 if(uri) IUri_Release(uri);
8788
8789 uri = NULL;
8790 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8791 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8792 hr, S_OK);
8793 ok(uri != NULL, "Error: uri was NULL.\n");
8794 if(uri) IUri_Release(uri);
8795
8796 uri = NULL;
8797 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8798 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8799 hr, S_OK);
8800 ok(uri != NULL, "Error: uri was NULL.\n");
8801 if(uri) IUri_Release(uri);
8802
8803 hr = IUriBuilder_SetFragment(builder, NULL);
8804 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8805
8806 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8807 uri = (void*) 0xdeadbeef;
8808 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8809 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8810 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8811
8812 uri = (void*) 0xdeadbeef;
8813 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8814 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8815 hr, S_OK);
8816 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8817
8818 uri = (void*) 0xdeadbeef;
8819 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8820 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8821 hr, E_NOTIMPL);
8822 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8823 }
8824 if(test) IUri_Release(test);
8825 }
8826 if(builder) IUriBuilder_Release(builder);
8827 }
8828
8829 /* Tests invalid args to the "Get*" functions. */
8830 static void test_IUriBuilder_GetInvalidArgs(void) {
8831 IUriBuilder *builder = NULL;
8832 HRESULT hr;
8833
8834 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8835 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8836 if(SUCCEEDED(hr)) {
8837 LPCWSTR received = (void*) 0xdeadbeef;
8838 DWORD len = -1, port = -1;
8839 BOOL set = -1;
8840
8841 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8842 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8843 hr, E_POINTER);
8844 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8845 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8846 hr, E_POINTER);
8847 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8848 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8849 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8850 hr, E_POINTER);
8851 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8852
8853 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8854 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8855 hr, E_POINTER);
8856 received = (void*) 0xdeadbeef;
8857 hr = IUriBuilder_GetHost(builder, NULL, &received);
8858 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8859 hr, E_POINTER);
8860 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8861 len = -1;
8862 hr = IUriBuilder_GetHost(builder, &len, NULL);
8863 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8864 hr, E_POINTER);
8865 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8866
8867 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8868 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8869 hr, E_POINTER);
8870 received = (void*) 0xdeadbeef;
8871 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8872 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8873 hr, E_POINTER);
8874 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8875 len = -1;
8876 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8877 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8878 hr, E_POINTER);
8879 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8880
8881 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8882 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8883 hr, E_POINTER);
8884 received = (void*) 0xdeadbeef;
8885 hr = IUriBuilder_GetPath(builder, NULL, &received);
8886 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8887 hr, E_POINTER);
8888 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8889 len = -1;
8890 hr = IUriBuilder_GetPath(builder, &len, NULL);
8891 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8892 hr, E_POINTER);
8893 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8894
8895 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8896 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8897 hr, E_POINTER);
8898 hr = IUriBuilder_GetPort(builder, NULL, &port);
8899 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8900 hr, E_POINTER);
8901 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8902 hr = IUriBuilder_GetPort(builder, &set, NULL);
8903 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8904 hr, E_POINTER);
8905 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8906
8907 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8908 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8909 hr, E_POINTER);
8910 received = (void*) 0xdeadbeef;
8911 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8912 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8913 hr, E_POINTER);
8914 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8915 len = -1;
8916 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8917 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8918 hr, E_POINTER);
8919 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8920
8921 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8922 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8923 hr, E_POINTER);
8924 received = (void*) 0xdeadbeef;
8925 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8926 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8927 hr, E_POINTER);
8928 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8929 len = -1;
8930 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8931 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8932 hr, E_POINTER);
8933 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8934
8935 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8936 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8937 hr, E_POINTER);
8938 received = (void*) 0xdeadbeef;
8939 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8940 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8941 hr, E_POINTER);
8942 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8943 len = -1;
8944 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8945 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8946 hr, E_POINTER);
8947 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8948 }
8949 if(builder) IUriBuilder_Release(builder);
8950 }
8951
8952 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8953 DWORD test_index) {
8954 HRESULT hr;
8955 DWORD i;
8956 LPCWSTR received = NULL;
8957 DWORD len = -1;
8958 const uri_builder_property *prop = NULL;
8959
8960 /* Check if the property was set earlier. */
8961 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8962 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8963 prop = &(test->properties[i]);
8964 }
8965
8966 if(prop) {
8967 /* Use expected_value unless it's NULL, then use value. */
8968 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8969 hr = IUriBuilder_GetFragment(builder, &len, &received);
8970 if(prop->todo) {
8971 todo_wine {
8972 ok(hr == (expected ? S_OK : S_FALSE),
8973 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8974 hr, (expected ? S_OK : S_FALSE), test_index);
8975 }
8976 if(SUCCEEDED(hr)) {
8977 todo_wine {
8978 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8979 expected, wine_dbgstr_w(received), test_index);
8980 }
8981 todo_wine {
8982 ok(lstrlen(expected) == len,
8983 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8984 lstrlen(expected), len, test_index);
8985 }
8986 }
8987 } else {
8988 ok(hr == (expected ? S_OK : S_FALSE),
8989 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8990 hr, (expected ? S_OK : S_FALSE), test_index);
8991 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8992 expected, wine_dbgstr_w(received), test_index);
8993 ok(lstrlen(expected) == len,
8994 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8995 lstrlen(expected), len, test_index);
8996 }
8997 } else {
8998 /* The property wasn't set earlier, so it should return whatever
8999 * the base IUri contains (if anything).
9000 */
9001 IUri *uri = NULL;
9002 hr = IUriBuilder_GetIUri(builder, &uri);
9003 ok(hr == S_OK,
9004 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9005 hr, S_OK, test_index);
9006 if(SUCCEEDED(hr)) {
9007 if(!uri) {
9008 received = (void*) 0xdeadbeef;
9009 len = -1;
9010
9011 hr = IUriBuilder_GetFragment(builder, &len, &received);
9012 ok(hr == S_FALSE,
9013 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9014 hr, S_FALSE, test_index);
9015 if(SUCCEEDED(hr)) {
9016 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9017 len, test_index);
9018 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9019 received, test_index);
9020 }
9021 } else {
9022 BOOL has_prop = FALSE;
9023 BSTR expected = NULL;
9024
9025 hr = IUri_GetFragment(uri, &expected);
9026 ok(SUCCEEDED(hr),
9027 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9028 hr, test_index);
9029 has_prop = hr == S_OK;
9030
9031 hr = IUriBuilder_GetFragment(builder, &len, &received);
9032 if(has_prop) {
9033 ok(hr == S_OK,
9034 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9035 hr, S_OK, test_index);
9036 if(SUCCEEDED(hr)) {
9037 ok(!lstrcmpW(expected, received),
9038 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9039 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9040 ok(lstrlenW(expected) == len,
9041 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9042 lstrlenW(expected), len, test_index);
9043 }
9044 } else {
9045 ok(hr == S_FALSE,
9046 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9047 hr, S_FALSE, test_index);
9048 if(SUCCEEDED(hr)) {
9049 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9050 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9051 len, test_index);
9052 }
9053 }
9054 SysFreeString(expected);
9055 }
9056 }
9057 if(uri) IUri_Release(uri);
9058 }
9059 }
9060
9061 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9062 DWORD test_index) {
9063 HRESULT hr;
9064 DWORD i;
9065 LPCWSTR received = NULL;
9066 DWORD len = -1;
9067 const uri_builder_property *prop = NULL;
9068
9069 /* Check if the property was set earlier. */
9070 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9071 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9072 prop = &(test->properties[i]);
9073 }
9074
9075 if(prop) {
9076 /* Use expected_value unless it's NULL, then use value. */
9077 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9078 hr = IUriBuilder_GetHost(builder, &len, &received);
9079 if(prop->todo) {
9080 todo_wine {
9081 ok(hr == (expected ? S_OK : S_FALSE),
9082 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9083 hr, (expected ? S_OK : S_FALSE), test_index);
9084 }
9085 if(SUCCEEDED(hr)) {
9086 todo_wine {
9087 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9088 expected, wine_dbgstr_w(received), test_index);
9089 }
9090 todo_wine {
9091 ok(lstrlen(expected) == len,
9092 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9093 lstrlen(expected), len, test_index);
9094 }
9095 }
9096 } else {
9097 ok(hr == (expected ? S_OK : S_FALSE),
9098 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9099 hr, (expected ? S_OK : S_FALSE), test_index);
9100 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9101 expected, wine_dbgstr_w(received), test_index);
9102 ok(lstrlen(expected) == len,
9103 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9104 lstrlen(expected), len, test_index);
9105 }
9106 } else {
9107 /* The property wasn't set earlier, so it should return whatever
9108 * the base IUri contains (if anything).
9109 */
9110 IUri *uri = NULL;
9111 hr = IUriBuilder_GetIUri(builder, &uri);
9112 ok(hr == S_OK,
9113 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9114 hr, S_OK, test_index);
9115 if(SUCCEEDED(hr)) {
9116 if(!uri) {
9117 received = (void*) 0xdeadbeef;
9118 len = -1;
9119
9120 hr = IUriBuilder_GetHost(builder, &len, &received);
9121 ok(hr == S_FALSE,
9122 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9123 hr, S_FALSE, test_index);
9124 if(SUCCEEDED(hr)) {
9125 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9126 len, test_index);
9127 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9128 received, test_index);
9129 }
9130 } else {
9131 BOOL has_prop = FALSE;
9132 BSTR expected = NULL;
9133
9134 hr = IUri_GetHost(uri, &expected);
9135 ok(SUCCEEDED(hr),
9136 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9137 hr, test_index);
9138 has_prop = hr == S_OK;
9139
9140 hr = IUriBuilder_GetHost(builder, &len, &received);
9141 if(has_prop) {
9142 ok(hr == S_OK,
9143 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9144 hr, S_OK, test_index);
9145 if(SUCCEEDED(hr)) {
9146 ok(!lstrcmpW(expected, received),
9147 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9148 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9149 ok(lstrlenW(expected) == len,
9150 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9151 lstrlenW(expected), len, test_index);
9152 }
9153 } else {
9154 ok(hr == S_FALSE,
9155 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9156 hr, S_FALSE, test_index);
9157 if(SUCCEEDED(hr)) {
9158 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9159 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9160 len, test_index);
9161 }
9162 }
9163 SysFreeString(expected);
9164 }
9165 }
9166 if(uri) IUri_Release(uri);
9167 }
9168 }
9169
9170 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9171 DWORD test_index) {
9172 HRESULT hr;
9173 DWORD i;
9174 LPCWSTR received = NULL;
9175 DWORD len = -1;
9176 const uri_builder_property *prop = NULL;
9177
9178 /* Check if the property was set earlier. */
9179 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9180 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9181 prop = &(test->properties[i]);
9182 }
9183
9184 if(prop) {
9185 /* Use expected_value unless it's NULL, then use value. */
9186 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9187 hr = IUriBuilder_GetPassword(builder, &len, &received);
9188 if(prop->todo) {
9189 todo_wine {
9190 ok(hr == (expected ? S_OK : S_FALSE),
9191 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9192 hr, (expected ? S_OK : S_FALSE), test_index);
9193 }
9194 if(SUCCEEDED(hr)) {
9195 todo_wine {
9196 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9197 expected, wine_dbgstr_w(received), test_index);
9198 }
9199 todo_wine {
9200 ok(lstrlen(expected) == len,
9201 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9202 lstrlen(expected), len, test_index);
9203 }
9204 }
9205 } else {
9206 ok(hr == (expected ? S_OK : S_FALSE),
9207 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9208 hr, (expected ? S_OK : S_FALSE), test_index);
9209 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9210 expected, wine_dbgstr_w(received), test_index);
9211 ok(lstrlen(expected) == len,
9212 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9213 lstrlen(expected), len, test_index);
9214 }
9215 } else {
9216 /* The property wasn't set earlier, so it should return whatever
9217 * the base IUri contains (if anything).
9218 */
9219 IUri *uri = NULL;
9220 hr = IUriBuilder_GetIUri(builder, &uri);
9221 ok(hr == S_OK,
9222 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9223 hr, S_OK, test_index);
9224 if(SUCCEEDED(hr)) {
9225 if(!uri) {
9226 received = (void*) 0xdeadbeef;
9227 len = -1;
9228
9229 hr = IUriBuilder_GetPassword(builder, &len, &received);
9230 ok(hr == S_FALSE,
9231 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9232 hr, S_FALSE, test_index);
9233 if(SUCCEEDED(hr)) {
9234 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9235 len, test_index);
9236 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9237 received, test_index);
9238 }
9239 } else {
9240 BOOL has_prop = FALSE;
9241 BSTR expected = NULL;
9242
9243 hr = IUri_GetPassword(uri, &expected);
9244 ok(SUCCEEDED(hr),
9245 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9246 hr, test_index);
9247 has_prop = hr == S_OK;
9248
9249 hr = IUriBuilder_GetPassword(builder, &len, &received);
9250 if(has_prop) {
9251 ok(hr == S_OK,
9252 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9253 hr, S_OK, test_index);
9254 if(SUCCEEDED(hr)) {
9255 ok(!lstrcmpW(expected, received),
9256 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9257 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9258 ok(lstrlenW(expected) == len,
9259 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9260 lstrlenW(expected), len, test_index);
9261 }
9262 } else {
9263 ok(hr == S_FALSE,
9264 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9265 hr, S_FALSE, test_index);
9266 if(SUCCEEDED(hr)) {
9267 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9268 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9269 len, test_index);
9270 }
9271 }
9272 SysFreeString(expected);
9273 }
9274 }
9275 if(uri) IUri_Release(uri);
9276 }
9277 }
9278
9279 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9280 DWORD test_index) {
9281 HRESULT hr;
9282 DWORD i;
9283 LPCWSTR received = NULL;
9284 DWORD len = -1;
9285 const uri_builder_property *prop = NULL;
9286
9287 /* Check if the property was set earlier. */
9288 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9289 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9290 prop = &(test->properties[i]);
9291 }
9292
9293 if(prop) {
9294 /* Use expected_value unless it's NULL, then use value. */
9295 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9296 hr = IUriBuilder_GetPath(builder, &len, &received);
9297 if(prop->todo) {
9298 todo_wine {
9299 ok(hr == (expected ? S_OK : S_FALSE),
9300 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9301 hr, (expected ? S_OK : S_FALSE), test_index);
9302 }
9303 if(SUCCEEDED(hr)) {
9304 todo_wine {
9305 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9306 expected, wine_dbgstr_w(received), test_index);
9307 }
9308 todo_wine {
9309 ok(lstrlen(expected) == len,
9310 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9311 lstrlen(expected), len, test_index);
9312 }
9313 }
9314 } else {
9315 ok(hr == (expected ? S_OK : S_FALSE),
9316 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9317 hr, (expected ? S_OK : S_FALSE), test_index);
9318 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9319 expected, wine_dbgstr_w(received), test_index);
9320 ok(lstrlen(expected) == len,
9321 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9322 lstrlen(expected), len, test_index);
9323 }
9324 } else {
9325 /* The property wasn't set earlier, so it should return whatever
9326 * the base IUri contains (if anything).
9327 */
9328 IUri *uri = NULL;
9329 hr = IUriBuilder_GetIUri(builder, &uri);
9330 ok(hr == S_OK,
9331 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9332 hr, S_OK, test_index);
9333 if(SUCCEEDED(hr)) {
9334 if(!uri) {
9335 received = (void*) 0xdeadbeef;
9336 len = -1;
9337
9338 hr = IUriBuilder_GetPath(builder, &len, &received);
9339 ok(hr == S_FALSE,
9340 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9341 hr, S_FALSE, test_index);
9342 if(SUCCEEDED(hr)) {
9343 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9344 len, test_index);
9345 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9346 received, test_index);
9347 }
9348 } else {
9349 BOOL has_prop = FALSE;
9350 BSTR expected = NULL;
9351
9352 hr = IUri_GetPath(uri, &expected);
9353 ok(SUCCEEDED(hr),
9354 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9355 hr, test_index);
9356 has_prop = hr == S_OK;
9357
9358 hr = IUriBuilder_GetPath(builder, &len, &received);
9359 if(has_prop) {
9360 ok(hr == S_OK,
9361 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9362 hr, S_OK, test_index);
9363 if(SUCCEEDED(hr)) {
9364 ok(!lstrcmpW(expected, received),
9365 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9366 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9367 ok(lstrlenW(expected) == len,
9368 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9369 lstrlenW(expected), len, test_index);
9370 }
9371 } else {
9372 ok(hr == S_FALSE,
9373 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9374 hr, S_FALSE, test_index);
9375 if(SUCCEEDED(hr)) {
9376 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9377 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9378 len, test_index);
9379 }
9380 }
9381 SysFreeString(expected);
9382 }
9383 }
9384 if(uri) IUri_Release(uri);
9385 }
9386 }
9387
9388 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9389 DWORD test_index) {
9390 HRESULT hr;
9391 BOOL has_port = FALSE;
9392 DWORD received = -1;
9393
9394 if(test->port_prop.change) {
9395 DWORD expected = test->port_prop.value;
9396
9397 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9398 if(test->port_prop.todo) {
9399 todo_wine {
9400 ok(hr == S_OK,
9401 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9402 hr, S_OK, test_index);
9403 }
9404 if(SUCCEEDED(hr)) {
9405 todo_wine {
9406 ok(has_port == test->port_prop.set,
9407 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9408 test->port_prop.set, has_port, test_index);
9409 }
9410 todo_wine {
9411 ok(received == expected,
9412 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9413 expected, received, test_index);
9414 }
9415 }
9416 } else {
9417 ok(hr == S_OK,
9418 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9419 hr, S_OK, test_index);
9420 ok(has_port == test->port_prop.set,
9421 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9422 test->port_prop.set, has_port, test_index);
9423 ok(received == test->port_prop.value,
9424 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9425 test->port_prop.value, received, test_index);
9426 }
9427 } else {
9428 IUri *uri = NULL;
9429
9430 hr = IUriBuilder_GetIUri(builder, &uri);
9431 ok(hr == S_OK,
9432 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9433 hr, S_OK, test_index);
9434 if(SUCCEEDED(hr)) {
9435 if(!uri) {
9436 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9437 ok(hr == S_OK,
9438 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9439 hr, S_OK, test_index);
9440 if(SUCCEEDED(hr)) {
9441 ok(has_port == FALSE,
9442 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9443 has_port, test_index);
9444 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9445 received, test_index);
9446 }
9447 } else {
9448 DWORD expected;
9449
9450 hr = IUri_GetPort(uri, &expected);
9451 ok(SUCCEEDED(hr),
9452 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9453 hr, test_index);
9454
9455 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9456 ok(hr == S_OK,
9457 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9458 hr, S_OK, test_index);
9459 if(SUCCEEDED(hr)) {
9460 ok(!has_port,
9461 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9462 test_index);
9463 ok(received == expected,
9464 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9465 expected, received, test_index);
9466 }
9467 }
9468 }
9469 if(uri) IUri_Release(uri);
9470 }
9471 }
9472
9473 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9474 DWORD test_index) {
9475 HRESULT hr;
9476 DWORD i;
9477 LPCWSTR received = NULL;
9478 DWORD len = -1;
9479 const uri_builder_property *prop = NULL;
9480
9481 /* Check if the property was set earlier. */
9482 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9483 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9484 prop = &(test->properties[i]);
9485 }
9486
9487 if(prop) {
9488 /* Use expected_value unless it's NULL, then use value. */
9489 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9490 hr = IUriBuilder_GetQuery(builder, &len, &received);
9491 if(prop->todo) {
9492 todo_wine {
9493 ok(hr == (expected ? S_OK : S_FALSE),
9494 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9495 hr, (expected ? S_OK : S_FALSE), test_index);
9496 }
9497 if(SUCCEEDED(hr)) {
9498 todo_wine {
9499 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9500 expected, wine_dbgstr_w(received), test_index);
9501 }
9502 todo_wine {
9503 ok(lstrlen(expected) == len,
9504 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9505 lstrlen(expected), len, test_index);
9506 }
9507 }
9508 } else {
9509 ok(hr == (expected ? S_OK : S_FALSE),
9510 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9511 hr, (expected ? S_OK : S_FALSE), test_index);
9512 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9513 expected, wine_dbgstr_w(received), test_index);
9514 ok(lstrlen(expected) == len,
9515 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9516 lstrlen(expected), len, test_index);
9517 }
9518 } else {
9519 /* The property wasn't set earlier, so it should return whatever
9520 * the base IUri contains (if anything).
9521 */
9522 IUri *uri = NULL;
9523 hr = IUriBuilder_GetIUri(builder, &uri);
9524 ok(hr == S_OK,
9525 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9526 hr, S_OK, test_index);
9527 if(SUCCEEDED(hr)) {
9528 if(!uri) {
9529 received = (void*) 0xdeadbeef;
9530 len = -1;
9531
9532 hr = IUriBuilder_GetQuery(builder, &len, &received);
9533 ok(hr == S_FALSE,
9534 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9535 hr, S_FALSE, test_index);
9536 if(SUCCEEDED(hr)) {
9537 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9538 len, test_index);
9539 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9540 received, test_index);
9541 }
9542 } else {
9543 BOOL has_prop = FALSE;
9544 BSTR expected = NULL;
9545
9546 hr = IUri_GetQuery(uri, &expected);
9547 ok(SUCCEEDED(hr),
9548 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9549 hr, test_index);
9550 has_prop = hr == S_OK;
9551
9552 hr = IUriBuilder_GetQuery(builder, &len, &received);
9553 if(has_prop) {
9554 ok(hr == S_OK,
9555 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9556 hr, S_OK, test_index);
9557 if(SUCCEEDED(hr)) {
9558 ok(!lstrcmpW(expected, received),
9559 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9560 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9561 ok(lstrlenW(expected) == len,
9562 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9563 lstrlenW(expected), len, test_index);
9564 }
9565 } else {
9566 ok(hr == S_FALSE,
9567 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9568 hr, S_FALSE, test_index);
9569 if(SUCCEEDED(hr)) {
9570 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9571 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9572 len, test_index);
9573 }
9574 }
9575 SysFreeString(expected);
9576 }
9577 }
9578 if(uri) IUri_Release(uri);
9579 }
9580 }
9581
9582 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9583 DWORD test_index) {
9584 HRESULT hr;
9585 DWORD i;
9586 LPCWSTR received = NULL;
9587 DWORD len = -1;
9588 const uri_builder_property *prop = NULL;
9589
9590 /* Check if the property was set earlier. */
9591 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9592 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9593 prop = &(test->properties[i]);
9594 }
9595
9596 if(prop) {
9597 /* Use expected_value unless it's NULL, then use value. */
9598 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9599 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9600 if(prop->todo) {
9601 todo_wine {
9602 ok(hr == (expected ? S_OK : S_FALSE),
9603 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9604 hr, (expected ? S_OK : S_FALSE), test_index);
9605 }
9606 if(SUCCEEDED(hr)) {
9607 todo_wine {
9608 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9609 expected, wine_dbgstr_w(received), test_index);
9610 }
9611 todo_wine {
9612 ok(lstrlen(expected) == len,
9613 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9614 lstrlen(expected), len, test_index);
9615 }
9616 }
9617 } else {
9618 ok(hr == (expected ? S_OK : S_FALSE),
9619 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9620 hr, (expected ? S_OK : S_FALSE), test_index);
9621 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9622 expected, wine_dbgstr_w(received), test_index);
9623 ok(lstrlen(expected) == len,
9624 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9625 lstrlen(expected), len, test_index);
9626 }
9627 } else {
9628 /* The property wasn't set earlier, so it should return whatever
9629 * the base IUri contains (if anything).
9630 */
9631 IUri *uri = NULL;
9632 hr = IUriBuilder_GetIUri(builder, &uri);
9633 ok(hr == S_OK,
9634 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9635 hr, S_OK, test_index);
9636 if(SUCCEEDED(hr)) {
9637 if(!uri) {
9638 received = (void*) 0xdeadbeef;
9639 len = -1;
9640
9641 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9642 ok(hr == S_FALSE,
9643 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9644 hr, S_FALSE, test_index);
9645 if(SUCCEEDED(hr)) {
9646 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9647 len, test_index);
9648 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9649 received, test_index);
9650 }
9651 } else {
9652 BOOL has_prop = FALSE;
9653 BSTR expected = NULL;
9654
9655 hr = IUri_GetSchemeName(uri, &expected);
9656 ok(SUCCEEDED(hr),
9657 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9658 hr, test_index);
9659 has_prop = hr == S_OK;
9660
9661 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9662 if(has_prop) {
9663 ok(hr == S_OK,
9664 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9665 hr, S_OK, test_index);
9666 if(SUCCEEDED(hr)) {
9667 ok(!lstrcmpW(expected, received),
9668 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9669 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9670 ok(lstrlenW(expected) == len,
9671 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9672 lstrlenW(expected), len, test_index);
9673 }
9674 } else {
9675 ok(hr == S_FALSE,
9676 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9677 hr, S_FALSE, test_index);
9678 if(SUCCEEDED(hr)) {
9679 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9680 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9681 len, test_index);
9682 }
9683 }
9684 SysFreeString(expected);
9685 }
9686 }
9687 if(uri) IUri_Release(uri);
9688 }
9689 }
9690
9691 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9692 DWORD test_index) {
9693 HRESULT hr;
9694 DWORD i;
9695 LPCWSTR received = NULL;
9696 DWORD len = -1;
9697 const uri_builder_property *prop = NULL;
9698
9699 /* Check if the property was set earlier. */
9700 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9701 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9702 prop = &(test->properties[i]);
9703 }
9704
9705 if(prop && prop->value && *prop->value) {
9706 /* Use expected_value unless it's NULL, then use value. */
9707 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9708 hr = IUriBuilder_GetUserName(builder, &len, &received);
9709 if(prop->todo) {
9710 todo_wine {
9711 ok(hr == (expected ? S_OK : S_FALSE),
9712 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9713 hr, (expected ? S_OK : S_FALSE), test_index);
9714 }
9715 if(SUCCEEDED(hr)) {
9716 todo_wine {
9717 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9718 expected, wine_dbgstr_w(received), test_index);
9719 }
9720 todo_wine {
9721 ok(lstrlen(expected) == len,
9722 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9723 lstrlen(expected), len, test_index);
9724 }
9725 }
9726 } else {
9727 ok(hr == (expected ? S_OK : S_FALSE),
9728 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9729 hr, (expected ? S_OK : S_FALSE), test_index);
9730 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9731 expected, wine_dbgstr_w(received), test_index);
9732 ok(lstrlen(expected) == len,
9733 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9734 lstrlen(expected), len, test_index);
9735 }
9736 } else {
9737 /* The property wasn't set earlier, so it should return whatever
9738 * the base IUri contains (if anything).
9739 */
9740 IUri *uri = NULL;
9741 hr = IUriBuilder_GetIUri(builder, &uri);
9742 ok(hr == S_OK,
9743 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9744 hr, S_OK, test_index);
9745 if(SUCCEEDED(hr)) {
9746 if(!uri) {
9747 received = (void*) 0xdeadbeef;
9748 len = -1;
9749
9750 hr = IUriBuilder_GetUserName(builder, &len, &received);
9751 ok(hr == S_FALSE,
9752 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9753 hr, S_FALSE, test_index);
9754 if(SUCCEEDED(hr)) {
9755 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9756 len, test_index);
9757 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9758 received, test_index);
9759 }
9760 } else {
9761 BSTR expected = NULL;
9762 BOOL has_prop = FALSE;
9763
9764 hr = IUri_GetUserName(uri, &expected);
9765 ok(SUCCEEDED(hr),
9766 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9767 hr, test_index);
9768 has_prop = hr == S_OK;
9769
9770 hr = IUriBuilder_GetUserName(builder, &len, &received);
9771 if(has_prop) {
9772 ok(hr == S_OK,
9773 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9774 hr, S_OK, test_index);
9775 if(SUCCEEDED(hr)) {
9776 ok(!lstrcmpW(expected, received),
9777 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9778 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9779 ok(lstrlenW(expected) == len,
9780 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9781 lstrlenW(expected), len, test_index);
9782 }
9783 } else {
9784 ok(hr == S_FALSE,
9785 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9786 hr, S_FALSE, test_index);
9787 if(SUCCEEDED(hr)) {
9788 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9789 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9790 len, test_index);
9791 }
9792 }
9793 SysFreeString(expected);
9794 }
9795 }
9796 if(uri) IUri_Release(uri);
9797 }
9798 }
9799
9800 /* Tests IUriBuilder functions. */
9801 static void test_IUriBuilder(void) {
9802 HRESULT hr;
9803 IUriBuilder *builder;
9804 DWORD i;
9805
9806 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9807 IUri *uri = NULL;
9808 uri_builder_test test = uri_builder_tests[i];
9809 LPWSTR uriW = NULL;
9810
9811 if(test.uri) {
9812 uriW = a2w(test.uri);
9813 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9814 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9815 hr, S_OK, i);
9816 if(FAILED(hr)) continue;
9817 }
9818 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9819 if(test.create_builder_todo) {
9820 todo_wine {
9821 ok(hr == test.create_builder_expected,
9822 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9823 hr, test.create_builder_expected, i);
9824 }
9825 } else {
9826 ok(hr == test.create_builder_expected,
9827 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9828 hr, test.create_builder_expected, i);
9829 }
9830 if(SUCCEEDED(hr)) {
9831 DWORD j;
9832 BOOL modified = FALSE, received = FALSE;
9833
9834 /* Perform all the string property changes. */
9835 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9836 uri_builder_property prop = test.properties[j];
9837 if(prop.change) {
9838 change_property(builder, &prop, i);
9839 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9840 prop.property != Uri_PROPERTY_HOST)
9841 modified = TRUE;
9842 else if(prop.value && *prop.value)
9843 modified = TRUE;
9844 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9845 /* Host name property can't be NULL, but it can be empty. */
9846 modified = TRUE;
9847 }
9848 }
9849
9850 if(test.port_prop.change) {
9851 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9852 modified = TRUE;
9853 if(test.port_prop.todo) {
9854 todo_wine {
9855 ok(hr == test.port_prop.expected,
9856 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9857 hr, test.port_prop.expected, i);
9858 }
9859 } else {
9860 ok(hr == test.port_prop.expected,
9861 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9862 hr, test.port_prop.expected, i);
9863 }
9864 }
9865
9866 hr = IUriBuilder_HasBeenModified(builder, &received);
9867 ok(hr == S_OK,
9868 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9869 hr, S_OK, i);
9870 if(SUCCEEDED(hr))
9871 ok(received == modified,
9872 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9873 modified, received, i);
9874
9875 /* Test the "Get*" functions. */
9876 test_IUriBuilder_GetFragment(builder, &test, i);
9877 test_IUriBuilder_GetHost(builder, &test, i);
9878 test_IUriBuilder_GetPassword(builder, &test, i);
9879 test_IUriBuilder_GetPath(builder, &test, i);
9880 test_IUriBuilder_GetPort(builder, &test, i);
9881 test_IUriBuilder_GetQuery(builder, &test, i);
9882 test_IUriBuilder_GetSchemeName(builder, &test, i);
9883 test_IUriBuilder_GetUserName(builder, &test, i);
9884
9885 test_IUriBuilder_CreateUri(builder, &test, i);
9886 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9887 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9888 }
9889 if(builder) IUriBuilder_Release(builder);
9890 if(uri) IUri_Release(uri);
9891 heap_free(uriW);
9892 }
9893 }
9894
9895 static void test_IUriBuilder_HasBeenModified(void) {
9896 HRESULT hr;
9897 IUriBuilder *builder = NULL;
9898
9899 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9900 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9901 if(SUCCEEDED(hr)) {
9902 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9903 IUri *uri = NULL;
9904 BOOL received;
9905
9906 hr = IUriBuilder_HasBeenModified(builder, NULL);
9907 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9908 hr, E_POINTER);
9909
9910 hr = IUriBuilder_SetHost(builder, hostW);
9911 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9912 hr, S_OK);
9913
9914 hr = IUriBuilder_HasBeenModified(builder, &received);
9915 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9916 hr, S_OK);
9917 if(SUCCEEDED(hr))
9918 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9919
9920 hr = pCreateUri(http_urlW, 0, 0, &uri);
9921 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9922 if(SUCCEEDED(hr)) {
9923 LPCWSTR prop;
9924 DWORD len = -1;
9925
9926 hr = IUriBuilder_SetIUri(builder, uri);
9927 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9928 hr, S_OK);
9929
9930 hr = IUriBuilder_HasBeenModified(builder, &received);
9931 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9932 hr, S_OK);
9933 if(SUCCEEDED(hr))
9934 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9935
9936 /* Test what happens with you call SetIUri with the same IUri again. */
9937 hr = IUriBuilder_SetHost(builder, hostW);
9938 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9939
9940 hr = IUriBuilder_HasBeenModified(builder, &received);
9941 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9942 hr, S_OK);
9943 if(SUCCEEDED(hr))
9944 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9945
9946 hr = IUriBuilder_SetIUri(builder, uri);
9947 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9948
9949 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9950 * reset any of the changes that were made to the IUriBuilder.
9951 */
9952 hr = IUriBuilder_HasBeenModified(builder, &received);
9953 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9954 if(SUCCEEDED(hr))
9955 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9956
9957 hr = IUriBuilder_GetHost(builder, &len, &prop);
9958 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9959 if(SUCCEEDED(hr)) {
9960 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9961 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9962 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9963 lstrlenW(hostW), len);
9964 }
9965
9966 hr = IUriBuilder_SetIUri(builder, NULL);
9967 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9968
9969 hr = IUriBuilder_SetHost(builder, hostW);
9970 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9971 hr = IUriBuilder_HasBeenModified(builder, &received);
9972 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9973 hr, S_OK);
9974 if(SUCCEEDED(hr))
9975 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9976
9977 hr = IUriBuilder_SetIUri(builder, NULL);
9978 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9979
9980 hr = IUriBuilder_HasBeenModified(builder, &received);
9981 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9982 hr, S_OK);
9983 if(SUCCEEDED(hr))
9984 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9985
9986 hr = IUriBuilder_GetHost(builder, &len, &prop);
9987 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9988 if(SUCCEEDED(hr)) {
9989 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9990 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9991 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9992 lstrlenW(hostW), len);
9993 }
9994 }
9995 if(uri) IUri_Release(uri);
9996 }
9997 if(builder) IUriBuilder_Release(builder);
9998 }
9999
10000 /* Test IUriBuilder {Get,Set}IUri functions. */
10001 static void test_IUriBuilder_IUriProperty(void) {
10002 IUriBuilder *builder = NULL;
10003 HRESULT hr;
10004
10005 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10006 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10007 if(SUCCEEDED(hr)) {
10008 IUri *uri = NULL;
10009
10010 hr = IUriBuilder_GetIUri(builder, NULL);
10011 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10012 hr, E_POINTER);
10013
10014 hr = pCreateUri(http_urlW, 0, 0, &uri);
10015 if(SUCCEEDED(hr)) {
10016 IUri *test = NULL;
10017 ULONG cur_count, orig_count;
10018
10019 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10020 orig_count = get_refcnt(uri);
10021 hr = IUriBuilder_SetIUri(builder, uri);
10022 cur_count = get_refcnt(uri);
10023 if(SUCCEEDED(hr))
10024 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10025 orig_count+1, cur_count);
10026
10027 hr = IUriBuilder_SetIUri(builder, NULL);
10028 cur_count = get_refcnt(uri);
10029 if(SUCCEEDED(hr))
10030 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10031 orig_count, cur_count);
10032
10033 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10034 hr = IUriBuilder_SetIUri(builder, uri);
10035 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10036 orig_count = get_refcnt(uri);
10037
10038 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10039 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10040 if(SUCCEEDED(hr)) {
10041 cur_count = get_refcnt(uri);
10042 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10043 orig_count+1, cur_count);
10044 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10045 uri, test);
10046 }
10047 if(test) IUri_Release(test);
10048
10049 test = NULL;
10050 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10051 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10052 if(SUCCEEDED(hr)) {
10053 cur_count = get_refcnt(uri);
10054 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10055 orig_count+1, cur_count);
10056 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10057 }
10058 if(test) IUri_Release(test);
10059
10060 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10061 * the base IUri.
10062 */
10063 test = NULL;
10064 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10065 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10066 if(SUCCEEDED(hr))
10067 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10068
10069 if(test) IUri_Release(test);
10070
10071 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10072 * explicitly set (because it's a default flags).
10073 */
10074 test = NULL;
10075 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10076 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10077 if(SUCCEEDED(hr)) {
10078 cur_count = get_refcnt(uri);
10079 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10080 orig_count+1, cur_count);
10081 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10082 }
10083 if(test) IUri_Release(test);
10084
10085 test = NULL;
10086 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10087 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10088 if(SUCCEEDED(hr)) {
10089 cur_count = get_refcnt(uri);
10090 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10091 orig_count+1, cur_count);
10092 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10093 }
10094 if(test) IUri_Release(test);
10095
10096 test = NULL;
10097 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10098 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10099 hr, S_OK);
10100 if(SUCCEEDED(hr)) {
10101 cur_count = get_refcnt(uri);
10102 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10103 orig_count+1, cur_count);
10104 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10105 }
10106 if(test) IUri_Release(test);
10107
10108 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10109 * the base IUri.
10110 */
10111 test = NULL;
10112 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10113 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10114 if(SUCCEEDED(hr))
10115 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10116
10117 if(test) IUri_Release(test);
10118
10119 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10120 * explicitly set (because it's a default flags).
10121 */
10122 test = NULL;
10123 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10124 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10125 if(SUCCEEDED(hr)) {
10126 cur_count = get_refcnt(uri);
10127 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10128 orig_count+1, cur_count);
10129 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10130 }
10131 if(test) IUri_Release(test);
10132 }
10133 if(uri) IUri_Release(uri);
10134 }
10135 if(builder) IUriBuilder_Release(builder);
10136 }
10137
10138 static void test_IUriBuilder_RemoveProperties(void) {
10139 IUriBuilder *builder = NULL;
10140 HRESULT hr;
10141 DWORD i;
10142
10143 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10144 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10145 if(SUCCEEDED(hr)) {
10146 /* Properties that can't be removed. */
10147 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10148 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10149
10150 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10151 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10152 if((i << 1) & invalid) {
10153 ok(hr == E_INVALIDARG,
10154 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10155 hr, E_INVALIDARG, i);
10156 } else {
10157 ok(hr == S_OK,
10158 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10159 hr, S_OK, i);
10160 }
10161 }
10162
10163 /* Also doesn't accept anything that's outside the range of the
10164 * Uri_HAS flags.
10165 */
10166 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10167 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10168 hr, E_INVALIDARG);
10169 }
10170 if(builder) IUriBuilder_Release(builder);
10171
10172 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
10173 uri_builder_remove_test test = uri_builder_remove_tests[i];
10174 IUri *uri = NULL;
10175 LPWSTR uriW;
10176
10177 uriW = a2w(test.uri);
10178 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10179 if(SUCCEEDED(hr)) {
10180 builder = NULL;
10181
10182 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10183 if(test.create_builder_todo) {
10184 todo_wine {
10185 ok(hr == test.create_builder_expected,
10186 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10187 hr, test.create_builder_expected, i);
10188 }
10189 } else {
10190 ok(hr == test.create_builder_expected,
10191 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10192 hr, test.create_builder_expected, i);
10193 }
10194 if(SUCCEEDED(hr)) {
10195 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10196 if(test.remove_todo) {
10197 todo_wine {
10198 ok(hr == test.remove_expected,
10199 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10200 hr, test.remove_expected, i);
10201 }
10202 } else {
10203 ok(hr == test.remove_expected,
10204 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10205 hr, test.remove_expected, i);
10206 }
10207 if(SUCCEEDED(hr)) {
10208 IUri *result = NULL;
10209
10210 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10211 if(test.expected_todo) {
10212 todo_wine {
10213 ok(hr == test.expected_hres,
10214 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10215 hr, test.expected_hres, i);
10216 }
10217 } else {
10218 ok(hr == test.expected_hres,
10219 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10220 hr, test.expected_hres, i);
10221 }
10222 if(SUCCEEDED(hr)) {
10223 BSTR received = NULL;
10224
10225 hr = IUri_GetAbsoluteUri(result, &received);
10226 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10227 ok(!strcmp_aw(test.expected_uri, received),
10228 "Error: Expected %s but got %s instead on test %d.\n",
10229 test.expected_uri, wine_dbgstr_w(received), i);
10230 SysFreeString(received);
10231 }
10232 if(result) IUri_Release(result);
10233 }
10234 }
10235 if(builder) IUriBuilder_Release(builder);
10236 }
10237 if(uri) IUri_Release(uri);
10238 heap_free(uriW);
10239 }
10240 }
10241
10242 static void test_IUriBuilder_Misc(void) {
10243 HRESULT hr;
10244 IUri *uri;
10245
10246 hr = pCreateUri(http_urlW, 0, 0, &uri);
10247 if(SUCCEEDED(hr)) {
10248 IUriBuilder *builder;
10249
10250 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10251 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10252 if(SUCCEEDED(hr)) {
10253 BOOL has = -1;
10254 DWORD port = -1;
10255
10256 hr = IUriBuilder_GetPort(builder, &has, &port);
10257 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10258 if(SUCCEEDED(hr)) {
10259 /* 'has' will be set to FALSE, even though uri had a port. */
10260 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10261 /* Still sets 'port' to 80. */
10262 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10263 }
10264 }
10265 if(builder) IUriBuilder_Release(builder);
10266 }
10267 if(uri) IUri_Release(uri);
10268 }
10269
10270 static void test_IUriBuilderFactory(void) {
10271 HRESULT hr;
10272 IUri *uri;
10273 IUriBuilderFactory *factory;
10274 IUriBuilder *builder;
10275
10276 hr = pCreateUri(http_urlW, 0, 0, &uri);
10277 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10278 if(SUCCEEDED(hr)) {
10279 factory = NULL;
10280 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10281 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10282 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10283
10284 if(SUCCEEDED(hr)) {
10285 builder = (void*) 0xdeadbeef;
10286 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10287 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10288 hr, E_INVALIDARG);
10289 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10290
10291 builder = (void*) 0xdeadbeef;
10292 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10293 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10294 hr, E_INVALIDARG);
10295 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10296
10297 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10298 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10299 hr, E_POINTER);
10300
10301 builder = NULL;
10302 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10303 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10304 hr, S_OK);
10305 if(SUCCEEDED(hr)) {
10306 IUri *tmp = (void*) 0xdeadbeef;
10307 LPCWSTR result;
10308 DWORD result_len;
10309
10310 hr = IUriBuilder_GetIUri(builder, &tmp);
10311 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10312 hr, S_OK);
10313 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10314
10315 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10316 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10317 hr, S_FALSE);
10318 }
10319 if(builder) IUriBuilder_Release(builder);
10320
10321 builder = (void*) 0xdeadbeef;
10322 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10323 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10324 hr, E_INVALIDARG);
10325 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10326
10327 builder = (void*) 0xdeadbeef;
10328 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10329 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10330 hr, E_INVALIDARG);
10331 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10332
10333 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10334 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10335 hr, E_POINTER);
10336
10337 builder = NULL;
10338 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10339 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10340 hr, S_OK);
10341 if(SUCCEEDED(hr)) {
10342 IUri *tmp = NULL;
10343
10344 hr = IUriBuilder_GetIUri(builder, &tmp);
10345 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10346 hr, S_OK);
10347 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10348 if(uri) IUri_Release(uri);
10349 }
10350 if(builder) IUriBuilder_Release(builder);
10351 }
10352 if(factory) IUriBuilderFactory_Release(factory);
10353 }
10354 if(uri) IUri_Release(uri);
10355 }
10356
10357 static void test_CoInternetCombineIUri(void) {
10358 HRESULT hr;
10359 IUri *base, *relative, *result;
10360 DWORD i;
10361
10362 base = NULL;
10363 hr = pCreateUri(http_urlW, 0, 0, &base);
10364 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10365 if(SUCCEEDED(hr)) {
10366 result = (void*) 0xdeadbeef;
10367 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10368 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10369 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10370 }
10371
10372 relative = NULL;
10373 hr = pCreateUri(http_urlW, 0, 0, &relative);
10374 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10375 if(SUCCEEDED(hr)) {
10376 result = (void*) 0xdeadbeef;
10377 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10378 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10379 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10380 }
10381
10382 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10383 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10384
10385 if(base) IUri_Release(base);
10386 if(relative) IUri_Release(relative);
10387
10388 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10389 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10390
10391 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10392 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10393 if(SUCCEEDED(hr)) {
10394 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10395
10396 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10397 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10398 if(SUCCEEDED(hr)) {
10399 result = NULL;
10400
10401 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10402 if(uri_combine_tests[i].todo) {
10403 todo_wine {
10404 ok(hr == uri_combine_tests[i].expected,
10405 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10406 hr, uri_combine_tests[i].expected, i);
10407 }
10408 } else {
10409 ok(hr == uri_combine_tests[i].expected,
10410 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10411 hr, uri_combine_tests[i]. expected, i);
10412 }
10413 if(SUCCEEDED(hr)) {
10414 DWORD j;
10415
10416 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10417 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10418 BSTR received;
10419
10420 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10421 if(prop.todo) {
10422 todo_wine {
10423 ok(hr == prop.expected,
10424 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10425 hr, prop.expected, i, j);
10426 }
10427 todo_wine {
10428 ok(!strcmp_aw(prop.value, received) ||
10429 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10430 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10431 prop.value, wine_dbgstr_w(received), i, j);
10432 }
10433 } else {
10434 ok(hr == prop.expected,
10435 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10436 hr, prop.expected, i, j);
10437 ok(!strcmp_aw(prop.value, received) ||
10438 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10439 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10440 prop.value, wine_dbgstr_w(received), i, j);
10441 }
10442 SysFreeString(received);
10443 }
10444
10445 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10446 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10447 DWORD received;
10448
10449 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10450 if(prop.todo) {
10451 todo_wine {
10452 ok(hr == prop.expected,
10453 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10454 hr, prop.expected, i, j);
10455 }
10456 todo_wine {
10457 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10458 prop.value, received, i, j);
10459 }
10460 } else {
10461 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10462 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10463 hr, prop.expected, i, j);
10464 if(!prop.broken_combine_hres || hr != S_FALSE)
10465 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10466 prop.value, received, i, j);
10467 }
10468 }
10469 }
10470 if(result) IUri_Release(result);
10471 }
10472 if(relative) IUri_Release(relative);
10473 heap_free(relativeW);
10474 }
10475 if(base) IUri_Release(base);
10476 heap_free(baseW);
10477 }
10478 }
10479
10480 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10481 REFIID riid, void **ppv)
10482 {
10483 ok(0, "unexpected call\n");
10484 return E_NOINTERFACE;
10485 }
10486
10487 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10488 {
10489 return 2;
10490 }
10491
10492 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10493 {
10494 return 1;
10495 }
10496
10497 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10498 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10499 DWORD *pcchResult, DWORD dwReserved)
10500 {
10501 CHECK_EXPECT(ParseUrl);
10502 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10503 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10504 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10505 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10506 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10507
10508 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10509 *pcchResult = lstrlenW(parse_resultW);
10510
10511 return S_OK;
10512 }
10513
10514 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10515 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10516 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10517 {
10518 CHECK_EXPECT(CombineUrl);
10519 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10520 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10521 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10522 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10523 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10524 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10525 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10526
10527 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10528 *pcchResult = lstrlenW(combine_resultW);
10529
10530 return S_OK;
10531 }
10532
10533 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10534 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10535 {
10536 ok(0, "unexpected call\n");
10537 return E_NOTIMPL;
10538 }
10539
10540 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10541 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10542 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10543 {
10544 ok(0, "unexpected call\n");
10545 return E_NOTIMPL;
10546 }
10547
10548 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10549 InternetProtocolInfo_QueryInterface,
10550 InternetProtocolInfo_AddRef,
10551 InternetProtocolInfo_Release,
10552 InternetProtocolInfo_ParseUrl,
10553 InternetProtocolInfo_CombineUrl,
10554 InternetProtocolInfo_CompareUrl,
10555 InternetProtocolInfo_QueryInfo
10556 };
10557
10558 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10559
10560 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10561 {
10562 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10563 *ppv = &protocol_info;
10564 return S_OK;
10565 }
10566
10567 ok(0, "unexpected call\n");
10568 return E_NOINTERFACE;
10569 }
10570
10571 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10572 {
10573 return 2;
10574 }
10575
10576 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10577 {
10578 return 1;
10579 }
10580
10581 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10582 REFIID riid, void **ppv)
10583 {
10584 ok(0, "unexpected call\n");
10585 return E_NOTIMPL;
10586 }
10587
10588 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10589 {
10590 ok(0, "unexpected call\n");
10591 return S_OK;
10592 }
10593
10594 static const IClassFactoryVtbl ClassFactoryVtbl = {
10595 ClassFactory_QueryInterface,
10596 ClassFactory_AddRef,
10597 ClassFactory_Release,
10598 ClassFactory_CreateInstance,
10599 ClassFactory_LockServer
10600 };
10601
10602 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10603
10604 static void register_protocols(void)
10605 {
10606 IInternetSession *session;
10607 HRESULT hres;
10608
10609 hres = pCoInternetGetSession(0, &session, 0);
10610 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10611 if(FAILED(hres))
10612 return;
10613
10614 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10615 winetestW, 0, NULL, 0);
10616 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10617
10618 IInternetSession_Release(session);
10619 }
10620
10621 static void unregister_protocols(void) {
10622 IInternetSession *session;
10623 HRESULT hr;
10624
10625 hr = pCoInternetGetSession(0, &session, 0);
10626 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10627 if(FAILED(hr))
10628 return;
10629
10630 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10631 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10632
10633 IInternetSession_Release(session);
10634 }
10635
10636 static void test_CoInternetCombineIUri_Pluggable(void) {
10637 HRESULT hr;
10638 IUri *base = NULL;
10639
10640 hr = pCreateUri(combine_baseW, 0, 0, &base);
10641 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10642 if(SUCCEEDED(hr)) {
10643 IUri *relative = NULL;
10644
10645 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10646 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10647 if(SUCCEEDED(hr)) {
10648 IUri *result = NULL;
10649
10650 SET_EXPECT(CombineUrl);
10651
10652 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10653 &result, 0);
10654 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10655
10656 CHECK_CALLED(CombineUrl);
10657
10658 if(SUCCEEDED(hr)) {
10659 BSTR received = NULL;
10660 hr = IUri_GetAbsoluteUri(result, &received);
10661 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10662 if(SUCCEEDED(hr)) {
10663 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10664 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10665 }
10666 SysFreeString(received);
10667 }
10668 if(result) IUri_Release(result);
10669 }
10670 if(relative) IUri_Release(relative);
10671 }
10672 if(base) IUri_Release(base);
10673 }
10674
10675 static void test_CoInternetCombineUrlEx(void) {
10676 HRESULT hr;
10677 IUri *base, *result;
10678 DWORD i;
10679
10680 base = NULL;
10681 hr = pCreateUri(http_urlW, 0, 0, &base);
10682 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10683 if(SUCCEEDED(hr)) {
10684 result = (void*) 0xdeadbeef;
10685 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10686 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10687 hr, E_UNEXPECTED);
10688 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10689 }
10690
10691 result = (void*) 0xdeadbeef;
10692 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10693 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10694 hr, E_INVALIDARG);
10695 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10696
10697 result = (void*) 0xdeadbeef;
10698 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10699 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10700 hr, E_UNEXPECTED);
10701 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10702
10703 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10704 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10705 hr, E_POINTER);
10706 if(base) IUri_Release(base);
10707
10708 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10709 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10710
10711 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10712 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10713 if(SUCCEEDED(hr)) {
10714 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10715
10716 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10717 &result, 0);
10718 if(uri_combine_tests[i].todo) {
10719 todo_wine {
10720 ok(hr == uri_combine_tests[i].expected,
10721 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10722 hr, uri_combine_tests[i].expected, i);
10723 }
10724 } else {
10725 ok(hr == uri_combine_tests[i].expected,
10726 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10727 hr, uri_combine_tests[i]. expected, i);
10728 }
10729 if(SUCCEEDED(hr)) {
10730 DWORD j;
10731
10732 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10733 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10734 BSTR received;
10735 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10736
10737 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10738 if(prop.todo) {
10739 todo_wine {
10740 ok(hr == prop.expected,
10741 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10742 hr, prop.expected, i, j);
10743 }
10744 todo_wine {
10745 ok(!strcmp_aw(value, received) ||
10746 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10747 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10748 value, wine_dbgstr_w(received), i, j);
10749 }
10750 } else {
10751 ok(hr == prop.expected,
10752 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10753 hr, prop.expected, i, j);
10754 ok(!strcmp_aw(value, received) ||
10755 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10756 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10757 value, wine_dbgstr_w(received), i, j);
10758 }
10759 SysFreeString(received);
10760 }
10761
10762 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10763 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10764 DWORD received;
10765
10766 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10767 if(prop.todo) {
10768 todo_wine {
10769 ok(hr == prop.expected,
10770 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10771 hr, prop.expected, i, j);
10772 }
10773 todo_wine {
10774 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10775 prop.value, received, i, j);
10776 }
10777 } else {
10778 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10779 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10780 hr, prop.expected, i, j);
10781 if(!prop.broken_combine_hres || hr != S_FALSE)
10782 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10783 prop.value, received, i, j);
10784 }
10785 }
10786 }
10787 if(result) IUri_Release(result);
10788 heap_free(relativeW);
10789 }
10790 if(base) IUri_Release(base);
10791 heap_free(baseW);
10792 }
10793 }
10794
10795 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10796 HRESULT hr;
10797 IUri *base = NULL;
10798
10799 hr = pCreateUri(combine_baseW, 0, 0, &base);
10800 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10801 if(SUCCEEDED(hr)) {
10802 IUri *result = NULL;
10803
10804 SET_EXPECT(CombineUrl);
10805
10806 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10807 &result, 0);
10808 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10809
10810 CHECK_CALLED(CombineUrl);
10811
10812 if(SUCCEEDED(hr)) {
10813 BSTR received = NULL;
10814 hr = IUri_GetAbsoluteUri(result, &received);
10815 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10816 if(SUCCEEDED(hr)) {
10817 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10818 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10819 }
10820 SysFreeString(received);
10821 }
10822 if(result) IUri_Release(result);
10823 }
10824 if(base) IUri_Release(base);
10825 }
10826
10827 static void test_CoInternetParseIUri_InvalidArgs(void) {
10828 HRESULT hr;
10829 IUri *uri = NULL;
10830 WCHAR tmp[3];
10831 DWORD result = -1;
10832
10833 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10834 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10835 hr, E_INVALIDARG);
10836 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10837
10838 hr = pCreateUri(http_urlW, 0, 0, &uri);
10839 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10840 if(SUCCEEDED(hr)) {
10841 DWORD expected_len;
10842
10843 result = -1;
10844 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10845 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10846 hr, E_INVALIDARG);
10847 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10848
10849 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10850 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10851 hr, E_POINTER);
10852
10853 result = -1;
10854 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10855 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10856 hr, E_FAIL);
10857 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10858
10859 result = -1;
10860 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10861 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10862 hr, E_FAIL);
10863 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10864
10865 result = -1;
10866 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10867 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10868 hr, E_FAIL);
10869 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10870
10871 result = -1;
10872 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10873 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10874 hr, E_FAIL);
10875 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10876
10877 expected_len = lstrlenW(http_urlW);
10878 result = -1;
10879 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10880 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10881 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10882 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10883 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10884 expected_len, result);
10885 }
10886 if(uri) IUri_Release(uri);
10887 }
10888
10889 static void test_CoInternetParseIUri(void) {
10890 DWORD i;
10891
10892 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10893 HRESULT hr;
10894 IUri *uri;
10895 LPWSTR uriW;
10896 uri_parse_test test = uri_parse_tests[i];
10897
10898 uriW = a2w(test.uri);
10899 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10900 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10901 if(SUCCEEDED(hr)) {
10902 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10903 DWORD result_len = -1;
10904
10905 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10906 if(test.todo) {
10907 todo_wine {
10908 ok(hr == test.expected,
10909 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10910 hr, test.expected, i);
10911 }
10912 } else {
10913 ok(hr == test.expected,
10914 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10915 hr, test.expected, i);
10916 }
10917 if(SUCCEEDED(hr)) {
10918 DWORD len = lstrlenA(test.property);
10919 ok(!strcmp_aw(test.property, result),
10920 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10921 test.property, wine_dbgstr_w(result), i);
10922 ok(len == result_len,
10923 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10924 len, result_len, i);
10925 } else {
10926 ok(!result_len,
10927 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10928 result_len, i);
10929 }
10930 }
10931 if(uri) IUri_Release(uri);
10932 heap_free(uriW);
10933 }
10934 }
10935
10936 static void test_CoInternetParseIUri_Pluggable(void) {
10937 HRESULT hr;
10938 IUri *uri = NULL;
10939
10940 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10941 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10942 if(SUCCEEDED(hr)) {
10943 WCHAR result[200];
10944 DWORD result_len;
10945
10946 SET_EXPECT(ParseUrl);
10947
10948 parse_action = PARSE_CANONICALIZE;
10949 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10950
10951 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10952 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10953
10954 CHECK_CALLED(ParseUrl);
10955
10956 if(SUCCEEDED(hr)) {
10957 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10958 lstrlenW(parse_resultW), result_len);
10959 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10960 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10961 }
10962 }
10963 if(uri) IUri_Release(uri);
10964 }
10965
10966 typedef struct {
10967 const char *url;
10968 DWORD uri_flags;
10969 const char *base_url;
10970 DWORD base_uri_flags;
10971 const char *legacy_url;
10972 const char *uniform_url;
10973 const char *no_canon_url;
10974 const char *uri_url;
10975 } create_urlmon_test_t;
10976
10977 static const create_urlmon_test_t create_urlmon_tests[] = {
10978 {
10979 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10980 NULL,0,
10981 "http://www.winehq.org/",
10982 "http://www.winehq.org/",
10983 "http://www.winehq.org",
10984 "http://www.winehq.org"
10985 },
10986 {
10987 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10988 NULL,0,
10989 "file://c:\\dir\\file.txt",
10990 "file:///c:/dir/file.txt",
10991 "file:///c:/dir/file.txt",
10992 "file:///c:/dir/file.txt"
10993 },
10994 {
10995 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10996 NULL,0,
10997 "file://c:\\dir\\file.txt",
10998 "file:///c:/dir/file.txt",
10999 "file:///c:/dir/file.txt",
11000 "file://c:\\dir\\file.txt"
11001 },
11002 {
11003 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11004 "http://www.winehq.org",0,
11005 "http://www.winehq.org/data",
11006 "http://www.winehq.org/data",
11007 "http://www.winehq.org:80/data",
11008 },
11009 {
11010 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11011 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11012 "file://c:\\dir\\file.txt",
11013 "file:///c:/dir/file.txt",
11014 "file:///c:/dir/file.txt",
11015 },
11016 {
11017 "",Uri_CREATE_ALLOW_RELATIVE,
11018 NULL,0,
11019 "",
11020 "",
11021 "",
11022 ""
11023 },
11024 {
11025 "test",Uri_CREATE_ALLOW_RELATIVE,
11026 NULL,0,
11027 "test",
11028 "test",
11029 "test",
11030 "test"
11031 },
11032 {
11033 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11034 NULL,0,
11035 "file://c:\\dir\\file.txt",
11036 "file:///c:/dir/file.txt",
11037 "file:///c:/dir/file.txt",
11038 "file:///c:/dir/file.txt",
11039 }
11040 };
11041
11042 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11043 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11044 {
11045 WCHAR *display_name;
11046 HRESULT hres;
11047
11048 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11049 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11050 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11051 wine_dbgstr_w(display_name), exurl);
11052
11053 CoTaskMemFree(display_name);
11054 }
11055
11056 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11057 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11058 {
11059 IUriContainer *uri_container;
11060 IUri *uri;
11061 BSTR display_uri;
11062 HRESULT hres;
11063
11064 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11065 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11066
11067 uri = NULL;
11068 hres = IUriContainer_GetIUri(uri_container, &uri);
11069 IUriContainer_Release(uri_container);
11070 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11071 ok(uri != NULL, "uri == NULL\n");
11072
11073 hres = IUri_GetDisplayUri(uri, &display_uri);
11074 IUri_Release(uri);
11075 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11076 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11077 wine_dbgstr_w(display_uri), exurl);
11078 SysFreeString(display_uri);
11079 }
11080
11081 static void test_CreateURLMoniker(void)
11082 {
11083 const create_urlmon_test_t *test;
11084 IMoniker *mon, *base_mon;
11085 WCHAR *url, *base_url;
11086 IUri *uri, *base_uri;
11087 HRESULT hres;
11088
11089 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
11090 url = a2w(test->url);
11091 base_url = a2w(test->base_url);
11092
11093 if(base_url) {
11094 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11095 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11096
11097 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11098 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11099 }else {
11100 base_uri = NULL;
11101 base_mon = NULL;
11102 }
11103
11104 hres = CreateURLMoniker(base_mon, url, &mon);
11105 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11106 test_urlmon_display_name(mon, test->legacy_url);
11107 test_display_uri(mon, test->legacy_url);
11108 IMoniker_Release(mon);
11109
11110 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11111 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11112 test_urlmon_display_name(mon, test->legacy_url);
11113 test_display_uri(mon, test->legacy_url);
11114 IMoniker_Release(mon);
11115
11116 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11117 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11118 test_urlmon_display_name(mon, test->uniform_url);
11119 test_display_uri(mon, test->uniform_url);
11120 IMoniker_Release(mon);
11121
11122 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11123 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11124 test_urlmon_display_name(mon, test->no_canon_url);
11125 test_display_uri(mon, test->no_canon_url);
11126 IMoniker_Release(mon);
11127
11128 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11129 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11130
11131 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11132 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11133 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11134 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11135 IMoniker_Release(mon);
11136
11137 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11138 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11139 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11140 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11141 IMoniker_Release(mon);
11142
11143 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11144 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11145 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11146 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11147 IMoniker_Release(mon);
11148
11149 IUri_Release(uri);
11150 heap_free(url);
11151 heap_free(base_url);
11152 if(base_uri)
11153 IUri_Release(base_uri);
11154 if(base_mon)
11155 IMoniker_Release(base_mon);
11156 }
11157 }
11158
11159 static int add_default_flags(DWORD flags) {
11160 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11161 flags |= Uri_CREATE_CANONICALIZE;
11162 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11163 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11164 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11165 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11166 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11167 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11168 if(!(flags & Uri_CREATE_IE_SETTINGS))
11169 flags |= Uri_CREATE_NO_IE_SETTINGS;
11170
11171 return flags;
11172 }
11173
11174 static void test_IPersistStream(void)
11175 {
11176 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11177
11178 props_order[Uri_PROPERTY_RAW_URI] = 1;
11179 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11180 props_order[Uri_PROPERTY_HOST] = 3;
11181 props_order[Uri_PROPERTY_PASSWORD] = 4;
11182 props_order[Uri_PROPERTY_PATH] = 5;
11183 props_order[Uri_PROPERTY_PORT] = 6;
11184 props_order[Uri_PROPERTY_QUERY] = 7;
11185 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11186 props_order[Uri_PROPERTY_USER_NAME] = 9;
11187
11188 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
11189 const uri_properties *test = uri_tests+i;
11190 LPWSTR uriW;
11191 IUri *uri;
11192 IPersistStream *persist_stream;
11193 IStream *stream;
11194 IMarshal *marshal;
11195 DWORD props, props_no, dw_data[6];
11196 WCHAR str_data[1024];
11197 ULARGE_INTEGER size, max_size;
11198 LARGE_INTEGER no_off;
11199 CLSID curi;
11200 BSTR raw_uri;
11201 HRESULT hr;
11202
11203 if(test->create_todo || test->create_expected!=S_OK)
11204 continue;
11205
11206 uriW = a2w(test->uri);
11207 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11208 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11209
11210 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11211 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11212
11213 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11214 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11215 hr = IPersistStream_IsDirty(persist_stream);
11216 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11217 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11218 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11219 hr = IPersistStream_IsDirty(persist_stream);
11220 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11221 no_off.QuadPart = 0;
11222 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11223 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11224 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11225 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11226 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11227 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11228 ok(U(size).LowPart+2 == U(max_size).LowPart,
11229 "%d) Written data size is %d, max_size %d.\n",
11230 i, U(size).LowPart, U(max_size).LowPart);
11231
11232 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11233 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11234 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11235 i, dw_data[0]-2, U(size).LowPart);
11236 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11237 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11238 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11239 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11240 ok(dw_data[2] == add_default_flags(test->create_flags),
11241 "%d) Incorrect value %x, expected %x (creation flags).\n",
11242 i, dw_data[2], add_default_flags(test->create_flags));
11243 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11244 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11245 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11246
11247 props_no = 0;
11248 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11249 if(!props_order[props])
11250 continue;
11251
11252 if(props <= Uri_PROPERTY_STRING_LAST) {
11253 if(test->str_props[props].expected == S_OK)
11254 props_no++;
11255 } else {
11256 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11257 props_no++;
11258 }
11259 }
11260 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11261 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11262 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11263 props_no = 1;
11264
11265 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11266 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11267 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11268
11269 dw_data[2] = 0;
11270 dw_data[3] = -1;
11271 while(props) {
11272 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11273 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11274 props--;
11275 ok(dw_data[2]<props_order[dw_data[0]],
11276 "%d) Incorrect properties order (%d, %d)\n",
11277 i, dw_data[0], dw_data[3]);
11278 dw_data[2] = props_order[dw_data[0]];
11279 dw_data[3] = dw_data[0];
11280
11281 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11282 const uri_str_property *prop = test->str_props+dw_data[0];
11283 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11284 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11285 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11286 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11287 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11288 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11289 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11290 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11291 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11292 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11293 } else {
11294 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11295 break;
11296 }
11297 }
11298 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11299 i, props, dw_data[0]);
11300
11301 IPersistStream_Release(persist_stream);
11302 IUri_Release(uri);
11303
11304 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11305 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11306 hr = IPersistStream_GetClassID(persist_stream, &curi);
11307 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11308 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11309 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11310 &IID_IUri, (void**)&uri);
11311 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11312 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11313 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11314 hr = IPersistStream_Load(persist_stream, stream);
11315 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11316 hr = IUri_GetRawUri(uri, &raw_uri);
11317 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11318 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11319 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11320 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11321 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11322 wine_dbgstr_w(raw_uri));
11323 SysFreeString(raw_uri);
11324
11325 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11326 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11327 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11328 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11329 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11330 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11331 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11332 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11333 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11334 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11335 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11336 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11337 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11338 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11339 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11340 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11341 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11342 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11343 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11344 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11345 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11346 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11347 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11348 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11349 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11350 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11351 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11352 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11353 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11354
11355 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11356 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11357 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11358 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11359 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11360 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11361 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11362 i, dw_data[0]-2, U(size).LowPart);
11363 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11364 i, dw_data[1]);
11365 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11366 i, dw_data[2], dw_data[0]-8);
11367 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11368 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11369 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11370 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11371 U(max_size).LowPart += 3*sizeof(DWORD);
11372 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11373 i, dw_data[2], U(max_size).LowPart);
11374 IMarshal_Release(marshal);
11375 IUri_Release(uri);
11376
11377 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11378 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11379 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11380 &IID_IUri, (void**)&uri);
11381 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11382 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11383 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11384 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11385 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11386 hr = IUri_GetRawUri(uri, &raw_uri);
11387 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11388 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11389 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11390 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11391 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11392 wine_dbgstr_w(raw_uri));
11393 SysFreeString(raw_uri);
11394
11395 IMarshal_Release(marshal);
11396 IStream_Release(stream);
11397 IPersistStream_Release(persist_stream);
11398 IUri_Release(uri);
11399 heap_free(uriW);
11400 }
11401 }
11402
11403 static void test_UninitializedUri(void)
11404 {
11405 IUri *uri;
11406 IUriBuilderFactory *ubf;
11407 IPersistStream *ps;
11408 IUriBuilder *ub;
11409 BSTR bstr;
11410 DWORD dword;
11411 BOOL eq;
11412 ULARGE_INTEGER ui;
11413 HRESULT hr;
11414
11415 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11416 &IID_IUri, (void**)&uri);
11417 if(FAILED(hr)) {
11418 win_skip("Skipping uninitialized Uri tests.\n");
11419 return;
11420 }
11421
11422 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11423 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11424 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11425 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11426
11427 hr = IUri_GetAbsoluteUri(uri, NULL);
11428 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11429 hr = IUri_GetAbsoluteUri(uri, &bstr);
11430 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11431 hr = IUri_GetAuthority(uri, &bstr);
11432 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11433 hr = IUri_GetDisplayUri(uri, &bstr);
11434 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11435 hr = IUri_GetDomain(uri, &bstr);
11436 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11437 hr = IUri_GetExtension(uri, &bstr);
11438 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11439 hr = IUri_GetFragment(uri, &bstr);
11440 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11441 hr = IUri_GetHost(uri, &bstr);
11442 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11443 hr = IUri_GetHostType(uri, &dword);
11444 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11445 hr = IUri_GetPassword(uri, &bstr);
11446 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11447 hr = IUri_GetPassword(uri, &bstr);
11448 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11449 hr = IUri_GetPathAndQuery(uri, &bstr);
11450 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11451 hr = IUri_GetPort(uri, &dword);
11452 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11453 hr = IUri_GetProperties(uri, &dword);
11454 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11455 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11456 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11457 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11458 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11459 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11460 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11461 hr = IUri_GetQuery(uri, &bstr);
11462 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11463 hr = IUri_GetRawUri(uri, &bstr);
11464 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11465 hr = IUri_GetScheme(uri, &dword);
11466 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11467 hr = IUri_GetSchemeName(uri, &bstr);
11468 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11469 hr = IUri_GetUserInfo(uri, &bstr);
11470 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11471 hr = IUri_GetUserName(uri, &bstr);
11472 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11473 hr = IUri_GetZone(uri, &dword);
11474 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11475 hr = IUri_IsEqual(uri, uri, &eq);
11476 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11477
11478 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11479 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11480 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11481 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11482 IUriBuilder_Release(ub);
11483
11484 hr = IPersistStream_GetSizeMax(ps, &ui);
11485 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11486 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11487 hr = IPersistStream_IsDirty(ps);
11488 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11489
11490 IPersistStream_Release(ps);
11491 IUriBuilderFactory_Release(ubf);
11492 IUri_Release(uri);
11493 }
11494
11495 START_TEST(uri) {
11496 HMODULE hurlmon;
11497
11498 hurlmon = GetModuleHandle("urlmon.dll");
11499 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11500 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11501 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11502 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11503 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11504 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11505 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11506 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11507 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11508
11509 if(!pCreateUri) {
11510 win_skip("CreateUri is not present, skipping tests.\n");
11511 return;
11512 }
11513
11514 trace("test CreateUri invalid flags...\n");
11515 test_CreateUri_InvalidFlags();
11516
11517 trace("test CreateUri invalid args...\n");
11518 test_CreateUri_InvalidArgs();
11519
11520 trace("test CreateUri invalid URIs...\n");
11521 test_CreateUri_InvalidUri();
11522
11523 trace("test IUri_GetPropertyBSTR...\n");
11524 test_IUri_GetPropertyBSTR();
11525
11526 trace("test IUri_GetPropertyDWORD...\n");
11527 test_IUri_GetPropertyDWORD();
11528
11529 trace("test IUri_GetStrProperties...\n");
11530 test_IUri_GetStrProperties();
11531
11532 trace("test IUri_GetDwordProperties...\n");
11533 test_IUri_GetDwordProperties();
11534
11535 trace("test IUri_GetPropertyLength...\n");
11536 test_IUri_GetPropertyLength();
11537
11538 trace("test IUri_GetProperties...\n");
11539 test_IUri_GetProperties();
11540
11541 trace("test IUri_HasProperty...\n");
11542 test_IUri_HasProperty();
11543
11544 trace("test IUri_IsEqual...\n");
11545 test_IUri_IsEqual();
11546
11547 trace("test CreateUriWithFragment invalid args...\n");
11548 test_CreateUriWithFragment_InvalidArgs();
11549
11550 trace("test CreateUriWithFragment invalid flags...\n");
11551 test_CreateUriWithFragment_InvalidFlags();
11552
11553 trace("test CreateUriWithFragment...\n");
11554 test_CreateUriWithFragment();
11555
11556 trace("test CreateIUriBuilder...\n");
11557 test_CreateIUriBuilder();
11558
11559 trace("test IUriBuilder_CreateInvalidArgs...\n");
11560 test_IUriBuilder_CreateInvalidArgs();
11561
11562 trace("test IUriBuilder...\n");
11563 test_IUriBuilder();
11564
11565 trace("test IUriBuilder_GetInvalidArgs...\n");
11566 test_IUriBuilder_GetInvalidArgs();
11567
11568 trace("test IUriBuilder_HasBeenModified...\n");
11569 test_IUriBuilder_HasBeenModified();
11570
11571 trace("test IUriBuilder_IUriProperty...\n");
11572 test_IUriBuilder_IUriProperty();
11573
11574 trace("test IUriBuilder_RemoveProperties...\n");
11575 test_IUriBuilder_RemoveProperties();
11576
11577 trace("test IUriBuilder miscellaneous...\n");
11578 test_IUriBuilder_Misc();
11579
11580 trace("test IUriBuilderFactory...\n");
11581 test_IUriBuilderFactory();
11582
11583 trace("test CoInternetCombineIUri...\n");
11584 test_CoInternetCombineIUri();
11585
11586 trace("test CoInternetCombineUrlEx...\n");
11587 test_CoInternetCombineUrlEx();
11588
11589 trace("test CoInternetParseIUri Invalid Args...\n");
11590 test_CoInternetParseIUri_InvalidArgs();
11591
11592 trace("test CoInternetParseIUri...\n");
11593 test_CoInternetParseIUri();
11594
11595 register_protocols();
11596
11597 trace("test CoInternetCombineIUri pluggable...\n");
11598 test_CoInternetCombineIUri_Pluggable();
11599
11600 trace("test CoInternetCombineUrlEx Pluggable...\n");
11601 test_CoInternetCombineUrlEx_Pluggable();
11602
11603 trace("test CoInternetParseIUri pluggable...\n");
11604 test_CoInternetParseIUri_Pluggable();
11605
11606 trace("test CreateURLMoniker...\n");
11607 test_CreateURLMoniker();
11608
11609 CoInitialize(NULL);
11610
11611 trace("test IPersistStream...\n");
11612 test_IPersistStream();
11613
11614 trace("test uninitialized Uri...\n");
11615 test_UninitializedUri();
11616
11617 CoUninitialize();
11618 unregister_protocols();
11619 }