[URLMON]
[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 it's 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 it's 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 it's 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 its 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 /* Too 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 /* Expects a valid IP Literal. */
4618 {"ftp://[not.valid.uri]/",0,FALSE},
4619 /* Expects valid port for a known scheme type. */
4620 {"ftp://www.winehq.org:123fgh",0,FALSE},
4621 /* Port exceeds USHORT_MAX for known scheme type. */
4622 {"ftp://www.winehq.org:65536",0,FALSE},
4623 /* Invalid port with IPv4 address. */
4624 {"http://www.winehq.org:1abcd",0,FALSE},
4625 /* Invalid port with IPv6 address. */
4626 {"http://[::ffff]:32xy",0,FALSE},
4627 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4628 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4629 /* Not allowed to have invalid % encoded data in opaque URI path. */
4630 {"news:test%XX",0,FALSE},
4631 {"mailto:wine@winehq%G8.com",0,FALSE},
4632 /* Known scheme types can't have invalid % encoded data in query string. */
4633 {"http://google.com/?query=te%xx",0,FALSE},
4634 /* Invalid % encoded data in fragment of know scheme type. */
4635 {"ftp://google.com/#Test%xx",0,FALSE},
4636 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4637 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4638 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4639 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,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 /* res URIs aren't allowed to have forbidden dos path characters in the
4645 * hostname.
4646 */
4647 {"res://c:\\te<st\\test/test",0,FALSE},
4648 {"res://c:\\te>st\\test/test",0,FALSE},
4649 {"res://c:\\te\"st\\test/test",0,FALSE},
4650 {"res://c:\\test/te%xxst",0,FALSE}
4651 };
4652
4653 typedef struct _uri_equality {
4654 const char* a;
4655 DWORD create_flags_a;
4656 const char* b;
4657 DWORD create_flags_b;
4658 BOOL equal;
4659 BOOL todo;
4660 } uri_equality;
4661
4662 static const uri_equality equality_tests[] = {
4663 {
4664 "HTTP://www.winehq.org/test dir/./",0,
4665 "http://www.winehq.org/test dir/../test dir/",0,
4666 TRUE
4667 },
4668 {
4669 /* http://www.winehq.org/test%20dir */
4670 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4671 "http://www.winehq.org/test dir",0,
4672 TRUE
4673 },
4674 {
4675 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4676 "file:///c:/test.mp3",0,
4677 TRUE
4678 },
4679 {
4680 "ftp://ftp.winehq.org/",0,
4681 "ftp://ftp.winehq.org",0,
4682 TRUE
4683 },
4684 {
4685 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4686 "ftp://ftp.winehq.org/t%45stB/",0,
4687 FALSE
4688 },
4689 {
4690 "http://google.com/TEST",0,
4691 "http://google.com/test",0,
4692 FALSE
4693 },
4694 {
4695 "http://GOOGLE.com/",0,
4696 "http://google.com/",0,
4697 TRUE
4698 },
4699 /* Performs case insensitive compare of host names (for known scheme types). */
4700 {
4701 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4702 "ftp://google.com/",0,
4703 TRUE
4704 },
4705 {
4706 "zip://GOOGLE.com/",0,
4707 "zip://google.com/",0,
4708 FALSE
4709 },
4710 {
4711 "file:///c:/TEST/TeST/",0,
4712 "file:///c:/test/test/",0,
4713 TRUE
4714 },
4715 {
4716 "file:///server/TEST",0,
4717 "file:///SERVER/TEST",0,
4718 TRUE
4719 },
4720 {
4721 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4722 "http://google.com/",0,
4723 TRUE
4724 },
4725 {
4726 "ftp://google.com:21/",0,
4727 "ftp://google.com/",0,
4728 TRUE
4729 },
4730 {
4731 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4732 "http://google.com/",0,
4733 TRUE
4734 },
4735 {
4736 "http://google.com:70/",0,
4737 "http://google.com:71/",0,
4738 FALSE
4739 },
4740 {
4741 "file:///c:/dir/file.txt", 0,
4742 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4743 TRUE
4744 },
4745 {
4746 "file:///c:/dir/file.txt", 0,
4747 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4748 TRUE
4749 },
4750 {
4751 "file:///c:/dir/file.txt", 0,
4752 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4753 TRUE
4754 },
4755 {
4756 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4757 "file:///c:/%20dir/file.txt", 0,
4758 TRUE
4759 },
4760 {
4761 "file:///c:/Dir/file.txt", 0,
4762 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4763 TRUE
4764 },
4765 {
4766 "file:///c:/dir/file.txt", 0,
4767 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4768 TRUE
4769 },
4770 {
4771 "file:///c:/dir/file.txt#a", 0,
4772 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4773 FALSE
4774 },
4775 /* Tests of an empty hash/fragment part */
4776 {
4777 "http://google.com/test",0,
4778 "http://google.com/test#",0,
4779 FALSE
4780 },
4781 {
4782 "ftp://ftp.winehq.org/",0,
4783 "ftp://ftp.winehq.org/#",0,
4784 FALSE
4785 },
4786 {
4787 "file:///c:/dir/file.txt#", 0,
4788 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4789 FALSE
4790 }
4791 };
4792
4793 typedef struct _uri_with_fragment {
4794 const char* uri;
4795 const char* fragment;
4796 DWORD create_flags;
4797 HRESULT create_expected;
4798 BOOL create_todo;
4799
4800 const char* expected_uri;
4801 BOOL expected_todo;
4802 } uri_with_fragment;
4803
4804 static const uri_with_fragment uri_fragment_tests[] = {
4805 {
4806 "http://google.com/","#fragment",0,S_OK,FALSE,
4807 "http://google.com/#fragment",FALSE
4808 },
4809 {
4810 "http://google.com/","fragment",0,S_OK,FALSE,
4811 "http://google.com/#fragment",FALSE
4812 },
4813 {
4814 "zip://test.com/","?test",0,S_OK,FALSE,
4815 "zip://test.com/#?test",FALSE
4816 },
4817 /* The fragment can be empty. */
4818 {
4819 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4820 "ftp://ftp.google.com/#",FALSE
4821 }
4822 };
4823
4824 typedef struct _uri_builder_property {
4825 BOOL change;
4826 const char *value;
4827 const char *expected_value;
4828 Uri_PROPERTY property;
4829 HRESULT expected;
4830 BOOL todo;
4831 } uri_builder_property;
4832
4833 typedef struct _uri_builder_port {
4834 BOOL change;
4835 BOOL set;
4836 DWORD value;
4837 HRESULT expected;
4838 BOOL todo;
4839 } uri_builder_port;
4840
4841 typedef struct _uri_builder_str_property {
4842 const char* expected;
4843 HRESULT result;
4844 BOOL todo;
4845 } uri_builder_str_property;
4846
4847 typedef struct _uri_builder_dword_property {
4848 DWORD expected;
4849 HRESULT result;
4850 BOOL todo;
4851 } uri_builder_dword_property;
4852
4853 typedef struct _uri_builder_test {
4854 const char *uri;
4855 DWORD create_flags;
4856 HRESULT create_builder_expected;
4857 BOOL create_builder_todo;
4858
4859 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4860
4861 uri_builder_port port_prop;
4862
4863 DWORD uri_flags;
4864 HRESULT uri_hres;
4865 BOOL uri_todo;
4866
4867 DWORD uri_simple_encode_flags;
4868 HRESULT uri_simple_hres;
4869 BOOL uri_simple_todo;
4870
4871 DWORD uri_with_flags;
4872 DWORD uri_with_builder_flags;
4873 DWORD uri_with_encode_flags;
4874 HRESULT uri_with_hres;
4875 BOOL uri_with_todo;
4876
4877 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4878 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4879 } uri_builder_test;
4880
4881 static const uri_builder_test uri_builder_tests[] = {
4882 { "http://google.com/",0,S_OK,FALSE,
4883 {
4884 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4885 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4886 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4887 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4888 },
4889 {FALSE},
4890 0,S_OK,FALSE,
4891 0,S_OK,FALSE,
4892 0,0,0,S_OK,FALSE,
4893 {
4894 {"http://username:password@google.com/?query=x#fragment",S_OK},
4895 {"username:password@google.com",S_OK},
4896 {"http://google.com/?query=x#fragment",S_OK},
4897 {"google.com",S_OK},
4898 {"",S_FALSE},
4899 {"#fragment",S_OK},
4900 {"google.com",S_OK},
4901 {"password",S_OK},
4902 {"/",S_OK},
4903 {"/?query=x",S_OK},
4904 {"?query=x",S_OK},
4905 {"http://username:password@google.com/?query=x#fragment",S_OK},
4906 {"http",S_OK},
4907 {"username:password",S_OK},
4908 {"username",S_OK}
4909 },
4910 {
4911 {Uri_HOST_DNS,S_OK},
4912 {80,S_OK},
4913 {URL_SCHEME_HTTP,S_OK},
4914 {URLZONE_INVALID,E_NOTIMPL}
4915 }
4916 },
4917 { "http://google.com/",0,S_OK,FALSE,
4918 {
4919 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4920 },
4921 {TRUE,TRUE,120,S_OK,FALSE},
4922 0,S_OK,FALSE,
4923 0,S_OK,FALSE,
4924 0,0,0,S_OK,FALSE,
4925 {
4926 {"test://google.com:120/",S_OK},
4927 {"google.com:120",S_OK},
4928 {"test://google.com:120/",S_OK},
4929 {"google.com",S_OK},
4930 {"",S_FALSE},
4931 {"",S_FALSE},
4932 {"google.com",S_OK},
4933 {"",S_FALSE},
4934 {"/",S_OK},
4935 {"/",S_OK},
4936 {"",S_FALSE},
4937 {"test://google.com:120/",S_OK},
4938 {"test",S_OK},
4939 {"",S_FALSE},
4940 {"",S_FALSE}
4941 },
4942 {
4943 {Uri_HOST_DNS,S_OK},
4944 {120,S_OK},
4945 {URL_SCHEME_UNKNOWN,S_OK},
4946 {URLZONE_INVALID,E_NOTIMPL}
4947 }
4948 },
4949 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4950 {
4951 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4952 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4953 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4954 },
4955 {FALSE},
4956 0,S_OK,FALSE,
4957 0,S_OK,FALSE,
4958 0,0,0,S_OK,FALSE,
4959 {
4960 {"http://[::192.2.3.4]/",S_OK},
4961 {"[::192.2.3.4]",S_OK},
4962 {"http://[::192.2.3.4]/",S_OK},
4963 {"",S_FALSE},
4964 {"",S_FALSE},
4965 {"",S_FALSE},
4966 {"::192.2.3.4",S_OK},
4967 {"",S_FALSE},
4968 {"/",S_OK},
4969 {"/",S_OK},
4970 {"",S_FALSE},
4971 {"http://[::192.2.3.4]/",S_OK},
4972 {"http",S_OK},
4973 {"",S_FALSE},
4974 {"",S_FALSE}
4975 },
4976 {
4977 {Uri_HOST_IPV6,S_OK},
4978 {80,S_OK},
4979 {URL_SCHEME_HTTP,S_OK},
4980 {URLZONE_INVALID,E_NOTIMPL}
4981 }
4982 },
4983 { "http://google.com/",0,S_OK,FALSE,
4984 {
4985 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4986 },
4987 {FALSE},
4988 0,S_OK,FALSE,
4989 0,S_OK,FALSE,
4990 0,0,0,S_OK,FALSE,
4991 {
4992 {"http://google.com/#Frag",S_OK},
4993 {"google.com",S_OK},
4994 {"http://google.com/#Frag",S_OK},
4995 {"google.com",S_OK},
4996 {"",S_FALSE},
4997 {"#Frag",S_OK},
4998 {"google.com",S_OK},
4999 {"",S_FALSE},
5000 {"/",S_OK},
5001 {"/",S_OK},
5002 {"",S_FALSE},
5003 {"http://google.com/#Frag",S_OK},
5004 {"http",S_OK},
5005 {"",S_FALSE},
5006 {"",S_FALSE}
5007 },
5008 {
5009 {Uri_HOST_DNS,S_OK},
5010 {80,S_OK},
5011 {URL_SCHEME_HTTP,S_OK},
5012 {URLZONE_INVALID,E_NOTIMPL}
5013 }
5014 },
5015 { "http://google.com/",0,S_OK,FALSE,
5016 {
5017 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5018 },
5019 {FALSE},
5020 0,S_OK,FALSE,
5021 0,S_OK,FALSE,
5022 0,0,0,S_OK,FALSE,
5023 {
5024 {"http://google.com/#",S_OK},
5025 {"google.com",S_OK},
5026 {"http://google.com/#",S_OK},
5027 {"google.com",S_OK},
5028 {"",S_FALSE},
5029 {"#",S_OK},
5030 {"google.com",S_OK},
5031 {"",S_FALSE},
5032 {"/",S_OK},
5033 {"/",S_OK},
5034 {"",S_FALSE},
5035 {"http://google.com/#",S_OK},
5036 {"http",S_OK},
5037 {"",S_FALSE},
5038 {"",S_FALSE}
5039 },
5040 {
5041 {Uri_HOST_DNS,S_OK},
5042 {80,S_OK},
5043 {URL_SCHEME_HTTP,S_OK},
5044 {URLZONE_INVALID,E_NOTIMPL}
5045 }
5046 },
5047 { "http://google.com/",0,S_OK,FALSE,
5048 {
5049 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5050 },
5051 {FALSE},
5052 0,S_OK,FALSE,
5053 0,S_OK,FALSE,
5054 0,0,0,S_OK,FALSE,
5055 {
5056 {"http://::password@google.com/",S_OK},
5057 {"::password@google.com",S_OK},
5058 {"http://google.com/",S_OK},
5059 {"google.com",S_OK},
5060 {"",S_FALSE},
5061 {"",S_FALSE},
5062 {"google.com",S_OK},
5063 {":password",S_OK},
5064 {"/",S_OK},
5065 {"/",S_OK},
5066 {"",S_FALSE},
5067 {"http://::password@google.com/",S_OK},
5068 {"http",S_OK},
5069 {"::password",S_OK},
5070 {"",S_FALSE}
5071 },
5072 {
5073 {Uri_HOST_DNS,S_OK},
5074 {80,S_OK},
5075 {URL_SCHEME_HTTP,S_OK},
5076 {URLZONE_INVALID,E_NOTIMPL}
5077 }
5078 },
5079 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5080 {
5081 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5082 },
5083 {FALSE},
5084 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5085 0,S_OK,FALSE,
5086 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5087 {
5088 {":password@test/test",S_OK},
5089 {":password@",S_OK},
5090 {":password@test/test",S_OK},
5091 {"",S_FALSE},
5092 {"",S_FALSE},
5093 {"",S_FALSE},
5094 {"",S_FALSE},
5095 {"password",S_OK},
5096 {"test/test",S_OK},
5097 {"test/test",S_OK},
5098 {"",S_FALSE},
5099 {":password@test/test",S_OK},
5100 {"",S_FALSE},
5101 {":password",S_OK},
5102 {"",S_FALSE}
5103 },
5104 {
5105 {Uri_HOST_UNKNOWN,S_OK},
5106 {0,S_FALSE},
5107 {URL_SCHEME_UNKNOWN,S_OK},
5108 {URLZONE_INVALID,E_NOTIMPL}
5109 }
5110 },
5111 { "http://google.com/",0,S_OK,FALSE,
5112 {
5113 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5114 },
5115 {FALSE},
5116 0,S_OK,FALSE,
5117 0,S_OK,FALSE,
5118 0,0,0,S_OK,FALSE,
5119 {
5120 {"http://google.com/test/test",S_OK},
5121 {"google.com",S_OK},
5122 {"http://google.com/test/test",S_OK},
5123 {"google.com",S_OK},
5124 {"",S_FALSE},
5125 {"",S_FALSE},
5126 {"google.com",S_OK},
5127 {"",S_FALSE},
5128 {"/test/test",S_OK},
5129 {"/test/test",S_OK},
5130 {"",S_FALSE},
5131 {"http://google.com/test/test",S_OK},
5132 {"http",S_OK},
5133 {"",S_FALSE},
5134 {"",S_FALSE}
5135 },
5136 {
5137 {Uri_HOST_DNS,S_OK},
5138 {80,S_OK},
5139 {URL_SCHEME_HTTP,S_OK},
5140 {URLZONE_INVALID,E_NOTIMPL}
5141 }
5142 },
5143 { "zip:testing/test",0,S_OK,FALSE,
5144 {
5145 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5146 },
5147 {FALSE},
5148 0,S_OK,FALSE,
5149 0,S_OK,FALSE,
5150 0,0,0,S_OK,FALSE,
5151 {
5152 {"zip:test",S_OK},
5153 {"",S_FALSE},
5154 {"zip:test",S_OK},
5155 {"",S_FALSE},
5156 {"",S_FALSE},
5157 {"",S_FALSE},
5158 {"",S_FALSE},
5159 {"",S_FALSE},
5160 {"test",S_OK},
5161 {"test",S_OK},
5162 {"",S_FALSE},
5163 {"zip:test",S_OK},
5164 {"zip",S_OK},
5165 {"",S_FALSE},
5166 {"",S_FALSE}
5167 },
5168 {
5169 {Uri_HOST_UNKNOWN,S_OK},
5170 {0,S_FALSE},
5171 {URL_SCHEME_UNKNOWN,S_OK},
5172 {URLZONE_INVALID,E_NOTIMPL}
5173 }
5174 },
5175 { "http://google.com/",0,S_OK,FALSE,
5176 {
5177 {FALSE},
5178 },
5179 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5180 {TRUE,FALSE,555,S_OK,FALSE},
5181 0,S_OK,FALSE,
5182 0,S_OK,FALSE,
5183 0,0,0,S_OK,FALSE,
5184 {
5185 {"http://google.com/",S_OK},
5186 {"google.com",S_OK},
5187 {"http://google.com/",S_OK},
5188 {"google.com",S_OK},
5189 {"",S_FALSE},
5190 {"",S_FALSE},
5191 {"google.com",S_OK},
5192 {"",S_FALSE},
5193 {"/",S_OK},
5194 {"/",S_OK},
5195 {"",S_FALSE},
5196 {"http://google.com/",S_OK},
5197 {"http",S_OK},
5198 {"",S_FALSE},
5199 {"",S_FALSE}
5200 },
5201 {
5202 {Uri_HOST_DNS,S_OK},
5203 /* Still returns 80, even though earlier the port was disabled. */
5204 {80,S_OK},
5205 {URL_SCHEME_HTTP,S_OK},
5206 {URLZONE_INVALID,E_NOTIMPL}
5207 }
5208 },
5209 { "http://google.com/",0,S_OK,FALSE,
5210 {
5211 {FALSE},
5212 },
5213 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5214 * you'll get 122345 instead.
5215 */
5216 {TRUE,122345,222,S_OK,FALSE},
5217 0,S_OK,FALSE,
5218 0,S_OK,FALSE,
5219 0,0,0,S_OK,FALSE,
5220 {
5221 {"http://google.com:222/",S_OK},
5222 {"google.com:222",S_OK},
5223 {"http://google.com:222/",S_OK},
5224 {"google.com",S_OK},
5225 {"",S_FALSE},
5226 {"",S_FALSE},
5227 {"google.com",S_OK},
5228 {"",S_FALSE},
5229 {"/",S_OK},
5230 {"/",S_OK},
5231 {"",S_FALSE},
5232 {"http://google.com:222/",S_OK},
5233 {"http",S_OK},
5234 {"",S_FALSE},
5235 {"",S_FALSE}
5236 },
5237 {
5238 {Uri_HOST_DNS,S_OK},
5239 {222,S_OK},
5240 {URL_SCHEME_HTTP,S_OK},
5241 {URLZONE_INVALID,E_NOTIMPL}
5242 }
5243 },
5244 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5245 { "http://google.com/",0,S_OK,FALSE,
5246 {
5247 {FALSE},
5248 },
5249 {TRUE,TRUE,999999,S_OK,FALSE},
5250 0,S_OK,FALSE,
5251 0,S_OK,FALSE,
5252 0,0,0,S_OK,FALSE,
5253 {
5254 {"http://google.com:999999/",S_OK},
5255 {"google.com:999999",S_OK},
5256 {"http://google.com:999999/",S_OK},
5257 {"google.com",S_OK},
5258 {"",S_FALSE},
5259 {"",S_FALSE},
5260 {"google.com",S_OK},
5261 {"",S_FALSE},
5262 {"/",S_OK},
5263 {"/",S_OK},
5264 {"",S_FALSE},
5265 {"http://google.com:999999/",S_OK},
5266 {"http",S_OK},
5267 {"",S_FALSE},
5268 {"",S_FALSE}
5269 },
5270 {
5271 {Uri_HOST_DNS,S_OK},
5272 {999999,S_OK},
5273 {URL_SCHEME_HTTP,S_OK},
5274 {URLZONE_INVALID,E_NOTIMPL}
5275 }
5276 },
5277 { "http://google.com/",0,S_OK,FALSE,
5278 {
5279 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5280 },
5281
5282 {FALSE},
5283 0,S_OK,FALSE,
5284 0,S_OK,FALSE,
5285 0,0,0,S_OK,FALSE,
5286 {
5287 {"http://google.com/?test",S_OK},
5288 {"google.com",S_OK},
5289 {"http://google.com/?test",S_OK},
5290 {"google.com",S_OK},
5291 {"",S_FALSE},
5292 {"",S_FALSE},
5293 {"google.com",S_OK},
5294 {"",S_FALSE},
5295 {"/",S_OK},
5296 {"/?test",S_OK},
5297 {"?test",S_OK},
5298 {"http://google.com/?test",S_OK},
5299 {"http",S_OK},
5300 {"",S_FALSE},
5301 {"",S_FALSE}
5302 },
5303 {
5304 {Uri_HOST_DNS,S_OK},
5305 {80,S_OK},
5306 {URL_SCHEME_HTTP,S_OK},
5307 {URLZONE_INVALID,E_NOTIMPL}
5308 }
5309 },
5310 { "http://:password@google.com/",0,S_OK,FALSE,
5311 {
5312 {FALSE},
5313 },
5314 {FALSE},
5315 0,S_OK,FALSE,
5316 0,S_OK,FALSE,
5317 0,0,0,S_OK,FALSE,
5318 {
5319 {"http://:password@google.com/",S_OK},
5320 {":password@google.com",S_OK},
5321 {"http://google.com/",S_OK},
5322 {"google.com",S_OK},
5323 {"",S_FALSE},
5324 {"",S_FALSE},
5325 {"google.com",S_OK},
5326 {"password",S_OK},
5327 {"/",S_OK},
5328 {"/",S_OK},
5329 {"",S_FALSE},
5330 {"http://:password@google.com/",S_OK},
5331 {"http",S_OK},
5332 {":password",S_OK},
5333 {"",S_FALSE}
5334 },
5335 {
5336 {Uri_HOST_DNS,S_OK},
5337 {80,S_OK},
5338 {URL_SCHEME_HTTP,S_OK},
5339 {URLZONE_INVALID,E_NOTIMPL}
5340 }
5341 },
5342 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5343 { NULL,0,S_OK,FALSE,
5344 {
5345 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5346 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5347 },
5348 {FALSE},
5349 0,S_OK,FALSE,
5350 0,S_OK,FALSE,
5351 0,0,0,S_OK,FALSE,
5352 {
5353 {"http://google.com/",S_OK},
5354 {"google.com",S_OK},
5355 {"http://google.com/",S_OK},
5356 {"google.com",S_OK},
5357 {"",S_FALSE},
5358 {"",S_FALSE},
5359 {"google.com",S_OK},
5360 {"",S_FALSE},
5361 {"/",S_OK},
5362 {"/",S_OK},
5363 {"",S_FALSE},
5364 {"http://google.com/",S_OK},
5365 {"http",S_OK},
5366 {"",S_FALSE},
5367 {"",S_FALSE}
5368 },
5369 {
5370 {Uri_HOST_DNS,S_OK},
5371 {80,S_OK},
5372 {URL_SCHEME_HTTP,S_OK},
5373 {URLZONE_INVALID,E_NOTIMPL}
5374 }
5375 },
5376 /* Can't set the scheme name to NULL. */
5377 { "zip://google.com/",0,S_OK,FALSE,
5378 {
5379 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5380 },
5381 {FALSE},
5382 0,S_OK,FALSE,
5383 0,S_OK,FALSE,
5384 0,0,0,S_OK,FALSE,
5385 {
5386 {"zip://google.com/",S_OK},
5387 {"google.com",S_OK},
5388 {"zip://google.com/",S_OK},
5389 {"google.com",S_OK},
5390 {"",S_FALSE},
5391 {"",S_FALSE},
5392 {"google.com",S_OK},
5393 {"",S_FALSE},
5394 {"/",S_OK},
5395 {"/",S_OK},
5396 {"",S_FALSE},
5397 {"zip://google.com/",S_OK},
5398 {"zip",S_OK},
5399 {"",S_FALSE},
5400 {"",S_FALSE}
5401 },
5402 {
5403 {Uri_HOST_DNS,S_OK},
5404 {0,S_FALSE},
5405 {URL_SCHEME_UNKNOWN,S_OK},
5406 {URLZONE_INVALID,E_NOTIMPL}
5407 }
5408 },
5409 /* Can't set the scheme name to an empty string. */
5410 { "zip://google.com/",0,S_OK,FALSE,
5411 {
5412 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5413 },
5414 {FALSE},
5415 0,S_OK,FALSE,
5416 0,S_OK,FALSE,
5417 0,0,0,S_OK,FALSE,
5418 {
5419 {"zip://google.com/",S_OK},
5420 {"google.com",S_OK},
5421 {"zip://google.com/",S_OK},
5422 {"google.com",S_OK},
5423 {"",S_FALSE},
5424 {"",S_FALSE},
5425 {"google.com",S_OK},
5426 {"",S_FALSE},
5427 {"/",S_OK},
5428 {"/",S_OK},
5429 {"",S_FALSE},
5430 {"zip://google.com/",S_OK},
5431 {"zip",S_OK},
5432 {"",S_FALSE},
5433 {"",S_FALSE}
5434 },
5435 {
5436 {Uri_HOST_DNS,S_OK},
5437 {0,S_FALSE},
5438 {URL_SCHEME_UNKNOWN,S_OK},
5439 {URLZONE_INVALID,E_NOTIMPL}
5440 }
5441 },
5442 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5443 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5444 */
5445 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5446 {{FALSE}},
5447 {FALSE},
5448 -1,S_OK,FALSE,
5449 0,S_OK,FALSE,
5450 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5451 {
5452 {"http://google.com/../../",S_OK},
5453 {"google.com",S_OK},
5454 {"http://google.com/../../",S_OK},
5455 {"google.com",S_OK},
5456 {"",S_FALSE},
5457 {"",S_FALSE},
5458 {"google.com",S_OK},
5459 {"",S_FALSE},
5460 {"/../../",S_OK},
5461 {"/../../",S_OK},
5462 {"",S_FALSE},
5463 {"http://google.com/../../",S_OK},
5464 {"http",S_OK},
5465 {"",S_FALSE},
5466 {"",S_FALSE}
5467 },
5468 {
5469 {Uri_HOST_DNS,S_OK},
5470 {80,S_OK},
5471 {URL_SCHEME_HTTP,S_OK},
5472 {URLZONE_INVALID,E_NOTIMPL}
5473 }
5474 },
5475 { "http://google.com/",0,S_OK,FALSE,
5476 {
5477 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5478 },
5479 {FALSE},
5480 -1,S_OK,FALSE,
5481 0,S_OK,FALSE,
5482 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5483 {
5484 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5485 {"google.com",S_OK},
5486 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5487 {"google.com",S_OK},
5488 {"",S_FALSE},
5489 {"#Fr%3C%7C%3Eg",S_OK},
5490 {"google.com",S_OK},
5491 {"",S_FALSE},
5492 {"/",S_OK},
5493 {"/",S_OK},
5494 {"",S_FALSE},
5495 {"http://google.com/#Fr<|>g",S_OK},
5496 {"http",S_OK},
5497 {"",S_FALSE},
5498 {"",S_FALSE}
5499 },
5500 {
5501 {Uri_HOST_DNS,S_OK},
5502 {80,S_OK},
5503 {URL_SCHEME_HTTP,S_OK},
5504 {URLZONE_INVALID,E_NOTIMPL}
5505 }
5506 },
5507 { "http://google.com/",0,S_OK,FALSE,
5508 {
5509 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5510 },
5511 {FALSE},
5512 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5513 0,S_OK,FALSE,
5514 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5515 {
5516 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5517 {"google.com",S_OK},
5518 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5519 {"google.com",S_OK},
5520 {"",S_FALSE},
5521 {"#Fr%3C%7C%3Eg",S_OK},
5522 {"google.com",S_OK},
5523 {"",S_FALSE},
5524 {"/",S_OK},
5525 {"/",S_OK},
5526 {"",S_FALSE},
5527 {"http://google.com/#Fr<|>g",S_OK},
5528 {"http",S_OK},
5529 {"",S_FALSE},
5530 {"",S_FALSE}
5531 },
5532 {
5533 {Uri_HOST_DNS,S_OK},
5534 {80,S_OK},
5535 {URL_SCHEME_HTTP,S_OK},
5536 {URLZONE_INVALID,E_NOTIMPL}
5537 }
5538 },
5539 { NULL,0,S_OK,FALSE,
5540 {
5541 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5542 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5543 },
5544 {FALSE},
5545 0,INET_E_INVALID_URL,FALSE,
5546 0,INET_E_INVALID_URL,FALSE,
5547 0,0,0,INET_E_INVALID_URL,FALSE
5548 },
5549 { "http://google.com/",0,S_OK,FALSE,
5550 {
5551 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5552 },
5553 {FALSE},
5554 0,INET_E_INVALID_URL,FALSE,
5555 0,INET_E_INVALID_URL,FALSE,
5556 0,0,0,INET_E_INVALID_URL,FALSE
5557 },
5558 /* File scheme's can't have a username set. */
5559 { "file://google.com/",0,S_OK,FALSE,
5560 {
5561 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5562 },
5563 {FALSE},
5564 0,INET_E_INVALID_URL,FALSE,
5565 0,INET_E_INVALID_URL,FALSE,
5566 0,0,0,INET_E_INVALID_URL,FALSE
5567 },
5568 /* File schemes can't have a password set. */
5569 { "file://google.com/",0,S_OK,FALSE,
5570 {
5571 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5572 },
5573 {FALSE},
5574 0,INET_E_INVALID_URL,FALSE,
5575 0,INET_E_INVALID_URL,FALSE,
5576 0,0,0,INET_E_INVALID_URL,FALSE
5577 },
5578 /* UserName can't contain any character that is a delimeter for another
5579 * component that appears after it in a normal URI.
5580 */
5581 { "http://google.com/",0,S_OK,FALSE,
5582 {
5583 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5584 },
5585 {FALSE},
5586 0,INET_E_INVALID_URL,FALSE,
5587 0,INET_E_INVALID_URL,FALSE,
5588 0,0,0,INET_E_INVALID_URL,FALSE
5589 },
5590 { "http://google.com/",0,S_OK,FALSE,
5591 {
5592 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5593 },
5594 {FALSE},
5595 0,INET_E_INVALID_URL,FALSE,
5596 0,INET_E_INVALID_URL,FALSE,
5597 0,0,0,INET_E_INVALID_URL,FALSE
5598 },
5599 { "http://google.com/",0,S_OK,FALSE,
5600 {
5601 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5602 },
5603 {FALSE},
5604 0,INET_E_INVALID_URL,FALSE,
5605 0,INET_E_INVALID_URL,FALSE,
5606 0,0,0,INET_E_INVALID_URL,FALSE
5607 },
5608 { "http://google.com/",0,S_OK,FALSE,
5609 {
5610 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5611 },
5612 {FALSE},
5613 0,INET_E_INVALID_URL,FALSE,
5614 0,INET_E_INVALID_URL,FALSE,
5615 0,0,0,INET_E_INVALID_URL,FALSE
5616 },
5617 { "http://google.com/",0,S_OK,FALSE,
5618 {
5619 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5620 },
5621 {FALSE},
5622 0,INET_E_INVALID_URL,FALSE,
5623 0,INET_E_INVALID_URL,FALSE,
5624 0,0,0,INET_E_INVALID_URL,FALSE
5625 },
5626 { "http://google.com/",0,S_OK,FALSE,
5627 {
5628 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5629 },
5630 {FALSE},
5631 0,INET_E_INVALID_URL,FALSE,
5632 0,INET_E_INVALID_URL,FALSE,
5633 0,0,0,INET_E_INVALID_URL,FALSE
5634 },
5635 { "http://google.com/",0,S_OK,FALSE,
5636 {
5637 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5638 },
5639 {FALSE},
5640 0,INET_E_INVALID_URL,FALSE,
5641 0,INET_E_INVALID_URL,FALSE,
5642 0,0,0,INET_E_INVALID_URL,FALSE
5643 },
5644 { "http://google.com/",0,S_OK,FALSE,
5645 {
5646 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5647 },
5648 {FALSE},
5649 0,INET_E_INVALID_URL,FALSE,
5650 0,INET_E_INVALID_URL,FALSE,
5651 0,0,0,INET_E_INVALID_URL,FALSE
5652 },
5653 { "http://google.com/",0,S_OK,FALSE,
5654 {
5655 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5656 },
5657 {FALSE},
5658 0,INET_E_INVALID_URL,FALSE,
5659 0,INET_E_INVALID_URL,FALSE,
5660 0,0,0,INET_E_INVALID_URL,FALSE
5661 },
5662 { "http://google.com/",0,S_OK,FALSE,
5663 {
5664 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5665 },
5666 {FALSE},
5667 0,INET_E_INVALID_URL,FALSE,
5668 0,INET_E_INVALID_URL,FALSE,
5669 0,0,0,INET_E_INVALID_URL,FALSE
5670 },
5671 { "http://google.com/",0,S_OK,FALSE,
5672 {
5673 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5674 },
5675 {FALSE},
5676 0,INET_E_INVALID_URL,FALSE,
5677 0,INET_E_INVALID_URL,FALSE,
5678 0,0,0,INET_E_INVALID_URL,FALSE
5679 },
5680 { "http://google.com/",0,S_OK,FALSE,
5681 {
5682 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5683 },
5684 {FALSE},
5685 0,INET_E_INVALID_URL,FALSE,
5686 0,INET_E_INVALID_URL,FALSE,
5687 0,0,0,INET_E_INVALID_URL,FALSE
5688 },
5689 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5690 { "http://google.com/",0,S_OK,FALSE,
5691 {
5692 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5693 },
5694 {FALSE},
5695 0,S_OK,FALSE,
5696 0,S_OK,FALSE,
5697 0,0,0,S_OK,FALSE,
5698 {
5699 {"http://winehq.org:test/",S_OK},
5700 {"winehq.org:test",S_OK},
5701 {"http://winehq.org:test/",S_OK},
5702 {"winehq.org:test",S_OK},
5703 {"",S_FALSE},
5704 {"",S_FALSE},
5705 {"winehq.org:test",S_OK},
5706 {"",S_FALSE},
5707 {"/",S_OK},
5708 {"/",S_OK},
5709 {"",S_FALSE},
5710 {"http://winehq.org:test/",S_OK},
5711 {"http",S_OK},
5712 {"",S_FALSE},
5713 {"",S_FALSE}
5714 },
5715 {
5716 {Uri_HOST_DNS,S_OK},
5717 {80,S_OK},
5718 {URL_SCHEME_HTTP,S_OK},
5719 {URLZONE_INVALID,E_NOTIMPL}
5720 }
5721 },
5722 /* Can't set the host name to NULL. */
5723 { "http://google.com/",0,S_OK,FALSE,
5724 {
5725 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5726 },
5727 {FALSE},
5728 0,S_OK,FALSE,
5729 0,S_OK,FALSE,
5730 0,0,0,S_OK,FALSE,
5731 {
5732 {"http://google.com/",S_OK},
5733 {"google.com",S_OK},
5734 {"http://google.com/",S_OK},
5735 {"google.com",S_OK},
5736 {"",S_FALSE},
5737 {"",S_FALSE},
5738 {"google.com",S_OK},
5739 {"",S_FALSE},
5740 {"/",S_OK},
5741 {"/",S_OK},
5742 {"",S_FALSE},
5743 {"http://google.com/",S_OK},
5744 {"http",S_OK},
5745 {"",S_FALSE},
5746 {"",S_FALSE}
5747 },
5748 {
5749 {Uri_HOST_DNS,S_OK},
5750 {80,S_OK},
5751 {URL_SCHEME_HTTP,S_OK},
5752 {URLZONE_INVALID,E_NOTIMPL}
5753 }
5754 },
5755 /* Can set the host name to an empty string. */
5756 { "http://google.com/",0,S_OK,FALSE,
5757 {
5758 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5759 },
5760 {FALSE},
5761 0,S_OK,FALSE,
5762 0,S_OK,FALSE,
5763 0,0,0,S_OK,FALSE,
5764 {
5765 {"http:///",S_OK},
5766 {"",S_OK},
5767 {"http:///",S_OK},
5768 {"",S_FALSE},
5769 {"",S_FALSE},
5770 {"",S_FALSE},
5771 {"",S_OK},
5772 {"",S_FALSE},
5773 {"/",S_OK},
5774 {"/",S_OK},
5775 {"",S_FALSE},
5776 {"http:///",S_OK},
5777 {"http",S_OK},
5778 {"",S_FALSE},
5779 {"",S_FALSE}
5780 },
5781 {
5782 {Uri_HOST_UNKNOWN,S_OK},
5783 {80,S_OK},
5784 {URL_SCHEME_HTTP,S_OK},
5785 {URLZONE_INVALID,E_NOTIMPL}
5786 }
5787 },
5788 { "http://google.com/",0,S_OK,FALSE,
5789 {
5790 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5791 },
5792 {FALSE},
5793 0,INET_E_INVALID_URL,FALSE,
5794 0,INET_E_INVALID_URL,FALSE,
5795 0,0,0,INET_E_INVALID_URL,FALSE
5796 },
5797 { "http://google.com/",0,S_OK,FALSE,
5798 {
5799 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5800 },
5801 {FALSE},
5802 0,INET_E_INVALID_URL,FALSE,
5803 0,INET_E_INVALID_URL,FALSE,
5804 0,0,0,INET_E_INVALID_URL,FALSE
5805 },
5806 { "http://google.com/",0,S_OK,FALSE,
5807 {
5808 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5809 },
5810 {FALSE},
5811 0,INET_E_INVALID_URL,FALSE,
5812 0,INET_E_INVALID_URL,FALSE,
5813 0,0,0,INET_E_INVALID_URL,FALSE
5814 },
5815 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5816 {
5817 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5818 },
5819 {FALSE},
5820 0,S_OK,FALSE,
5821 0,S_OK,FALSE,
5822 0,0,0,S_OK,FALSE,
5823 {
5824 {"file:///c:/dir/file.html",S_OK},
5825 {"",S_FALSE},
5826 {"file:///c:/dir/file.html",S_OK},
5827 {"",S_FALSE},
5828 {".html",S_OK},
5829 {"",S_FALSE},
5830 {"",S_FALSE},
5831 {"",S_FALSE},
5832 {"/c:/dir/file.html",S_OK},
5833 {"/c:/dir/file.html",S_OK},
5834 {"",S_FALSE},
5835 {"file:///c:/dir/file.html",S_OK},
5836 {"file",S_OK},
5837 {"",S_FALSE},
5838 {"",S_FALSE}
5839 },
5840 {
5841 {Uri_HOST_UNKNOWN,S_OK},
5842 {0,S_FALSE},
5843 {URL_SCHEME_FILE,S_OK},
5844 {URLZONE_INVALID,E_NOTIMPL}
5845 }
5846 },
5847 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5848 {
5849 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5850 },
5851 {FALSE},
5852 0,S_OK,FALSE,
5853 0,S_OK,FALSE,
5854 0,0,0,S_OK,FALSE,
5855 {
5856 {"file:///c:/dir/file.html#",S_OK},
5857 {"",S_FALSE},
5858 {"file:///c:/dir/file.html#",S_OK},
5859 {"",S_FALSE},
5860 {".html",S_OK},
5861 {"#",S_OK},
5862 {"",S_FALSE},
5863 {"",S_FALSE},
5864 {"/c:/dir/file.html",S_OK},
5865 {"/c:/dir/file.html",S_OK},
5866 {"",S_FALSE},
5867 {"file:///c:/dir/file.html#",S_OK},
5868 {"file",S_OK},
5869 {"",S_FALSE},
5870 {"",S_FALSE}
5871 },
5872 {
5873 {Uri_HOST_UNKNOWN,S_OK},
5874 {0,S_FALSE},
5875 {URL_SCHEME_FILE,S_OK},
5876 {URLZONE_INVALID,E_NOTIMPL}
5877 }
5878 }
5879 };
5880
5881 typedef struct _uri_builder_remove_test {
5882 const char *uri;
5883 DWORD create_flags;
5884 HRESULT create_builder_expected;
5885 BOOL create_builder_todo;
5886
5887 DWORD remove_properties;
5888 HRESULT remove_expected;
5889 BOOL remove_todo;
5890
5891 const char *expected_uri;
5892 DWORD expected_flags;
5893 HRESULT expected_hres;
5894 BOOL expected_todo;
5895 } uri_builder_remove_test;
5896
5897 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5898 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5899 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5900 "http://google.com/",0,S_OK,FALSE
5901 },
5902 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5903 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5904 "http://winehq.org/",0,S_OK,FALSE
5905 },
5906 { "zip://google.com?Test=x",0,S_OK,FALSE,
5907 Uri_HAS_HOST,S_OK,FALSE,
5908 "zip:/?Test=x",0,S_OK,FALSE
5909 },
5910 /* Doesn't remove the whole userinfo component. */
5911 { "http://username:pass@google.com/",0,S_OK,FALSE,
5912 Uri_HAS_USER_INFO,S_OK,FALSE,
5913 "http://username:pass@google.com/",0,S_OK,FALSE
5914 },
5915 /* Doesn't remove the domain. */
5916 { "http://google.com/",0,S_OK,FALSE,
5917 Uri_HAS_DOMAIN,S_OK,FALSE,
5918 "http://google.com/",0,S_OK,FALSE
5919 },
5920 { "http://google.com:120/",0,S_OK,FALSE,
5921 Uri_HAS_AUTHORITY,S_OK,FALSE,
5922 "http://google.com:120/",0,S_OK,FALSE
5923 },
5924 { "http://google.com/test.com/",0,S_OK,FALSE,
5925 Uri_HAS_EXTENSION,S_OK,FALSE,
5926 "http://google.com/test.com/",0,S_OK,FALSE
5927 },
5928 { "http://google.com/?test=x",0,S_OK,FALSE,
5929 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5930 "http://google.com/?test=x",0,S_OK,FALSE
5931 },
5932 /* Can't remove the scheme name. */
5933 { "http://google.com/?test=x",0,S_OK,FALSE,
5934 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5935 "http://google.com/?test=x",0,S_OK,FALSE
5936 }
5937 };
5938
5939 typedef struct _uri_combine_str_property {
5940 const char *value;
5941 HRESULT expected;
5942 BOOL todo;
5943 const char *broken_value;
5944 const char *value_ex;
5945 } uri_combine_str_property;
5946
5947 typedef struct _uri_combine_test {
5948 const char *base_uri;
5949 DWORD base_create_flags;
5950 const char *relative_uri;
5951 DWORD relative_create_flags;
5952 DWORD combine_flags;
5953 HRESULT expected;
5954 BOOL todo;
5955
5956 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5957 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5958 } uri_combine_test;
5959
5960 static const uri_combine_test uri_combine_tests[] = {
5961 { "http://google.com/fun/stuff",0,
5962 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5963 0,S_OK,FALSE,
5964 {
5965 {"http://google.com/not/fun/stuff",S_OK},
5966 {"google.com",S_OK},
5967 {"http://google.com/not/fun/stuff",S_OK},
5968 {"google.com",S_OK},
5969 {"",S_FALSE},
5970 {"",S_FALSE},
5971 {"google.com",S_OK},
5972 {"",S_FALSE},
5973 {"/not/fun/stuff",S_OK},
5974 {"/not/fun/stuff",S_OK},
5975 {"",S_FALSE},
5976 {"http://google.com/not/fun/stuff",S_OK},
5977 {"http",S_OK},
5978 {"",S_FALSE},
5979 {"",S_FALSE}
5980 },
5981 {
5982 {Uri_HOST_DNS,S_OK},
5983 {80,S_OK},
5984 {URL_SCHEME_HTTP,S_OK},
5985 {URLZONE_INVALID,E_NOTIMPL}
5986 }
5987 },
5988 { "http://google.com/test",0,
5989 "zip://test.com/cool",0,
5990 0,S_OK,FALSE,
5991 {
5992 {"zip://test.com/cool",S_OK},
5993 {"test.com",S_OK},
5994 {"zip://test.com/cool",S_OK},
5995 {"test.com",S_OK},
5996 {"",S_FALSE},
5997 {"",S_FALSE},
5998 {"test.com",S_OK},
5999 {"",S_FALSE},
6000 {"/cool",S_OK},
6001 {"/cool",S_OK},
6002 {"",S_FALSE},
6003 {"zip://test.com/cool",S_OK},
6004 {"zip",S_OK},
6005 {"",S_FALSE},
6006 {"",S_FALSE}
6007 },
6008 {
6009 {Uri_HOST_DNS,S_OK},
6010 {0,S_FALSE},
6011 {URL_SCHEME_UNKNOWN,S_OK},
6012 {URLZONE_INVALID,E_NOTIMPL}
6013 }
6014 },
6015 { "http://google.com/use/base/path",0,
6016 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6017 0,S_OK,FALSE,
6018 {
6019 {"http://google.com/use/base/path?relative",S_OK},
6020 {"google.com",S_OK},
6021 {"http://google.com/use/base/path?relative",S_OK},
6022 {"google.com",S_OK},
6023 {"",S_FALSE},
6024 {"",S_FALSE},
6025 {"google.com",S_OK},
6026 {"",S_FALSE},
6027 {"/use/base/path",S_OK},
6028 {"/use/base/path?relative",S_OK},
6029 {"?relative",S_OK},
6030 {"http://google.com/use/base/path?relative",S_OK},
6031 {"http",S_OK},
6032 {"",S_FALSE},
6033 {"",S_FALSE}
6034 },
6035 {
6036 {Uri_HOST_DNS,S_OK},
6037 {80,S_OK},
6038 {URL_SCHEME_HTTP,S_OK},
6039 {URLZONE_INVALID,E_NOTIMPL}
6040 }
6041 },
6042 { "http://google.com/path",0,
6043 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6044 0,S_OK,FALSE,
6045 {
6046 {"http://google.com/testing",S_OK},
6047 {"google.com",S_OK},
6048 {"http://google.com/testing",S_OK},
6049 {"google.com",S_OK},
6050 {"",S_FALSE},
6051 {"",S_FALSE},
6052 {"google.com",S_OK},
6053 {"",S_FALSE},
6054 {"/testing",S_OK},
6055 {"/testing",S_OK},
6056 {"",S_FALSE},
6057 {"http://google.com/testing",S_OK},
6058 {"http",S_OK},
6059 {"",S_FALSE},
6060 {"",S_FALSE}
6061 },
6062 {
6063 {Uri_HOST_DNS,S_OK},
6064 {80,S_OK},
6065 {URL_SCHEME_HTTP,S_OK},
6066 {URLZONE_INVALID,E_NOTIMPL}
6067 }
6068 },
6069 { "http://google.com/path",0,
6070 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6071 URL_DONT_SIMPLIFY,S_OK,FALSE,
6072 {
6073 {"http://google.com:80/test/../test/.././testing",S_OK},
6074 {"google.com",S_OK},
6075 {"http://google.com:80/test/../test/.././testing",S_OK},
6076 {"google.com",S_OK},
6077 {"",S_FALSE},
6078 {"",S_FALSE},
6079 {"google.com",S_OK},
6080 {"",S_FALSE},
6081 {"/test/../test/.././testing",S_OK},
6082 {"/test/../test/.././testing",S_OK},
6083 {"",S_FALSE},
6084 {"http://google.com:80/test/../test/.././testing",S_OK},
6085 {"http",S_OK},
6086 {"",S_FALSE},
6087 {"",S_FALSE}
6088 },
6089 {
6090 {Uri_HOST_DNS,S_OK},
6091 {80,S_OK},
6092 {URL_SCHEME_HTTP,S_OK},
6093 {URLZONE_INVALID,E_NOTIMPL}
6094 }
6095 },
6096 { "http://winehq.org/test/abc",0,
6097 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6098 0,S_OK,FALSE,
6099 {
6100 {"http://winehq.org/test/testing/test",S_OK},
6101 {"winehq.org",S_OK},
6102 {"http://winehq.org/test/testing/test",S_OK},
6103 {"winehq.org",S_OK},
6104 {"",S_FALSE},
6105 {"",S_FALSE},
6106 {"winehq.org",S_OK},
6107 {"",S_FALSE},
6108 {"/test/testing/test",S_OK},
6109 {"/test/testing/test",S_OK},
6110 {"",S_FALSE},
6111 {"http://winehq.org/test/testing/test",S_OK},
6112 {"http",S_OK},
6113 {"",S_FALSE},
6114 {"",S_FALSE}
6115 },
6116 {
6117 {Uri_HOST_DNS,S_OK},
6118 {80,S_OK},
6119 {URL_SCHEME_HTTP,S_OK},
6120 {URLZONE_INVALID,E_NOTIMPL}
6121 }
6122 },
6123 { "http://winehq.org/test/abc",0,
6124 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6125 URL_DONT_SIMPLIFY,S_OK,FALSE,
6126 {
6127 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6128 /* Default port is hidden in the authority. */
6129 {"winehq.org",S_OK},
6130 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6131 {"winehq.org",S_OK},
6132 {"",S_FALSE},
6133 {"",S_FALSE},
6134 {"winehq.org",S_OK},
6135 {"",S_FALSE},
6136 {"/test/testing/abc/../test",S_OK},
6137 {"/test/testing/abc/../test",S_OK},
6138 {"",S_FALSE},
6139 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6140 {"http",S_OK},
6141 {"",S_FALSE},
6142 {"",S_FALSE}
6143 },
6144 {
6145 {Uri_HOST_DNS,S_OK},
6146 {80,S_OK},
6147 {URL_SCHEME_HTTP,S_OK},
6148 {URLZONE_INVALID,E_NOTIMPL}
6149 }
6150 },
6151 { "http://winehq.org/test?query",0,
6152 "testing",Uri_CREATE_ALLOW_RELATIVE,
6153 0,S_OK,FALSE,
6154 {
6155 {"http://winehq.org/testing",S_OK},
6156 {"winehq.org",S_OK},
6157 {"http://winehq.org/testing",S_OK},
6158 {"winehq.org",S_OK},
6159 {"",S_FALSE},
6160 {"",S_FALSE},
6161 {"winehq.org",S_OK},
6162 {"",S_FALSE},
6163 {"/testing",S_OK},
6164 {"/testing",S_OK},
6165 {"",S_FALSE},
6166 {"http://winehq.org/testing",S_OK},
6167 {"http",S_OK},
6168 {"",S_FALSE},
6169 {"",S_FALSE}
6170 },
6171 {
6172 {Uri_HOST_DNS,S_OK},
6173 {80,S_OK},
6174 {URL_SCHEME_HTTP,S_OK},
6175 {URLZONE_INVALID,E_NOTIMPL}
6176 }
6177 },
6178 { "http://winehq.org/test#frag",0,
6179 "testing",Uri_CREATE_ALLOW_RELATIVE,
6180 0,S_OK,FALSE,
6181 {
6182 {"http://winehq.org/testing",S_OK},
6183 {"winehq.org",S_OK},
6184 {"http://winehq.org/testing",S_OK},
6185 {"winehq.org",S_OK},
6186 {"",S_FALSE},
6187 {"",S_FALSE},
6188 {"winehq.org",S_OK},
6189 {"",S_FALSE},
6190 {"/testing",S_OK},
6191 {"/testing",S_OK},
6192 {"",S_FALSE},
6193 {"http://winehq.org/testing",S_OK},
6194 {"http",S_OK},
6195 {"",S_FALSE},
6196 {"",S_FALSE}
6197 },
6198 {
6199 {Uri_HOST_DNS,S_OK},
6200 {80,S_OK},
6201 {URL_SCHEME_HTTP,S_OK},
6202 {URLZONE_INVALID,E_NOTIMPL}
6203 }
6204 },
6205 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6206 "test",Uri_CREATE_ALLOW_RELATIVE,
6207 0,S_OK,FALSE,
6208 {
6209 {"test",S_OK},
6210 {"",S_FALSE},
6211 {"test",S_OK},
6212 {"",S_FALSE},
6213 {"",S_FALSE},
6214 {"",S_FALSE},
6215 {"",S_FALSE},
6216 {"",S_FALSE},
6217 {"test",S_OK},
6218 {"test",S_OK},
6219 {"",S_FALSE},
6220 {"test",S_OK},
6221 {"",S_FALSE},
6222 {"",S_FALSE},
6223 {"",S_FALSE}
6224 },
6225 {
6226 {Uri_HOST_UNKNOWN,S_OK},
6227 {0,S_FALSE},
6228 {URL_SCHEME_UNKNOWN,S_OK},
6229 {URLZONE_INVALID,E_NOTIMPL}
6230 }
6231 },
6232 { "file:///c:/test/test",0,
6233 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6234 URL_FILE_USE_PATHURL,S_OK,FALSE,
6235 {
6236 {"file://c:\\testing.mp3",S_OK},
6237 {"",S_FALSE},
6238 {"file://c:\\testing.mp3",S_OK},
6239 {"",S_FALSE},
6240 {".mp3",S_OK},
6241 {"",S_FALSE},
6242 {"",S_FALSE},
6243 {"",S_FALSE},
6244 {"c:\\testing.mp3",S_OK},
6245 {"c:\\testing.mp3",S_OK},
6246 {"",S_FALSE},
6247 {"file://c:\\testing.mp3",S_OK},
6248 {"file",S_OK},
6249 {"",S_FALSE},
6250 {"",S_FALSE}
6251 },
6252 {
6253 {Uri_HOST_UNKNOWN,S_OK},
6254 {0,S_FALSE},
6255 {URL_SCHEME_FILE,S_OK},
6256 {URLZONE_INVALID,E_NOTIMPL}
6257 }
6258 },
6259 { "file:///c:/test/test",0,
6260 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6261 0,S_OK,FALSE,
6262 {
6263 {"file:///c:/testing.mp3",S_OK},
6264 {"",S_FALSE},
6265 {"file:///c:/testing.mp3",S_OK},
6266 {"",S_FALSE},
6267 {".mp3",S_OK},
6268 {"",S_FALSE},
6269 {"",S_FALSE},
6270 {"",S_FALSE},
6271 {"/c:/testing.mp3",S_OK},
6272 {"/c:/testing.mp3",S_OK},
6273 {"",S_FALSE},
6274 {"file:///c:/testing.mp3",S_OK},
6275 {"file",S_OK},
6276 {"",S_FALSE},
6277 {"",S_FALSE}
6278 },
6279 {
6280 {Uri_HOST_UNKNOWN,S_OK},
6281 {0,S_FALSE},
6282 {URL_SCHEME_FILE,S_OK},
6283 {URLZONE_INVALID,E_NOTIMPL}
6284 }
6285 },
6286 { "file://test.com/test/test",0,
6287 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6288 URL_FILE_USE_PATHURL,S_OK,FALSE,
6289 {
6290 {"file://\\\\test.com\\testing.mp3",S_OK},
6291 {"test.com",S_OK},
6292 {"file://\\\\test.com\\testing.mp3",S_OK},
6293 {"test.com",S_OK},
6294 {".mp3",S_OK},
6295 {"",S_FALSE},
6296 {"test.com",S_OK},
6297 {"",S_FALSE},
6298 {"\\testing.mp3",S_OK},
6299 {"\\testing.mp3",S_OK},
6300 {"",S_FALSE},
6301 {"file://\\\\test.com\\testing.mp3",S_OK},
6302 {"file",S_OK},
6303 {"",S_FALSE},
6304 {"",S_FALSE}
6305 },
6306 {
6307 {Uri_HOST_DNS,S_OK},
6308 {0,S_FALSE},
6309 {URL_SCHEME_FILE,S_OK},
6310 {URLZONE_INVALID,E_NOTIMPL}
6311 }
6312 },
6313 /* URL_DONT_SIMPLIFY has no effect. */
6314 { "http://google.com/test",0,
6315 "zip://test.com/cool/../cool/test",0,
6316 URL_DONT_SIMPLIFY,S_OK,FALSE,
6317 {
6318 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6319 {"test.com",S_OK},
6320 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6321 {"test.com",S_OK},
6322 {"",S_FALSE},
6323 {"",S_FALSE},
6324 {"test.com",S_OK},
6325 {"",S_FALSE},
6326 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6327 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6328 {"",S_FALSE},
6329 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6330 * On IE 7 it reduces the path in the Raw URI.
6331 */
6332 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6333 {"zip",S_OK},
6334 {"",S_FALSE},
6335 {"",S_FALSE}
6336 },
6337 {
6338 {Uri_HOST_DNS,S_OK},
6339 {0,S_FALSE},
6340 {URL_SCHEME_UNKNOWN,S_OK},
6341 {URLZONE_INVALID,E_NOTIMPL}
6342 }
6343 },
6344 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6345 * resulting URI is converted into a dos path.
6346 */
6347 { "http://google.com/test",0,
6348 "file:///c:/test/",0,
6349 URL_FILE_USE_PATHURL,S_OK,FALSE,
6350 {
6351 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6352 {"",S_FALSE},
6353 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6354 {"",S_FALSE},
6355 {"",S_FALSE},
6356 {"",S_FALSE},
6357 {"",S_FALSE},
6358 {"",S_FALSE},
6359 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6360 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6361 {"",S_FALSE},
6362 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6363 {"file",S_OK},
6364 {"",S_FALSE},
6365 {"",S_FALSE}
6366 },
6367 {
6368 {Uri_HOST_UNKNOWN,S_OK},
6369 {0,S_FALSE},
6370 {URL_SCHEME_FILE,S_OK},
6371 {URLZONE_INVALID,E_NOTIMPL}
6372 }
6373 },
6374 { "http://google.com/test",0,
6375 "http://test.com/test#%30test",0,
6376 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6377 {
6378 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6379 {"test.com",S_OK},
6380 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6381 {"test.com",S_OK},
6382 {"",S_FALSE},
6383 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6384 {"test.com",S_OK},
6385 {"",S_FALSE},
6386 {"/test",S_OK},
6387 {"/test",S_OK},
6388 {"",S_FALSE},
6389 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6390 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6391 {"http",S_OK},
6392 {"",S_FALSE},
6393 {"",S_FALSE}
6394 },
6395 {
6396 {Uri_HOST_DNS,S_OK},
6397 {80,S_OK},
6398 {URL_SCHEME_HTTP,S_OK},
6399 {URLZONE_INVALID,E_NOTIMPL}
6400 }
6401 },
6402 /* Windows validates the path component from the relative Uri. */
6403 { "http://google.com/test",0,
6404 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6405 0,E_INVALIDARG,FALSE
6406 },
6407 /* Windows doesn't validate the query from the relative Uri. */
6408 { "http://google.com/test",0,
6409 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6410 0,S_OK,FALSE,
6411 {
6412 {"http://google.com/test?Tes%XXt",S_OK},
6413 {"google.com",S_OK},
6414 {"http://google.com/test?Tes%XXt",S_OK},
6415 {"google.com",S_OK},
6416 {"",S_FALSE},
6417 {"",S_FALSE},
6418 {"google.com",S_OK},
6419 {"",S_FALSE},
6420 {"/test",S_OK},
6421 {"/test?Tes%XXt",S_OK},
6422 {"?Tes%XXt",S_OK},
6423 {"http://google.com/test?Tes%XXt",S_OK},
6424 {"http",S_OK},
6425 {"",S_FALSE},
6426 {"",S_FALSE}
6427 },
6428 {
6429 {Uri_HOST_DNS,S_OK},
6430 {80,S_OK},
6431 {URL_SCHEME_HTTP,S_OK},
6432 {URLZONE_INVALID,E_NOTIMPL}
6433 }
6434 },
6435 /* Windows doesn't validate the fragment from the relative Uri. */
6436 { "http://google.com/test",0,
6437 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6438 0,S_OK,FALSE,
6439 {
6440 {"http://google.com/test#Tes%XXt",S_OK},
6441 {"google.com",S_OK},
6442 {"http://google.com/test#Tes%XXt",S_OK},
6443 {"google.com",S_OK},
6444 {"",S_FALSE},
6445 {"#Tes%XXt",S_OK},
6446 {"google.com",S_OK},
6447 {"",S_FALSE},
6448 {"/test",S_OK},
6449 {"/test",S_OK},
6450 {"",S_FALSE},
6451 {"http://google.com/test#Tes%XXt",S_OK},
6452 {"http",S_OK},
6453 {"",S_FALSE},
6454 {"",S_FALSE}
6455 },
6456 {
6457 {Uri_HOST_DNS,S_OK},
6458 {80,S_OK},
6459 {URL_SCHEME_HTTP,S_OK},
6460 {URLZONE_INVALID,E_NOTIMPL}
6461 }
6462 },
6463 /* Creates an IUri which contains an invalid dos path char. */
6464 { "file:///c:/test",0,
6465 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6466 URL_FILE_USE_PATHURL,S_OK,FALSE,
6467 {
6468 {"file://c:\\test<ing",S_OK},
6469 {"",S_FALSE},
6470 {"file://c:\\test<ing",S_OK},
6471 {"",S_FALSE},
6472 {"",S_FALSE},
6473 {"",S_FALSE},
6474 {"",S_FALSE},
6475 {"",S_FALSE},
6476 {"c:\\test<ing",S_OK},
6477 {"c:\\test<ing",S_OK},
6478 {"",S_FALSE},
6479 {"file://c:\\test<ing",S_OK},
6480 {"file",S_OK},
6481 {"",S_FALSE},
6482 {"",S_FALSE}
6483 },
6484 {
6485 {Uri_HOST_UNKNOWN,S_OK},
6486 {0,S_FALSE},
6487 {URL_SCHEME_FILE,S_OK},
6488 {URLZONE_INVALID,E_NOTIMPL}
6489 }
6490 },
6491 /* Appends the path after the drive letter (if any). */
6492 { "file:///c:/test",0,
6493 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6494 0,S_OK,FALSE,
6495 {
6496 {"file:///c:/c:/testing",S_OK},
6497 {"",S_FALSE},
6498 {"file:///c:/c:/testing",S_OK},
6499 {"",S_FALSE},
6500 {"",S_FALSE},
6501 {"",S_FALSE},
6502 {"",S_FALSE},
6503 {"",S_FALSE},
6504 {"/c:/c:/testing",S_OK},
6505 {"/c:/c:/testing",S_OK},
6506 {"",S_FALSE},
6507 {"file:///c:/c:/testing",S_OK},
6508 {"file",S_OK},
6509 {"",S_FALSE},
6510 {"",S_FALSE}
6511 },
6512 {
6513 {Uri_HOST_UNKNOWN,S_OK},
6514 {0,S_FALSE},
6515 {URL_SCHEME_FILE,S_OK},
6516 {URLZONE_INVALID,E_NOTIMPL}
6517 }
6518 },
6519 /* A '/' is added if the base URI doesn't have a path and the
6520 * relative URI doesn't contain a path (since the base URI is
6521 * hierarchical.
6522 */
6523 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6524 "?test",Uri_CREATE_ALLOW_RELATIVE,
6525 0,S_OK,FALSE,
6526 {
6527 {"http://google.com/?test",S_OK},
6528 {"google.com",S_OK},
6529 {"http://google.com/?test",S_OK},
6530 {"google.com",S_OK},
6531 {"",S_FALSE},
6532 {"",S_FALSE},
6533 {"google.com",S_OK},
6534 {"",S_FALSE},
6535 {"/",S_OK},
6536 {"/?test",S_OK},
6537 {"?test",S_OK},
6538 {"http://google.com/?test",S_OK},
6539 {"http",S_OK},
6540 {"",S_FALSE},
6541 {"",S_FALSE}
6542 },
6543 {
6544 {Uri_HOST_DNS,S_OK},
6545 {80,S_OK},
6546 {URL_SCHEME_HTTP,S_OK},
6547 {URLZONE_INVALID,E_NOTIMPL}
6548 }
6549 },
6550 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6551 "?test",Uri_CREATE_ALLOW_RELATIVE,
6552 0,S_OK,FALSE,
6553 {
6554 {"zip://google.com/?test",S_OK},
6555 {"google.com",S_OK},
6556 {"zip://google.com/?test",S_OK},
6557 {"google.com",S_OK},
6558 {"",S_FALSE},
6559 {"",S_FALSE},
6560 {"google.com",S_OK},
6561 {"",S_FALSE},
6562 {"/",S_OK},
6563 {"/?test",S_OK},
6564 {"?test",S_OK},
6565 {"zip://google.com/?test",S_OK},
6566 {"zip",S_OK},
6567 {"",S_FALSE},
6568 {"",S_FALSE}
6569 },
6570 {
6571 {Uri_HOST_DNS,S_OK},
6572 {0,S_FALSE},
6573 {URL_SCHEME_UNKNOWN,S_OK},
6574 {URLZONE_INVALID,E_NOTIMPL}
6575 }
6576 },
6577 /* No path is appended since the base URI is opaque. */
6578 { "zip:?testing",0,
6579 "?test",Uri_CREATE_ALLOW_RELATIVE,
6580 0,S_OK,FALSE,
6581 {
6582 {"zip:?test",S_OK},
6583 {"",S_FALSE},
6584 {"zip:?test",S_OK},
6585 {"",S_FALSE},
6586 {"",S_FALSE},
6587 {"",S_FALSE},
6588 {"",S_FALSE},
6589 {"",S_FALSE},
6590 {"",S_OK},
6591 {"?test",S_OK},
6592 {"?test",S_OK},
6593 {"zip:?test",S_OK},
6594 {"zip",S_OK},
6595 {"",S_FALSE},
6596 {"",S_FALSE}
6597 },
6598 {
6599 {Uri_HOST_UNKNOWN,S_OK},
6600 {0,S_FALSE},
6601 {URL_SCHEME_UNKNOWN,S_OK},
6602 {URLZONE_INVALID,E_NOTIMPL}
6603 }
6604 },
6605 { "file:///c:/",0,
6606 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6607 0,S_OK,FALSE,
6608 {
6609 {"file:///c:/testing/test",S_OK},
6610 {"",S_FALSE},
6611 {"file:///c:/testing/test",S_OK},
6612 {"",S_FALSE},
6613 {"",S_FALSE},
6614 {"",S_FALSE},
6615 {"",S_FALSE},
6616 {"",S_FALSE},
6617 {"/c:/testing/test",S_OK},
6618 {"/c:/testing/test",S_OK},
6619 {"",S_FALSE},
6620 {"file:///c:/testing/test",S_OK},
6621 {"file",S_OK},
6622 {"",S_FALSE},
6623 {"",S_FALSE}
6624 },
6625 {
6626 {Uri_HOST_UNKNOWN,S_OK},
6627 {0,S_FALSE},
6628 {URL_SCHEME_FILE,S_OK},
6629 {URLZONE_INVALID,E_NOTIMPL}
6630 }
6631 },
6632 { "http://winehq.org/dir/testfile",0,
6633 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6634 0,S_OK,FALSE,
6635 {
6636 {"http://winehq.org/dir/test?querystring",S_OK},
6637 {"winehq.org",S_OK},
6638 {"http://winehq.org/dir/test?querystring",S_OK},
6639 {"winehq.org",S_OK},
6640 {"",S_FALSE},
6641 {"",S_FALSE},
6642 {"winehq.org",S_OK},
6643 {"",S_FALSE},
6644 {"/dir/test",S_OK},
6645 {"/dir/test?querystring",S_OK},
6646 {"?querystring",S_OK},
6647 {"http://winehq.org/dir/test?querystring",S_OK},
6648 {"http",S_OK},
6649 {"",S_FALSE},
6650 {"",S_FALSE}
6651 },
6652 {
6653 {Uri_HOST_DNS,S_OK},
6654 {80,S_OK},
6655 {URL_SCHEME_HTTP,S_OK},
6656 {URLZONE_INVALID,E_NOTIMPL}
6657 }
6658 },
6659 { "http://winehq.org/dir/test",0,
6660 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6661 0,S_OK,FALSE,
6662 {
6663 {"http://winehq.org/dir/test?querystring",S_OK},
6664 {"winehq.org",S_OK},
6665 {"http://winehq.org/dir/test?querystring",S_OK},
6666 {"winehq.org",S_OK},
6667 {"",S_FALSE},
6668 {"",S_FALSE},
6669 {"winehq.org",S_OK},
6670 {"",S_FALSE},
6671 {"/dir/test",S_OK},
6672 {"/dir/test?querystring",S_OK},
6673 {"?querystring",S_OK},
6674 {"http://winehq.org/dir/test?querystring",S_OK},
6675 {"http",S_OK},
6676 {"",S_FALSE},
6677 {"",S_FALSE}
6678 },
6679 {
6680 {Uri_HOST_DNS,S_OK},
6681 {80,S_OK},
6682 {URL_SCHEME_HTTP,S_OK},
6683 {URLZONE_INVALID,E_NOTIMPL}
6684 }
6685 },
6686 { "http://winehq.org/dir/test?querystring",0,
6687 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6688 0,S_OK,FALSE,
6689 {
6690 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6691 {"winehq.org",S_OK},
6692 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6693 {"winehq.org",S_OK},
6694 {"",S_FALSE},
6695 {"#hash",S_OK},
6696 {"winehq.org",S_OK},
6697 {"",S_FALSE},
6698 {"/dir/test",S_OK},
6699 {"/dir/test?querystring",S_OK},
6700 {"?querystring",S_OK},
6701 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6702 {"http",S_OK},
6703 {"",S_FALSE},
6704 {"",S_FALSE}
6705 },
6706 {
6707 {Uri_HOST_DNS,S_OK},
6708 {80,S_OK},
6709 {URL_SCHEME_HTTP,S_OK},
6710 {URLZONE_INVALID,E_NOTIMPL}
6711 }
6712 },
6713 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6714 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6715 0,S_OK,FALSE,
6716 {
6717 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6718 {"",S_FALSE},
6719 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6720 {"",S_FALSE},
6721 {".txt",S_OK},
6722 {"",S_FALSE},
6723 {"",S_FALSE},
6724 {"",S_FALSE},
6725 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6726 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6727 {"",S_FALSE},
6728 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6729 {"mk",S_OK},
6730 {"",S_FALSE},
6731 {"",S_FALSE}
6732 },
6733 {
6734 {Uri_HOST_UNKNOWN,S_OK},
6735 {0,S_FALSE},
6736 {URL_SCHEME_MK,S_OK},
6737 {URLZONE_INVALID,E_NOTIMPL}
6738 }
6739 },
6740 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6741 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6742 0,S_OK,FALSE,
6743 {
6744 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6745 {"",S_FALSE},
6746 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6747 {"",S_FALSE},
6748 {".txt",S_OK},
6749 {"",S_FALSE},
6750 {"",S_FALSE},
6751 {"",S_FALSE},
6752 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6753 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6754 {"",S_FALSE},
6755 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6756 {"mk",S_OK},
6757 {"",S_FALSE},
6758 {"",S_FALSE}
6759 },
6760 {
6761 {Uri_HOST_UNKNOWN,S_OK},
6762 {0,S_FALSE},
6763 {URL_SCHEME_MK,S_OK},
6764 {URLZONE_INVALID,E_NOTIMPL}
6765 }
6766 },
6767 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6768 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6769 0,S_OK,FALSE,
6770 {
6771 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6772 {"",S_FALSE},
6773 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6774 {"",S_FALSE},
6775 {".txt",S_OK},
6776 {"",S_FALSE},
6777 {"",S_FALSE},
6778 {"",S_FALSE},
6779 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6780 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6781 {"",S_FALSE},
6782 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6783 {"mk",S_OK},
6784 {"",S_FALSE},
6785 {"",S_FALSE}
6786 },
6787 {
6788 {Uri_HOST_UNKNOWN,S_OK},
6789 {0,S_FALSE},
6790 {URL_SCHEME_MK,S_OK},
6791 {URLZONE_INVALID,E_NOTIMPL}
6792 }
6793 },
6794 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6795 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6796 0,S_OK,FALSE,
6797 {
6798 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6799 {"",S_FALSE},
6800 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6801 {"",S_FALSE},
6802 {".txt",S_OK},
6803 {"",S_FALSE},
6804 {"",S_FALSE},
6805 {"",S_FALSE},
6806 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6807 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6808 {"",S_FALSE},
6809 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6810 {"mk",S_OK},
6811 {"",S_FALSE},
6812 {"",S_FALSE}
6813 },
6814 {
6815 {Uri_HOST_UNKNOWN,S_OK},
6816 {0,S_FALSE},
6817 {URL_SCHEME_MK,S_OK},
6818 {URLZONE_INVALID,E_NOTIMPL}
6819 }
6820 },
6821 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6822 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6823 0,S_OK,FALSE,
6824 {
6825 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6826 {"",S_FALSE},
6827 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6828 {"",S_FALSE},
6829 {".txt",S_OK},
6830 {"",S_FALSE},
6831 {"",S_FALSE},
6832 {"",S_FALSE},
6833 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6834 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6835 {"",S_FALSE},
6836 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6837 {"mk",S_OK},
6838 {"",S_FALSE},
6839 {"",S_FALSE}
6840 },
6841 {
6842 {Uri_HOST_UNKNOWN,S_OK},
6843 {0,S_FALSE},
6844 {URL_SCHEME_MK,S_OK},
6845 {URLZONE_INVALID,E_NOTIMPL}
6846 }
6847 },
6848 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6849 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6850 0,S_OK,FALSE,
6851 {
6852 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6853 {"",S_FALSE},
6854 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6855 {"",S_FALSE},
6856 {".txt",S_OK},
6857 {"",S_FALSE},
6858 {"",S_FALSE},
6859 {"",S_FALSE},
6860 {"@MSITSTORE:/relative/path.txt",S_OK},
6861 {"@MSITSTORE:/relative/path.txt",S_OK},
6862 {"",S_FALSE},
6863 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6864 {"mk",S_OK},
6865 {"",S_FALSE},
6866 {"",S_FALSE}
6867 },
6868 {
6869 {Uri_HOST_UNKNOWN,S_OK},
6870 {0,S_FALSE},
6871 {URL_SCHEME_MK,S_OK},
6872 {URLZONE_INVALID,E_NOTIMPL}
6873 }
6874 },
6875 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6876 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6877 0,S_OK,FALSE,
6878 {
6879 {"mk:@xxx:/relative/path.txt",S_OK},
6880 {"",S_FALSE},
6881 {"mk:@xxx:/relative/path.txt",S_OK},
6882 {"",S_FALSE},
6883 {".txt",S_OK},
6884 {"",S_FALSE},
6885 {"",S_FALSE},
6886 {"",S_FALSE},
6887 {"@xxx:/relative/path.txt",S_OK},
6888 {"@xxx:/relative/path.txt",S_OK},
6889 {"",S_FALSE},
6890 {"mk:@xxx:/relative/path.txt",S_OK},
6891 {"mk",S_OK},
6892 {"",S_FALSE},
6893 {"",S_FALSE}
6894 },
6895 {
6896 {Uri_HOST_UNKNOWN,S_OK},
6897 {0,S_FALSE},
6898 {URL_SCHEME_MK,S_OK},
6899 {URLZONE_INVALID,E_NOTIMPL}
6900 }
6901 },
6902 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6903 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6904 0,S_OK,FALSE,
6905 {
6906 {"mk:/relative/path.txt",S_OK},
6907 {"",S_FALSE},
6908 {"mk:/relative/path.txt",S_OK},
6909 {"",S_FALSE},
6910 {".txt",S_OK},
6911 {"",S_FALSE},
6912 {"",S_FALSE},
6913 {"",S_FALSE},
6914 {"/relative/path.txt",S_OK},
6915 {"/relative/path.txt",S_OK},
6916 {"",S_FALSE},
6917 {"mk:/relative/path.txt",S_OK},
6918 {"mk",S_OK},
6919 {"",S_FALSE},
6920 {"",S_FALSE}
6921 },
6922 {
6923 {Uri_HOST_UNKNOWN,S_OK},
6924 {0,S_FALSE},
6925 {URL_SCHEME_MK,S_OK},
6926 {URLZONE_INVALID,E_NOTIMPL}
6927 }
6928 },
6929 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6930 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6931 0,S_OK,FALSE,
6932 {
6933 {"ml:/relative/path.txt",S_OK},
6934 {"",S_FALSE},
6935 {"ml:/relative/path.txt",S_OK},
6936 {"",S_FALSE},
6937 {".txt",S_OK},
6938 {"",S_FALSE},
6939 {"",S_FALSE},
6940 {"",S_FALSE},
6941 {"/relative/path.txt",S_OK},
6942 {"/relative/path.txt",S_OK},
6943 {"",S_FALSE},
6944 {"ml:/relative/path.txt",S_OK},
6945 {"ml",S_OK},
6946 {"",S_FALSE},
6947 {"",S_FALSE}
6948 },
6949 {
6950 {Uri_HOST_UNKNOWN,S_OK},
6951 {0,S_FALSE},
6952 {URL_SCHEME_UNKNOWN,S_OK},
6953 {URLZONE_INVALID,E_NOTIMPL}
6954 }
6955 },
6956 { "http://winehq.org/dir/test?querystring",0,
6957 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
6958 0,S_OK,FALSE,
6959 {
6960 {"http://winehq.com/#hash",S_OK},
6961 {"winehq.com",S_OK},
6962 {"http://winehq.com/#hash",S_OK},
6963 {"winehq.com",S_OK},
6964 {"",S_FALSE},
6965 {"#hash",S_OK},
6966 {"winehq.com",S_OK},
6967 {"",S_FALSE},
6968 {"/",S_OK},
6969 {"/",S_OK},
6970 {"",S_FALSE},
6971 {"http://winehq.com/#hash",S_OK},
6972 {"http",S_OK},
6973 {"",S_FALSE},
6974 {"",S_FALSE}
6975 },
6976 {
6977 {Uri_HOST_DNS,S_OK},
6978 {80,S_OK,FALSE,TRUE},
6979 {URL_SCHEME_HTTP,S_OK},
6980 {URLZONE_INVALID,E_NOTIMPL}
6981 }
6982 },
6983 { "http://winehq.org/dir/test?querystring",0,
6984 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
6985 0,S_OK,FALSE,
6986 {
6987 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6988 {"winehq.com",S_OK},
6989 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6990 {"winehq.com",S_OK},
6991 {".txt",S_OK},
6992 {"#hash",S_OK},
6993 {"winehq.com",S_OK},
6994 {"",S_FALSE},
6995 {"/dir/file.txt",S_OK},
6996 {"/dir/file.txt?query",S_OK},
6997 {"?query",S_OK},
6998 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6999 {"http",S_OK},
7000 {"",S_FALSE},
7001 {"",S_FALSE}
7002 },
7003 {
7004 {Uri_HOST_DNS,S_OK},
7005 {80,S_OK,FALSE,TRUE},
7006 {URL_SCHEME_HTTP,S_OK},
7007 {URLZONE_INVALID,E_NOTIMPL}
7008 }
7009 },
7010 { "http://google.com/test",0,
7011 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7012 0,S_OK,FALSE,
7013 {
7014 {"file:///c:/test/",S_OK},
7015 {"",S_FALSE},
7016 {"file:///c:/test/",S_OK},
7017 {"",S_FALSE},
7018 {"",S_FALSE},
7019 {"",S_FALSE},
7020 {"",S_FALSE},
7021 {"",S_FALSE},
7022 {"/c:/test/",S_OK},
7023 {"/c:/test/",S_OK},
7024 {"",S_FALSE},
7025 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7026 {"file",S_OK},
7027 {"",S_FALSE},
7028 {"",S_FALSE}
7029 },
7030 {
7031 {Uri_HOST_UNKNOWN,S_OK},
7032 {0,S_FALSE},
7033 {URL_SCHEME_FILE,S_OK},
7034 {URLZONE_INVALID,E_NOTIMPL}
7035 }
7036 },
7037 { "http://google.com/test",0,
7038 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7039 0,S_OK,FALSE,
7040 {
7041 {"file:///c:/test/",S_OK},
7042 {"",S_FALSE},
7043 {"file:///c:/test/",S_OK},
7044 {"",S_FALSE},
7045 {"",S_FALSE},
7046 {"",S_FALSE},
7047 {"",S_FALSE},
7048 {"",S_FALSE},
7049 {"/c:/test/",S_OK},
7050 {"/c:/test/",S_OK},
7051 {"",S_FALSE},
7052 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7053 {"file",S_OK},
7054 {"",S_FALSE},
7055 {"",S_FALSE}
7056 },
7057 {
7058 {Uri_HOST_UNKNOWN,S_OK},
7059 {0,S_FALSE},
7060 {URL_SCHEME_FILE,S_OK},
7061 {URLZONE_INVALID,E_NOTIMPL}
7062 }
7063 },
7064 { "http://winehq.org",0,
7065 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7066 0,S_OK,FALSE,
7067 {
7068 {"mailto:",S_OK},
7069 {"",S_FALSE},
7070 {"mailto:",S_OK},
7071 {"",S_FALSE},
7072 {"",S_FALSE},
7073 {"",S_FALSE},
7074 {"",S_FALSE},
7075 {"",S_FALSE},
7076 {"",S_FALSE},
7077 {"",S_FALSE},
7078 {"",S_FALSE},
7079 {"mailto://",S_OK,FALSE,"mailto:"},
7080 {"mailto",S_OK},
7081 {"",S_FALSE},
7082 {"",S_FALSE}
7083 },
7084 {
7085 {Uri_HOST_UNKNOWN,S_OK},
7086 {0,S_FALSE},
7087 {URL_SCHEME_MAILTO,S_OK},
7088 {URLZONE_INVALID,E_NOTIMPL}
7089 }
7090 },
7091 { "http://winehq.org",0,
7092 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7093 0,S_OK,FALSE,
7094 {
7095 {"mailto:a@b.com",S_OK},
7096 {"",S_FALSE},
7097 {"mailto:a@b.com",S_OK},
7098 {"",S_FALSE},
7099 {".com",S_OK},
7100 {"",S_FALSE},
7101 {"",S_FALSE},
7102 {"",S_FALSE},
7103 {"a@b.com",S_OK},
7104 {"a@b.com",S_OK},
7105 {"",S_FALSE},
7106 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7107 {"mailto",S_OK},
7108 {"",S_FALSE},
7109 {"",S_FALSE}
7110 },
7111 {
7112 {Uri_HOST_UNKNOWN,S_OK},
7113 {0,S_FALSE},
7114 {URL_SCHEME_MAILTO,S_OK},
7115 {URLZONE_INVALID,E_NOTIMPL}
7116 }
7117 }
7118 };
7119
7120 typedef struct _uri_parse_test {
7121 const char *uri;
7122 DWORD uri_flags;
7123 PARSEACTION action;
7124 DWORD flags;
7125 const char *property;
7126 HRESULT expected;
7127 BOOL todo;
7128 } uri_parse_test;
7129
7130 static const uri_parse_test uri_parse_tests[] = {
7131 /* PARSE_CANONICALIZE tests. */
7132 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7133 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7134 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7135 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7136 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7137 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7138 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7139 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7140 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7141 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7142 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7143 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7144
7145 /* PARSE_FRIENDLY tests. */
7146 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7147 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7148
7149 /* PARSE_ROOTDOCUMENT tests. */
7150 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7151 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7152 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7153 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7154 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7155 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7156
7157 /* PARSE_DOCUMENT tests. */
7158 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7159 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7160 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7161 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7162 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7163 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7164
7165 /* PARSE_PATH_FROM_URL tests. */
7166 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7167 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7168 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7169 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7170 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7171
7172 /* PARSE_URL_FROM_PATH tests. */
7173 /* This function almost seems to useless (just returns the absolute uri). */
7174 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7175 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7176 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7177 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7178 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7179
7180 /* PARSE_SCHEMA tests. */
7181 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7182 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7183
7184 /* PARSE_SITE tests. */
7185 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7186 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7187 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7188 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7189
7190 /* PARSE_DOMAIN tests. */
7191 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7192 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7193 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7194 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7195
7196 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7197 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7198 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7199 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7200 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7201 };
7202
7203 static inline LPWSTR a2w(LPCSTR str) {
7204 LPWSTR ret = NULL;
7205
7206 if(str) {
7207 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7208 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7209 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7210 }
7211
7212 return ret;
7213 }
7214
7215 static inline BOOL heap_free(void* mem) {
7216 return HeapFree(GetProcessHeap(), 0, mem);
7217 }
7218
7219 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7220 LPWSTR strAW = a2w(strA);
7221 DWORD ret = lstrcmpW(strAW, strB);
7222 heap_free(strAW);
7223 return ret;
7224 }
7225
7226 static inline ULONG get_refcnt(IUri *uri) {
7227 IUri_AddRef(uri);
7228 return IUri_Release(uri);
7229 }
7230
7231 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7232 DWORD test_index) {
7233 HRESULT hr;
7234 LPWSTR valueW;
7235
7236 valueW = a2w(prop->value);
7237 switch(prop->property) {
7238 case Uri_PROPERTY_FRAGMENT:
7239 hr = IUriBuilder_SetFragment(builder, valueW);
7240 if(prop->todo) {
7241 todo_wine {
7242 ok(hr == prop->expected,
7243 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7244 hr, prop->expected, test_index);
7245 }
7246 } else {
7247 ok(hr == prop->expected,
7248 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7249 hr, prop->expected, test_index);
7250 }
7251 break;
7252 case Uri_PROPERTY_HOST:
7253 hr = IUriBuilder_SetHost(builder, valueW);
7254 if(prop->todo) {
7255 todo_wine {
7256 ok(hr == prop->expected,
7257 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7258 hr, prop->expected, test_index);
7259 }
7260 } else {
7261 ok(hr == prop->expected,
7262 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7263 hr, prop->expected, test_index);
7264 }
7265 break;
7266 case Uri_PROPERTY_PASSWORD:
7267 hr = IUriBuilder_SetPassword(builder, valueW);
7268 if(prop->todo) {
7269 todo_wine {
7270 ok(hr == prop->expected,
7271 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7272 hr, prop->expected, test_index);
7273 }
7274 } else {
7275 ok(hr == prop->expected,
7276 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7277 hr, prop->expected, test_index);
7278 }
7279 break;
7280 case Uri_PROPERTY_PATH:
7281 hr = IUriBuilder_SetPath(builder, valueW);
7282 if(prop->todo) {
7283 todo_wine {
7284 ok(hr == prop->expected,
7285 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7286 hr, prop->expected, test_index);
7287 }
7288 } else {
7289 ok(hr == prop->expected,
7290 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7291 hr, prop->expected, test_index);
7292 }
7293 break;
7294 case Uri_PROPERTY_QUERY:
7295 hr = IUriBuilder_SetQuery(builder, valueW);
7296 if(prop->todo) {
7297 todo_wine {
7298 ok(hr == prop->expected,
7299 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7300 hr, prop->expected, test_index);
7301 }
7302 } else {
7303 ok(hr == prop->expected,
7304 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7305 hr, prop->expected, test_index);
7306 }
7307 break;
7308 case Uri_PROPERTY_SCHEME_NAME:
7309 hr = IUriBuilder_SetSchemeName(builder, valueW);
7310 if(prop->todo) {
7311 todo_wine {
7312 ok(hr == prop->expected,
7313 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7314 hr, prop->expected, test_index);
7315 }
7316 } else {
7317 ok(hr == prop->expected,
7318 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7319 hr, prop->expected, test_index);
7320 }
7321 break;
7322 case Uri_PROPERTY_USER_NAME:
7323 hr = IUriBuilder_SetUserName(builder, valueW);
7324 if(prop->todo) {
7325 todo_wine {
7326 ok(hr == prop->expected,
7327 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7328 hr, prop->expected, test_index);
7329 }
7330 } else {
7331 ok(hr == prop->expected,
7332 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7333 hr, prop->expected, test_index);
7334 }
7335 break;
7336 default:
7337 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7338 }
7339
7340 heap_free(valueW);
7341 }
7342
7343 /*
7344 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7345 * correctly.
7346 */
7347 static void test_CreateUri_InvalidFlags(void) {
7348 DWORD i;
7349
7350 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7351 HRESULT hr;
7352 IUri *uri = (void*) 0xdeadbeef;
7353
7354 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7355 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7356 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7357 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7358 }
7359 }
7360
7361 static void test_CreateUri_InvalidArgs(void) {
7362 HRESULT hr;
7363 IUri *uri = (void*) 0xdeadbeef;
7364
7365 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7366 static const WCHAR emptyW[] = {0};
7367
7368 hr = pCreateUri(http_urlW, 0, 0, NULL);
7369 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7370
7371 hr = pCreateUri(NULL, 0, 0, &uri);
7372 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7373 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7374
7375 uri = (void*) 0xdeadbeef;
7376 hr = pCreateUri(invalidW, 0, 0, &uri);
7377 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7378 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7379
7380 uri = (void*) 0xdeadbeef;
7381 hr = pCreateUri(emptyW, 0, 0, &uri);
7382 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7383 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7384 }
7385
7386 static void test_CreateUri_InvalidUri(void) {
7387 DWORD i;
7388
7389 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7390 invalid_uri test = invalid_uri_tests[i];
7391 IUri *uri = NULL;
7392 LPWSTR uriW;
7393 HRESULT hr;
7394
7395 uriW = a2w(test.uri);
7396 hr = pCreateUri(uriW, test.flags, 0, &uri);
7397 if(test.todo) {
7398 todo_wine {
7399 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7400 hr, E_INVALIDARG, i);
7401 }
7402 } else {
7403 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7404 hr, E_INVALIDARG, i);
7405 }
7406 if(uri) IUri_Release(uri);
7407
7408 heap_free(uriW);
7409 }
7410 }
7411
7412 static void test_IUri_GetPropertyBSTR(void) {
7413 IUri *uri = NULL;
7414 HRESULT hr;
7415 DWORD i;
7416
7417 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7418 hr = pCreateUri(http_urlW, 0, 0, &uri);
7419 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7420 if(SUCCEEDED(hr)) {
7421 BSTR received = NULL;
7422
7423 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7424 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7425
7426 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7427 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7428 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7429 if(SUCCEEDED(hr)) {
7430 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7431 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7432 SysFreeString(received);
7433 }else {
7434 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7435 }
7436
7437 /* Make sure it handles the ZONE property correctly. */
7438 received = NULL;
7439 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7440 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7441 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7442 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7443 SysFreeString(received);
7444 }
7445 if(uri) IUri_Release(uri);
7446
7447 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7448 uri_properties test = uri_tests[i];
7449 LPWSTR uriW;
7450 uri = NULL;
7451
7452 uriW = a2w(test.uri);
7453 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7454 if(test.create_todo) {
7455 todo_wine {
7456 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7457 hr, test.create_expected, i);
7458 }
7459 } else {
7460 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7461 hr, test.create_expected, i);
7462 }
7463
7464 if(SUCCEEDED(hr)) {
7465 DWORD j;
7466
7467 /* Checks all the string properties of the uri. */
7468 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7469 BSTR received = NULL;
7470 uri_str_property prop = test.str_props[j];
7471
7472 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7473 if(prop.todo) {
7474 todo_wine {
7475 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7476 hr, prop.expected, i, j);
7477 }
7478 todo_wine {
7479 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7480 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7481 prop.value, wine_dbgstr_w(received), i, j);
7482 }
7483 } else {
7484 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7485 hr, prop.expected, i, j);
7486 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7487 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7488 prop.value, wine_dbgstr_w(received), i, j);
7489 }
7490
7491 SysFreeString(received);
7492 }
7493 }
7494
7495 if(uri) IUri_Release(uri);
7496
7497 heap_free(uriW);
7498 }
7499 }
7500
7501 static void test_IUri_GetPropertyDWORD(void) {
7502 IUri *uri = NULL;
7503 HRESULT hr;
7504 DWORD i;
7505
7506 hr = pCreateUri(http_urlW, 0, 0, &uri);
7507 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7508 if(SUCCEEDED(hr)) {
7509 DWORD received = 0xdeadbeef;
7510
7511 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7512 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7513
7514 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7515 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7516 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7517 }
7518 if(uri) IUri_Release(uri);
7519
7520 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7521 uri_properties test = uri_tests[i];
7522 LPWSTR uriW;
7523 uri = NULL;
7524
7525 uriW = a2w(test.uri);
7526 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7527 if(test.create_todo) {
7528 todo_wine {
7529 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7530 hr, test.create_expected, i);
7531 }
7532 } else {
7533 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7534 hr, test.create_expected, i);
7535 }
7536
7537 if(SUCCEEDED(hr)) {
7538 DWORD j;
7539
7540 /* Checks all the DWORD properties of the uri. */
7541 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7542 DWORD received;
7543 uri_dword_property prop = test.dword_props[j];
7544
7545 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7546 if(prop.todo) {
7547 todo_wine {
7548 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7549 hr, prop.expected, i, j);
7550 }
7551 todo_wine {
7552 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7553 prop.value, received, i, j);
7554 }
7555 } else {
7556 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7557 hr, prop.expected, i, j);
7558 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7559 prop.value, received, i, j);
7560 }
7561 }
7562 }
7563
7564 if(uri) IUri_Release(uri);
7565
7566 heap_free(uriW);
7567 }
7568 }
7569
7570 /* Tests all the 'Get*' property functions which deal with strings. */
7571 static void test_IUri_GetStrProperties(void) {
7572 IUri *uri = NULL;
7573 HRESULT hr;
7574 DWORD i;
7575
7576 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7577 hr = pCreateUri(http_urlW, 0, 0, &uri);
7578 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7579 if(SUCCEEDED(hr)) {
7580 hr = IUri_GetAbsoluteUri(uri, NULL);
7581 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7582
7583 hr = IUri_GetAuthority(uri, NULL);
7584 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7585
7586 hr = IUri_GetDisplayUri(uri, NULL);
7587 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7588
7589 hr = IUri_GetDomain(uri, NULL);
7590 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7591
7592 hr = IUri_GetExtension(uri, NULL);
7593 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7594
7595 hr = IUri_GetFragment(uri, NULL);
7596 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7597
7598 hr = IUri_GetHost(uri, NULL);
7599 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7600
7601 hr = IUri_GetPassword(uri, NULL);
7602 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7603
7604 hr = IUri_GetPath(uri, NULL);
7605 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7606
7607 hr = IUri_GetPathAndQuery(uri, NULL);
7608 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7609
7610 hr = IUri_GetQuery(uri, NULL);
7611 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7612
7613 hr = IUri_GetRawUri(uri, NULL);
7614 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7615
7616 hr = IUri_GetSchemeName(uri, NULL);
7617 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7618
7619 hr = IUri_GetUserInfo(uri, NULL);
7620 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7621
7622 hr = IUri_GetUserName(uri, NULL);
7623 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7624 }
7625 if(uri) IUri_Release(uri);
7626
7627 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7628 uri_properties test = uri_tests[i];
7629 LPWSTR uriW;
7630 uri = NULL;
7631
7632 uriW = a2w(test.uri);
7633 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7634 if(test.create_todo) {
7635 todo_wine {
7636 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7637 hr, test.create_expected, i);
7638 }
7639 } else {
7640 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7641 hr, test.create_expected, i);
7642 }
7643
7644 if(SUCCEEDED(hr)) {
7645 uri_str_property prop;
7646 BSTR received = NULL;
7647
7648 /* GetAbsoluteUri() tests. */
7649 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7650 hr = IUri_GetAbsoluteUri(uri, &received);
7651 if(prop.todo) {
7652 todo_wine {
7653 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7654 hr, prop.expected, i);
7655 }
7656 todo_wine {
7657 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7658 "Error: Expected %s but got %s on uri_tests[%d].\n",
7659 prop.value, wine_dbgstr_w(received), i);
7660 }
7661 } else {
7662 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7663 hr, prop.expected, i);
7664 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7665 "Error: Expected %s but got %s on uri_tests[%d].\n",
7666 prop.value, wine_dbgstr_w(received), i);
7667 }
7668 SysFreeString(received);
7669 received = NULL;
7670
7671 /* GetAuthority() tests. */
7672 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7673 hr = IUri_GetAuthority(uri, &received);
7674 if(prop.todo) {
7675 todo_wine {
7676 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7677 hr, prop.expected, i);
7678 }
7679 todo_wine {
7680 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7681 prop.value, wine_dbgstr_w(received), i);
7682 }
7683 } else {
7684 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7685 hr, prop.expected, i);
7686 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7687 prop.value, wine_dbgstr_w(received), i);
7688 }
7689 SysFreeString(received);
7690 received = NULL;
7691
7692 /* GetDisplayUri() tests. */
7693 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7694 hr = IUri_GetDisplayUri(uri, &received);
7695 if(prop.todo) {
7696 todo_wine {
7697 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7698 hr, prop.expected, i);
7699 }
7700 todo_wine {
7701 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7702 "Error: Expected %s but got %s on uri_test[%d].\n",
7703 prop.value, wine_dbgstr_w(received), i);
7704 }
7705 } else {
7706 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7707 hr, prop.expected, i);
7708 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7709 "Error: Expected %s but got %s on uri_tests[%d].\n",
7710 prop.value, wine_dbgstr_w(received), i);
7711 }
7712 SysFreeString(received);
7713 received = NULL;
7714
7715 /* GetDomain() tests. */
7716 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7717 hr = IUri_GetDomain(uri, &received);
7718 if(prop.todo) {
7719 todo_wine {
7720 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7721 hr, prop.expected, i);
7722 }
7723 todo_wine {
7724 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7725 prop.value, wine_dbgstr_w(received), i);
7726 }
7727 } else {
7728 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7729 hr, prop.expected, i);
7730 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7731 prop.value, wine_dbgstr_w(received), i);
7732 }
7733 SysFreeString(received);
7734 received = NULL;
7735
7736 /* GetExtension() tests. */
7737 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7738 hr = IUri_GetExtension(uri, &received);
7739 if(prop.todo) {
7740 todo_wine {
7741 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7742 hr, prop.expected, i);
7743 }
7744 todo_wine {
7745 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7746 prop.value, wine_dbgstr_w(received), i);
7747 }
7748 } else {
7749 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7750 hr, prop.expected, i);
7751 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7752 prop.value, wine_dbgstr_w(received), i);
7753 }
7754 SysFreeString(received);
7755 received = NULL;
7756
7757 /* GetFragment() tests. */
7758 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7759 hr = IUri_GetFragment(uri, &received);
7760 if(prop.todo) {
7761 todo_wine {
7762 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7763 hr, prop.expected, i);
7764 }
7765 todo_wine {
7766 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7767 prop.value, wine_dbgstr_w(received), i);
7768 }
7769 } else {
7770 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7771 hr, prop.expected, i);
7772 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7773 prop.value, wine_dbgstr_w(received), i);
7774 }
7775 SysFreeString(received);
7776 received = NULL;
7777
7778 /* GetHost() tests. */
7779 prop = test.str_props[Uri_PROPERTY_HOST];
7780 hr = IUri_GetHost(uri, &received);
7781 if(prop.todo) {
7782 todo_wine {
7783 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7784 hr, prop.expected, i);
7785 }
7786 todo_wine {
7787 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7788 prop.value, wine_dbgstr_w(received), i);
7789 }
7790 } else {
7791 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7792 hr, prop.expected, i);
7793 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7794 prop.value, wine_dbgstr_w(received), i);
7795 }
7796 SysFreeString(received);
7797 received = NULL;
7798
7799 /* GetPassword() tests. */
7800 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7801 hr = IUri_GetPassword(uri, &received);
7802 if(prop.todo) {
7803 todo_wine {
7804 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7805 hr, prop.expected, i);
7806 }
7807 todo_wine {
7808 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7809 prop.value, wine_dbgstr_w(received), i);
7810 }
7811 } else {
7812 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7813 hr, prop.expected, i);
7814 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7815 prop.value, wine_dbgstr_w(received), i);
7816 }
7817 SysFreeString(received);
7818 received = NULL;
7819
7820 /* GetPath() tests. */
7821 prop = test.str_props[Uri_PROPERTY_PATH];
7822 hr = IUri_GetPath(uri, &received);
7823 if(prop.todo) {
7824 todo_wine {
7825 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7826 hr, prop.expected, i);
7827 }
7828 todo_wine {
7829 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7830 prop.value, wine_dbgstr_w(received), i);
7831 }
7832 } else {
7833 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7834 hr, prop.expected, i);
7835 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7836 prop.value, wine_dbgstr_w(received), i);
7837 }
7838 SysFreeString(received);
7839 received = NULL;
7840
7841 /* GetPathAndQuery() tests. */
7842 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7843 hr = IUri_GetPathAndQuery(uri, &received);
7844 if(prop.todo) {
7845 todo_wine {
7846 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7847 hr, prop.expected, i);
7848 }
7849 todo_wine {
7850 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7851 prop.value, wine_dbgstr_w(received), i);
7852 }
7853 } else {
7854 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7855 hr, prop.expected, i);
7856 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7857 prop.value, wine_dbgstr_w(received), i);
7858 }
7859 SysFreeString(received);
7860 received = NULL;
7861
7862 /* GetQuery() tests. */
7863 prop = test.str_props[Uri_PROPERTY_QUERY];
7864 hr = IUri_GetQuery(uri, &received);
7865 if(prop.todo) {
7866 todo_wine {
7867 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7868 hr, prop.expected, i);
7869 }
7870 todo_wine {
7871 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7872 prop.value, wine_dbgstr_w(received), i);
7873 }
7874 } else {
7875 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7876 hr, prop.expected, i);
7877 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7878 prop.value, wine_dbgstr_w(received), i);
7879 }
7880 SysFreeString(received);
7881 received = NULL;
7882
7883 /* GetRawUri() tests. */
7884 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7885 hr = IUri_GetRawUri(uri, &received);
7886 if(prop.todo) {
7887 todo_wine {
7888 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7889 hr, prop.expected, i);
7890 }
7891 todo_wine {
7892 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7893 prop.value, wine_dbgstr_w(received), i);
7894 }
7895 } else {
7896 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7897 hr, prop.expected, i);
7898 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7899 prop.value, wine_dbgstr_w(received), i);
7900 }
7901 SysFreeString(received);
7902 received = NULL;
7903
7904 /* GetSchemeName() tests. */
7905 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7906 hr = IUri_GetSchemeName(uri, &received);
7907 if(prop.todo) {
7908 todo_wine {
7909 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7910 hr, prop.expected, i);
7911 }
7912 todo_wine {
7913 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7914 prop.value, wine_dbgstr_w(received), i);
7915 }
7916 } else {
7917 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7918 hr, prop.expected, i);
7919 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7920 prop.value, wine_dbgstr_w(received), i);
7921 }
7922 SysFreeString(received);
7923 received = NULL;
7924
7925 /* GetUserInfo() tests. */
7926 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7927 hr = IUri_GetUserInfo(uri, &received);
7928 if(prop.todo) {
7929 todo_wine {
7930 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7931 hr, prop.expected, i);
7932 }
7933 todo_wine {
7934 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7935 prop.value, wine_dbgstr_w(received), i);
7936 }
7937 } else {
7938 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7939 hr, prop.expected, i);
7940 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7941 prop.value, wine_dbgstr_w(received), i);
7942 }
7943 SysFreeString(received);
7944 received = NULL;
7945
7946 /* GetUserName() tests. */
7947 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7948 hr = IUri_GetUserName(uri, &received);
7949 if(prop.todo) {
7950 todo_wine {
7951 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7952 hr, prop.expected, i);
7953 }
7954 todo_wine {
7955 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7956 prop.value, wine_dbgstr_w(received), i);
7957 }
7958 } else {
7959 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7960 hr, prop.expected, i);
7961 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7962 prop.value, wine_dbgstr_w(received), i);
7963 }
7964 SysFreeString(received);
7965 }
7966
7967 if(uri) IUri_Release(uri);
7968
7969 heap_free(uriW);
7970 }
7971 }
7972
7973 static void test_IUri_GetDwordProperties(void) {
7974 IUri *uri = NULL;
7975 HRESULT hr;
7976 DWORD i;
7977
7978 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7979 hr = pCreateUri(http_urlW, 0, 0, &uri);
7980 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7981 if(SUCCEEDED(hr)) {
7982 hr = IUri_GetHostType(uri, NULL);
7983 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7984
7985 hr = IUri_GetPort(uri, NULL);
7986 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7987
7988 hr = IUri_GetScheme(uri, NULL);
7989 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7990
7991 hr = IUri_GetZone(uri, NULL);
7992 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7993 }
7994 if(uri) IUri_Release(uri);
7995
7996 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7997 uri_properties test = uri_tests[i];
7998 LPWSTR uriW;
7999 uri = NULL;
8000
8001 uriW = a2w(test.uri);
8002 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8003 if(test.create_todo) {
8004 todo_wine {
8005 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8006 hr, test.create_expected, i);
8007 }
8008 } else {
8009 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8010 hr, test.create_expected, i);
8011 }
8012
8013 if(SUCCEEDED(hr)) {
8014 uri_dword_property prop;
8015 DWORD received;
8016
8017 /* Assign an insane value so tests don't accidentally pass when
8018 * they shouldn't!
8019 */
8020 received = -9999999;
8021
8022 /* GetHostType() tests. */
8023 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8024 hr = IUri_GetHostType(uri, &received);
8025 if(prop.todo) {
8026 todo_wine {
8027 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8028 hr, prop.expected, i);
8029 }
8030 todo_wine {
8031 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8032 }
8033 } else {
8034 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8035 hr, prop.expected, i);
8036 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8037 }
8038 received = -9999999;
8039
8040 /* GetPort() tests. */
8041 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8042 hr = IUri_GetPort(uri, &received);
8043 if(prop.todo) {
8044 todo_wine {
8045 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8046 hr, prop.expected, i);
8047 }
8048 todo_wine {
8049 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8050 }
8051 } else {
8052 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8053 hr, prop.expected, i);
8054 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8055 }
8056 received = -9999999;
8057
8058 /* GetScheme() tests. */
8059 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8060 hr = IUri_GetScheme(uri, &received);
8061 if(prop.todo) {
8062 todo_wine {
8063 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8064 hr, prop.expected, i);
8065 }
8066 todo_wine {
8067 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8068 }
8069 } else {
8070 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8071 hr, prop.expected, i);
8072 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8073 }
8074 received = -9999999;
8075
8076 /* GetZone() tests. */
8077 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8078 hr = IUri_GetZone(uri, &received);
8079 if(prop.todo) {
8080 todo_wine {
8081 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8082 hr, prop.expected, i);
8083 }
8084 todo_wine {
8085 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8086 }
8087 } else {
8088 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8089 hr, prop.expected, i);
8090 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8091 }
8092 }
8093
8094 if(uri) IUri_Release(uri);
8095
8096 heap_free(uriW);
8097 }
8098 }
8099
8100 static void test_IUri_GetPropertyLength(void) {
8101 IUri *uri = NULL;
8102 HRESULT hr;
8103 DWORD i;
8104
8105 /* Make sure it handles invalid args correctly. */
8106 hr = pCreateUri(http_urlW, 0, 0, &uri);
8107 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8108 if(SUCCEEDED(hr)) {
8109 DWORD received = 0xdeadbeef;
8110
8111 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8112 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8113
8114 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8115 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8116 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8117 }
8118 if(uri) IUri_Release(uri);
8119
8120 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8121 uri_properties test = uri_tests[i];
8122 LPWSTR uriW;
8123 uri = NULL;
8124
8125 uriW = a2w(test.uri);
8126 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8127 if(test.create_todo) {
8128 todo_wine {
8129 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8130 hr, test.create_expected, i);
8131 }
8132 } else {
8133 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8134 hr, test.create_expected, i);
8135 }
8136
8137 if(SUCCEEDED(hr)) {
8138 DWORD j;
8139
8140 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8141 DWORD expectedLen, receivedLen;
8142 uri_str_property prop = test.str_props[j];
8143
8144 expectedLen = lstrlenA(prop.value);
8145
8146 /* This won't be necessary once GetPropertyLength is implemented. */
8147 receivedLen = -1;
8148
8149 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8150 if(prop.todo) {
8151 todo_wine {
8152 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8153 hr, prop.expected, i, j);
8154 }
8155 todo_wine {
8156 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8157 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8158 expectedLen, receivedLen, i, j);
8159 }
8160 } else {
8161 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8162 hr, prop.expected, i, j);
8163 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8164 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8165 expectedLen, receivedLen, i, j);
8166 }
8167 }
8168 }
8169
8170 if(uri) IUri_Release(uri);
8171
8172 heap_free(uriW);
8173 }
8174 }
8175
8176 static DWORD compute_expected_props(uri_properties *test)
8177 {
8178 DWORD ret = 0, i;
8179
8180 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8181 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8182 ret |= 1<<i;
8183 }
8184
8185 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8186 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8187 ret |= 1<<i;
8188 }
8189
8190 return ret;
8191 }
8192
8193 static void test_IUri_GetProperties(void) {
8194 IUri *uri = NULL;
8195 HRESULT hr;
8196 DWORD i;
8197
8198 hr = pCreateUri(http_urlW, 0, 0, &uri);
8199 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8200 if(SUCCEEDED(hr)) {
8201 hr = IUri_GetProperties(uri, NULL);
8202 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8203 }
8204 if(uri) IUri_Release(uri);
8205
8206 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8207 uri_properties test = uri_tests[i];
8208 LPWSTR uriW;
8209 uri = NULL;
8210
8211 uriW = a2w(test.uri);
8212 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8213 if(test.create_todo) {
8214 todo_wine {
8215 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8216 }
8217 } else {
8218 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8219 }
8220
8221 if(SUCCEEDED(hr)) {
8222 DWORD received = 0, expected_props;
8223 DWORD j;
8224
8225 hr = IUri_GetProperties(uri, &received);
8226 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8227
8228 expected_props = compute_expected_props(&test);
8229
8230 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8231 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8232 if(expected_props & (1 << j))
8233 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8234 else
8235 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8236 }
8237 }
8238
8239 if(uri) IUri_Release(uri);
8240
8241 heap_free(uriW);
8242 }
8243 }
8244
8245 static void test_IUri_HasProperty(void) {
8246 IUri *uri = NULL;
8247 HRESULT hr;
8248 DWORD i;
8249
8250 hr = pCreateUri(http_urlW, 0, 0, &uri);
8251 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8252 if(SUCCEEDED(hr)) {
8253 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8254 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8255 }
8256 if(uri) IUri_Release(uri);
8257
8258 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8259 uri_properties test = uri_tests[i];
8260 LPWSTR uriW;
8261 uri = NULL;
8262
8263 uriW = a2w(test.uri);
8264
8265 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8266 if(test.create_todo) {
8267 todo_wine {
8268 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8269 }
8270 } else {
8271 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8272 }
8273
8274 if(SUCCEEDED(hr)) {
8275 DWORD expected_props, j;
8276
8277 expected_props = compute_expected_props(&test);
8278
8279 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8280 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8281 BOOL received = -1;
8282
8283 hr = IUri_HasProperty(uri, j, &received);
8284 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8285 hr, S_OK, j, i);
8286
8287 if(expected_props & (1 << j)) {
8288 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8289 } else {
8290 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8291 }
8292 }
8293 }
8294
8295 if(uri) IUri_Release(uri);
8296
8297 heap_free(uriW);
8298 }
8299 }
8300
8301 static void test_IUri_IsEqual(void) {
8302 IUri *uriA, *uriB;
8303 BOOL equal;
8304 HRESULT hres;
8305 DWORD i;
8306
8307 uriA = uriB = NULL;
8308
8309 /* Make sure IsEqual handles invalid args correctly. */
8310 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8311 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8312 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8313 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8314
8315 equal = -1;
8316 hres = IUri_IsEqual(uriA, NULL, &equal);
8317 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8318 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8319
8320 hres = IUri_IsEqual(uriA, uriB, NULL);
8321 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8322
8323 IUri_Release(uriA);
8324 IUri_Release(uriB);
8325
8326 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8327 uri_equality test = equality_tests[i];
8328 LPWSTR uriA_W, uriB_W;
8329
8330 uriA = uriB = NULL;
8331
8332 uriA_W = a2w(test.a);
8333 uriB_W = a2w(test.b);
8334
8335 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8336 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8337
8338 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8339 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8340
8341 equal = -1;
8342 hres = IUri_IsEqual(uriA, uriB, &equal);
8343 if(test.todo) todo_wine {
8344 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8345 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8346 } else {
8347 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8348 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8349 }
8350 if(uriA) IUri_Release(uriA);
8351 if(uriB) IUri_Release(uriB);
8352
8353 heap_free(uriA_W);
8354 heap_free(uriB_W);
8355 }
8356 }
8357
8358 static void test_CreateUriWithFragment_InvalidArgs(void) {
8359 HRESULT hr;
8360 IUri *uri = (void*) 0xdeadbeef;
8361 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8362
8363 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8364 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8365 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8366
8367 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8368 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8369
8370 /* Original URI can't already contain a fragment component. */
8371 uri = (void*) 0xdeadbeef;
8372 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8373 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8374 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8375 }
8376
8377 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8378 static void test_CreateUriWithFragment_InvalidFlags(void) {
8379 DWORD i;
8380
8381 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8382 HRESULT hr;
8383 IUri *uri = (void*) 0xdeadbeef;
8384
8385 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8386 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8387 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8388 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8389 }
8390 }
8391
8392 static void test_CreateUriWithFragment(void) {
8393 DWORD i;
8394
8395 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8396 HRESULT hr;
8397 IUri *uri = NULL;
8398 LPWSTR uriW, fragW;
8399 uri_with_fragment test = uri_fragment_tests[i];
8400
8401 uriW = a2w(test.uri);
8402 fragW = a2w(test.fragment);
8403
8404 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8405 if(test.expected_todo) {
8406 todo_wine {
8407 ok(hr == test.create_expected,
8408 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8409 hr, test.create_expected, i);
8410 }
8411 } else
8412 ok(hr == test.create_expected,
8413 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8414 hr, test.create_expected, i);
8415
8416 if(SUCCEEDED(hr)) {
8417 BSTR received = NULL;
8418
8419 hr = IUri_GetAbsoluteUri(uri, &received);
8420 if(test.expected_todo) {
8421 todo_wine {
8422 ok(hr == S_OK,
8423 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8424 hr, S_OK, i);
8425 }
8426 todo_wine {
8427 ok(!strcmp_aw(test.expected_uri, received),
8428 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8429 test.expected_uri, wine_dbgstr_w(received), i);
8430 }
8431 } else {
8432 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8433 hr, S_OK, i);
8434 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8435 test.expected_uri, wine_dbgstr_w(received), i);
8436 }
8437
8438 SysFreeString(received);
8439 }
8440
8441 if(uri) IUri_Release(uri);
8442 heap_free(uriW);
8443 heap_free(fragW);
8444 }
8445 }
8446
8447 static void test_CreateIUriBuilder(void) {
8448 HRESULT hr;
8449 IUriBuilder *builder = NULL;
8450 IUri *uri;
8451
8452 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8453 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8454 hr, E_POINTER);
8455
8456 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8457 hr = pCreateUri(http_urlW, 0, 0, &uri);
8458 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8459 if(SUCCEEDED(hr)) {
8460 ULONG cur_count, orig_count;
8461
8462 orig_count = get_refcnt(uri);
8463 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8464 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8465 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8466
8467 cur_count = get_refcnt(uri);
8468 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8469
8470 if(builder) IUriBuilder_Release(builder);
8471 cur_count = get_refcnt(uri);
8472 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8473 }
8474 if(uri) IUri_Release(uri);
8475 }
8476
8477 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8478 DWORD test_index) {
8479 HRESULT hr;
8480 IUri *uri = NULL;
8481
8482 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8483 if(test->uri_todo) {
8484 todo_wine {
8485 ok(hr == test->uri_hres,
8486 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8487 hr, test->uri_hres, test_index);
8488 }
8489 } else {
8490 ok(hr == test->uri_hres,
8491 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8492 hr, test->uri_hres, test_index);
8493 }
8494
8495 if(SUCCEEDED(hr)) {
8496 DWORD i;
8497
8498 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8499 uri_builder_str_property prop = test->expected_str_props[i];
8500 BSTR received = NULL;
8501
8502 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8503 if(prop.todo) {
8504 todo_wine {
8505 ok(hr == prop.result,
8506 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8507 hr, prop.result, test_index, i);
8508 }
8509 } else {
8510 ok(hr == prop.result,
8511 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8512 hr, prop.result, test_index, i);
8513 }
8514 if(SUCCEEDED(hr)) {
8515 if(prop.todo) {
8516 todo_wine {
8517 ok(!strcmp_aw(prop.expected, received),
8518 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8519 prop.expected, wine_dbgstr_w(received), test_index, i);
8520 }
8521 } else {
8522 ok(!strcmp_aw(prop.expected, received),
8523 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8524 prop.expected, wine_dbgstr_w(received), test_index, i);
8525 }
8526 }
8527 SysFreeString(received);
8528 }
8529
8530 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8531 uri_builder_dword_property prop = test->expected_dword_props[i];
8532 DWORD received = -2;
8533
8534 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8535 if(prop.todo) {
8536 todo_wine {
8537 ok(hr == prop.result,
8538 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8539 hr, prop.result, test_index, i);
8540 }
8541 } else {
8542 ok(hr == prop.result,
8543 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8544 hr, prop.result, test_index, i);
8545 }
8546 if(SUCCEEDED(hr)) {
8547 if(prop.todo) {
8548 todo_wine {
8549 ok(received == prop.expected,
8550 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8551 prop.expected, received, test_index, i);
8552 }
8553 } else {
8554 ok(received == prop.expected,
8555 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8556 prop.expected, received, test_index, i);
8557 }
8558 }
8559 }
8560 }
8561 if(uri) IUri_Release(uri);
8562 }
8563
8564 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8565 DWORD test_index) {
8566 HRESULT hr;
8567 IUri *uri = NULL;
8568
8569 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8570 if(test->uri_simple_todo) {
8571 todo_wine {
8572 ok(hr == test->uri_simple_hres,
8573 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8574 hr, test->uri_simple_hres, test_index);
8575 }
8576 } else {
8577 ok(hr == test->uri_simple_hres,
8578 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8579 hr, test->uri_simple_hres, test_index);
8580 }
8581
8582 if(SUCCEEDED(hr)) {
8583 DWORD i;
8584
8585 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8586 uri_builder_str_property prop = test->expected_str_props[i];
8587 BSTR received = NULL;
8588
8589 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8590 if(prop.todo) {
8591 todo_wine {
8592 ok(hr == prop.result,
8593 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8594 hr, prop.result, test_index, i);
8595 }
8596 } else {
8597 ok(hr == prop.result,
8598 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8599 hr, prop.result, test_index, i);
8600 }
8601 if(SUCCEEDED(hr)) {
8602 if(prop.todo) {
8603 todo_wine {
8604 ok(!strcmp_aw(prop.expected, received),
8605 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8606 prop.expected, wine_dbgstr_w(received), test_index, i);
8607 }
8608 } else {
8609 ok(!strcmp_aw(prop.expected, received),
8610 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8611 prop.expected, wine_dbgstr_w(received), test_index, i);
8612 }
8613 }
8614 SysFreeString(received);
8615 }
8616
8617 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8618 uri_builder_dword_property prop = test->expected_dword_props[i];
8619 DWORD received = -2;
8620
8621 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8622 if(prop.todo) {
8623 todo_wine {
8624 ok(hr == prop.result,
8625 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8626 hr, prop.result, test_index, i);
8627 }
8628 } else {
8629 ok(hr == prop.result,
8630 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8631 hr, prop.result, test_index, i);
8632 }
8633 if(SUCCEEDED(hr)) {
8634 if(prop.todo) {
8635 todo_wine {
8636 ok(received == prop.expected,
8637 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8638 prop.expected, received, test_index, i);
8639 }
8640 } else {
8641 ok(received == prop.expected,
8642 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8643 prop.expected, received, test_index, i);
8644 }
8645 }
8646 }
8647 }
8648 if(uri) IUri_Release(uri);
8649 }
8650
8651 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8652 DWORD test_index) {
8653 HRESULT hr;
8654 IUri *uri = NULL;
8655
8656 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8657 test->uri_with_encode_flags, 0, &uri);
8658 if(test->uri_with_todo) {
8659 todo_wine {
8660 ok(hr == test->uri_with_hres,
8661 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8662 hr, test->uri_with_hres, test_index);
8663 }
8664 } else {
8665 ok(hr == test->uri_with_hres,
8666 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8667 hr, test->uri_with_hres, test_index);
8668 }
8669
8670 if(SUCCEEDED(hr)) {
8671 DWORD i;
8672
8673 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8674 uri_builder_str_property prop = test->expected_str_props[i];
8675 BSTR received = NULL;
8676
8677 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8678 if(prop.todo) {
8679 todo_wine {
8680 ok(hr == prop.result,
8681 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8682 hr, prop.result, test_index, i);
8683 }
8684 } else {
8685 ok(hr == prop.result,
8686 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8687 hr, prop.result, test_index, i);
8688 }
8689 if(SUCCEEDED(hr)) {
8690 if(prop.todo) {
8691 todo_wine {
8692 ok(!strcmp_aw(prop.expected, received),
8693 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8694 prop.expected, wine_dbgstr_w(received), test_index, i);
8695 }
8696 } else {
8697 ok(!strcmp_aw(prop.expected, received),
8698 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8699 prop.expected, wine_dbgstr_w(received), test_index, i);
8700 }
8701 }
8702 SysFreeString(received);
8703 }
8704
8705 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8706 uri_builder_dword_property prop = test->expected_dword_props[i];
8707 DWORD received = -2;
8708
8709 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8710 if(prop.todo) {
8711 todo_wine {
8712 ok(hr == prop.result,
8713 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8714 hr, prop.result, test_index, i);
8715 }
8716 } else {
8717 ok(hr == prop.result,
8718 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8719 hr, prop.result, test_index, i);
8720 }
8721 if(SUCCEEDED(hr)) {
8722 if(prop.todo) {
8723 todo_wine {
8724 ok(received == prop.expected,
8725 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8726 prop.expected, received, test_index, i);
8727 }
8728 } else {
8729 ok(received == prop.expected,
8730 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8731 prop.expected, received, test_index, i);
8732 }
8733 }
8734 }
8735 }
8736 if(uri) IUri_Release(uri);
8737 }
8738
8739 static void test_IUriBuilder_CreateInvalidArgs(void) {
8740 IUriBuilder *builder;
8741 HRESULT hr;
8742
8743 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8744 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8745 if(SUCCEEDED(hr)) {
8746 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8747
8748 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8749 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8750 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8751
8752 uri = (void*) 0xdeadbeef;
8753 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8754 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8755 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8756
8757 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8758 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8759 hr, E_POINTER);
8760
8761 uri = (void*) 0xdeadbeef;
8762 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8763 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8764 hr, E_NOTIMPL);
8765 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8766
8767 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8768 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8769 hr, E_POINTER);
8770
8771 uri = (void*) 0xdeadbeef;
8772 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8773 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8774 hr, E_NOTIMPL);
8775 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8776
8777 hr = pCreateUri(http_urlW, 0, 0, &test);
8778 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8779 if(SUCCEEDED(hr)) {
8780 hr = IUriBuilder_SetIUri(builder, test);
8781 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8782
8783 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8784 uri = NULL;
8785 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8786 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8787 ok(uri != NULL, "Error: The uri was NULL.\n");
8788 if(uri) IUri_Release(uri);
8789
8790 uri = NULL;
8791 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8792 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8793 hr, S_OK);
8794 ok(uri != NULL, "Error: uri was NULL.\n");
8795 if(uri) IUri_Release(uri);
8796
8797 uri = NULL;
8798 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8799 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8800 hr, S_OK);
8801 ok(uri != NULL, "Error: uri was NULL.\n");
8802 if(uri) IUri_Release(uri);
8803
8804 hr = IUriBuilder_SetFragment(builder, NULL);
8805 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8806
8807 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8808 uri = (void*) 0xdeadbeef;
8809 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8810 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8811 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8812
8813 uri = (void*) 0xdeadbeef;
8814 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8815 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8816 hr, S_OK);
8817 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8818
8819 uri = (void*) 0xdeadbeef;
8820 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8821 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8822 hr, E_NOTIMPL);
8823 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8824 }
8825 if(test) IUri_Release(test);
8826 }
8827 if(builder) IUriBuilder_Release(builder);
8828 }
8829
8830 /* Tests invalid args to the "Get*" functions. */
8831 static void test_IUriBuilder_GetInvalidArgs(void) {
8832 IUriBuilder *builder = NULL;
8833 HRESULT hr;
8834
8835 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8836 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8837 if(SUCCEEDED(hr)) {
8838 LPCWSTR received = (void*) 0xdeadbeef;
8839 DWORD len = -1, port = -1;
8840 BOOL set = -1;
8841
8842 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8843 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8844 hr, E_POINTER);
8845 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8846 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8847 hr, E_POINTER);
8848 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8849 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8850 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8851 hr, E_POINTER);
8852 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8853
8854 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8855 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8856 hr, E_POINTER);
8857 received = (void*) 0xdeadbeef;
8858 hr = IUriBuilder_GetHost(builder, NULL, &received);
8859 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8860 hr, E_POINTER);
8861 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8862 len = -1;
8863 hr = IUriBuilder_GetHost(builder, &len, NULL);
8864 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8865 hr, E_POINTER);
8866 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8867
8868 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8869 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8870 hr, E_POINTER);
8871 received = (void*) 0xdeadbeef;
8872 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8873 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8874 hr, E_POINTER);
8875 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8876 len = -1;
8877 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8878 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8879 hr, E_POINTER);
8880 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8881
8882 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8883 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8884 hr, E_POINTER);
8885 received = (void*) 0xdeadbeef;
8886 hr = IUriBuilder_GetPath(builder, NULL, &received);
8887 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8888 hr, E_POINTER);
8889 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8890 len = -1;
8891 hr = IUriBuilder_GetPath(builder, &len, NULL);
8892 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8893 hr, E_POINTER);
8894 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8895
8896 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8897 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8898 hr, E_POINTER);
8899 hr = IUriBuilder_GetPort(builder, NULL, &port);
8900 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8901 hr, E_POINTER);
8902 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8903 hr = IUriBuilder_GetPort(builder, &set, NULL);
8904 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8905 hr, E_POINTER);
8906 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8907
8908 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8909 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8910 hr, E_POINTER);
8911 received = (void*) 0xdeadbeef;
8912 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8913 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8914 hr, E_POINTER);
8915 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8916 len = -1;
8917 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8918 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8919 hr, E_POINTER);
8920 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8921
8922 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8923 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8924 hr, E_POINTER);
8925 received = (void*) 0xdeadbeef;
8926 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8927 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8928 hr, E_POINTER);
8929 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8930 len = -1;
8931 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8932 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8933 hr, E_POINTER);
8934 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8935
8936 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8937 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8938 hr, E_POINTER);
8939 received = (void*) 0xdeadbeef;
8940 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8941 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8942 hr, E_POINTER);
8943 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8944 len = -1;
8945 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8946 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8947 hr, E_POINTER);
8948 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8949 }
8950 if(builder) IUriBuilder_Release(builder);
8951 }
8952
8953 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8954 DWORD test_index) {
8955 HRESULT hr;
8956 DWORD i;
8957 LPCWSTR received = NULL;
8958 DWORD len = -1;
8959 const uri_builder_property *prop = NULL;
8960
8961 /* Check if the property was set earlier. */
8962 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8963 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8964 prop = &(test->properties[i]);
8965 }
8966
8967 if(prop) {
8968 /* Use expected_value unless it's NULL, then use value. */
8969 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8970 DWORD expected_len = expected ? strlen(expected) : 0;
8971 hr = IUriBuilder_GetFragment(builder, &len, &received);
8972 if(prop->todo) {
8973 todo_wine {
8974 ok(hr == (expected ? S_OK : S_FALSE),
8975 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8976 hr, (expected ? S_OK : S_FALSE), test_index);
8977 }
8978 if(SUCCEEDED(hr)) {
8979 todo_wine {
8980 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8981 expected, wine_dbgstr_w(received), test_index);
8982 }
8983 todo_wine {
8984 ok(expected_len == len,
8985 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8986 expected_len, len, test_index);
8987 }
8988 }
8989 } else {
8990 ok(hr == (expected ? S_OK : S_FALSE),
8991 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8992 hr, (expected ? S_OK : S_FALSE), test_index);
8993 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8994 expected, wine_dbgstr_w(received), test_index);
8995 ok(expected_len == len,
8996 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8997 expected_len, len, test_index);
8998 }
8999 } else {
9000 /* The property wasn't set earlier, so it should return whatever
9001 * the base IUri contains (if anything).
9002 */
9003 IUri *uri = NULL;
9004 hr = IUriBuilder_GetIUri(builder, &uri);
9005 ok(hr == S_OK,
9006 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9007 hr, S_OK, test_index);
9008 if(SUCCEEDED(hr)) {
9009 if(!uri) {
9010 received = (void*) 0xdeadbeef;
9011 len = -1;
9012
9013 hr = IUriBuilder_GetFragment(builder, &len, &received);
9014 ok(hr == S_FALSE,
9015 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9016 hr, S_FALSE, test_index);
9017 if(SUCCEEDED(hr)) {
9018 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9019 len, test_index);
9020 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9021 received, test_index);
9022 }
9023 } else {
9024 BOOL has_prop = FALSE;
9025 BSTR expected = NULL;
9026
9027 hr = IUri_GetFragment(uri, &expected);
9028 ok(SUCCEEDED(hr),
9029 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9030 hr, test_index);
9031 has_prop = hr == S_OK;
9032
9033 hr = IUriBuilder_GetFragment(builder, &len, &received);
9034 if(has_prop) {
9035 ok(hr == S_OK,
9036 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9037 hr, S_OK, test_index);
9038 if(SUCCEEDED(hr)) {
9039 ok(!lstrcmpW(expected, received),
9040 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9041 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9042 ok(lstrlenW(expected) == len,
9043 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9044 lstrlenW(expected), len, test_index);
9045 }
9046 } else {
9047 ok(hr == S_FALSE,
9048 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9049 hr, S_FALSE, test_index);
9050 if(SUCCEEDED(hr)) {
9051 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9052 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9053 len, test_index);
9054 }
9055 }
9056 SysFreeString(expected);
9057 }
9058 }
9059 if(uri) IUri_Release(uri);
9060 }
9061 }
9062
9063 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9064 DWORD test_index) {
9065 HRESULT hr;
9066 DWORD i;
9067 LPCWSTR received = NULL;
9068 DWORD len = -1;
9069 const uri_builder_property *prop = NULL;
9070
9071 /* Check if the property was set earlier. */
9072 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9073 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9074 prop = &(test->properties[i]);
9075 }
9076
9077 if(prop) {
9078 /* Use expected_value unless it's NULL, then use value. */
9079 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9080 DWORD expected_len = expected ? strlen(expected) : 0;
9081 hr = IUriBuilder_GetHost(builder, &len, &received);
9082 if(prop->todo) {
9083 todo_wine {
9084 ok(hr == (expected ? S_OK : S_FALSE),
9085 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9086 hr, (expected ? S_OK : S_FALSE), test_index);
9087 }
9088 if(SUCCEEDED(hr)) {
9089 todo_wine {
9090 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9091 expected, wine_dbgstr_w(received), test_index);
9092 }
9093 todo_wine {
9094 ok(expected_len == len,
9095 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9096 expected_len, len, test_index);
9097 }
9098 }
9099 } else {
9100 ok(hr == (expected ? S_OK : S_FALSE),
9101 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9102 hr, (expected ? S_OK : S_FALSE), test_index);
9103 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9104 expected, wine_dbgstr_w(received), test_index);
9105 ok(expected_len == len,
9106 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9107 expected_len, len, test_index);
9108 }
9109 } else {
9110 /* The property wasn't set earlier, so it should return whatever
9111 * the base IUri contains (if anything).
9112 */
9113 IUri *uri = NULL;
9114 hr = IUriBuilder_GetIUri(builder, &uri);
9115 ok(hr == S_OK,
9116 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9117 hr, S_OK, test_index);
9118 if(SUCCEEDED(hr)) {
9119 if(!uri) {
9120 received = (void*) 0xdeadbeef;
9121 len = -1;
9122
9123 hr = IUriBuilder_GetHost(builder, &len, &received);
9124 ok(hr == S_FALSE,
9125 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9126 hr, S_FALSE, test_index);
9127 if(SUCCEEDED(hr)) {
9128 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9129 len, test_index);
9130 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9131 received, test_index);
9132 }
9133 } else {
9134 BOOL has_prop = FALSE;
9135 BSTR expected = NULL;
9136
9137 hr = IUri_GetHost(uri, &expected);
9138 ok(SUCCEEDED(hr),
9139 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9140 hr, test_index);
9141 has_prop = hr == S_OK;
9142
9143 hr = IUriBuilder_GetHost(builder, &len, &received);
9144 if(has_prop) {
9145 ok(hr == S_OK,
9146 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9147 hr, S_OK, test_index);
9148 if(SUCCEEDED(hr)) {
9149 ok(!lstrcmpW(expected, received),
9150 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9151 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9152 ok(lstrlenW(expected) == len,
9153 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9154 lstrlenW(expected), len, test_index);
9155 }
9156 } else {
9157 ok(hr == S_FALSE,
9158 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9159 hr, S_FALSE, test_index);
9160 if(SUCCEEDED(hr)) {
9161 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9162 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9163 len, test_index);
9164 }
9165 }
9166 SysFreeString(expected);
9167 }
9168 }
9169 if(uri) IUri_Release(uri);
9170 }
9171 }
9172
9173 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9174 DWORD test_index) {
9175 HRESULT hr;
9176 DWORD i;
9177 LPCWSTR received = NULL;
9178 DWORD len = -1;
9179 const uri_builder_property *prop = NULL;
9180
9181 /* Check if the property was set earlier. */
9182 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9183 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9184 prop = &(test->properties[i]);
9185 }
9186
9187 if(prop) {
9188 /* Use expected_value unless it's NULL, then use value. */
9189 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9190 DWORD expected_len = expected ? strlen(expected) : 0;
9191 hr = IUriBuilder_GetPassword(builder, &len, &received);
9192 if(prop->todo) {
9193 todo_wine {
9194 ok(hr == (expected ? S_OK : S_FALSE),
9195 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9196 hr, (expected ? S_OK : S_FALSE), test_index);
9197 }
9198 if(SUCCEEDED(hr)) {
9199 todo_wine {
9200 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9201 expected, wine_dbgstr_w(received), test_index);
9202 }
9203 todo_wine {
9204 ok(expected_len == len,
9205 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9206 expected_len, len, test_index);
9207 }
9208 }
9209 } else {
9210 ok(hr == (expected ? S_OK : S_FALSE),
9211 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9212 hr, (expected ? S_OK : S_FALSE), test_index);
9213 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9214 expected, wine_dbgstr_w(received), test_index);
9215 ok(expected_len == len,
9216 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9217 expected_len, len, test_index);
9218 }
9219 } else {
9220 /* The property wasn't set earlier, so it should return whatever
9221 * the base IUri contains (if anything).
9222 */
9223 IUri *uri = NULL;
9224 hr = IUriBuilder_GetIUri(builder, &uri);
9225 ok(hr == S_OK,
9226 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9227 hr, S_OK, test_index);
9228 if(SUCCEEDED(hr)) {
9229 if(!uri) {
9230 received = (void*) 0xdeadbeef;
9231 len = -1;
9232
9233 hr = IUriBuilder_GetPassword(builder, &len, &received);
9234 ok(hr == S_FALSE,
9235 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9236 hr, S_FALSE, test_index);
9237 if(SUCCEEDED(hr)) {
9238 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9239 len, test_index);
9240 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9241 received, test_index);
9242 }
9243 } else {
9244 BOOL has_prop = FALSE;
9245 BSTR expected = NULL;
9246
9247 hr = IUri_GetPassword(uri, &expected);
9248 ok(SUCCEEDED(hr),
9249 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9250 hr, test_index);
9251 has_prop = hr == S_OK;
9252
9253 hr = IUriBuilder_GetPassword(builder, &len, &received);
9254 if(has_prop) {
9255 ok(hr == S_OK,
9256 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9257 hr, S_OK, test_index);
9258 if(SUCCEEDED(hr)) {
9259 ok(!lstrcmpW(expected, received),
9260 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9261 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9262 ok(lstrlenW(expected) == len,
9263 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9264 lstrlenW(expected), len, test_index);
9265 }
9266 } else {
9267 ok(hr == S_FALSE,
9268 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9269 hr, S_FALSE, test_index);
9270 if(SUCCEEDED(hr)) {
9271 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9272 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9273 len, test_index);
9274 }
9275 }
9276 SysFreeString(expected);
9277 }
9278 }
9279 if(uri) IUri_Release(uri);
9280 }
9281 }
9282
9283 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9284 DWORD test_index) {
9285 HRESULT hr;
9286 DWORD i;
9287 LPCWSTR received = NULL;
9288 DWORD len = -1;
9289 const uri_builder_property *prop = NULL;
9290
9291 /* Check if the property was set earlier. */
9292 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9293 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9294 prop = &(test->properties[i]);
9295 }
9296
9297 if(prop) {
9298 /* Use expected_value unless it's NULL, then use value. */
9299 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9300 DWORD expected_len = expected ? strlen(expected) : 0;
9301 hr = IUriBuilder_GetPath(builder, &len, &received);
9302 if(prop->todo) {
9303 todo_wine {
9304 ok(hr == (expected ? S_OK : S_FALSE),
9305 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9306 hr, (expected ? S_OK : S_FALSE), test_index);
9307 }
9308 if(SUCCEEDED(hr)) {
9309 todo_wine {
9310 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9311 expected, wine_dbgstr_w(received), test_index);
9312 }
9313 todo_wine {
9314 ok(expected_len == len,
9315 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9316 expected_len, len, test_index);
9317 }
9318 }
9319 } else {
9320 ok(hr == (expected ? S_OK : S_FALSE),
9321 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9322 hr, (expected ? S_OK : S_FALSE), test_index);
9323 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9324 expected, wine_dbgstr_w(received), test_index);
9325 ok(expected_len == len,
9326 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9327 expected_len, len, test_index);
9328 }
9329 } else {
9330 /* The property wasn't set earlier, so it should return whatever
9331 * the base IUri contains (if anything).
9332 */
9333 IUri *uri = NULL;
9334 hr = IUriBuilder_GetIUri(builder, &uri);
9335 ok(hr == S_OK,
9336 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9337 hr, S_OK, test_index);
9338 if(SUCCEEDED(hr)) {
9339 if(!uri) {
9340 received = (void*) 0xdeadbeef;
9341 len = -1;
9342
9343 hr = IUriBuilder_GetPath(builder, &len, &received);
9344 ok(hr == S_FALSE,
9345 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9346 hr, S_FALSE, test_index);
9347 if(SUCCEEDED(hr)) {
9348 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9349 len, test_index);
9350 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9351 received, test_index);
9352 }
9353 } else {
9354 BOOL has_prop = FALSE;
9355 BSTR expected = NULL;
9356
9357 hr = IUri_GetPath(uri, &expected);
9358 ok(SUCCEEDED(hr),
9359 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9360 hr, test_index);
9361 has_prop = hr == S_OK;
9362
9363 hr = IUriBuilder_GetPath(builder, &len, &received);
9364 if(has_prop) {
9365 ok(hr == S_OK,
9366 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9367 hr, S_OK, test_index);
9368 if(SUCCEEDED(hr)) {
9369 ok(!lstrcmpW(expected, received),
9370 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9371 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9372 ok(lstrlenW(expected) == len,
9373 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9374 lstrlenW(expected), len, test_index);
9375 }
9376 } else {
9377 ok(hr == S_FALSE,
9378 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9379 hr, S_FALSE, test_index);
9380 if(SUCCEEDED(hr)) {
9381 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9382 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9383 len, test_index);
9384 }
9385 }
9386 SysFreeString(expected);
9387 }
9388 }
9389 if(uri) IUri_Release(uri);
9390 }
9391 }
9392
9393 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9394 DWORD test_index) {
9395 HRESULT hr;
9396 BOOL has_port = FALSE;
9397 DWORD received = -1;
9398
9399 if(test->port_prop.change) {
9400 DWORD expected = test->port_prop.value;
9401
9402 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9403 if(test->port_prop.todo) {
9404 todo_wine {
9405 ok(hr == S_OK,
9406 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9407 hr, S_OK, test_index);
9408 }
9409 if(SUCCEEDED(hr)) {
9410 todo_wine {
9411 ok(has_port == test->port_prop.set,
9412 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9413 test->port_prop.set, has_port, test_index);
9414 }
9415 todo_wine {
9416 ok(received == expected,
9417 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9418 expected, received, test_index);
9419 }
9420 }
9421 } else {
9422 ok(hr == S_OK,
9423 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9424 hr, S_OK, test_index);
9425 ok(has_port == test->port_prop.set,
9426 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9427 test->port_prop.set, has_port, test_index);
9428 ok(received == test->port_prop.value,
9429 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9430 test->port_prop.value, received, test_index);
9431 }
9432 } else {
9433 IUri *uri = NULL;
9434
9435 hr = IUriBuilder_GetIUri(builder, &uri);
9436 ok(hr == S_OK,
9437 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9438 hr, S_OK, test_index);
9439 if(SUCCEEDED(hr)) {
9440 if(!uri) {
9441 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9442 ok(hr == S_OK,
9443 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9444 hr, S_OK, test_index);
9445 if(SUCCEEDED(hr)) {
9446 ok(has_port == FALSE,
9447 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9448 has_port, test_index);
9449 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9450 received, test_index);
9451 }
9452 } else {
9453 DWORD expected;
9454
9455 hr = IUri_GetPort(uri, &expected);
9456 ok(SUCCEEDED(hr),
9457 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9458 hr, test_index);
9459
9460 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9461 ok(hr == S_OK,
9462 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9463 hr, S_OK, test_index);
9464 if(SUCCEEDED(hr)) {
9465 ok(!has_port,
9466 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9467 test_index);
9468 ok(received == expected,
9469 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9470 expected, received, test_index);
9471 }
9472 }
9473 }
9474 if(uri) IUri_Release(uri);
9475 }
9476 }
9477
9478 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9479 DWORD test_index) {
9480 HRESULT hr;
9481 DWORD i;
9482 LPCWSTR received = NULL;
9483 DWORD len = -1;
9484 const uri_builder_property *prop = NULL;
9485
9486 /* Check if the property was set earlier. */
9487 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9488 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9489 prop = &(test->properties[i]);
9490 }
9491
9492 if(prop) {
9493 /* Use expected_value unless it's NULL, then use value. */
9494 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9495 DWORD expected_len = expected ? strlen(expected) : 0;
9496 hr = IUriBuilder_GetQuery(builder, &len, &received);
9497 if(prop->todo) {
9498 todo_wine {
9499 ok(hr == (expected ? S_OK : S_FALSE),
9500 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9501 hr, (expected ? S_OK : S_FALSE), test_index);
9502 }
9503 if(SUCCEEDED(hr)) {
9504 todo_wine {
9505 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9506 expected, wine_dbgstr_w(received), test_index);
9507 }
9508 todo_wine {
9509 ok(expected_len == len,
9510 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9511 expected_len, len, test_index);
9512 }
9513 }
9514 } else {
9515 ok(hr == (expected ? S_OK : S_FALSE),
9516 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9517 hr, (expected ? S_OK : S_FALSE), test_index);
9518 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9519 expected, wine_dbgstr_w(received), test_index);
9520 ok(expected_len == len,
9521 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9522 expected_len, len, test_index);
9523 }
9524 } else {
9525 /* The property wasn't set earlier, so it should return whatever
9526 * the base IUri contains (if anything).
9527 */
9528 IUri *uri = NULL;
9529 hr = IUriBuilder_GetIUri(builder, &uri);
9530 ok(hr == S_OK,
9531 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9532 hr, S_OK, test_index);
9533 if(SUCCEEDED(hr)) {
9534 if(!uri) {
9535 received = (void*) 0xdeadbeef;
9536 len = -1;
9537
9538 hr = IUriBuilder_GetQuery(builder, &len, &received);
9539 ok(hr == S_FALSE,
9540 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9541 hr, S_FALSE, test_index);
9542 if(SUCCEEDED(hr)) {
9543 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9544 len, test_index);
9545 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9546 received, test_index);
9547 }
9548 } else {
9549 BOOL has_prop = FALSE;
9550 BSTR expected = NULL;
9551
9552 hr = IUri_GetQuery(uri, &expected);
9553 ok(SUCCEEDED(hr),
9554 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9555 hr, test_index);
9556 has_prop = hr == S_OK;
9557
9558 hr = IUriBuilder_GetQuery(builder, &len, &received);
9559 if(has_prop) {
9560 ok(hr == S_OK,
9561 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9562 hr, S_OK, test_index);
9563 if(SUCCEEDED(hr)) {
9564 ok(!lstrcmpW(expected, received),
9565 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9566 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9567 ok(lstrlenW(expected) == len,
9568 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9569 lstrlenW(expected), len, test_index);
9570 }
9571 } else {
9572 ok(hr == S_FALSE,
9573 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9574 hr, S_FALSE, test_index);
9575 if(SUCCEEDED(hr)) {
9576 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9577 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9578 len, test_index);
9579 }
9580 }
9581 SysFreeString(expected);
9582 }
9583 }
9584 if(uri) IUri_Release(uri);
9585 }
9586 }
9587
9588 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9589 DWORD test_index) {
9590 HRESULT hr;
9591 DWORD i;
9592 LPCWSTR received = NULL;
9593 DWORD len = -1;
9594 const uri_builder_property *prop = NULL;
9595
9596 /* Check if the property was set earlier. */
9597 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9598 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9599 prop = &(test->properties[i]);
9600 }
9601
9602 if(prop) {
9603 /* Use expected_value unless it's NULL, then use value. */
9604 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9605 DWORD expected_len = expected ? strlen(expected) : 0;
9606 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9607 if(prop->todo) {
9608 todo_wine {
9609 ok(hr == (expected ? S_OK : S_FALSE),
9610 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9611 hr, (expected ? S_OK : S_FALSE), test_index);
9612 }
9613 if(SUCCEEDED(hr)) {
9614 todo_wine {
9615 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9616 expected, wine_dbgstr_w(received), test_index);
9617 }
9618 todo_wine {
9619 ok(expected_len == len,
9620 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9621 expected_len, len, test_index);
9622 }
9623 }
9624 } else {
9625 ok(hr == (expected ? S_OK : S_FALSE),
9626 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9627 hr, (expected ? S_OK : S_FALSE), test_index);
9628 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9629 expected, wine_dbgstr_w(received), test_index);
9630 ok(expected_len == len,
9631 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9632 expected_len, len, test_index);
9633 }
9634 } else {
9635 /* The property wasn't set earlier, so it should return whatever
9636 * the base IUri contains (if anything).
9637 */
9638 IUri *uri = NULL;
9639 hr = IUriBuilder_GetIUri(builder, &uri);
9640 ok(hr == S_OK,
9641 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9642 hr, S_OK, test_index);
9643 if(SUCCEEDED(hr)) {
9644 if(!uri) {
9645 received = (void*) 0xdeadbeef;
9646 len = -1;
9647
9648 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9649 ok(hr == S_FALSE,
9650 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9651 hr, S_FALSE, test_index);
9652 if(SUCCEEDED(hr)) {
9653 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9654 len, test_index);
9655 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9656 received, test_index);
9657 }
9658 } else {
9659 BOOL has_prop = FALSE;
9660 BSTR expected = NULL;
9661
9662 hr = IUri_GetSchemeName(uri, &expected);
9663 ok(SUCCEEDED(hr),
9664 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9665 hr, test_index);
9666 has_prop = hr == S_OK;
9667
9668 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9669 if(has_prop) {
9670 ok(hr == S_OK,
9671 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9672 hr, S_OK, test_index);
9673 if(SUCCEEDED(hr)) {
9674 ok(!lstrcmpW(expected, received),
9675 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9676 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9677 ok(lstrlenW(expected) == len,
9678 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9679 lstrlenW(expected), len, test_index);
9680 }
9681 } else {
9682 ok(hr == S_FALSE,
9683 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9684 hr, S_FALSE, test_index);
9685 if(SUCCEEDED(hr)) {
9686 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9687 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9688 len, test_index);
9689 }
9690 }
9691 SysFreeString(expected);
9692 }
9693 }
9694 if(uri) IUri_Release(uri);
9695 }
9696 }
9697
9698 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9699 DWORD test_index) {
9700 HRESULT hr;
9701 DWORD i;
9702 LPCWSTR received = NULL;
9703 DWORD len = -1;
9704 const uri_builder_property *prop = NULL;
9705
9706 /* Check if the property was set earlier. */
9707 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9708 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9709 prop = &(test->properties[i]);
9710 }
9711
9712 if(prop && prop->value && *prop->value) {
9713 /* Use expected_value unless it's NULL, then use value. */
9714 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9715 DWORD expected_len = expected ? strlen(expected) : 0;
9716 hr = IUriBuilder_GetUserName(builder, &len, &received);
9717 if(prop->todo) {
9718 todo_wine {
9719 ok(hr == (expected ? S_OK : S_FALSE),
9720 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9721 hr, (expected ? S_OK : S_FALSE), test_index);
9722 }
9723 if(SUCCEEDED(hr)) {
9724 todo_wine {
9725 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9726 expected, wine_dbgstr_w(received), test_index);
9727 }
9728 todo_wine {
9729 ok(expected_len == len,
9730 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9731 expected_len, len, test_index);
9732 }
9733 }
9734 } else {
9735 ok(hr == (expected ? S_OK : S_FALSE),
9736 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9737 hr, (expected ? S_OK : S_FALSE), test_index);
9738 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9739 expected, wine_dbgstr_w(received), test_index);
9740 ok(expected_len == len,
9741 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9742 expected_len, len, test_index);
9743 }
9744 } else {
9745 /* The property wasn't set earlier, so it should return whatever
9746 * the base IUri contains (if anything).
9747 */
9748 IUri *uri = NULL;
9749 hr = IUriBuilder_GetIUri(builder, &uri);
9750 ok(hr == S_OK,
9751 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9752 hr, S_OK, test_index);
9753 if(SUCCEEDED(hr)) {
9754 if(!uri) {
9755 received = (void*) 0xdeadbeef;
9756 len = -1;
9757
9758 hr = IUriBuilder_GetUserName(builder, &len, &received);
9759 ok(hr == S_FALSE,
9760 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9761 hr, S_FALSE, test_index);
9762 if(SUCCEEDED(hr)) {
9763 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9764 len, test_index);
9765 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9766 received, test_index);
9767 }
9768 } else {
9769 BSTR expected = NULL;
9770 BOOL has_prop = FALSE;
9771
9772 hr = IUri_GetUserName(uri, &expected);
9773 ok(SUCCEEDED(hr),
9774 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9775 hr, test_index);
9776 has_prop = hr == S_OK;
9777
9778 hr = IUriBuilder_GetUserName(builder, &len, &received);
9779 if(has_prop) {
9780 ok(hr == S_OK,
9781 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9782 hr, S_OK, test_index);
9783 if(SUCCEEDED(hr)) {
9784 ok(!lstrcmpW(expected, received),
9785 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9786 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9787 ok(lstrlenW(expected) == len,
9788 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9789 lstrlenW(expected), len, test_index);
9790 }
9791 } else {
9792 ok(hr == S_FALSE,
9793 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9794 hr, S_FALSE, test_index);
9795 if(SUCCEEDED(hr)) {
9796 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9797 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9798 len, test_index);
9799 }
9800 }
9801 SysFreeString(expected);
9802 }
9803 }
9804 if(uri) IUri_Release(uri);
9805 }
9806 }
9807
9808 /* Tests IUriBuilder functions. */
9809 static void test_IUriBuilder(void) {
9810 HRESULT hr;
9811 IUriBuilder *builder;
9812 DWORD i;
9813
9814 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9815 IUri *uri = NULL;
9816 uri_builder_test test = uri_builder_tests[i];
9817 LPWSTR uriW = NULL;
9818
9819 if(test.uri) {
9820 uriW = a2w(test.uri);
9821 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9822 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9823 hr, S_OK, i);
9824 if(FAILED(hr)) continue;
9825 }
9826 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9827 if(test.create_builder_todo) {
9828 todo_wine {
9829 ok(hr == test.create_builder_expected,
9830 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9831 hr, test.create_builder_expected, i);
9832 }
9833 } else {
9834 ok(hr == test.create_builder_expected,
9835 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9836 hr, test.create_builder_expected, i);
9837 }
9838 if(SUCCEEDED(hr)) {
9839 DWORD j;
9840 BOOL modified = FALSE, received = FALSE;
9841
9842 /* Perform all the string property changes. */
9843 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9844 uri_builder_property prop = test.properties[j];
9845 if(prop.change) {
9846 change_property(builder, &prop, i);
9847 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9848 prop.property != Uri_PROPERTY_HOST)
9849 modified = TRUE;
9850 else if(prop.value && *prop.value)
9851 modified = TRUE;
9852 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9853 /* Host name property can't be NULL, but it can be empty. */
9854 modified = TRUE;
9855 }
9856 }
9857
9858 if(test.port_prop.change) {
9859 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9860 modified = TRUE;
9861 if(test.port_prop.todo) {
9862 todo_wine {
9863 ok(hr == test.port_prop.expected,
9864 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9865 hr, test.port_prop.expected, i);
9866 }
9867 } else {
9868 ok(hr == test.port_prop.expected,
9869 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9870 hr, test.port_prop.expected, i);
9871 }
9872 }
9873
9874 hr = IUriBuilder_HasBeenModified(builder, &received);
9875 ok(hr == S_OK,
9876 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9877 hr, S_OK, i);
9878 if(SUCCEEDED(hr))
9879 ok(received == modified,
9880 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9881 modified, received, i);
9882
9883 /* Test the "Get*" functions. */
9884 test_IUriBuilder_GetFragment(builder, &test, i);
9885 test_IUriBuilder_GetHost(builder, &test, i);
9886 test_IUriBuilder_GetPassword(builder, &test, i);
9887 test_IUriBuilder_GetPath(builder, &test, i);
9888 test_IUriBuilder_GetPort(builder, &test, i);
9889 test_IUriBuilder_GetQuery(builder, &test, i);
9890 test_IUriBuilder_GetSchemeName(builder, &test, i);
9891 test_IUriBuilder_GetUserName(builder, &test, i);
9892
9893 test_IUriBuilder_CreateUri(builder, &test, i);
9894 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9895 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9896 }
9897 if(builder) IUriBuilder_Release(builder);
9898 if(uri) IUri_Release(uri);
9899 heap_free(uriW);
9900 }
9901 }
9902
9903 static void test_IUriBuilder_HasBeenModified(void) {
9904 HRESULT hr;
9905 IUriBuilder *builder = NULL;
9906
9907 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9908 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9909 if(SUCCEEDED(hr)) {
9910 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9911 IUri *uri = NULL;
9912 BOOL received;
9913
9914 hr = IUriBuilder_HasBeenModified(builder, NULL);
9915 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9916 hr, E_POINTER);
9917
9918 hr = IUriBuilder_SetHost(builder, hostW);
9919 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9920 hr, S_OK);
9921
9922 hr = IUriBuilder_HasBeenModified(builder, &received);
9923 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9924 hr, S_OK);
9925 if(SUCCEEDED(hr))
9926 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9927
9928 hr = pCreateUri(http_urlW, 0, 0, &uri);
9929 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9930 if(SUCCEEDED(hr)) {
9931 LPCWSTR prop;
9932 DWORD len = -1;
9933
9934 hr = IUriBuilder_SetIUri(builder, uri);
9935 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9936 hr, S_OK);
9937
9938 hr = IUriBuilder_HasBeenModified(builder, &received);
9939 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9940 hr, S_OK);
9941 if(SUCCEEDED(hr))
9942 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9943
9944 /* Test what happens with you call SetIUri with the same IUri again. */
9945 hr = IUriBuilder_SetHost(builder, hostW);
9946 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9947
9948 hr = IUriBuilder_HasBeenModified(builder, &received);
9949 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9950 hr, S_OK);
9951 if(SUCCEEDED(hr))
9952 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9953
9954 hr = IUriBuilder_SetIUri(builder, uri);
9955 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9956
9957 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
9958 * reset any of the changes that were made to the IUriBuilder.
9959 */
9960 hr = IUriBuilder_HasBeenModified(builder, &received);
9961 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9962 if(SUCCEEDED(hr))
9963 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9964
9965 hr = IUriBuilder_GetHost(builder, &len, &prop);
9966 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9967 if(SUCCEEDED(hr)) {
9968 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9969 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9970 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9971 lstrlenW(hostW), len);
9972 }
9973
9974 hr = IUriBuilder_SetIUri(builder, NULL);
9975 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9976
9977 hr = IUriBuilder_SetHost(builder, hostW);
9978 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9979 hr = IUriBuilder_HasBeenModified(builder, &received);
9980 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9981 hr, S_OK);
9982 if(SUCCEEDED(hr))
9983 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9984
9985 hr = IUriBuilder_SetIUri(builder, NULL);
9986 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9987
9988 hr = IUriBuilder_HasBeenModified(builder, &received);
9989 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9990 hr, S_OK);
9991 if(SUCCEEDED(hr))
9992 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9993
9994 hr = IUriBuilder_GetHost(builder, &len, &prop);
9995 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9996 if(SUCCEEDED(hr)) {
9997 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9998 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9999 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
10000 lstrlenW(hostW), len);
10001 }
10002 }
10003 if(uri) IUri_Release(uri);
10004 }
10005 if(builder) IUriBuilder_Release(builder);
10006 }
10007
10008 /* Test IUriBuilder {Get,Set}IUri functions. */
10009 static void test_IUriBuilder_IUriProperty(void) {
10010 IUriBuilder *builder = NULL;
10011 HRESULT hr;
10012
10013 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10014 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10015 if(SUCCEEDED(hr)) {
10016 IUri *uri = NULL;
10017
10018 hr = IUriBuilder_GetIUri(builder, NULL);
10019 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10020 hr, E_POINTER);
10021
10022 hr = pCreateUri(http_urlW, 0, 0, &uri);
10023 if(SUCCEEDED(hr)) {
10024 IUri *test = NULL;
10025 ULONG cur_count, orig_count;
10026
10027 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10028 orig_count = get_refcnt(uri);
10029 hr = IUriBuilder_SetIUri(builder, uri);
10030 cur_count = get_refcnt(uri);
10031 if(SUCCEEDED(hr))
10032 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10033 orig_count+1, cur_count);
10034
10035 hr = IUriBuilder_SetIUri(builder, NULL);
10036 cur_count = get_refcnt(uri);
10037 if(SUCCEEDED(hr))
10038 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10039 orig_count, cur_count);
10040
10041 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10042 hr = IUriBuilder_SetIUri(builder, uri);
10043 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10044 orig_count = get_refcnt(uri);
10045
10046 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10047 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10048 if(SUCCEEDED(hr)) {
10049 cur_count = get_refcnt(uri);
10050 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10051 orig_count+1, cur_count);
10052 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10053 uri, test);
10054 }
10055 if(test) IUri_Release(test);
10056
10057 test = NULL;
10058 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10059 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10060 if(SUCCEEDED(hr)) {
10061 cur_count = get_refcnt(uri);
10062 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10063 orig_count+1, cur_count);
10064 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10065 }
10066 if(test) IUri_Release(test);
10067
10068 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10069 * the base IUri.
10070 */
10071 test = NULL;
10072 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10073 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10074 if(SUCCEEDED(hr))
10075 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10076
10077 if(test) IUri_Release(test);
10078
10079 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10080 * explicitly set (because it's a default flag).
10081 */
10082 test = NULL;
10083 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10084 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10085 if(SUCCEEDED(hr)) {
10086 cur_count = get_refcnt(uri);
10087 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10088 orig_count+1, cur_count);
10089 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10090 }
10091 if(test) IUri_Release(test);
10092
10093 test = NULL;
10094 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10095 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10096 if(SUCCEEDED(hr)) {
10097 cur_count = get_refcnt(uri);
10098 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10099 orig_count+1, cur_count);
10100 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10101 }
10102 if(test) IUri_Release(test);
10103
10104 test = NULL;
10105 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10106 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10107 hr, S_OK);
10108 if(SUCCEEDED(hr)) {
10109 cur_count = get_refcnt(uri);
10110 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10111 orig_count+1, cur_count);
10112 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10113 }
10114 if(test) IUri_Release(test);
10115
10116 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10117 * the base IUri.
10118 */
10119 test = NULL;
10120 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10121 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10122 if(SUCCEEDED(hr))
10123 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10124
10125 if(test) IUri_Release(test);
10126
10127 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10128 * explicitly set (because it's a default flag).
10129 */
10130 test = NULL;
10131 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10132 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10133 if(SUCCEEDED(hr)) {
10134 cur_count = get_refcnt(uri);
10135 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10136 orig_count+1, cur_count);
10137 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10138 }
10139 if(test) IUri_Release(test);
10140 }
10141 if(uri) IUri_Release(uri);
10142 }
10143 if(builder) IUriBuilder_Release(builder);
10144 }
10145
10146 static void test_IUriBuilder_RemoveProperties(void) {
10147 IUriBuilder *builder = NULL;
10148 HRESULT hr;
10149 DWORD i;
10150
10151 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10152 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10153 if(SUCCEEDED(hr)) {
10154 /* Properties that can't be removed. */
10155 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10156 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10157
10158 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10159 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10160 if((i << 1) & invalid) {
10161 ok(hr == E_INVALIDARG,
10162 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10163 hr, E_INVALIDARG, i);
10164 } else {
10165 ok(hr == S_OK,
10166 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10167 hr, S_OK, i);
10168 }
10169 }
10170
10171 /* Also doesn't accept anything that's outside the range of the
10172 * Uri_HAS flags.
10173 */
10174 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10175 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10176 hr, E_INVALIDARG);
10177 }
10178 if(builder) IUriBuilder_Release(builder);
10179
10180 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
10181 uri_builder_remove_test test = uri_builder_remove_tests[i];
10182 IUri *uri = NULL;
10183 LPWSTR uriW;
10184
10185 uriW = a2w(test.uri);
10186 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10187 if(SUCCEEDED(hr)) {
10188 builder = NULL;
10189
10190 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10191 if(test.create_builder_todo) {
10192 todo_wine {
10193 ok(hr == test.create_builder_expected,
10194 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10195 hr, test.create_builder_expected, i);
10196 }
10197 } else {
10198 ok(hr == test.create_builder_expected,
10199 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10200 hr, test.create_builder_expected, i);
10201 }
10202 if(SUCCEEDED(hr)) {
10203 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10204 if(test.remove_todo) {
10205 todo_wine {
10206 ok(hr == test.remove_expected,
10207 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10208 hr, test.remove_expected, i);
10209 }
10210 } else {
10211 ok(hr == test.remove_expected,
10212 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10213 hr, test.remove_expected, i);
10214 }
10215 if(SUCCEEDED(hr)) {
10216 IUri *result = NULL;
10217
10218 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10219 if(test.expected_todo) {
10220 todo_wine {
10221 ok(hr == test.expected_hres,
10222 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10223 hr, test.expected_hres, i);
10224 }
10225 } else {
10226 ok(hr == test.expected_hres,
10227 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10228 hr, test.expected_hres, i);
10229 }
10230 if(SUCCEEDED(hr)) {
10231 BSTR received = NULL;
10232
10233 hr = IUri_GetAbsoluteUri(result, &received);
10234 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10235 ok(!strcmp_aw(test.expected_uri, received),
10236 "Error: Expected %s but got %s instead on test %d.\n",
10237 test.expected_uri, wine_dbgstr_w(received), i);
10238 SysFreeString(received);
10239 }
10240 if(result) IUri_Release(result);
10241 }
10242 }
10243 if(builder) IUriBuilder_Release(builder);
10244 }
10245 if(uri) IUri_Release(uri);
10246 heap_free(uriW);
10247 }
10248 }
10249
10250 static void test_IUriBuilder_Misc(void) {
10251 HRESULT hr;
10252 IUri *uri;
10253
10254 hr = pCreateUri(http_urlW, 0, 0, &uri);
10255 if(SUCCEEDED(hr)) {
10256 IUriBuilder *builder;
10257
10258 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10259 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10260 if(SUCCEEDED(hr)) {
10261 BOOL has = -1;
10262 DWORD port = -1;
10263
10264 hr = IUriBuilder_GetPort(builder, &has, &port);
10265 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10266 if(SUCCEEDED(hr)) {
10267 /* 'has' will be set to FALSE, even though uri had a port. */
10268 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10269 /* Still sets 'port' to 80. */
10270 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10271 }
10272 }
10273 if(builder) IUriBuilder_Release(builder);
10274 }
10275 if(uri) IUri_Release(uri);
10276 }
10277
10278 static void test_IUriBuilderFactory(void) {
10279 HRESULT hr;
10280 IUri *uri;
10281 IUriBuilderFactory *factory;
10282 IUriBuilder *builder;
10283
10284 hr = pCreateUri(http_urlW, 0, 0, &uri);
10285 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10286 if(SUCCEEDED(hr)) {
10287 factory = NULL;
10288 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10289 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10290 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10291
10292 if(SUCCEEDED(hr)) {
10293 builder = (void*) 0xdeadbeef;
10294 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10295 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10296 hr, E_INVALIDARG);
10297 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10298
10299 builder = (void*) 0xdeadbeef;
10300 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10301 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10302 hr, E_INVALIDARG);
10303 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10304
10305 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10306 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10307 hr, E_POINTER);
10308
10309 builder = NULL;
10310 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10311 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10312 hr, S_OK);
10313 if(SUCCEEDED(hr)) {
10314 IUri *tmp = (void*) 0xdeadbeef;
10315 LPCWSTR result;
10316 DWORD result_len;
10317
10318 hr = IUriBuilder_GetIUri(builder, &tmp);
10319 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10320 hr, S_OK);
10321 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10322
10323 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10324 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10325 hr, S_FALSE);
10326 }
10327 if(builder) IUriBuilder_Release(builder);
10328
10329 builder = (void*) 0xdeadbeef;
10330 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10331 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10332 hr, E_INVALIDARG);
10333 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10334
10335 builder = (void*) 0xdeadbeef;
10336 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10337 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10338 hr, E_INVALIDARG);
10339 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10340
10341 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10342 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10343 hr, E_POINTER);
10344
10345 builder = NULL;
10346 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10347 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10348 hr, S_OK);
10349 if(SUCCEEDED(hr)) {
10350 IUri *tmp = NULL;
10351
10352 hr = IUriBuilder_GetIUri(builder, &tmp);
10353 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10354 hr, S_OK);
10355 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10356 if(uri) IUri_Release(uri);
10357 }
10358 if(builder) IUriBuilder_Release(builder);
10359 }
10360 if(factory) IUriBuilderFactory_Release(factory);
10361 }
10362 if(uri) IUri_Release(uri);
10363 }
10364
10365 static void test_CoInternetCombineIUri(void) {
10366 HRESULT hr;
10367 IUri *base, *relative, *result;
10368 DWORD i;
10369
10370 base = NULL;
10371 hr = pCreateUri(http_urlW, 0, 0, &base);
10372 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10373 if(SUCCEEDED(hr)) {
10374 result = (void*) 0xdeadbeef;
10375 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10376 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10377 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10378 }
10379
10380 relative = NULL;
10381 hr = pCreateUri(http_urlW, 0, 0, &relative);
10382 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10383 if(SUCCEEDED(hr)) {
10384 result = (void*) 0xdeadbeef;
10385 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10386 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10387 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10388 }
10389
10390 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10391 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10392
10393 if(base) IUri_Release(base);
10394 if(relative) IUri_Release(relative);
10395
10396 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10397 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10398
10399 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10400 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10401 if(SUCCEEDED(hr)) {
10402 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10403
10404 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10405 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10406 if(SUCCEEDED(hr)) {
10407 result = NULL;
10408
10409 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10410 if(uri_combine_tests[i].todo) {
10411 todo_wine {
10412 ok(hr == uri_combine_tests[i].expected,
10413 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10414 hr, uri_combine_tests[i].expected, i);
10415 }
10416 } else {
10417 ok(hr == uri_combine_tests[i].expected,
10418 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10419 hr, uri_combine_tests[i]. expected, i);
10420 }
10421 if(SUCCEEDED(hr)) {
10422 DWORD j;
10423
10424 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10425 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10426 BSTR received;
10427
10428 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10429 if(prop.todo) {
10430 todo_wine {
10431 ok(hr == prop.expected,
10432 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10433 hr, prop.expected, i, j);
10434 }
10435 todo_wine {
10436 ok(!strcmp_aw(prop.value, received) ||
10437 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10438 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10439 prop.value, wine_dbgstr_w(received), i, j);
10440 }
10441 } else {
10442 ok(hr == prop.expected,
10443 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10444 hr, prop.expected, i, j);
10445 ok(!strcmp_aw(prop.value, received) ||
10446 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10447 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10448 prop.value, wine_dbgstr_w(received), i, j);
10449 }
10450 SysFreeString(received);
10451 }
10452
10453 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10454 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10455 DWORD received;
10456
10457 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10458 if(prop.todo) {
10459 todo_wine {
10460 ok(hr == prop.expected,
10461 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10462 hr, prop.expected, i, j);
10463 }
10464 todo_wine {
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 } else {
10469 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10470 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10471 hr, prop.expected, i, j);
10472 if(!prop.broken_combine_hres || hr != S_FALSE)
10473 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10474 prop.value, received, i, j);
10475 }
10476 }
10477 }
10478 if(result) IUri_Release(result);
10479 }
10480 if(relative) IUri_Release(relative);
10481 heap_free(relativeW);
10482 }
10483 if(base) IUri_Release(base);
10484 heap_free(baseW);
10485 }
10486 }
10487
10488 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10489 REFIID riid, void **ppv)
10490 {
10491 ok(0, "unexpected call\n");
10492 return E_NOINTERFACE;
10493 }
10494
10495 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10496 {
10497 return 2;
10498 }
10499
10500 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10501 {
10502 return 1;
10503 }
10504
10505 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10506 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10507 DWORD *pcchResult, DWORD dwReserved)
10508 {
10509 CHECK_EXPECT(ParseUrl);
10510 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10511 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10512 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10513 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10514 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10515
10516 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10517 *pcchResult = lstrlenW(parse_resultW);
10518
10519 return S_OK;
10520 }
10521
10522 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10523 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10524 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10525 {
10526 CHECK_EXPECT(CombineUrl);
10527 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10528 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10529 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10530 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10531 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10532 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10533 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10534
10535 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10536 *pcchResult = lstrlenW(combine_resultW);
10537
10538 return S_OK;
10539 }
10540
10541 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10542 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10543 {
10544 ok(0, "unexpected call\n");
10545 return E_NOTIMPL;
10546 }
10547
10548 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10549 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10550 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10551 {
10552 ok(0, "unexpected call\n");
10553 return E_NOTIMPL;
10554 }
10555
10556 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10557 InternetProtocolInfo_QueryInterface,
10558 InternetProtocolInfo_AddRef,
10559 InternetProtocolInfo_Release,
10560 InternetProtocolInfo_ParseUrl,
10561 InternetProtocolInfo_CombineUrl,
10562 InternetProtocolInfo_CompareUrl,
10563 InternetProtocolInfo_QueryInfo
10564 };
10565
10566 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10567
10568 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10569 {
10570 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10571 *ppv = &protocol_info;
10572 return S_OK;
10573 }
10574
10575 ok(0, "unexpected call\n");
10576 return E_NOINTERFACE;
10577 }
10578
10579 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10580 {
10581 return 2;
10582 }
10583
10584 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10585 {
10586 return 1;
10587 }
10588
10589 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10590 REFIID riid, void **ppv)
10591 {
10592 ok(0, "unexpected call\n");
10593 return E_NOTIMPL;
10594 }
10595
10596 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10597 {
10598 ok(0, "unexpected call\n");
10599 return S_OK;
10600 }
10601
10602 static const IClassFactoryVtbl ClassFactoryVtbl = {
10603 ClassFactory_QueryInterface,
10604 ClassFactory_AddRef,
10605 ClassFactory_Release,
10606 ClassFactory_CreateInstance,
10607 ClassFactory_LockServer
10608 };
10609
10610 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10611
10612 static void register_protocols(void)
10613 {
10614 IInternetSession *session;
10615 HRESULT hres;
10616
10617 hres = pCoInternetGetSession(0, &session, 0);
10618 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10619 if(FAILED(hres))
10620 return;
10621
10622 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10623 winetestW, 0, NULL, 0);
10624 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10625
10626 IInternetSession_Release(session);
10627 }
10628
10629 static void unregister_protocols(void) {
10630 IInternetSession *session;
10631 HRESULT hr;
10632
10633 hr = pCoInternetGetSession(0, &session, 0);
10634 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10635 if(FAILED(hr))
10636 return;
10637
10638 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10639 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10640
10641 IInternetSession_Release(session);
10642 }
10643
10644 static void test_CoInternetCombineIUri_Pluggable(void) {
10645 HRESULT hr;
10646 IUri *base = NULL;
10647
10648 hr = pCreateUri(combine_baseW, 0, 0, &base);
10649 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10650 if(SUCCEEDED(hr)) {
10651 IUri *relative = NULL;
10652
10653 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10654 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10655 if(SUCCEEDED(hr)) {
10656 IUri *result = NULL;
10657
10658 SET_EXPECT(CombineUrl);
10659
10660 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10661 &result, 0);
10662 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10663
10664 CHECK_CALLED(CombineUrl);
10665
10666 if(SUCCEEDED(hr)) {
10667 BSTR received = NULL;
10668 hr = IUri_GetAbsoluteUri(result, &received);
10669 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10670 if(SUCCEEDED(hr)) {
10671 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10672 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10673 }
10674 SysFreeString(received);
10675 }
10676 if(result) IUri_Release(result);
10677 }
10678 if(relative) IUri_Release(relative);
10679 }
10680 if(base) IUri_Release(base);
10681 }
10682
10683 static void test_CoInternetCombineUrlEx(void) {
10684 HRESULT hr;
10685 IUri *base, *result;
10686 DWORD i;
10687
10688 base = NULL;
10689 hr = pCreateUri(http_urlW, 0, 0, &base);
10690 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10691 if(SUCCEEDED(hr)) {
10692 result = (void*) 0xdeadbeef;
10693 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10694 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10695 hr, E_UNEXPECTED);
10696 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10697 }
10698
10699 result = (void*) 0xdeadbeef;
10700 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10701 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10702 hr, E_INVALIDARG);
10703 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10704
10705 result = (void*) 0xdeadbeef;
10706 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10707 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10708 hr, E_UNEXPECTED);
10709 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10710
10711 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10712 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10713 hr, E_POINTER);
10714 if(base) IUri_Release(base);
10715
10716 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10717 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10718
10719 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10720 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10721 if(SUCCEEDED(hr)) {
10722 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10723
10724 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10725 &result, 0);
10726 if(uri_combine_tests[i].todo) {
10727 todo_wine {
10728 ok(hr == uri_combine_tests[i].expected,
10729 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10730 hr, uri_combine_tests[i].expected, i);
10731 }
10732 } else {
10733 ok(hr == uri_combine_tests[i].expected,
10734 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10735 hr, uri_combine_tests[i]. expected, i);
10736 }
10737 if(SUCCEEDED(hr)) {
10738 DWORD j;
10739
10740 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10741 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10742 BSTR received;
10743 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10744
10745 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10746 if(prop.todo) {
10747 todo_wine {
10748 ok(hr == prop.expected,
10749 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10750 hr, prop.expected, i, j);
10751 }
10752 todo_wine {
10753 ok(!strcmp_aw(value, received) ||
10754 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10755 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10756 value, wine_dbgstr_w(received), i, j);
10757 }
10758 } else {
10759 ok(hr == prop.expected,
10760 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10761 hr, prop.expected, i, j);
10762 ok(!strcmp_aw(value, received) ||
10763 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10764 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10765 value, wine_dbgstr_w(received), i, j);
10766 }
10767 SysFreeString(received);
10768 }
10769
10770 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10771 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10772 DWORD received;
10773
10774 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10775 if(prop.todo) {
10776 todo_wine {
10777 ok(hr == prop.expected,
10778 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10779 hr, prop.expected, i, j);
10780 }
10781 todo_wine {
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 } else {
10786 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10787 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10788 hr, prop.expected, i, j);
10789 if(!prop.broken_combine_hres || hr != S_FALSE)
10790 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10791 prop.value, received, i, j);
10792 }
10793 }
10794 }
10795 if(result) IUri_Release(result);
10796 heap_free(relativeW);
10797 }
10798 if(base) IUri_Release(base);
10799 heap_free(baseW);
10800 }
10801 }
10802
10803 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10804 HRESULT hr;
10805 IUri *base = NULL;
10806
10807 hr = pCreateUri(combine_baseW, 0, 0, &base);
10808 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10809 if(SUCCEEDED(hr)) {
10810 IUri *result = NULL;
10811
10812 SET_EXPECT(CombineUrl);
10813
10814 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10815 &result, 0);
10816 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10817
10818 CHECK_CALLED(CombineUrl);
10819
10820 if(SUCCEEDED(hr)) {
10821 BSTR received = NULL;
10822 hr = IUri_GetAbsoluteUri(result, &received);
10823 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10824 if(SUCCEEDED(hr)) {
10825 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10826 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10827 }
10828 SysFreeString(received);
10829 }
10830 if(result) IUri_Release(result);
10831 }
10832 if(base) IUri_Release(base);
10833 }
10834
10835 static void test_CoInternetParseIUri_InvalidArgs(void) {
10836 HRESULT hr;
10837 IUri *uri = NULL;
10838 WCHAR tmp[3];
10839 DWORD result = -1;
10840
10841 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10842 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10843 hr, E_INVALIDARG);
10844 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10845
10846 hr = pCreateUri(http_urlW, 0, 0, &uri);
10847 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10848 if(SUCCEEDED(hr)) {
10849 DWORD expected_len;
10850
10851 result = -1;
10852 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10853 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10854 hr, E_INVALIDARG);
10855 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10856
10857 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10858 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10859 hr, E_POINTER);
10860
10861 result = -1;
10862 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10863 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10864 hr, E_FAIL);
10865 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10866
10867 result = -1;
10868 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10869 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10870 hr, E_FAIL);
10871 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10872
10873 result = -1;
10874 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10875 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10876 hr, E_FAIL);
10877 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10878
10879 result = -1;
10880 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10881 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10882 hr, E_FAIL);
10883 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10884
10885 expected_len = lstrlenW(http_urlW);
10886 result = -1;
10887 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10888 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10889 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10890 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10891 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10892 expected_len, result);
10893 }
10894 if(uri) IUri_Release(uri);
10895 }
10896
10897 static void test_CoInternetParseIUri(void) {
10898 DWORD i;
10899
10900 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10901 HRESULT hr;
10902 IUri *uri;
10903 LPWSTR uriW;
10904 uri_parse_test test = uri_parse_tests[i];
10905
10906 uriW = a2w(test.uri);
10907 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10908 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10909 if(SUCCEEDED(hr)) {
10910 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10911 DWORD result_len = -1;
10912
10913 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10914 if(test.todo) {
10915 todo_wine {
10916 ok(hr == test.expected,
10917 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10918 hr, test.expected, i);
10919 }
10920 } else {
10921 ok(hr == test.expected,
10922 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10923 hr, test.expected, i);
10924 }
10925 if(SUCCEEDED(hr)) {
10926 DWORD len = lstrlenA(test.property);
10927 ok(!strcmp_aw(test.property, result),
10928 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10929 test.property, wine_dbgstr_w(result), i);
10930 ok(len == result_len,
10931 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10932 len, result_len, i);
10933 } else {
10934 ok(!result_len,
10935 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10936 result_len, i);
10937 }
10938 }
10939 if(uri) IUri_Release(uri);
10940 heap_free(uriW);
10941 }
10942 }
10943
10944 static void test_CoInternetParseIUri_Pluggable(void) {
10945 HRESULT hr;
10946 IUri *uri = NULL;
10947
10948 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10949 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10950 if(SUCCEEDED(hr)) {
10951 WCHAR result[200];
10952 DWORD result_len;
10953
10954 SET_EXPECT(ParseUrl);
10955
10956 parse_action = PARSE_CANONICALIZE;
10957 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10958
10959 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10960 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10961
10962 CHECK_CALLED(ParseUrl);
10963
10964 if(SUCCEEDED(hr)) {
10965 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10966 lstrlenW(parse_resultW), result_len);
10967 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10968 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10969 }
10970 }
10971 if(uri) IUri_Release(uri);
10972 }
10973
10974 typedef struct {
10975 const char *url;
10976 DWORD uri_flags;
10977 const char *base_url;
10978 DWORD base_uri_flags;
10979 const char *legacy_url;
10980 const char *uniform_url;
10981 const char *no_canon_url;
10982 const char *uri_url;
10983 } create_urlmon_test_t;
10984
10985 static const create_urlmon_test_t create_urlmon_tests[] = {
10986 {
10987 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10988 NULL,0,
10989 "http://www.winehq.org/",
10990 "http://www.winehq.org/",
10991 "http://www.winehq.org",
10992 "http://www.winehq.org"
10993 },
10994 {
10995 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
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 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
11004 NULL,0,
11005 "file://c:\\dir\\file.txt",
11006 "file:///c:/dir/file.txt",
11007 "file:///c:/dir/file.txt",
11008 "file://c:\\dir\\file.txt"
11009 },
11010 {
11011 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11012 "http://www.winehq.org",0,
11013 "http://www.winehq.org/data",
11014 "http://www.winehq.org/data",
11015 "http://www.winehq.org:80/data",
11016 },
11017 {
11018 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11019 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11020 "file://c:\\dir\\file.txt",
11021 "file:///c:/dir/file.txt",
11022 "file:///c:/dir/file.txt",
11023 },
11024 {
11025 "",Uri_CREATE_ALLOW_RELATIVE,
11026 NULL,0,
11027 "",
11028 "",
11029 "",
11030 ""
11031 },
11032 {
11033 "test",Uri_CREATE_ALLOW_RELATIVE,
11034 NULL,0,
11035 "test",
11036 "test",
11037 "test",
11038 "test"
11039 },
11040 {
11041 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11042 NULL,0,
11043 "file://c:\\dir\\file.txt",
11044 "file:///c:/dir/file.txt",
11045 "file:///c:/dir/file.txt",
11046 "file:///c:/dir/file.txt",
11047 }
11048 };
11049
11050 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11051 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11052 {
11053 WCHAR *display_name;
11054 HRESULT hres;
11055
11056 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11057 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11058 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11059 wine_dbgstr_w(display_name), exurl);
11060
11061 CoTaskMemFree(display_name);
11062 }
11063
11064 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11065 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11066 {
11067 IUriContainer *uri_container;
11068 IUri *uri;
11069 BSTR display_uri;
11070 HRESULT hres;
11071
11072 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11073 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11074
11075 uri = NULL;
11076 hres = IUriContainer_GetIUri(uri_container, &uri);
11077 IUriContainer_Release(uri_container);
11078 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11079 ok(uri != NULL, "uri == NULL\n");
11080
11081 hres = IUri_GetDisplayUri(uri, &display_uri);
11082 IUri_Release(uri);
11083 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11084 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11085 wine_dbgstr_w(display_uri), exurl);
11086 SysFreeString(display_uri);
11087 }
11088
11089 static void test_CreateURLMoniker(void)
11090 {
11091 const create_urlmon_test_t *test;
11092 IMoniker *mon, *base_mon;
11093 WCHAR *url, *base_url;
11094 IUri *uri, *base_uri;
11095 HRESULT hres;
11096
11097 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
11098 url = a2w(test->url);
11099 base_url = a2w(test->base_url);
11100
11101 if(base_url) {
11102 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11103 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11104
11105 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11106 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11107 }else {
11108 base_uri = NULL;
11109 base_mon = NULL;
11110 }
11111
11112 hres = CreateURLMoniker(base_mon, url, &mon);
11113 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11114 test_urlmon_display_name(mon, test->legacy_url);
11115 test_display_uri(mon, test->legacy_url);
11116 IMoniker_Release(mon);
11117
11118 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11119 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11120 test_urlmon_display_name(mon, test->legacy_url);
11121 test_display_uri(mon, test->legacy_url);
11122 IMoniker_Release(mon);
11123
11124 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11125 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11126 test_urlmon_display_name(mon, test->uniform_url);
11127 test_display_uri(mon, test->uniform_url);
11128 IMoniker_Release(mon);
11129
11130 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11131 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11132 test_urlmon_display_name(mon, test->no_canon_url);
11133 test_display_uri(mon, test->no_canon_url);
11134 IMoniker_Release(mon);
11135
11136 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11137 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11138
11139 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11140 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11141 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11142 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11143 IMoniker_Release(mon);
11144
11145 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11146 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11147 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11148 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11149 IMoniker_Release(mon);
11150
11151 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11152 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11153 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11154 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11155 IMoniker_Release(mon);
11156
11157 IUri_Release(uri);
11158 heap_free(url);
11159 heap_free(base_url);
11160 if(base_uri)
11161 IUri_Release(base_uri);
11162 if(base_mon)
11163 IMoniker_Release(base_mon);
11164 }
11165 }
11166
11167 static int add_default_flags(DWORD flags) {
11168 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11169 flags |= Uri_CREATE_CANONICALIZE;
11170 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11171 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11172 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11173 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11174 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11175 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11176 if(!(flags & Uri_CREATE_IE_SETTINGS))
11177 flags |= Uri_CREATE_NO_IE_SETTINGS;
11178
11179 return flags;
11180 }
11181
11182 static void test_IPersistStream(void)
11183 {
11184 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11185
11186 props_order[Uri_PROPERTY_RAW_URI] = 1;
11187 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11188 props_order[Uri_PROPERTY_HOST] = 3;
11189 props_order[Uri_PROPERTY_PASSWORD] = 4;
11190 props_order[Uri_PROPERTY_PATH] = 5;
11191 props_order[Uri_PROPERTY_PORT] = 6;
11192 props_order[Uri_PROPERTY_QUERY] = 7;
11193 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11194 props_order[Uri_PROPERTY_USER_NAME] = 9;
11195
11196 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
11197 const uri_properties *test = uri_tests+i;
11198 LPWSTR uriW;
11199 IUri *uri;
11200 IPersistStream *persist_stream;
11201 IStream *stream;
11202 IMarshal *marshal;
11203 DWORD props, props_no, dw_data[6];
11204 WCHAR str_data[1024];
11205 ULARGE_INTEGER size, max_size;
11206 LARGE_INTEGER no_off;
11207 CLSID curi;
11208 BSTR raw_uri;
11209 HRESULT hr;
11210
11211 if(test->create_todo || test->create_expected!=S_OK)
11212 continue;
11213
11214 uriW = a2w(test->uri);
11215 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11216 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11217
11218 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11219 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11220
11221 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11222 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11223 hr = IPersistStream_IsDirty(persist_stream);
11224 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11225 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11226 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11227 hr = IPersistStream_IsDirty(persist_stream);
11228 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11229 no_off.QuadPart = 0;
11230 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11231 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11232 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11233 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11234 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11235 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11236 ok(U(size).LowPart+2 == U(max_size).LowPart,
11237 "%d) Written data size is %d, max_size %d.\n",
11238 i, U(size).LowPart, U(max_size).LowPart);
11239
11240 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11241 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11242 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11243 i, dw_data[0]-2, U(size).LowPart);
11244 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11245 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11246 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11247 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11248 ok(dw_data[2] == add_default_flags(test->create_flags),
11249 "%d) Incorrect value %x, expected %x (creation flags).\n",
11250 i, dw_data[2], add_default_flags(test->create_flags));
11251 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11252 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11253 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11254
11255 props_no = 0;
11256 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11257 if(!props_order[props])
11258 continue;
11259
11260 if(props <= Uri_PROPERTY_STRING_LAST) {
11261 if(test->str_props[props].expected == S_OK)
11262 props_no++;
11263 } else {
11264 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11265 props_no++;
11266 }
11267 }
11268 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11269 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11270 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11271 props_no = 1;
11272
11273 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11274 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11275 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11276
11277 dw_data[2] = 0;
11278 dw_data[3] = -1;
11279 while(props) {
11280 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11281 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11282 props--;
11283 ok(dw_data[2]<props_order[dw_data[0]],
11284 "%d) Incorrect properties order (%d, %d)\n",
11285 i, dw_data[0], dw_data[3]);
11286 dw_data[2] = props_order[dw_data[0]];
11287 dw_data[3] = dw_data[0];
11288
11289 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11290 const uri_str_property *prop = test->str_props+dw_data[0];
11291 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11292 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11293 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11294 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11295 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11296 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11297 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11298 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11299 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11300 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11301 } else {
11302 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11303 break;
11304 }
11305 }
11306 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11307 i, props, dw_data[0]);
11308
11309 IUri_Release(uri);
11310
11311 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11312 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11313 hr = IPersistStream_GetClassID(persist_stream, &curi);
11314 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11315 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11316 IPersistStream_Release(persist_stream);
11317
11318 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11319 &IID_IUri, (void**)&uri);
11320 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11321 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11322 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11323 hr = IPersistStream_Load(persist_stream, stream);
11324 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11325 hr = IUri_GetRawUri(uri, &raw_uri);
11326 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11327 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11328 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11329 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11330 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11331 wine_dbgstr_w(raw_uri));
11332 SysFreeString(raw_uri);
11333 IPersistStream_Release(persist_stream);
11334
11335 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11336 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11337 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11338 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11339 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11340 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11341 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11342 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11343 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11344 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11345 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11346 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11347 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11348 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11349 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11350 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11351 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11352 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11353 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11354 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11355 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11356 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11357 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11358 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11359 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11360 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11361 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11362 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11363 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11364
11365 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11366 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11367 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11368 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11369 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11370 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11371 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11372 i, dw_data[0]-2, U(size).LowPart);
11373 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11374 i, dw_data[1]);
11375 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11376 i, dw_data[2], dw_data[0]-8);
11377 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11378 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11379 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11380 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11381 U(max_size).LowPart += 3*sizeof(DWORD);
11382 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11383 i, dw_data[2], U(max_size).LowPart);
11384 IMarshal_Release(marshal);
11385 IUri_Release(uri);
11386
11387 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11388 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11389 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11390 &IID_IUri, (void**)&uri);
11391 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11392 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11393 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11394 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11395 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11396 hr = IUri_GetRawUri(uri, &raw_uri);
11397 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11398 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11399 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11400 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11401 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11402 wine_dbgstr_w(raw_uri));
11403 SysFreeString(raw_uri);
11404
11405 IMarshal_Release(marshal);
11406 IStream_Release(stream);
11407 IUri_Release(uri);
11408 heap_free(uriW);
11409 }
11410 }
11411
11412 static void test_UninitializedUri(void)
11413 {
11414 IUri *uri;
11415 IUriBuilderFactory *ubf;
11416 IPersistStream *ps;
11417 IUriBuilder *ub;
11418 BSTR bstr;
11419 DWORD dword;
11420 BOOL eq;
11421 ULARGE_INTEGER ui;
11422 HRESULT hr;
11423
11424 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11425 &IID_IUri, (void**)&uri);
11426 if(FAILED(hr)) {
11427 win_skip("Skipping uninitialized Uri tests.\n");
11428 return;
11429 }
11430
11431 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11432 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11433 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11434 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11435
11436 hr = IUri_GetAbsoluteUri(uri, NULL);
11437 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11438 hr = IUri_GetAbsoluteUri(uri, &bstr);
11439 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11440 hr = IUri_GetAuthority(uri, &bstr);
11441 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11442 hr = IUri_GetDisplayUri(uri, &bstr);
11443 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11444 hr = IUri_GetDomain(uri, &bstr);
11445 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11446 hr = IUri_GetExtension(uri, &bstr);
11447 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11448 hr = IUri_GetFragment(uri, &bstr);
11449 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11450 hr = IUri_GetHost(uri, &bstr);
11451 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11452 hr = IUri_GetHostType(uri, &dword);
11453 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11454 hr = IUri_GetPassword(uri, &bstr);
11455 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11456 hr = IUri_GetPassword(uri, &bstr);
11457 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11458 hr = IUri_GetPathAndQuery(uri, &bstr);
11459 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11460 hr = IUri_GetPort(uri, &dword);
11461 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11462 hr = IUri_GetProperties(uri, &dword);
11463 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11464 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11465 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11466 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11467 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11468 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11469 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11470 hr = IUri_GetQuery(uri, &bstr);
11471 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11472 hr = IUri_GetRawUri(uri, &bstr);
11473 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11474 hr = IUri_GetScheme(uri, &dword);
11475 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11476 hr = IUri_GetSchemeName(uri, &bstr);
11477 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11478 hr = IUri_GetUserInfo(uri, &bstr);
11479 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11480 hr = IUri_GetUserName(uri, &bstr);
11481 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11482 hr = IUri_GetZone(uri, &dword);
11483 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11484 hr = IUri_IsEqual(uri, uri, &eq);
11485 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11486
11487 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11488 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11489 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11490 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11491 IUriBuilder_Release(ub);
11492
11493 hr = IPersistStream_GetSizeMax(ps, &ui);
11494 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11495 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11496 hr = IPersistStream_IsDirty(ps);
11497 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11498
11499 IPersistStream_Release(ps);
11500 IUriBuilderFactory_Release(ubf);
11501 IUri_Release(uri);
11502 }
11503
11504 START_TEST(uri) {
11505 HMODULE hurlmon;
11506
11507 hurlmon = GetModuleHandleA("urlmon.dll");
11508 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11509 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11510 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11511 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11512 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11513 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11514 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11515 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11516 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11517
11518 if(!pCreateUri) {
11519 win_skip("CreateUri is not present, skipping tests.\n");
11520 return;
11521 }
11522
11523 trace("test CreateUri invalid flags...\n");
11524 test_CreateUri_InvalidFlags();
11525
11526 trace("test CreateUri invalid args...\n");
11527 test_CreateUri_InvalidArgs();
11528
11529 trace("test CreateUri invalid URIs...\n");
11530 test_CreateUri_InvalidUri();
11531
11532 trace("test IUri_GetPropertyBSTR...\n");
11533 test_IUri_GetPropertyBSTR();
11534
11535 trace("test IUri_GetPropertyDWORD...\n");
11536 test_IUri_GetPropertyDWORD();
11537
11538 trace("test IUri_GetStrProperties...\n");
11539 test_IUri_GetStrProperties();
11540
11541 trace("test IUri_GetDwordProperties...\n");
11542 test_IUri_GetDwordProperties();
11543
11544 trace("test IUri_GetPropertyLength...\n");
11545 test_IUri_GetPropertyLength();
11546
11547 trace("test IUri_GetProperties...\n");
11548 test_IUri_GetProperties();
11549
11550 trace("test IUri_HasProperty...\n");
11551 test_IUri_HasProperty();
11552
11553 trace("test IUri_IsEqual...\n");
11554 test_IUri_IsEqual();
11555
11556 trace("test CreateUriWithFragment invalid args...\n");
11557 test_CreateUriWithFragment_InvalidArgs();
11558
11559 trace("test CreateUriWithFragment invalid flags...\n");
11560 test_CreateUriWithFragment_InvalidFlags();
11561
11562 trace("test CreateUriWithFragment...\n");
11563 test_CreateUriWithFragment();
11564
11565 trace("test CreateIUriBuilder...\n");
11566 test_CreateIUriBuilder();
11567
11568 trace("test IUriBuilder_CreateInvalidArgs...\n");
11569 test_IUriBuilder_CreateInvalidArgs();
11570
11571 trace("test IUriBuilder...\n");
11572 test_IUriBuilder();
11573
11574 trace("test IUriBuilder_GetInvalidArgs...\n");
11575 test_IUriBuilder_GetInvalidArgs();
11576
11577 trace("test IUriBuilder_HasBeenModified...\n");
11578 test_IUriBuilder_HasBeenModified();
11579
11580 trace("test IUriBuilder_IUriProperty...\n");
11581 test_IUriBuilder_IUriProperty();
11582
11583 trace("test IUriBuilder_RemoveProperties...\n");
11584 test_IUriBuilder_RemoveProperties();
11585
11586 trace("test IUriBuilder miscellaneous...\n");
11587 test_IUriBuilder_Misc();
11588
11589 trace("test IUriBuilderFactory...\n");
11590 test_IUriBuilderFactory();
11591
11592 trace("test CoInternetCombineIUri...\n");
11593 test_CoInternetCombineIUri();
11594
11595 trace("test CoInternetCombineUrlEx...\n");
11596 test_CoInternetCombineUrlEx();
11597
11598 trace("test CoInternetParseIUri Invalid Args...\n");
11599 test_CoInternetParseIUri_InvalidArgs();
11600
11601 trace("test CoInternetParseIUri...\n");
11602 test_CoInternetParseIUri();
11603
11604 register_protocols();
11605
11606 trace("test CoInternetCombineIUri pluggable...\n");
11607 test_CoInternetCombineIUri_Pluggable();
11608
11609 trace("test CoInternetCombineUrlEx Pluggable...\n");
11610 test_CoInternetCombineUrlEx_Pluggable();
11611
11612 trace("test CoInternetParseIUri pluggable...\n");
11613 test_CoInternetParseIUri_Pluggable();
11614
11615 trace("test CreateURLMoniker...\n");
11616 test_CreateURLMoniker();
11617
11618 CoInitialize(NULL);
11619
11620 trace("test IPersistStream...\n");
11621 test_IPersistStream();
11622
11623 trace("test uninitialized Uri...\n");
11624 test_UninitializedUri();
11625
11626 CoUninitialize();
11627 unregister_protocols();
11628 }