kernel32: Do not omit mandatory argument to DeviceIoControl.
[wine.git] / dlls / urlmon / tests / uri.c
blobd448566e9d9ff9d1a818d0d94677b2bcbeb5d2f0
1 /*
2 * UrlMon IUri tests
4 * Copyright 2010 Thomas Mullaly
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <wine/test.h>
22 #include <stdarg.h>
23 #include <stddef.h>
25 #define COBJMACROS
26 #define CONST_VTABLE
27 #define WIN32_LEAN_AND_MEAN
29 #include "windef.h"
30 #include "winbase.h"
31 #include "urlmon.h"
32 #include "shlwapi.h"
33 #include "wininet.h"
34 #include "strsafe.h"
35 #include "initguid.h"
37 DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
39 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
40 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
41 #define URI_BUILDER_STR_PROPERTY_COUNT 7
43 #define DEFINE_EXPECT(func) \
44 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
46 #define SET_EXPECT(func) \
47 expect_ ## func = TRUE
49 #define CHECK_EXPECT(func) \
50 do { \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 expect_ ## func = FALSE; \
53 called_ ## func = TRUE; \
54 }while(0)
56 #define CHECK_EXPECT2(func) \
57 do { \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 called_ ## func = TRUE; \
60 }while(0)
62 #define CHECK_CALLED(func) \
63 do { \
64 ok(called_ ## func, "expected " #func "\n"); \
65 expect_ ## func = called_ ## func = FALSE; \
66 }while(0)
68 DEFINE_EXPECT(CombineUrl);
69 DEFINE_EXPECT(ParseUrl);
71 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
72 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
73 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
74 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
75 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
76 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
77 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
78 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
79 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
81 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
82 '.','o','r','g','/',0};
83 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
84 '.','o','r','g','/','#','F','r','a','g',0};
86 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
87 'e','s','t','i','n','g',0};
88 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
89 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
91 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
93 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
94 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
96 static PARSEACTION parse_action;
97 static DWORD parse_flags;
99 typedef struct _uri_create_flag_test {
100 DWORD flags;
101 HRESULT expected;
102 } uri_create_flag_test;
104 static const uri_create_flag_test invalid_flag_tests[] = {
105 /* Set of invalid flag combinations to test for. */
106 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
107 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
108 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
109 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
110 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
113 typedef struct _uri_str_property {
114 const char* value;
115 HRESULT expected;
116 BOOL todo;
117 const char* broken_value;
118 } uri_str_property;
120 typedef struct _uri_dword_property {
121 DWORD value;
122 HRESULT expected;
123 BOOL todo;
124 BOOL broken_combine_hres;
125 } uri_dword_property;
127 typedef struct _uri_properties {
128 const char* uri;
129 DWORD create_flags;
130 HRESULT create_expected;
131 BOOL create_todo;
133 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
134 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
135 } uri_properties;
137 static const uri_properties uri_tests[] = {
138 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
140 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
141 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
142 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
143 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
144 {"",S_FALSE,FALSE}, /* EXTENSION */
145 {"",S_FALSE,FALSE}, /* FRAGMENT */
146 {"www.winehq.org",S_OK,FALSE}, /* HOST */
147 {"",S_FALSE,FALSE}, /* PASSWORD */
148 {"/",S_OK,FALSE}, /* PATH */
149 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
150 {"",S_FALSE,FALSE}, /* QUERY */
151 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
152 {"http",S_OK,FALSE}, /* SCHEME_NAME */
153 {"",S_FALSE,FALSE}, /* USER_INFO */
154 {"",S_FALSE,FALSE} /* USER_NAME */
157 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
158 {80,S_OK,FALSE}, /* PORT */
159 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
160 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
163 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
165 {"http://winehq.org/tests",S_OK,FALSE},
166 {"winehq.org",S_OK,FALSE},
167 {"http://winehq.org/tests",S_OK,FALSE},
168 {"winehq.org",S_OK,FALSE},
169 {"",S_FALSE,FALSE},
170 {"",S_FALSE,FALSE},
171 {"winehq.org",S_OK,FALSE},
172 {"",S_FALSE,FALSE},
173 {"/tests",S_OK,FALSE},
174 {"/tests",S_OK,FALSE},
175 {"",S_FALSE,FALSE},
176 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
177 {"http",S_OK,FALSE},
178 {"",S_FALSE,FALSE},
179 {"",S_FALSE,FALSE}
182 {Uri_HOST_DNS,S_OK,FALSE},
183 {80,S_OK,FALSE},
184 {URL_SCHEME_HTTP,S_OK,FALSE},
185 {URLZONE_INVALID,E_NOTIMPL,FALSE}
188 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
190 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
191 {"www.winehq.org",S_OK,FALSE},
192 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
193 {"winehq.org",S_OK,FALSE},
194 {"",S_FALSE,FALSE},
195 {"",S_FALSE,FALSE},
196 {"www.winehq.org",S_OK,FALSE},
197 {"",S_FALSE,FALSE},
198 {"/",S_OK,FALSE},
199 {"/?query=x&return=y",S_OK,FALSE},
200 {"?query=x&return=y",S_OK,FALSE},
201 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
202 {"http",S_OK,FALSE},
203 {"",S_FALSE,FALSE},
204 {"",S_FALSE,FALSE}
207 {Uri_HOST_DNS,S_OK,FALSE},
208 {80,S_OK,FALSE},
209 {URL_SCHEME_HTTP,S_OK,FALSE},
210 {URLZONE_INVALID,E_NOTIMPL,FALSE},
213 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
215 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
216 {"www.winehq.org",S_OK,FALSE},
217 {"https://www.winehq.org/?query=x&return=y",S_OK,FALSE},
218 {"winehq.org",S_OK,FALSE},
219 {"",S_FALSE,FALSE},
220 {"",S_FALSE,FALSE},
221 {"www.winehq.org",S_OK,FALSE},
222 {"",S_FALSE,FALSE},
223 {"/",S_OK,FALSE},
224 {"/?query=x&return=y",S_OK,FALSE},
225 {"?query=x&return=y",S_OK,FALSE},
226 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
227 {"https",S_OK,FALSE},
228 {"",S_FALSE,FALSE},
229 {"",S_FALSE,FALSE}
232 {Uri_HOST_DNS,S_OK,FALSE},
233 {443,S_OK,FALSE},
234 {URL_SCHEME_HTTPS,S_OK,FALSE},
235 {URLZONE_INVALID,E_NOTIMPL,FALSE},
238 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
240 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
241 {"usEr%3Ainfo@example.com",S_OK,FALSE},
242 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
243 {"example.com",S_OK,FALSE},
244 {"",S_FALSE,FALSE},
245 {"",S_FALSE,FALSE},
246 {"example.com",S_OK,FALSE},
247 {"",S_FALSE,FALSE},
248 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
249 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
250 {"",S_FALSE,FALSE},
251 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
252 {"http",S_OK,FALSE},
253 {"usEr%3Ainfo",S_OK,FALSE},
254 {"usEr%3Ainfo",S_OK,FALSE}
257 {Uri_HOST_DNS,S_OK,FALSE},
258 {80,S_OK,FALSE},
259 {URL_SCHEME_HTTP,S_OK,FALSE},
260 {URLZONE_INVALID,E_NOTIMPL,FALSE},
263 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
265 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
266 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
267 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
268 {"winehq.org",S_OK,FALSE},
269 {".txt",S_OK,FALSE},
270 {"",S_FALSE,FALSE},
271 {"ftp.winehq.org",S_OK,FALSE},
272 {"wine",S_OK,FALSE},
273 {"/dir/foo%20bar.txt",S_OK,FALSE},
274 {"/dir/foo%20bar.txt",S_OK,FALSE},
275 {"",S_FALSE,FALSE},
276 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
277 {"ftp",S_OK,FALSE},
278 {"winepass:wine",S_OK,FALSE},
279 {"winepass",S_OK,FALSE}
282 {Uri_HOST_DNS,S_OK,FALSE},
283 {9999,S_OK,FALSE},
284 {URL_SCHEME_FTP,S_OK,FALSE},
285 {URLZONE_INVALID,E_NOTIMPL,FALSE}
288 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
290 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
291 {"",S_FALSE,FALSE},
292 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
293 {"",S_FALSE,FALSE},
294 {".mp3",S_OK,FALSE},
295 {"",S_FALSE,FALSE},
296 {"",S_FALSE,FALSE},
297 {"",S_FALSE,FALSE},
298 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
299 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
300 {"",S_FALSE,FALSE},
301 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
302 {"file",S_OK,FALSE},
303 {"",S_FALSE,FALSE},
304 {"",S_FALSE,FALSE}
307 {Uri_HOST_UNKNOWN,S_OK,FALSE},
308 {0,S_FALSE,FALSE},
309 {URL_SCHEME_FILE,S_OK,FALSE},
310 {URLZONE_INVALID,E_NOTIMPL,FALSE}
313 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
315 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
316 {"",S_FALSE,FALSE},
317 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
318 {"",S_FALSE,FALSE},
319 {".mp3",S_OK,FALSE},
320 {"",S_FALSE,FALSE},
321 {"",S_FALSE,FALSE},
322 {"",S_FALSE,FALSE},
323 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
324 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK,FALSE},
325 {"",S_FALSE,FALSE},
326 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
327 {"file",S_OK,FALSE},
328 {"",S_FALSE,FALSE},
329 {"",S_FALSE,FALSE}
332 {Uri_HOST_UNKNOWN,S_OK,FALSE},
333 {0,S_FALSE,FALSE},
334 {URL_SCHEME_FILE,S_OK,FALSE},
335 {URLZONE_INVALID,E_NOTIMPL,FALSE}
338 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
340 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
341 {"",S_FALSE,FALSE},
342 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
343 {"",S_FALSE,FALSE},
344 {".txt",S_OK,FALSE},
345 {"",S_FALSE,FALSE},
346 {"",S_FALSE,FALSE},
347 {"",S_FALSE,FALSE},
348 {"/tests/test%20file.README.txt",S_OK,FALSE},
349 {"/tests/test%20file.README.txt",S_OK,FALSE},
350 {"",S_FALSE,FALSE},
351 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
352 {"file",S_OK,FALSE},
353 {"",S_FALSE,FALSE},
354 {"",S_FALSE,FALSE}
357 {Uri_HOST_UNKNOWN,S_OK,FALSE},
358 {0,S_FALSE,FALSE},
359 {URL_SCHEME_FILE,S_OK,FALSE},
360 {URLZONE_INVALID,E_NOTIMPL,FALSE}
363 { "file:///z:/test dir/README.txt", 0, S_OK, FALSE,
365 {"file:///z:/test%20dir/README.txt",S_OK},
366 {"",S_FALSE},
367 {"file:///z:/test%20dir/README.txt",S_OK},
368 {"",S_FALSE},
369 {".txt",S_OK},
370 {"",S_FALSE},
371 {"",S_FALSE},
372 {"",S_FALSE},
373 {"/z:/test%20dir/README.txt",S_OK},
374 {"/z:/test%20dir/README.txt",S_OK},
375 {"",S_FALSE},
376 {"file:///z:/test dir/README.txt",S_OK},
377 {"file",S_OK},
378 {"",S_FALSE},
379 {"",S_FALSE}
382 {Uri_HOST_UNKNOWN,S_OK,FALSE},
383 {0,S_FALSE,FALSE},
384 {URL_SCHEME_FILE,S_OK,FALSE},
385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
388 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
390 {"urn:nothing:should:happen here",S_OK,FALSE},
391 {"",S_FALSE,FALSE},
392 {"urn:nothing:should:happen here",S_OK,FALSE},
393 {"",S_FALSE,FALSE},
394 {"",S_FALSE,FALSE},
395 {"",S_FALSE,FALSE},
396 {"",S_FALSE,FALSE},
397 {"",S_FALSE,FALSE},
398 {"nothing:should:happen here",S_OK,FALSE},
399 {"nothing:should:happen here",S_OK,FALSE},
400 {"",S_FALSE,FALSE},
401 {"urn:nothing:should:happen here",S_OK,FALSE},
402 {"urn",S_OK,FALSE},
403 {"",S_FALSE,FALSE},
404 {"",S_FALSE,FALSE}
407 {Uri_HOST_UNKNOWN,S_OK,FALSE},
408 {0,S_FALSE,FALSE},
409 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
413 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
415 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
416 {"127.0.0.1",S_OK,FALSE},
417 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
418 {"",S_FALSE,FALSE},
419 {".txt",S_OK,FALSE},
420 {"",S_FALSE,FALSE},
421 {"127.0.0.1",S_OK,FALSE},
422 {"",S_FALSE,FALSE},
423 {"/test%20dir/test.txt",S_OK,FALSE},
424 {"/test%20dir/test.txt",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
427 {"http",S_OK,FALSE},
428 {"",S_FALSE,FALSE},
429 {"",S_FALSE,FALSE}
432 {Uri_HOST_IPV4,S_OK,FALSE},
433 {80,S_OK,FALSE},
434 {URL_SCHEME_HTTP,S_OK,FALSE},
435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
438 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
440 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
441 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
442 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
443 {"",S_FALSE,FALSE},
444 {"",S_FALSE,FALSE},
445 {"",S_FALSE,FALSE},
446 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
447 {"",S_FALSE,FALSE},
448 {"/",S_OK,FALSE},
449 {"/",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
452 {"http",S_OK,FALSE},
453 {"",S_FALSE,FALSE},
454 {"",S_FALSE,FALSE}
457 {Uri_HOST_IPV6,S_OK,FALSE},
458 {80,S_OK,FALSE},
459 {URL_SCHEME_HTTP,S_OK,FALSE},
460 {URLZONE_INVALID,E_NOTIMPL,FALSE}
463 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
465 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
466 {"[::13.1.68.3]",S_OK,FALSE},
467 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
468 {"",S_FALSE,FALSE},
469 {"",S_FALSE,FALSE},
470 {"",S_FALSE,FALSE},
471 {"::13.1.68.3",S_OK,FALSE},
472 {"",S_FALSE,FALSE},
473 {"/",S_OK,FALSE},
474 {"/",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"ftp://[::13.1.68.3]",S_OK,FALSE},
477 {"ftp",S_OK,FALSE},
478 {"",S_FALSE,FALSE},
479 {"",S_FALSE,FALSE}
482 {Uri_HOST_IPV6,S_OK,FALSE},
483 {21,S_OK,FALSE},
484 {URL_SCHEME_FTP,S_OK,FALSE},
485 {URLZONE_INVALID,E_NOTIMPL,FALSE}
488 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
490 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
491 {"[fedc:ba98::3210]",S_OK,FALSE},
492 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
493 {"",S_FALSE,FALSE},
494 {"",S_FALSE,FALSE},
495 {"",S_FALSE,FALSE},
496 {"fedc:ba98::3210",S_OK,FALSE},
497 {"",S_FALSE,FALSE},
498 {"/",S_OK,FALSE},
499 {"/",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
502 {"http",S_OK,FALSE},
503 {"",S_FALSE,FALSE},
504 {"",S_FALSE,FALSE},
507 {Uri_HOST_IPV6,S_OK,FALSE},
508 {80,S_OK,FALSE},
509 {URL_SCHEME_HTTP,S_OK,FALSE},
510 {URLZONE_INVALID,E_NOTIMPL,FALSE}
513 { "1234://www.winehq.org", 0, S_OK, FALSE,
515 {"1234://www.winehq.org/",S_OK,FALSE},
516 {"www.winehq.org",S_OK,FALSE},
517 {"1234://www.winehq.org/",S_OK,FALSE},
518 {"winehq.org",S_OK,FALSE},
519 {"",S_FALSE,FALSE},
520 {"",S_FALSE,FALSE},
521 {"www.winehq.org",S_OK,FALSE},
522 {"",S_FALSE,FALSE},
523 {"/",S_OK,FALSE},
524 {"/",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"1234://www.winehq.org",S_OK,FALSE},
527 {"1234",S_OK,FALSE},
528 {"",S_FALSE,FALSE},
529 {"",S_FALSE,FALSE}
532 {Uri_HOST_DNS,S_OK,FALSE},
533 {0,S_FALSE,FALSE},
534 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
535 {URLZONE_INVALID,E_NOTIMPL,FALSE}
538 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
539 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
541 {"file:///C:/test/test.mp3",S_OK,FALSE},
542 {"",S_FALSE,FALSE},
543 {"file:///C:/test/test.mp3",S_OK,FALSE},
544 {"",S_FALSE,FALSE},
545 {".mp3",S_OK,FALSE},
546 {"",S_FALSE,FALSE},
547 {"",S_FALSE,FALSE},
548 {"",S_FALSE,FALSE},
549 {"/C:/test/test.mp3",S_OK,FALSE},
550 {"/C:/test/test.mp3",S_OK,FALSE},
551 {"",S_FALSE,FALSE},
552 {"C:/test/test.mp3",S_OK,FALSE},
553 {"file",S_OK,FALSE},
554 {"",S_FALSE,FALSE},
555 {"",S_FALSE,FALSE}
558 {Uri_HOST_UNKNOWN,S_OK,FALSE},
559 {0,S_FALSE,FALSE},
560 {URL_SCHEME_FILE,S_OK,FALSE},
561 {URLZONE_INVALID,E_NOTIMPL,FALSE}
564 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
565 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
567 {"file://server/test.mp3",S_OK,FALSE},
568 {"server",S_OK,FALSE},
569 {"file://server/test.mp3",S_OK,FALSE},
570 {"",S_FALSE,FALSE},
571 {".mp3",S_OK,FALSE},
572 {"",S_FALSE,FALSE},
573 {"server",S_OK,FALSE},
574 {"",S_FALSE,FALSE},
575 {"/test.mp3",S_OK,FALSE},
576 {"/test.mp3",S_OK,FALSE},
577 {"",S_FALSE,FALSE},
578 {"\\\\Server/test.mp3",S_OK,FALSE},
579 {"file",S_OK,FALSE},
580 {"",S_FALSE,FALSE},
581 {"",S_FALSE,FALSE}
584 {Uri_HOST_DNS,S_OK,FALSE},
585 {0,S_FALSE,FALSE},
586 {URL_SCHEME_FILE,S_OK,FALSE},
587 {URLZONE_INVALID,E_NOTIMPL,FALSE}
590 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
592 {"*:www.winehq.org/test",S_OK,FALSE},
593 {"www.winehq.org",S_OK,FALSE},
594 {"*:www.winehq.org/test",S_OK,FALSE},
595 {"winehq.org",S_OK,FALSE},
596 {"",S_FALSE,FALSE},
597 {"",S_FALSE,FALSE},
598 {"www.winehq.org",S_OK,FALSE},
599 {"",S_FALSE,FALSE},
600 {"/test",S_OK,FALSE},
601 {"/test",S_OK,FALSE},
602 {"",S_FALSE,FALSE},
603 {"www.winehq.org/test",S_OK,FALSE},
604 {"*",S_OK,FALSE},
605 {"",S_FALSE,FALSE},
606 {"",S_FALSE,FALSE}
609 {Uri_HOST_DNS,S_OK,FALSE},
610 {0,S_FALSE,FALSE},
611 {URL_SCHEME_WILDCARD,S_OK,FALSE},
612 {URLZONE_INVALID,E_NOTIMPL,FALSE}
615 /* Valid since the '*' is the only character in the scheme name. */
616 { "*:www.winehq.org/test", 0, S_OK, FALSE,
618 {"*:www.winehq.org/test",S_OK,FALSE},
619 {"www.winehq.org",S_OK,FALSE},
620 {"*:www.winehq.org/test",S_OK,FALSE},
621 {"winehq.org",S_OK,FALSE},
622 {"",S_FALSE,FALSE},
623 {"",S_FALSE,FALSE},
624 {"www.winehq.org",S_OK,FALSE},
625 {"",S_FALSE,FALSE},
626 {"/test",S_OK,FALSE},
627 {"/test",S_OK,FALSE},
628 {"",S_FALSE,FALSE},
629 {"*:www.winehq.org/test",S_OK,FALSE},
630 {"*",S_OK,FALSE},
631 {"",S_FALSE,FALSE},
632 {"",S_FALSE,FALSE}
635 {Uri_HOST_DNS,S_OK,FALSE},
636 {0,S_FALSE,FALSE},
637 {URL_SCHEME_WILDCARD,S_OK,FALSE},
638 {URLZONE_INVALID,E_NOTIMPL,FALSE}
641 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
643 {"/../some dir/test.ext",S_OK,FALSE},
644 {"",S_FALSE,FALSE},
645 {"/../some dir/test.ext",S_OK,FALSE},
646 {"",S_FALSE,FALSE},
647 {".ext",S_OK,FALSE},
648 {"",S_FALSE,FALSE},
649 {"",S_FALSE,FALSE},
650 {"",S_FALSE,FALSE},
651 {"/../some dir/test.ext",S_OK,FALSE},
652 {"/../some dir/test.ext",S_OK,FALSE},
653 {"",S_FALSE,FALSE},
654 {"/../some dir/test.ext",S_OK,FALSE},
655 {"",S_FALSE,FALSE},
656 {"",S_FALSE,FALSE},
657 {"",S_FALSE,FALSE}
660 {Uri_HOST_UNKNOWN,S_OK,FALSE},
661 {0,S_FALSE,FALSE},
662 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
663 {URLZONE_INVALID,E_NOTIMPL,FALSE}
666 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
668 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
669 {"",S_OK,FALSE},
670 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
671 {"",S_FALSE,FALSE},
672 {"",S_FALSE,FALSE},
673 {"",S_FALSE,FALSE},
674 {"",S_OK,FALSE},
675 {"",S_FALSE,FALSE},
676 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
677 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
678 {"",S_FALSE,FALSE},
679 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
680 {"*",S_OK,FALSE},
681 {"",S_FALSE,FALSE},
682 {"",S_FALSE,FALSE},
685 {Uri_HOST_UNKNOWN,S_OK,FALSE},
686 {0,S_FALSE,FALSE},
687 {URL_SCHEME_WILDCARD,S_OK,FALSE},
688 {URLZONE_INVALID,E_NOTIMPL,FALSE}
691 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
692 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
694 {"zip:/.//google.com",S_OK,FALSE},
695 {"",S_FALSE,FALSE},
696 {"zip:/.//google.com",S_OK,FALSE},
697 {"",S_FALSE,FALSE},
698 {".com",S_OK,FALSE},
699 {"",S_FALSE,FALSE},
700 {"",S_FALSE,FALSE},
701 {"",S_FALSE,FALSE},
702 {"/.//google.com",S_OK,FALSE},
703 {"/.//google.com",S_OK,FALSE},
704 {"",S_FALSE,FALSE},
705 {"zip://google.com",S_OK,FALSE},
706 {"zip",S_OK,FALSE},
707 {"",S_FALSE,FALSE},
708 {"",S_FALSE,FALSE}
711 {Uri_HOST_UNKNOWN,S_OK,FALSE},
712 {0,S_FALSE,FALSE},
713 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
714 {URLZONE_INVALID,E_NOTIMPL,FALSE}
717 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
718 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
720 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
721 {"user:pass:word@winehq.org",S_OK,FALSE},
722 {"ftp://winehq.org/",S_OK,FALSE},
723 {"winehq.org",S_OK,FALSE},
724 {"",S_FALSE,FALSE},
725 {"",S_FALSE,FALSE},
726 {"winehq.org",S_OK,FALSE},
727 {"pass:word",S_OK,FALSE},
728 {"/",S_OK,FALSE},
729 {"/",S_OK,FALSE},
730 {"",S_FALSE,FALSE},
731 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
732 {"ftp",S_OK,FALSE},
733 {"user:pass:word",S_OK,FALSE},
734 {"user",S_OK,FALSE}
737 {Uri_HOST_DNS,S_OK,FALSE},
738 {21,S_OK,FALSE},
739 {URL_SCHEME_FTP,S_OK,FALSE},
740 {URLZONE_INVALID,E_NOTIMPL,FALSE}
743 /* Make sure % encoded unreserved characters are decoded. */
744 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
746 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
747 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
748 {"ftp://ftp.google.com/",S_OK,FALSE},
749 {"google.com",S_OK,FALSE},
750 {"",S_FALSE,FALSE},
751 {"",S_FALSE,FALSE},
752 {"ftp.google.com",S_OK,FALSE},
753 {"PASS",S_OK,FALSE},
754 {"/",S_OK,FALSE},
755 {"/",S_OK,FALSE},
756 {"",S_FALSE,FALSE},
757 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
758 {"ftp",S_OK,FALSE},
759 {"wINe:PASS",S_OK,FALSE},
760 {"wINe",S_OK,FALSE}
763 {Uri_HOST_DNS,S_OK,FALSE},
764 {21,S_OK,FALSE},
765 {URL_SCHEME_FTP,S_OK,FALSE},
766 {URLZONE_INVALID,E_NOTIMPL,FALSE}
769 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
770 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
772 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
773 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
774 {"ftp://ftp.google.com/",S_OK,FALSE},
775 {"google.com",S_OK,FALSE},
776 {"",S_FALSE,FALSE},
777 {"",S_FALSE,FALSE},
778 {"ftp.google.com",S_OK,FALSE},
779 {"PA%7B%7D",S_OK,FALSE},
780 {"/",S_OK,FALSE},
781 {"/",S_OK,FALSE},
782 {"",S_FALSE,FALSE},
783 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
784 {"ftp",S_OK,FALSE},
785 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
786 {"w%5D%5Be",S_OK,FALSE}
789 {Uri_HOST_DNS,S_OK,FALSE},
790 {21,S_OK,FALSE},
791 {URL_SCHEME_FTP,S_OK,FALSE},
792 {URLZONE_INVALID,E_NOTIMPL,FALSE}
795 /* You're allowed to have an empty password portion in the userinfo section. */
796 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
798 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
799 {"empty:@ftp.google.com",S_OK,FALSE},
800 {"ftp://ftp.google.com/",S_OK,FALSE},
801 {"google.com",S_OK,FALSE},
802 {"",S_FALSE,FALSE},
803 {"",S_FALSE,FALSE},
804 {"ftp.google.com",S_OK,FALSE},
805 {"",S_OK,FALSE},
806 {"/",S_OK,FALSE},
807 {"/",S_OK,FALSE},
808 {"",S_FALSE,FALSE},
809 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
810 {"ftp",S_OK,FALSE},
811 {"empty:",S_OK,FALSE},
812 {"empty",S_OK,FALSE}
815 {Uri_HOST_DNS,S_OK,FALSE},
816 {21,S_OK,FALSE},
817 {URL_SCHEME_FTP,S_OK,FALSE},
818 {URLZONE_INVALID,E_NOTIMPL,FALSE}
821 /* Make sure forbidden characters in "userinfo" get encoded. */
822 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
824 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
825 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
826 {"ftp://ftp.google.com/",S_OK,FALSE},
827 {"google.com",S_OK,FALSE},
828 {"",S_FALSE,FALSE},
829 {"",S_FALSE,FALSE},
830 {"ftp.google.com",S_OK,FALSE},
831 {"",S_FALSE,FALSE},
832 {"/",S_OK,FALSE},
833 {"/",S_OK,FALSE},
834 {"",S_FALSE,FALSE},
835 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
836 {"ftp",S_OK,FALSE},
837 {"%22%20%22weird",S_OK,FALSE},
838 {"%22%20%22weird",S_OK,FALSE}
841 {Uri_HOST_DNS,S_OK,FALSE},
842 {21,S_OK,FALSE},
843 {URL_SCHEME_FTP,S_OK,FALSE},
844 {URLZONE_INVALID,E_NOTIMPL,FALSE}
847 /* Make sure the forbidden characters don't get percent encoded. */
848 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
850 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
851 {"\" \"weird@ftp.google.com",S_OK,FALSE},
852 {"ftp://ftp.google.com/",S_OK,FALSE},
853 {"google.com",S_OK,FALSE},
854 {"",S_FALSE,FALSE},
855 {"",S_FALSE,FALSE},
856 {"ftp.google.com",S_OK,FALSE},
857 {"",S_FALSE,FALSE},
858 {"/",S_OK,FALSE},
859 {"/",S_OK,FALSE},
860 {"",S_FALSE,FALSE},
861 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
862 {"ftp",S_OK,FALSE},
863 {"\" \"weird",S_OK,FALSE},
864 {"\" \"weird",S_OK,FALSE}
867 {Uri_HOST_DNS,S_OK,FALSE},
868 {21,S_OK,FALSE},
869 {URL_SCHEME_FTP,S_OK,FALSE},
870 {URLZONE_INVALID,E_NOTIMPL,FALSE}
873 /* Make sure already percent encoded characters don't get unencoded. */
874 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
876 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
877 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
878 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
879 {"google.com",S_OK,FALSE},
880 {"",S_FALSE,FALSE},
881 {"",S_FALSE,FALSE},
882 {"ftp.google.com",S_OK,FALSE},
883 {"",S_FALSE,FALSE},
884 {"/\"%20\"weird",S_OK,FALSE},
885 {"/\"%20\"weird",S_OK,FALSE},
886 {"",S_FALSE,FALSE},
887 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
888 {"ftp",S_OK,FALSE},
889 {"\"%20\"weird",S_OK,FALSE},
890 {"\"%20\"weird",S_OK,FALSE}
893 {Uri_HOST_DNS,S_OK,FALSE},
894 {21,S_OK,FALSE},
895 {URL_SCHEME_FTP,S_OK,FALSE},
896 {URLZONE_INVALID,E_NOTIMPL,FALSE}
899 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
900 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
902 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
903 {"%xy:word@winehq.org",S_OK,FALSE},
904 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
905 {"winehq.org",S_OK,FALSE},
906 {"",S_FALSE,FALSE},
907 {"",S_FALSE,FALSE},
908 {"winehq.org",S_OK,FALSE},
909 {"word",S_OK,FALSE},
910 {"/",S_OK,FALSE},
911 {"/",S_OK,FALSE},
912 {"",S_FALSE,FALSE},
913 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
914 {"zip",S_OK,FALSE},
915 {"%xy:word",S_OK,FALSE},
916 {"%xy",S_OK,FALSE}
919 {Uri_HOST_DNS,S_OK,FALSE},
920 {0,S_FALSE,FALSE},
921 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
922 {URLZONE_INVALID,E_NOTIMPL,FALSE}
925 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
926 * isn't known.
928 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
930 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
931 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
932 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
933 {"winehq.org",S_OK,FALSE},
934 {"",S_FALSE,FALSE},
935 {"",S_FALSE,FALSE},
936 {"winehq.org",S_OK,FALSE},
937 {"%52%53ord",S_OK,FALSE},
938 {"/",S_OK,FALSE},
939 {"/",S_OK,FALSE},
940 {"",S_FALSE,FALSE},
941 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
942 {"zip",S_OK,FALSE},
943 {"%2E:%52%53ord",S_OK,FALSE},
944 {"%2E",S_OK,FALSE}
947 {Uri_HOST_DNS,S_OK,FALSE},
948 {0,S_FALSE,FALSE},
949 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
950 {URLZONE_INVALID,E_NOTIMPL,FALSE}
953 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
955 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
956 {"[](),'test':word@winehq.org",S_OK,FALSE},
957 {"ftp://winehq.org/",S_OK,FALSE},
958 {"winehq.org",S_OK,FALSE},
959 {"",S_FALSE,FALSE},
960 {"",S_FALSE,FALSE},
961 {"winehq.org",S_OK,FALSE},
962 {"word",S_OK,FALSE},
963 {"/",S_OK,FALSE},
964 {"/",S_OK,FALSE},
965 {"",S_FALSE,FALSE},
966 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
967 {"ftp",S_OK,FALSE},
968 {"[](),'test':word",S_OK,FALSE},
969 {"[](),'test'",S_OK,FALSE}
972 {Uri_HOST_DNS,S_OK,FALSE},
973 {21,S_OK,FALSE},
974 {URL_SCHEME_FTP,S_OK,FALSE},
975 {URLZONE_INVALID,E_NOTIMPL,FALSE}
978 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
980 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
981 {"test",S_OK,FALSE},
982 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
983 {"",S_FALSE,FALSE},
984 {"",S_FALSE,FALSE},
985 {"",S_FALSE,FALSE},
986 {"test",S_OK,FALSE},
987 {"",S_FALSE,FALSE},
988 {"/",S_OK,FALSE},
989 {"/?:word@winehq.org/",S_OK,FALSE},
990 {"?:word@winehq.org/",S_OK,FALSE},
991 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
992 {"ftp",S_OK,FALSE},
993 {"",S_FALSE,FALSE},
994 {"",S_FALSE,FALSE}
997 {Uri_HOST_DNS,S_OK,FALSE},
998 {21,S_OK,FALSE},
999 {URL_SCHEME_FTP,S_OK,FALSE},
1000 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1003 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
1005 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1006 {"test",S_OK,FALSE},
1007 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
1008 {"",S_FALSE,FALSE},
1009 {"",S_FALSE,FALSE},
1010 {"#:word@winehq.org/",S_OK,FALSE},
1011 {"test",S_OK,FALSE},
1012 {"",S_FALSE,FALSE},
1013 {"/",S_OK,FALSE},
1014 {"/",S_OK,FALSE},
1015 {"",S_FALSE,FALSE},
1016 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
1017 {"ftp",S_OK,FALSE},
1018 {"",S_FALSE,FALSE},
1019 {"",S_FALSE,FALSE}
1022 {Uri_HOST_DNS,S_OK,FALSE},
1023 {21,S_OK,FALSE},
1024 {URL_SCHEME_FTP,S_OK,FALSE},
1025 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1028 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1029 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1031 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1032 {"test\\:word@winehq.org",S_OK,FALSE},
1033 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1034 {"winehq.org",S_OK,FALSE},
1035 {"",S_FALSE,FALSE},
1036 {"",S_FALSE,FALSE},
1037 {"winehq.org",S_OK,FALSE},
1038 {"word",S_OK,FALSE},
1039 {"/",S_OK,FALSE},
1040 {"/",S_OK,FALSE},
1041 {"",S_FALSE,FALSE},
1042 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1043 {"zip",S_OK,FALSE},
1044 {"test\\:word",S_OK,FALSE},
1045 {"test\\",S_OK,FALSE}
1048 {Uri_HOST_DNS,S_OK,FALSE},
1049 {0,S_FALSE,FALSE},
1050 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1051 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1054 /* It normalizes IPv4 addresses correctly. */
1055 { "http://127.000.000.100/", 0, S_OK, FALSE,
1057 {"http://127.0.0.100/",S_OK,FALSE},
1058 {"127.0.0.100",S_OK,FALSE},
1059 {"http://127.0.0.100/",S_OK,FALSE},
1060 {"",S_FALSE,FALSE},
1061 {"",S_FALSE,FALSE},
1062 {"",S_FALSE,FALSE},
1063 {"127.0.0.100",S_OK,FALSE},
1064 {"",S_FALSE,FALSE},
1065 {"/",S_OK,FALSE},
1066 {"/",S_OK,FALSE},
1067 {"",S_FALSE,FALSE},
1068 {"http://127.000.000.100/",S_OK,FALSE},
1069 {"http",S_OK,FALSE},
1070 {"",S_FALSE,FALSE},
1071 {"",S_FALSE,FALSE}
1074 {Uri_HOST_IPV4,S_OK,FALSE},
1075 {80,S_OK,FALSE},
1076 {URL_SCHEME_HTTP,S_OK,FALSE},
1077 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1080 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1082 {"http://127.0.0.1:8000/",S_OK},
1083 {"127.0.0.1:8000",S_OK},
1084 {"http://127.0.0.1:8000/",S_OK},
1085 {"",S_FALSE},
1086 {"",S_FALSE},
1087 {"",S_FALSE},
1088 {"127.0.0.1",S_OK},
1089 {"",S_FALSE},
1090 {"/",S_OK},
1091 {"/",S_OK},
1092 {"",S_FALSE},
1093 {"http://127.0.0.1:8000",S_OK},
1094 {"http",S_OK},
1095 {"",S_FALSE},
1096 {"",S_FALSE}
1099 {Uri_HOST_IPV4,S_OK,FALSE},
1100 {8000,S_OK,FALSE},
1101 {URL_SCHEME_HTTP,S_OK,FALSE},
1102 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1105 /* Make sure it normalizes partial IPv4 addresses correctly. */
1106 { "http://127.0/", 0, S_OK, FALSE,
1108 {"http://127.0.0.0/",S_OK,FALSE},
1109 {"127.0.0.0",S_OK,FALSE},
1110 {"http://127.0.0.0/",S_OK,FALSE},
1111 {"",S_FALSE,FALSE},
1112 {"",S_FALSE,FALSE},
1113 {"",S_FALSE,FALSE},
1114 {"127.0.0.0",S_OK,FALSE},
1115 {"",S_FALSE,FALSE},
1116 {"/",S_OK,FALSE},
1117 {"/",S_OK,FALSE},
1118 {"",S_FALSE,FALSE},
1119 {"http://127.0/",S_OK,FALSE},
1120 {"http",S_OK,FALSE},
1121 {"",S_FALSE,FALSE},
1122 {"",S_FALSE,FALSE}
1125 {Uri_HOST_IPV4,S_OK,FALSE},
1126 {80,S_OK,FALSE},
1127 {URL_SCHEME_HTTP,S_OK,FALSE},
1128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1131 /* Make sure it converts implicit IPv4's correctly. */
1132 { "http://123456/", 0, S_OK, FALSE,
1134 {"http://0.1.226.64/",S_OK,FALSE},
1135 {"0.1.226.64",S_OK,FALSE},
1136 {"http://0.1.226.64/",S_OK,FALSE},
1137 {"",S_FALSE,FALSE},
1138 {"",S_FALSE,FALSE},
1139 {"",S_FALSE,FALSE},
1140 {"0.1.226.64",S_OK,FALSE},
1141 {"",S_FALSE,FALSE},
1142 {"/",S_OK,FALSE},
1143 {"/",S_OK,FALSE},
1144 {"",S_FALSE,FALSE},
1145 {"http://123456/",S_OK,FALSE},
1146 {"http",S_OK,FALSE},
1147 {"",S_FALSE,FALSE},
1148 {"",S_FALSE,FALSE}
1151 {Uri_HOST_IPV4,S_OK,FALSE},
1152 {80,S_OK,FALSE},
1153 {URL_SCHEME_HTTP,S_OK,FALSE},
1154 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1157 /* UINT_MAX */
1158 { "http://4294967295/", 0, S_OK, FALSE,
1160 {"http://255.255.255.255/",S_OK,FALSE},
1161 {"255.255.255.255",S_OK,FALSE},
1162 {"http://255.255.255.255/",S_OK,FALSE},
1163 {"",S_FALSE,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"",S_FALSE,FALSE},
1166 {"255.255.255.255",S_OK,FALSE},
1167 {"",S_FALSE,FALSE},
1168 {"/",S_OK,FALSE},
1169 {"/",S_OK,FALSE},
1170 {"",S_FALSE,FALSE},
1171 {"http://4294967295/",S_OK,FALSE},
1172 {"http",S_OK,FALSE},
1173 {"",S_FALSE,FALSE},
1174 {"",S_FALSE,FALSE}
1177 {Uri_HOST_IPV4,S_OK,FALSE},
1178 {80,S_OK,FALSE},
1179 {URL_SCHEME_HTTP,S_OK,FALSE},
1180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1183 /* UINT_MAX+1 */
1184 { "http://4294967296/", 0, S_OK, FALSE,
1186 {"http://4294967296/",S_OK,FALSE},
1187 {"4294967296",S_OK,FALSE},
1188 {"http://4294967296/",S_OK,FALSE},
1189 {"",S_FALSE,FALSE},
1190 {"",S_FALSE,FALSE},
1191 {"",S_FALSE,FALSE},
1192 {"4294967296",S_OK,FALSE},
1193 {"",S_FALSE,FALSE},
1194 {"/",S_OK,FALSE},
1195 {"/",S_OK,FALSE},
1196 {"",S_FALSE,FALSE},
1197 {"http://4294967296/",S_OK,FALSE},
1198 {"http",S_OK,FALSE},
1199 {"",S_FALSE,FALSE},
1200 {"",S_FALSE,FALSE}
1203 {Uri_HOST_DNS,S_OK,FALSE},
1204 {80,S_OK,FALSE},
1205 {URL_SCHEME_HTTP,S_OK,FALSE},
1206 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1209 /* Window's doesn't normalize IP address for unknown schemes. */
1210 { "1234://4294967295/", 0, S_OK, FALSE,
1212 {"1234://4294967295/",S_OK,FALSE},
1213 {"4294967295",S_OK,FALSE},
1214 {"1234://4294967295/",S_OK,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"",S_FALSE,FALSE},
1217 {"",S_FALSE,FALSE},
1218 {"4294967295",S_OK,FALSE},
1219 {"",S_FALSE,FALSE},
1220 {"/",S_OK,FALSE},
1221 {"/",S_OK,FALSE},
1222 {"",S_FALSE,FALSE},
1223 {"1234://4294967295/",S_OK,FALSE},
1224 {"1234",S_OK,FALSE},
1225 {"",S_FALSE,FALSE},
1226 {"",S_FALSE,FALSE}
1229 {Uri_HOST_IPV4,S_OK,FALSE},
1230 {0,S_FALSE,FALSE},
1231 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1232 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1235 /* Window's doesn't normalize IP address for unknown schemes. */
1236 { "1234://127.001/", 0, S_OK, FALSE,
1238 {"1234://127.001/",S_OK,FALSE},
1239 {"127.001",S_OK,FALSE},
1240 {"1234://127.001/",S_OK,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"",S_FALSE,FALSE},
1243 {"",S_FALSE,FALSE},
1244 {"127.001",S_OK,FALSE},
1245 {"",S_FALSE,FALSE},
1246 {"/",S_OK,FALSE},
1247 {"/",S_OK,FALSE},
1248 {"",S_FALSE,FALSE},
1249 {"1234://127.001/",S_OK,FALSE},
1250 {"1234",S_OK,FALSE},
1251 {"",S_FALSE,FALSE},
1252 {"",S_FALSE,FALSE}
1255 {Uri_HOST_IPV4,S_OK,FALSE},
1256 {0,S_FALSE,FALSE},
1257 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1258 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1261 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1263 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1264 {"[fedc:ba98::3210]",S_OK,FALSE},
1265 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"",S_FALSE,FALSE},
1269 {"fedc:ba98::3210",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"/",S_OK,FALSE},
1272 {"/",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1275 {"http",S_OK,FALSE},
1276 {"",S_FALSE,FALSE},
1277 {"",S_FALSE,FALSE},
1280 {Uri_HOST_IPV6,S_OK,FALSE},
1281 {80,S_OK,FALSE},
1282 {URL_SCHEME_HTTP,S_OK,FALSE},
1283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1286 { "http://[::]", 0, S_OK, FALSE,
1288 {"http://[::]/",S_OK,FALSE},
1289 {"[::]",S_OK,FALSE},
1290 {"http://[::]/",S_OK,FALSE},
1291 {"",S_FALSE,FALSE},
1292 {"",S_FALSE,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"::",S_OK,FALSE},
1295 {"",S_FALSE,FALSE},
1296 {"/",S_OK,FALSE},
1297 {"/",S_OK,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"http://[::]",S_OK,FALSE},
1300 {"http",S_OK,FALSE},
1301 {"",S_FALSE,FALSE},
1302 {"",S_FALSE,FALSE},
1305 {Uri_HOST_IPV6,S_OK,FALSE},
1306 {80,S_OK,FALSE},
1307 {URL_SCHEME_HTTP,S_OK,FALSE},
1308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1311 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1313 {"http://[fedc:ba98::]/",S_OK,FALSE},
1314 {"[fedc:ba98::]",S_OK,FALSE},
1315 {"http://[fedc:ba98::]/",S_OK,FALSE},
1316 {"",S_FALSE,FALSE},
1317 {"",S_FALSE,FALSE},
1318 {"",S_FALSE,FALSE},
1319 {"fedc:ba98::",S_OK,FALSE},
1320 {"",S_FALSE,FALSE},
1321 {"/",S_OK,FALSE},
1322 {"/",S_OK,FALSE},
1323 {"",S_FALSE,FALSE},
1324 {"http://[FEDC:BA98::]",S_OK,FALSE},
1325 {"http",S_OK,FALSE},
1326 {"",S_FALSE,FALSE},
1327 {"",S_FALSE,FALSE},
1330 {Uri_HOST_IPV6,S_OK,FALSE},
1331 {80,S_OK,FALSE},
1332 {URL_SCHEME_HTTP,S_OK,FALSE},
1333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1336 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1337 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1339 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1340 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1341 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1342 {"",S_FALSE,FALSE},
1343 {"",S_FALSE,FALSE},
1344 {"",S_FALSE,FALSE},
1345 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1346 {"",S_FALSE,FALSE},
1347 {"/",S_OK,FALSE},
1348 {"/",S_OK,FALSE},
1349 {"",S_FALSE,FALSE},
1350 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1351 {"http",S_OK,FALSE},
1352 {"",S_FALSE,FALSE},
1353 {"",S_FALSE,FALSE},
1356 {Uri_HOST_IPV6,S_OK,FALSE},
1357 {80,S_OK,FALSE},
1358 {URL_SCHEME_HTTP,S_OK,FALSE},
1359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1362 { "http://[v2.34]/", 0, S_OK, FALSE,
1364 {"http://[v2.34]/",S_OK,FALSE},
1365 {"[v2.34]",S_OK,FALSE},
1366 {"http://[v2.34]/",S_OK,FALSE},
1367 {"",S_FALSE,FALSE},
1368 {"",S_FALSE,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"[v2.34]",S_OK,FALSE},
1371 {"",S_FALSE,FALSE},
1372 {"/",S_OK,FALSE},
1373 {"/",S_OK,FALSE},
1374 {"",S_FALSE,FALSE},
1375 {"http://[v2.34]/",S_OK,FALSE},
1376 {"http",S_OK,FALSE},
1377 {"",S_FALSE,FALSE},
1378 {"",S_FALSE,FALSE}
1381 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1382 {80,S_OK,FALSE},
1383 {URL_SCHEME_HTTP,S_OK,FALSE},
1384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1387 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1388 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1390 {"http://[xyz:12345.com/test",S_OK,FALSE},
1391 {"[xyz:12345.com",S_OK,FALSE},
1392 {"http://[xyz:12345.com/test",S_OK,FALSE},
1393 {"[xyz:12345.com",S_OK,FALSE},
1394 {"",S_FALSE,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"[xyz:12345.com",S_OK,FALSE},
1397 {"",S_FALSE,FALSE},
1398 {"/test",S_OK,FALSE},
1399 {"/test",S_OK,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"http://[xyz:12345.com/test",S_OK,FALSE},
1402 {"http",S_OK,FALSE},
1403 {"",S_FALSE,FALSE},
1404 {"",S_FALSE,FALSE}
1407 {Uri_HOST_DNS,S_OK,FALSE},
1408 {80,S_OK,FALSE},
1409 {URL_SCHEME_HTTP,S_OK,FALSE},
1410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1413 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1414 * of the host name (respectively).
1416 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1418 {"ftp://www.[works].com/",S_OK,FALSE},
1419 {"www.[works].com",S_OK,FALSE},
1420 {"ftp://www.[works].com/",S_OK,FALSE},
1421 {"[works].com",S_OK,FALSE},
1422 {"",S_FALSE,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"www.[works].com",S_OK,FALSE},
1425 {"",S_FALSE,FALSE},
1426 {"/",S_OK,FALSE},
1427 {"/",S_OK,FALSE},
1428 {"",S_FALSE,FALSE},
1429 {"ftp://www.[works].com/",S_OK,FALSE},
1430 {"ftp",S_OK,FALSE},
1431 {"",S_FALSE,FALSE},
1432 {"",S_FALSE,FALSE}
1435 {Uri_HOST_DNS,S_OK,FALSE},
1436 {21,S_OK,FALSE},
1437 {URL_SCHEME_FTP,S_OK,FALSE},
1438 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1441 /* Considers ':' a delimiter since it appears after the ']'. */
1442 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1444 {"http://www.google.com]:12345/",S_OK,FALSE},
1445 {"www.google.com]:12345",S_OK,FALSE},
1446 {"http://www.google.com]:12345/",S_OK,FALSE},
1447 {"google.com]",S_OK,FALSE},
1448 {"",S_FALSE,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"www.google.com]",S_OK,FALSE},
1451 {"",S_FALSE,FALSE},
1452 {"/",S_OK,FALSE},
1453 {"/",S_OK,FALSE},
1454 {"",S_FALSE,FALSE},
1455 {"http://www.google.com]:12345/",S_OK,FALSE},
1456 {"http",S_OK,FALSE},
1457 {"",S_FALSE,FALSE},
1458 {"",S_FALSE,FALSE}
1461 {Uri_HOST_DNS,S_OK,FALSE},
1462 {12345,S_OK,FALSE},
1463 {URL_SCHEME_HTTP,S_OK,FALSE},
1464 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1467 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1468 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1470 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1471 {"w%XXw%GEw.google.com",S_OK,FALSE},
1472 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1473 {"google.com",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"",S_FALSE,FALSE},
1476 {"w%XXw%GEw.google.com",S_OK,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"/",S_OK,FALSE},
1479 {"/",S_OK,FALSE},
1480 {"",S_FALSE,FALSE},
1481 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1482 {"zip",S_OK,FALSE},
1483 {"",S_FALSE,FALSE},
1484 {"",S_FALSE,FALSE}
1487 {Uri_HOST_DNS,S_OK,FALSE},
1488 {0,S_FALSE,FALSE},
1489 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1490 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1493 /* Unknown scheme types hostname doesn't get lower cased. */
1494 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1496 {"zip://GOOGLE.com/",S_OK,FALSE},
1497 {"GOOGLE.com",S_OK,FALSE},
1498 {"zip://GOOGLE.com/",S_OK,FALSE},
1499 {"GOOGLE.com",S_OK,FALSE},
1500 {"",S_FALSE,FALSE},
1501 {"",S_FALSE,FALSE},
1502 {"GOOGLE.com",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"/",S_OK,FALSE},
1505 {"/",S_OK,FALSE},
1506 {"",S_FALSE,FALSE},
1507 {"zip://GOOGLE.com/",S_OK,FALSE},
1508 {"zip",S_OK,FALSE},
1509 {"",S_FALSE,FALSE},
1510 {"",S_FALSE,FALSE}
1513 {Uri_HOST_DNS,S_OK,FALSE},
1514 {0,S_FALSE,FALSE},
1515 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1519 /* Hostname gets lower-cased for known scheme types. */
1520 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1522 {"http://www.google.com/",S_OK,FALSE},
1523 {"www.google.com",S_OK,FALSE},
1524 {"http://www.google.com/",S_OK,FALSE},
1525 {"google.com",S_OK,FALSE},
1526 {"",S_FALSE,FALSE},
1527 {"",S_FALSE,FALSE},
1528 {"www.google.com",S_OK,FALSE},
1529 {"",S_FALSE,FALSE},
1530 {"/",S_OK,FALSE},
1531 {"/",S_OK,FALSE},
1532 {"",S_FALSE,FALSE},
1533 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1534 {"http",S_OK,FALSE},
1535 {"",S_FALSE,FALSE},
1536 {"",S_FALSE,FALSE}
1539 {Uri_HOST_DNS,S_OK,FALSE},
1540 {80,S_OK,FALSE},
1541 {URL_SCHEME_HTTP,S_OK,FALSE},
1542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1545 /* Characters that get % encoded in the hostname also have their percent
1546 * encoded forms lower cased.
1548 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1550 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1551 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1552 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1553 {"%7cgoogle%7c.com",S_OK,FALSE},
1554 {"",S_FALSE,FALSE},
1555 {"",S_FALSE,FALSE},
1556 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1557 {"",S_FALSE,FALSE},
1558 {"/",S_OK,FALSE},
1559 {"/",S_OK,FALSE},
1560 {"",S_FALSE,FALSE},
1561 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1562 {"http",S_OK,FALSE},
1563 {"",S_FALSE,FALSE},
1564 {"",S_FALSE,FALSE}
1567 {Uri_HOST_DNS,S_OK,FALSE},
1568 {80,S_OK,FALSE},
1569 {URL_SCHEME_HTTP,S_OK,FALSE},
1570 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1573 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1574 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1576 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1577 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1578 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1579 {"",S_FALSE,FALSE},
1580 {"",S_FALSE,FALSE},
1581 {"",S_FALSE,FALSE},
1582 {"1:2:3:4:5:6::",S_OK,FALSE},
1583 {"",S_FALSE,FALSE},
1584 {"/",S_OK,FALSE},
1585 {"/",S_OK,FALSE},
1586 {"",S_FALSE,FALSE},
1587 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1588 {"http",S_OK,FALSE},
1589 {"",S_FALSE,FALSE},
1590 {"",S_FALSE,FALSE},
1593 {Uri_HOST_IPV6,S_OK,FALSE},
1594 {80,S_OK,FALSE},
1595 {URL_SCHEME_HTTP,S_OK,FALSE},
1596 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1599 /* IPv4 addresses get normalized. */
1600 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1602 {"http://[::1.2.3.0]/",S_OK,FALSE},
1603 {"[::1.2.3.0]",S_OK,FALSE},
1604 {"http://[::1.2.3.0]/",S_OK,FALSE},
1605 {"",S_FALSE,FALSE},
1606 {"",S_FALSE,FALSE},
1607 {"",S_FALSE,FALSE},
1608 {"::1.2.3.0",S_OK,FALSE},
1609 {"",S_FALSE,FALSE},
1610 {"/",S_OK,FALSE},
1611 {"/",S_OK,FALSE},
1612 {"",S_FALSE,FALSE},
1613 {"http://[::001.002.003.000]",S_OK,FALSE},
1614 {"http",S_OK,FALSE},
1615 {"",S_FALSE,FALSE},
1616 {"",S_FALSE,FALSE},
1619 {Uri_HOST_IPV6,S_OK,FALSE},
1620 {80,S_OK,FALSE},
1621 {URL_SCHEME_HTTP,S_OK,FALSE},
1622 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1625 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1626 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1628 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1629 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1630 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1631 {"",S_FALSE,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"",S_FALSE,FALSE},
1634 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"/",S_OK,FALSE},
1637 {"/",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1640 {"zip",S_OK,FALSE},
1641 {"",S_FALSE,FALSE},
1642 {"",S_FALSE,FALSE},
1645 {Uri_HOST_IPV6,S_OK,FALSE},
1646 {0,S_FALSE,FALSE},
1647 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1648 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1651 /* IPv4 address is converted into 2 h16 components. */
1652 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1654 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1655 {"[ffff::c0de:6f20]",S_OK,FALSE},
1656 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"",S_FALSE,FALSE},
1659 {"",S_FALSE,FALSE},
1660 {"ffff::c0de:6f20",S_OK,FALSE},
1661 {"",S_FALSE,FALSE},
1662 {"/",S_OK,FALSE},
1663 {"/",S_OK,FALSE},
1664 {"",S_FALSE,FALSE},
1665 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1666 {"http",S_OK,FALSE},
1667 {"",S_FALSE,FALSE},
1668 {"",S_FALSE,FALSE},
1671 {Uri_HOST_IPV6,S_OK,FALSE},
1672 {80,S_OK,FALSE},
1673 {URL_SCHEME_HTTP,S_OK,FALSE},
1674 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1677 /* Max value for a port. */
1678 { "http://google.com:65535", 0, S_OK, FALSE,
1680 {"http://google.com:65535/",S_OK,FALSE},
1681 {"google.com:65535",S_OK,FALSE},
1682 {"http://google.com:65535/",S_OK,FALSE},
1683 {"google.com",S_OK,FALSE},
1684 {"",S_FALSE,FALSE},
1685 {"",S_FALSE,FALSE},
1686 {"google.com",S_OK,FALSE},
1687 {"",S_FALSE,FALSE},
1688 {"/",S_OK,FALSE},
1689 {"/",S_OK,FALSE},
1690 {"",S_FALSE,FALSE},
1691 {"http://google.com:65535",S_OK,FALSE},
1692 {"http",S_OK,FALSE},
1693 {"",S_FALSE,FALSE},
1694 {"",S_FALSE,FALSE}
1697 {Uri_HOST_DNS,S_OK,FALSE},
1698 {65535,S_OK,FALSE},
1699 {URL_SCHEME_HTTP,S_OK,FALSE},
1700 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1703 { "zip://google.com:65536", 0, S_OK, FALSE,
1705 {"zip://google.com:65536/",S_OK,FALSE},
1706 {"google.com:65536",S_OK,FALSE},
1707 {"zip://google.com:65536/",S_OK,FALSE},
1708 {"google.com:65536",S_OK,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"",S_FALSE,FALSE},
1711 {"google.com:65536",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"/",S_OK,FALSE},
1714 {"/",S_OK,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"zip://google.com:65536",S_OK,FALSE},
1717 {"zip",S_OK,FALSE},
1718 {"",S_FALSE,FALSE},
1719 {"",S_FALSE,FALSE}
1722 {Uri_HOST_DNS,S_OK,FALSE},
1723 {0,S_FALSE,FALSE},
1724 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1725 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1728 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1730 {"zip://google.com:65536:25/",S_OK,FALSE},
1731 {"google.com:65536:25",S_OK,FALSE},
1732 {"zip://google.com:65536:25/",S_OK,FALSE},
1733 {"google.com:65536:25",S_OK,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"google.com:65536:25",S_OK,FALSE},
1737 {"",S_FALSE,FALSE},
1738 {"/",S_OK,FALSE},
1739 {"/",S_OK,FALSE},
1740 {"",S_FALSE,FALSE},
1741 {"zip://google.com:65536:25",S_OK,FALSE},
1742 {"zip",S_OK,FALSE},
1743 {"",S_FALSE,FALSE},
1744 {"",S_FALSE,FALSE}
1747 {Uri_HOST_DNS,S_OK,FALSE},
1748 {0,S_FALSE,FALSE},
1749 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1750 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1753 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1755 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1756 {"[::ffff]:abcd",S_OK,FALSE},
1757 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1758 {"",S_FALSE,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"[::ffff]:abcd",S_OK,FALSE},
1762 {"",S_FALSE,FALSE},
1763 {"/",S_OK,FALSE},
1764 {"/",S_OK,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"zip://[::ffff]:abcd",S_OK,FALSE},
1767 {"zip",S_OK,FALSE},
1768 {"",S_FALSE,FALSE},
1769 {"",S_FALSE,FALSE}
1772 {Uri_HOST_DNS,S_OK,FALSE},
1773 {0,S_FALSE,FALSE},
1774 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1775 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1778 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1780 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1781 {"127.0.0.1:abcd",S_OK,FALSE},
1782 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1783 {"0.1:abcd",S_OK,FALSE},
1784 {"",S_FALSE,FALSE},
1785 {"",S_FALSE,FALSE},
1786 {"127.0.0.1:abcd",S_OK,FALSE},
1787 {"",S_FALSE,FALSE},
1788 {"/",S_OK,FALSE},
1789 {"/",S_OK,FALSE},
1790 {"",S_FALSE,FALSE},
1791 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1792 {"zip",S_OK,FALSE},
1793 {"",S_FALSE,FALSE},
1794 {"",S_FALSE,FALSE}
1797 {Uri_HOST_DNS,S_OK,FALSE},
1798 {0,S_FALSE,FALSE},
1799 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1800 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1803 /* Port is just copied over. */
1804 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1806 {"http://google.com:00035",S_OK,FALSE},
1807 {"google.com:00035",S_OK,FALSE},
1808 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1809 {"google.com",S_OK,FALSE},
1810 {"",S_FALSE,FALSE},
1811 {"",S_FALSE,FALSE},
1812 {"google.com",S_OK,FALSE},
1813 {"",S_FALSE,FALSE},
1814 {"",S_FALSE,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"",S_FALSE,FALSE},
1817 {"http://google.com:00035",S_OK,FALSE},
1818 {"http",S_OK,FALSE},
1819 {"",S_FALSE,FALSE},
1820 {"",S_FALSE,FALSE}
1823 {Uri_HOST_DNS,S_OK,FALSE},
1824 {35,S_OK,FALSE},
1825 {URL_SCHEME_HTTP,S_OK,FALSE},
1826 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1829 /* Default port is copied over. */
1830 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1832 {"http://google.com:80",S_OK,FALSE},
1833 {"google.com:80",S_OK,FALSE},
1834 {"http://google.com:80",S_OK,FALSE},
1835 {"google.com",S_OK,FALSE},
1836 {"",S_FALSE,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"google.com",S_OK,FALSE},
1839 {"",S_FALSE,FALSE},
1840 {"",S_FALSE,FALSE},
1841 {"",S_FALSE,FALSE},
1842 {"",S_FALSE,FALSE},
1843 {"http://google.com:80",S_OK,FALSE},
1844 {"http",S_OK,FALSE},
1845 {"",S_FALSE,FALSE},
1846 {"",S_FALSE,FALSE}
1849 {Uri_HOST_DNS,S_OK,FALSE},
1850 {80,S_OK,FALSE},
1851 {URL_SCHEME_HTTP,S_OK,FALSE},
1852 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1855 { "http://google.com.uk", 0, S_OK, FALSE,
1857 {"http://google.com.uk/",S_OK,FALSE},
1858 {"google.com.uk",S_OK,FALSE},
1859 {"http://google.com.uk/",S_OK,FALSE},
1860 {"google.com.uk",S_OK,FALSE},
1861 {"",S_FALSE,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"google.com.uk",S_OK,FALSE},
1864 {"",S_FALSE,FALSE},
1865 {"/",S_OK,FALSE},
1866 {"/",S_OK,FALSE},
1867 {"",S_FALSE,FALSE},
1868 {"http://google.com.uk",S_OK,FALSE},
1869 {"http",S_OK,FALSE},
1870 {"",S_FALSE,FALSE},
1871 {"",S_FALSE,FALSE}
1874 {Uri_HOST_DNS,S_OK,FALSE},
1875 {80,S_OK,FALSE},
1876 {URL_SCHEME_HTTP,S_OK,FALSE},
1877 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1880 { "http://google.com.com", 0, S_OK, FALSE,
1882 {"http://google.com.com/",S_OK,FALSE},
1883 {"google.com.com",S_OK,FALSE},
1884 {"http://google.com.com/",S_OK,FALSE},
1885 {"com.com",S_OK,FALSE},
1886 {"",S_FALSE,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"google.com.com",S_OK,FALSE},
1889 {"",S_FALSE,FALSE},
1890 {"/",S_OK,FALSE},
1891 {"/",S_OK,FALSE},
1892 {"",S_FALSE,FALSE},
1893 {"http://google.com.com",S_OK,FALSE},
1894 {"http",S_OK,FALSE},
1895 {"",S_FALSE,FALSE},
1896 {"",S_FALSE,FALSE}
1899 {Uri_HOST_DNS,S_OK,FALSE},
1900 {80,S_OK,FALSE},
1901 {URL_SCHEME_HTTP,S_OK,FALSE},
1902 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1905 { "http://google.uk.1", 0, S_OK, FALSE,
1907 {"http://google.uk.1/",S_OK,FALSE},
1908 {"google.uk.1",S_OK,FALSE},
1909 {"http://google.uk.1/",S_OK,FALSE},
1910 {"google.uk.1",S_OK,FALSE},
1911 {"",S_FALSE,FALSE},
1912 {"",S_FALSE,FALSE},
1913 {"google.uk.1",S_OK,FALSE},
1914 {"",S_FALSE,FALSE},
1915 {"/",S_OK,FALSE},
1916 {"/",S_OK,FALSE},
1917 {"",S_FALSE,FALSE},
1918 {"http://google.uk.1",S_OK,FALSE},
1919 {"http",S_OK,FALSE},
1920 {"",S_FALSE,FALSE},
1921 {"",S_FALSE,FALSE}
1924 {Uri_HOST_DNS,S_OK,FALSE},
1925 {80,S_OK,FALSE},
1926 {URL_SCHEME_HTTP,S_OK,FALSE},
1927 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1930 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
1931 { "http://google.foo.uk", 0, S_OK, FALSE,
1933 {"http://google.foo.uk/",S_OK,FALSE},
1934 {"google.foo.uk",S_OK,FALSE},
1935 {"http://google.foo.uk/",S_OK,FALSE},
1936 {"foo.uk",S_OK,FALSE},
1937 {"",S_FALSE,FALSE},
1938 {"",S_FALSE,FALSE},
1939 {"google.foo.uk",S_OK,FALSE},
1940 {"",S_FALSE,FALSE},
1941 {"/",S_OK,FALSE},
1942 {"/",S_OK,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"http://google.foo.uk",S_OK,FALSE},
1945 {"http",S_OK,FALSE},
1946 {"",S_FALSE,FALSE},
1947 {"",S_FALSE,FALSE}
1950 {Uri_HOST_DNS,S_OK,FALSE},
1951 {80,S_OK,FALSE},
1952 {URL_SCHEME_HTTP,S_OK,FALSE},
1953 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1956 { "http://.com", 0, S_OK, FALSE,
1958 {"http://.com/",S_OK,FALSE},
1959 {".com",S_OK,FALSE},
1960 {"http://.com/",S_OK,FALSE},
1961 {".com",S_OK,FALSE},
1962 {"",S_FALSE,FALSE},
1963 {"",S_FALSE,FALSE},
1964 {".com",S_OK,FALSE},
1965 {"",S_FALSE,FALSE},
1966 {"/",S_OK,FALSE},
1967 {"/",S_OK,FALSE},
1968 {"",S_FALSE,FALSE},
1969 {"http://.com",S_OK,FALSE},
1970 {"http",S_OK,FALSE},
1971 {"",S_FALSE,FALSE},
1972 {"",S_FALSE,FALSE}
1975 {Uri_HOST_DNS,S_OK,FALSE},
1976 {80,S_OK,FALSE},
1977 {URL_SCHEME_HTTP,S_OK,FALSE},
1978 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1981 { "http://.uk", 0, S_OK, FALSE,
1983 {"http://.uk/",S_OK,FALSE},
1984 {".uk",S_OK,FALSE},
1985 {"http://.uk/",S_OK,FALSE},
1986 {"",S_FALSE,FALSE},
1987 {"",S_FALSE,FALSE},
1988 {"",S_FALSE,FALSE},
1989 {".uk",S_OK,FALSE},
1990 {"",S_FALSE,FALSE},
1991 {"/",S_OK,FALSE},
1992 {"/",S_OK,FALSE},
1993 {"",S_FALSE,FALSE},
1994 {"http://.uk",S_OK,FALSE},
1995 {"http",S_OK,FALSE},
1996 {"",S_FALSE,FALSE},
1997 {"",S_FALSE,FALSE}
2000 {Uri_HOST_DNS,S_OK,FALSE},
2001 {80,S_OK,FALSE},
2002 {URL_SCHEME_HTTP,S_OK,FALSE},
2003 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2006 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
2008 {"http://www.co.google.com.[]/",S_OK,FALSE},
2009 {"www.co.google.com.[]",S_OK,FALSE},
2010 {"http://www.co.google.com.[]/",S_OK,FALSE},
2011 {"google.com.[]",S_OK,FALSE},
2012 {"",S_FALSE,FALSE},
2013 {"",S_FALSE,FALSE},
2014 {"www.co.google.com.[]",S_OK,FALSE},
2015 {"",S_FALSE,FALSE},
2016 {"/",S_OK,FALSE},
2017 {"/",S_OK,FALSE},
2018 {"",S_FALSE,FALSE},
2019 {"http://www.co.google.com.[]",S_OK,FALSE},
2020 {"http",S_OK,FALSE},
2021 {"",S_FALSE,FALSE},
2022 {"",S_FALSE,FALSE}
2025 {Uri_HOST_DNS,S_OK,FALSE},
2026 {80,S_OK,FALSE},
2027 {URL_SCHEME_HTTP,S_OK,FALSE},
2028 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2031 { "http://co.uk", 0, S_OK, FALSE,
2033 {"http://co.uk/",S_OK,FALSE},
2034 {"co.uk",S_OK,FALSE},
2035 {"http://co.uk/",S_OK,FALSE},
2036 {"",S_FALSE,FALSE},
2037 {"",S_FALSE,FALSE},
2038 {"",S_FALSE,FALSE},
2039 {"co.uk",S_OK,FALSE},
2040 {"",S_FALSE,FALSE},
2041 {"/",S_OK,FALSE},
2042 {"/",S_OK,FALSE},
2043 {"",S_FALSE,FALSE},
2044 {"http://co.uk",S_OK,FALSE},
2045 {"http",S_OK,FALSE},
2046 {"",S_FALSE,FALSE},
2047 {"",S_FALSE,FALSE}
2050 {Uri_HOST_DNS,S_OK,FALSE},
2051 {80,S_OK,FALSE},
2052 {URL_SCHEME_HTTP,S_OK,FALSE},
2053 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2056 { "http://www.co.google.us.test", 0, S_OK, FALSE,
2058 {"http://www.co.google.us.test/",S_OK,FALSE},
2059 {"www.co.google.us.test",S_OK,FALSE},
2060 {"http://www.co.google.us.test/",S_OK,FALSE},
2061 {"us.test",S_OK,FALSE},
2062 {"",S_FALSE,FALSE},
2063 {"",S_FALSE,FALSE},
2064 {"www.co.google.us.test",S_OK,FALSE},
2065 {"",S_FALSE,FALSE},
2066 {"/",S_OK,FALSE},
2067 {"/",S_OK,FALSE},
2068 {"",S_FALSE,FALSE},
2069 {"http://www.co.google.us.test",S_OK,FALSE},
2070 {"http",S_OK,FALSE},
2071 {"",S_FALSE,FALSE},
2072 {"",S_FALSE,FALSE}
2075 {Uri_HOST_DNS,S_OK,FALSE},
2076 {80,S_OK,FALSE},
2077 {URL_SCHEME_HTTP,S_OK,FALSE},
2078 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2081 { "http://gov.uk", 0, S_OK, FALSE,
2083 {"http://gov.uk/",S_OK,FALSE},
2084 {"gov.uk",S_OK,FALSE},
2085 {"http://gov.uk/",S_OK,FALSE},
2086 {"",S_FALSE,FALSE},
2087 {"",S_FALSE,FALSE},
2088 {"",S_FALSE,FALSE},
2089 {"gov.uk",S_OK,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"/",S_OK,FALSE},
2092 {"/",S_OK,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"http://gov.uk",S_OK,FALSE},
2095 {"http",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"",S_FALSE,FALSE}
2100 {Uri_HOST_DNS,S_OK,FALSE},
2101 {80,S_OK,FALSE},
2102 {URL_SCHEME_HTTP,S_OK,FALSE},
2103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2106 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2108 {"zip://www.google.com\\test",S_OK,FALSE},
2109 {"www.google.com\\test",S_OK,FALSE},
2110 {"zip://www.google.com\\test",S_OK,FALSE},
2111 {"google.com\\test",S_OK,FALSE},
2112 {"",S_FALSE,FALSE},
2113 {"",S_FALSE,FALSE},
2114 {"www.google.com\\test",S_OK,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {"",S_FALSE,FALSE},
2117 {"",S_FALSE,FALSE},
2118 {"",S_FALSE,FALSE},
2119 {"zip://www.google.com\\test",S_OK,FALSE},
2120 {"zip",S_OK,FALSE},
2121 {"",S_FALSE,FALSE},
2122 {"",S_FALSE,FALSE}
2125 {Uri_HOST_DNS,S_OK,FALSE},
2126 {0,S_FALSE,FALSE},
2127 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2131 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2133 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2134 {"",S_FALSE,FALSE},
2135 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2136 {"",S_FALSE,FALSE},
2137 {"",S_FALSE,FALSE},
2138 {"",S_FALSE,FALSE},
2139 {"",S_FALSE,FALSE},
2140 {"",S_FALSE,FALSE},
2141 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2142 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2145 {"urn",S_OK,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"",S_FALSE,FALSE}
2150 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2151 {0,S_FALSE,FALSE},
2152 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2153 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2156 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2157 * are decoded and all '%' are encoded.
2159 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2161 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2162 {"",S_FALSE,FALSE},
2163 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2164 {"",S_FALSE,FALSE},
2165 {".mp3",S_OK,FALSE},
2166 {"",S_FALSE,FALSE},
2167 {"",S_FALSE,FALSE},
2168 {"",S_FALSE,FALSE},
2169 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2170 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2173 {"file",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"",S_FALSE,FALSE}
2178 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2179 {0,S_FALSE,FALSE},
2180 {URL_SCHEME_FILE,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2184 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2185 * is decoded and only %'s in front of invalid hex digits are encoded.
2187 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2189 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2192 {"",S_FALSE,FALSE},
2193 {".mp3",S_OK,FALSE},
2194 {"",S_FALSE,FALSE},
2195 {"",S_FALSE,FALSE},
2196 {"",S_FALSE,FALSE},
2197 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2198 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2199 {"",S_FALSE,FALSE},
2200 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2201 {"file",S_OK,FALSE},
2202 {"",S_FALSE,FALSE},
2203 {"",S_FALSE,FALSE}
2206 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2207 {0,S_FALSE,FALSE},
2208 {URL_SCHEME_FILE,S_OK,FALSE},
2209 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2212 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2213 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2215 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2216 {"[::1.2.3.0]",S_OK,FALSE},
2217 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2218 {"",S_FALSE,FALSE},
2219 {"",S_FALSE,FALSE},
2220 {"",S_FALSE,FALSE},
2221 {"::1.2.3.0",S_OK,FALSE},
2222 {"",S_FALSE,FALSE},
2223 {"/%3F%23.T/test",S_OK,FALSE},
2224 {"/%3F%23.T/test",S_OK,FALSE},
2225 {"",S_FALSE,FALSE},
2226 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2227 {"http",S_OK,FALSE},
2228 {"",S_FALSE,FALSE},
2229 {"",S_FALSE,FALSE},
2232 {Uri_HOST_IPV6,S_OK,FALSE},
2233 {80,S_OK,FALSE},
2234 {URL_SCHEME_HTTP,S_OK,FALSE},
2235 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2238 /* Forbidden characters are always encoded for file URIs. */
2239 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2241 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2242 {"",S_FALSE,FALSE},
2243 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2244 {"",S_FALSE,FALSE},
2245 {".mp3",S_OK,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"",S_FALSE,FALSE},
2248 {"",S_FALSE,FALSE},
2249 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2250 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2251 {"",S_FALSE,FALSE},
2252 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2253 {"file",S_OK,FALSE},
2254 {"",S_FALSE,FALSE},
2255 {"",S_FALSE,FALSE}
2258 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2259 {0,S_FALSE,FALSE},
2260 {URL_SCHEME_FILE,S_OK,FALSE},
2261 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2264 /* Forbidden characters are never encoded for unknown scheme types. */
2265 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2267 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2268 {"4294967295",S_OK,FALSE},
2269 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2270 {"",S_FALSE,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"",S_FALSE,FALSE},
2273 {"4294967295",S_OK,FALSE},
2274 {"",S_FALSE,FALSE},
2275 {"/<|>\" test<|>",S_OK,FALSE},
2276 {"/<|>\" test<|>",S_OK,FALSE},
2277 {"",S_FALSE,FALSE},
2278 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2279 {"1234",S_OK,FALSE},
2280 {"",S_FALSE,FALSE},
2281 {"",S_FALSE,FALSE}
2284 {Uri_HOST_IPV4,S_OK,FALSE},
2285 {0,S_FALSE,FALSE},
2286 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2287 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2290 /* Make sure forbidden characters are percent encoded. */
2291 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2293 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2295 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2296 {"",S_FALSE,FALSE},
2297 {"",S_FALSE,FALSE},
2298 {"",S_FALSE,FALSE},
2299 {"gov.uk",S_OK,FALSE},
2300 {"",S_FALSE,FALSE},
2301 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2302 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2303 {"",S_FALSE,FALSE},
2304 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2305 {"http",S_OK,FALSE},
2306 {"",S_FALSE,FALSE},
2307 {"",S_FALSE,FALSE}
2310 {Uri_HOST_DNS,S_OK,FALSE},
2311 {80,S_OK,FALSE},
2312 {URL_SCHEME_HTTP,S_OK,FALSE},
2313 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2316 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2318 {"http://gov.uk/",S_OK,FALSE},
2319 {"gov.uk",S_OK,FALSE},
2320 {"http://gov.uk/",S_OK,FALSE},
2321 {"",S_FALSE,FALSE},
2322 {"",S_FALSE,FALSE},
2323 {"",S_FALSE,FALSE},
2324 {"gov.uk",S_OK,FALSE},
2325 {"",S_FALSE,FALSE},
2326 {"/",S_OK,FALSE},
2327 {"/",S_OK,FALSE},
2328 {"",S_FALSE,FALSE},
2329 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2330 {"http",S_OK,FALSE},
2331 {"",S_FALSE,FALSE},
2332 {"",S_FALSE,FALSE}
2335 {Uri_HOST_DNS,S_OK,FALSE},
2336 {80,S_OK,FALSE},
2337 {URL_SCHEME_HTTP,S_OK,FALSE},
2338 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2341 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2343 {"http://gov.uk/",S_OK,FALSE},
2344 {"gov.uk",S_OK,FALSE},
2345 {"http://gov.uk/",S_OK,FALSE},
2346 {"",S_FALSE,FALSE},
2347 {"",S_FALSE,FALSE},
2348 {"",S_FALSE,FALSE},
2349 {"gov.uk",S_OK,FALSE},
2350 {"",S_FALSE,FALSE},
2351 {"/",S_OK,FALSE},
2352 {"/",S_OK,FALSE},
2353 {"",S_FALSE,FALSE},
2354 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2355 {"http",S_OK,FALSE},
2356 {"",S_FALSE,FALSE},
2357 {"",S_FALSE,FALSE}
2360 {Uri_HOST_DNS,S_OK,FALSE},
2361 {80,S_OK,FALSE},
2362 {URL_SCHEME_HTTP,S_OK,FALSE},
2363 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2366 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2368 {"http://gov.uk/",S_OK,FALSE},
2369 {"gov.uk",S_OK,FALSE},
2370 {"http://gov.uk/",S_OK,FALSE},
2371 {"",S_FALSE,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {"",S_FALSE,FALSE},
2374 {"gov.uk",S_OK,FALSE},
2375 {"",S_FALSE,FALSE},
2376 {"/",S_OK,FALSE},
2377 {"/",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2380 {"http",S_OK,FALSE},
2381 {"",S_FALSE,FALSE},
2382 {"",S_FALSE,FALSE}
2385 {Uri_HOST_DNS,S_OK,FALSE},
2386 {80,S_OK,FALSE},
2387 {URL_SCHEME_HTTP,S_OK,FALSE},
2388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2391 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2393 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2394 {"",S_FALSE,FALSE},
2395 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2396 {"",S_FALSE,FALSE},
2397 {".mp3",S_OK,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"",S_FALSE,FALSE},
2400 {"",S_FALSE,FALSE},
2401 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2402 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2403 {"",S_FALSE,FALSE},
2404 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2405 {"file",S_OK,FALSE},
2406 {"",S_FALSE,FALSE},
2407 {"",S_FALSE,FALSE}
2410 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2411 {0,S_FALSE,FALSE},
2412 {URL_SCHEME_FILE,S_OK,FALSE},
2413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2416 /* Dot removal happens for unknown scheme types. */
2417 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2419 {"zip://gov.uk/",S_OK,FALSE},
2420 {"gov.uk",S_OK,FALSE},
2421 {"zip://gov.uk/",S_OK,FALSE},
2422 {"",S_FALSE,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {"",S_FALSE,FALSE},
2425 {"gov.uk",S_OK,FALSE},
2426 {"",S_FALSE,FALSE},
2427 {"/",S_OK,FALSE},
2428 {"/",S_OK,FALSE},
2429 {"",S_FALSE,FALSE},
2430 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2431 {"zip",S_OK,FALSE},
2432 {"",S_FALSE,FALSE},
2433 {"",S_FALSE,FALSE}
2436 {Uri_HOST_DNS,S_OK,FALSE},
2437 {0,S_FALSE,FALSE},
2438 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2439 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2442 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2443 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2445 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2446 {"gov.uk",S_OK,FALSE},
2447 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2448 {"",S_FALSE,FALSE},
2449 {".",S_OK,FALSE},
2450 {"",S_FALSE,FALSE},
2451 {"gov.uk",S_OK,FALSE},
2452 {"",S_FALSE,FALSE},
2453 {"/test/test2/../../.",S_OK,FALSE},
2454 {"/test/test2/../../.",S_OK,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2457 {"http",S_OK,FALSE},
2458 {"",S_FALSE,FALSE},
2459 {"",S_FALSE,FALSE}
2462 {Uri_HOST_DNS,S_OK,FALSE},
2463 {80,S_OK,FALSE},
2464 {URL_SCHEME_HTTP,S_OK,FALSE},
2465 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2468 /* Dot removal doesn't happen for wildcard scheme types. */
2469 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2471 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2472 {"gov.uk",S_OK,FALSE},
2473 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2474 {"",S_FALSE,FALSE},
2475 {".",S_OK,FALSE},
2476 {"",S_FALSE,FALSE},
2477 {"gov.uk",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"/test/test2/../../.",S_OK,FALSE},
2480 {"/test/test2/../../.",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2483 {"*",S_OK,FALSE},
2484 {"",S_FALSE,FALSE},
2485 {"",S_FALSE,FALSE}
2488 {Uri_HOST_DNS,S_OK,FALSE},
2489 {0,S_FALSE,FALSE},
2490 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2494 /* Forbidden characters are encoded for opaque known scheme types. */
2495 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2497 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2498 {"",S_FALSE,FALSE},
2499 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {".com%22",S_OK,FALSE},
2502 {"",S_FALSE,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {"",S_FALSE,FALSE},
2505 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2506 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2509 {"mailto",S_OK,FALSE},
2510 {"",S_FALSE,FALSE},
2511 {"",S_FALSE,FALSE}
2514 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2515 {0,S_FALSE,FALSE},
2516 {URL_SCHEME_MAILTO,S_OK,FALSE},
2517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2520 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2522 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2523 {"",S_FALSE,FALSE},
2524 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2525 {"",S_FALSE,FALSE},
2526 {".com",S_OK,FALSE},
2527 {"",S_FALSE,FALSE},
2528 {"",S_FALSE,FALSE},
2529 {"",S_FALSE,FALSE},
2530 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2531 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2532 {"",S_FALSE,FALSE},
2533 {"news:test.tes<|>t.com",S_OK,FALSE},
2534 {"news",S_OK,FALSE},
2535 {"",S_FALSE,FALSE},
2536 {"",S_FALSE,FALSE}
2539 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2540 {0,S_FALSE,FALSE},
2541 {URL_SCHEME_NEWS,S_OK,FALSE},
2542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2545 /* Don't encode forbidden characters. */
2546 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2548 {"news:test.tes<|>t.com",S_OK,FALSE},
2549 {"",S_FALSE,FALSE},
2550 {"news:test.tes<|>t.com",S_OK,FALSE},
2551 {"",S_FALSE,FALSE},
2552 {".com",S_OK,FALSE},
2553 {"",S_FALSE,FALSE},
2554 {"",S_FALSE,FALSE},
2555 {"",S_FALSE,FALSE},
2556 {"test.tes<|>t.com",S_OK,FALSE},
2557 {"test.tes<|>t.com",S_OK,FALSE},
2558 {"",S_FALSE,FALSE},
2559 {"news:test.tes<|>t.com",S_OK,FALSE},
2560 {"news",S_OK,FALSE},
2561 {"",S_FALSE,FALSE},
2562 {"",S_FALSE,FALSE}
2565 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2566 {0,S_FALSE,FALSE},
2567 {URL_SCHEME_NEWS,S_OK,FALSE},
2568 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2571 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2572 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2574 {"urn:test.tes<|>t.com",S_OK,FALSE},
2575 {"",S_FALSE,FALSE},
2576 {"urn:test.tes<|>t.com",S_OK,FALSE},
2577 {"",S_FALSE,FALSE},
2578 {".com",S_OK,FALSE},
2579 {"",S_FALSE,FALSE},
2580 {"",S_FALSE,FALSE},
2581 {"",S_FALSE,FALSE},
2582 {"test.tes<|>t.com",S_OK,FALSE},
2583 {"test.tes<|>t.com",S_OK,FALSE},
2584 {"",S_FALSE,FALSE},
2585 {"urn:test.tes<|>t.com",S_OK,FALSE},
2586 {"urn",S_OK,FALSE},
2587 {"",S_FALSE,FALSE},
2588 {"",S_FALSE,FALSE}
2591 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2592 {0,S_FALSE,FALSE},
2593 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2594 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2597 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2598 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2600 {"news:test.test.com",S_OK,FALSE},
2601 {"",S_FALSE,FALSE},
2602 {"news:test.test.com",S_OK,FALSE},
2603 {"",S_FALSE,FALSE},
2604 {".com",S_OK,FALSE},
2605 {"",S_FALSE,FALSE},
2606 {"",S_FALSE,FALSE},
2607 {"",S_FALSE,FALSE},
2608 {"test.test.com",S_OK,FALSE},
2609 {"test.test.com",S_OK,FALSE},
2610 {"",S_FALSE,FALSE},
2611 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2612 {"news",S_OK,FALSE},
2613 {"",S_FALSE,FALSE},
2614 {"",S_FALSE,FALSE}
2617 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2618 {0,S_FALSE,FALSE},
2619 {URL_SCHEME_NEWS,S_OK,FALSE},
2620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2623 /* Percent encoded characters are still decoded for known scheme types. */
2624 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2626 {"news:test.test.com",S_OK,FALSE},
2627 {"",S_FALSE,FALSE},
2628 {"news:test.test.com",S_OK,FALSE},
2629 {"",S_FALSE,FALSE},
2630 {".com",S_OK,FALSE},
2631 {"",S_FALSE,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {"",S_FALSE,FALSE},
2634 {"test.test.com",S_OK,FALSE},
2635 {"test.test.com",S_OK,FALSE},
2636 {"",S_FALSE,FALSE},
2637 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2638 {"news",S_OK,FALSE},
2639 {"",S_FALSE,FALSE},
2640 {"",S_FALSE,FALSE}
2643 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2644 {0,S_FALSE,FALSE},
2645 {URL_SCHEME_NEWS,S_OK,FALSE},
2646 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2649 /* Percent encoded characters aren't decoded for unknown scheme types. */
2650 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2652 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2653 {"",S_FALSE,FALSE},
2654 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {".com",S_OK,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"",S_FALSE,FALSE},
2659 {"",S_FALSE,FALSE},
2660 {"test.%74%65%73%74.com",S_OK,FALSE},
2661 {"test.%74%65%73%74.com",S_OK,FALSE},
2662 {"",S_FALSE,FALSE},
2663 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2664 {"urn",S_OK,FALSE},
2665 {"",S_FALSE,FALSE},
2666 {"",S_FALSE,FALSE}
2669 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2670 {0,S_FALSE,FALSE},
2671 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2672 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2675 /* Unknown scheme types can have invalid % encoded data in query string. */
2676 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2678 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2679 {"www.winehq.org",S_OK,FALSE},
2680 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2681 {"winehq.org",S_OK,FALSE},
2682 {"",S_FALSE,FALSE},
2683 {"",S_FALSE,FALSE},
2684 {"www.winehq.org",S_OK,FALSE},
2685 {"",S_FALSE,FALSE},
2686 {"/",S_OK,FALSE},
2687 {"/?query=%xx&return=y",S_OK,FALSE},
2688 {"?query=%xx&return=y",S_OK,FALSE},
2689 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2690 {"zip",S_OK,FALSE},
2691 {"",S_FALSE,FALSE},
2692 {"",S_FALSE,FALSE}
2695 {Uri_HOST_DNS,S_OK,FALSE},
2696 {0,S_FALSE,FALSE},
2697 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2698 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2701 /* Known scheme types can have invalid % encoded data with the right flags. */
2702 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2704 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2705 {"www.winehq.org",S_OK,FALSE},
2706 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2707 {"winehq.org",S_OK,FALSE},
2708 {"",S_FALSE,FALSE},
2709 {"",S_FALSE,FALSE},
2710 {"www.winehq.org",S_OK,FALSE},
2711 {"",S_FALSE,FALSE},
2712 {"/",S_OK,FALSE},
2713 {"/?query=%xx&return=y",S_OK,FALSE},
2714 {"?query=%xx&return=y",S_OK,FALSE},
2715 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2716 {"http",S_OK,FALSE},
2717 {"",S_FALSE,FALSE},
2718 {"",S_FALSE,FALSE}
2721 {Uri_HOST_DNS,S_OK,FALSE},
2722 {80,S_OK,FALSE},
2723 {URL_SCHEME_HTTP,S_OK,FALSE},
2724 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2727 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2728 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2730 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2731 {"www.winehq.org",S_OK,FALSE},
2732 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2733 {"winehq.org",S_OK,FALSE},
2734 {"",S_FALSE,FALSE},
2735 {"",S_FALSE,FALSE},
2736 {"www.winehq.org",S_OK,FALSE},
2737 {"",S_FALSE,FALSE},
2738 {"/",S_OK,FALSE},
2739 {"/?query=<|>&return=y",S_OK,FALSE},
2740 {"?query=<|>&return=y",S_OK,FALSE},
2741 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2742 {"http",S_OK,FALSE},
2743 {"",S_FALSE,FALSE},
2744 {"",S_FALSE,FALSE}
2747 {Uri_HOST_DNS,S_OK,FALSE},
2748 {80,S_OK,FALSE},
2749 {URL_SCHEME_HTTP,S_OK,FALSE},
2750 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2753 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2754 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2756 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2757 {"www.winehq.org",S_OK,FALSE},
2758 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2759 {"winehq.org",S_OK,FALSE},
2760 {"",S_FALSE,FALSE},
2761 {"",S_FALSE,FALSE},
2762 {"www.winehq.org",S_OK,FALSE},
2763 {"",S_FALSE,FALSE},
2764 {"/",S_OK,FALSE},
2765 {"/?query=<|>&return=y",S_OK,FALSE},
2766 {"?query=<|>&return=y",S_OK,FALSE},
2767 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2768 {"http",S_OK,FALSE},
2769 {"",S_FALSE,FALSE},
2770 {"",S_FALSE,FALSE}
2773 {Uri_HOST_DNS,S_OK,FALSE},
2774 {80,S_OK,FALSE},
2775 {URL_SCHEME_HTTP,S_OK,FALSE},
2776 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2779 /* Forbidden characters are encoded for known scheme types. */
2780 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2782 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2783 {"www.winehq.org",S_OK,FALSE},
2784 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2785 {"winehq.org",S_OK,FALSE},
2786 {"",S_FALSE,FALSE},
2787 {"",S_FALSE,FALSE},
2788 {"www.winehq.org",S_OK,FALSE},
2789 {"",S_FALSE,FALSE},
2790 {"/",S_OK,FALSE},
2791 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2792 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2793 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2794 {"http",S_OK,FALSE},
2795 {"",S_FALSE,FALSE},
2796 {"",S_FALSE,FALSE}
2799 {Uri_HOST_DNS,S_OK,FALSE},
2800 {80,S_OK,FALSE},
2801 {URL_SCHEME_HTTP,S_OK,FALSE},
2802 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2805 /* Forbidden characters are not encoded for unknown scheme types. */
2806 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2808 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2809 {"www.winehq.org",S_OK,FALSE},
2810 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2811 {"winehq.org",S_OK,FALSE},
2812 {"",S_FALSE,FALSE},
2813 {"",S_FALSE,FALSE},
2814 {"www.winehq.org",S_OK,FALSE},
2815 {"",S_FALSE,FALSE},
2816 {"/",S_OK,FALSE},
2817 {"/?query=<|>&return=y",S_OK,FALSE},
2818 {"?query=<|>&return=y",S_OK,FALSE},
2819 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2820 {"zip",S_OK,FALSE},
2821 {"",S_FALSE,FALSE},
2822 {"",S_FALSE,FALSE}
2825 {Uri_HOST_DNS,S_OK,FALSE},
2826 {0,S_FALSE,FALSE},
2827 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2828 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2831 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2832 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2834 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2835 {"www.winehq.org",S_OK,FALSE},
2836 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2837 {"winehq.org",S_OK,FALSE},
2838 {"",S_FALSE,FALSE},
2839 {"",S_FALSE,FALSE},
2840 {"www.winehq.org",S_OK,FALSE},
2841 {"",S_FALSE,FALSE},
2842 {"/",S_OK,FALSE},
2843 {"/?query=01&return=y",S_OK,FALSE},
2844 {"?query=01&return=y",S_OK,FALSE},
2845 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2846 {"http",S_OK,FALSE},
2847 {"",S_FALSE,FALSE},
2848 {"",S_FALSE,FALSE}
2851 {Uri_HOST_DNS,S_OK,FALSE},
2852 {80,S_OK,FALSE},
2853 {URL_SCHEME_HTTP,S_OK,FALSE},
2854 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2857 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2858 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2860 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2861 {"www.winehq.org",S_OK,FALSE},
2862 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2863 {"winehq.org",S_OK,FALSE},
2864 {"",S_FALSE,FALSE},
2865 {"",S_FALSE,FALSE},
2866 {"www.winehq.org",S_OK,FALSE},
2867 {"",S_FALSE,FALSE},
2868 {"/",S_OK,FALSE},
2869 {"/?query=%30%31&return=y",S_OK,FALSE},
2870 {"?query=%30%31&return=y",S_OK,FALSE},
2871 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2872 {"zip",S_OK,FALSE},
2873 {"",S_FALSE,FALSE},
2874 {"",S_FALSE,FALSE}
2877 {Uri_HOST_DNS,S_OK,FALSE},
2878 {0,S_FALSE,FALSE},
2879 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2880 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2883 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2884 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2886 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2887 {"www.winehq.org",S_OK,FALSE},
2888 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2889 {"winehq.org",S_OK,FALSE},
2890 {"",S_FALSE,FALSE},
2891 {"",S_FALSE,FALSE},
2892 {"www.winehq.org",S_OK,FALSE},
2893 {"",S_FALSE,FALSE},
2894 {"/",S_OK,FALSE},
2895 {"/?query=%30%31&return=y",S_OK,FALSE},
2896 {"?query=%30%31&return=y",S_OK,FALSE},
2897 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2898 {"http",S_OK,FALSE},
2899 {"",S_FALSE,FALSE},
2900 {"",S_FALSE,FALSE}
2903 {Uri_HOST_DNS,S_OK,FALSE},
2904 {80,S_OK,FALSE},
2905 {URL_SCHEME_HTTP,S_OK,FALSE},
2906 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2909 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2911 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2912 {"www.winehq.org",S_OK,FALSE},
2913 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2914 {"winehq.org",S_OK,FALSE},
2915 {"",S_FALSE,FALSE},
2916 {"",S_FALSE,FALSE},
2917 {"www.winehq.org",S_OK,FALSE},
2918 {"",S_FALSE,FALSE},
2919 {"",S_FALSE,FALSE},
2920 {"?query=12&return=y",S_OK,FALSE},
2921 {"?query=12&return=y",S_OK,FALSE},
2922 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2923 {"http",S_OK,FALSE},
2924 {"",S_FALSE,FALSE},
2925 {"",S_FALSE,FALSE}
2928 {Uri_HOST_DNS,S_OK,FALSE},
2929 {80,S_OK,FALSE},
2930 {URL_SCHEME_HTTP,S_OK,FALSE},
2931 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2934 /* Unknown scheme types can have invalid % encoded data in fragments. */
2935 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2937 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2938 {"www.winehq.org",S_OK,FALSE},
2939 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2940 {"winehq.org",S_OK,FALSE},
2941 {"",S_FALSE,FALSE},
2942 {"#Te%xx",S_OK,FALSE},
2943 {"www.winehq.org",S_OK,FALSE},
2944 {"",S_FALSE,FALSE},
2945 {"/tests/",S_OK,FALSE},
2946 {"/tests/",S_OK,FALSE},
2947 {"",S_FALSE,FALSE},
2948 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2949 {"zip",S_OK,FALSE},
2950 {"",S_FALSE,FALSE},
2951 {"",S_FALSE,FALSE}
2954 {Uri_HOST_DNS,S_OK,FALSE},
2955 {0,S_FALSE,FALSE},
2956 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2957 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2960 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2961 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2963 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2964 {"www.winehq.org",S_OK,FALSE},
2965 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2966 {"winehq.org",S_OK,FALSE},
2967 {"",S_FALSE,FALSE},
2968 {"#Te<|>",S_OK,FALSE},
2969 {"www.winehq.org",S_OK,FALSE},
2970 {"",S_FALSE,FALSE},
2971 {"/tests/",S_OK,FALSE},
2972 {"/tests/",S_OK,FALSE},
2973 {"",S_FALSE,FALSE},
2974 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2975 {"zip",S_OK,FALSE},
2976 {"",S_FALSE,FALSE},
2977 {"",S_FALSE,FALSE}
2980 {Uri_HOST_DNS,S_OK,FALSE},
2981 {0,S_FALSE,FALSE},
2982 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2983 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2986 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2987 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2989 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2990 {"www.winehq.org",S_OK,FALSE},
2991 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2992 {"winehq.org",S_OK,FALSE},
2993 {"",S_FALSE,FALSE},
2994 {"#Te%3C%7C%3E",S_OK,FALSE},
2995 {"www.winehq.org",S_OK,FALSE},
2996 {"",S_FALSE,FALSE},
2997 {"/tests/",S_OK,FALSE},
2998 {"/tests/",S_OK,FALSE},
2999 {"",S_FALSE,FALSE},
3000 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3001 {"http",S_OK,FALSE},
3002 {"",S_FALSE,FALSE},
3003 {"",S_FALSE,FALSE}
3006 {Uri_HOST_DNS,S_OK,FALSE},
3007 {80,S_OK,FALSE},
3008 {URL_SCHEME_HTTP,S_OK,FALSE},
3009 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3012 /* Forbidden characters aren't encoded in the fragment with this flag. */
3013 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3015 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3016 {"www.winehq.org",S_OK,FALSE},
3017 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3018 {"winehq.org",S_OK,FALSE},
3019 {"",S_FALSE,FALSE},
3020 {"#Te<|>",S_OK,FALSE},
3021 {"www.winehq.org",S_OK,FALSE},
3022 {"",S_FALSE,FALSE},
3023 {"/tests/",S_OK,FALSE},
3024 {"/tests/",S_OK,FALSE},
3025 {"",S_FALSE,FALSE},
3026 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3027 {"http",S_OK,FALSE},
3028 {"",S_FALSE,FALSE},
3029 {"",S_FALSE,FALSE}
3032 {Uri_HOST_DNS,S_OK,FALSE},
3033 {80,S_OK,FALSE},
3034 {URL_SCHEME_HTTP,S_OK,FALSE},
3035 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3038 /* Forbidden characters aren't encoded in the fragment with this flag. */
3039 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3041 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3042 {"www.winehq.org",S_OK,FALSE},
3043 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3044 {"winehq.org",S_OK,FALSE},
3045 {"",S_FALSE,FALSE},
3046 {"#Te<|>",S_OK,FALSE},
3047 {"www.winehq.org",S_OK,FALSE},
3048 {"",S_FALSE,FALSE},
3049 {"/tests/",S_OK,FALSE},
3050 {"/tests/",S_OK,FALSE},
3051 {"",S_FALSE,FALSE},
3052 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3053 {"http",S_OK,FALSE},
3054 {"",S_FALSE,FALSE},
3055 {"",S_FALSE,FALSE}
3058 {Uri_HOST_DNS,S_OK,FALSE},
3059 {80,S_OK,FALSE},
3060 {URL_SCHEME_HTTP,S_OK,FALSE},
3061 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3064 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3065 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3067 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3068 {"www.winehq.org",S_OK,FALSE},
3069 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3070 {"winehq.org",S_OK,FALSE},
3071 {"",S_FALSE,FALSE},
3072 {"#Te%30%31%32",S_OK,FALSE},
3073 {"www.winehq.org",S_OK,FALSE},
3074 {"",S_FALSE,FALSE},
3075 {"/tests/",S_OK,FALSE},
3076 {"/tests/",S_OK,FALSE},
3077 {"",S_FALSE,FALSE},
3078 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3079 {"zip",S_OK,FALSE},
3080 {"",S_FALSE,FALSE},
3081 {"",S_FALSE,FALSE}
3084 {Uri_HOST_DNS,S_OK,FALSE},
3085 {0,S_FALSE,FALSE},
3086 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3087 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3090 /* Percent encoded, unreserved characters are decoded for known schemes. */
3091 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3093 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3094 {"www.winehq.org",S_OK,FALSE},
3095 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3096 {"winehq.org",S_OK,FALSE},
3097 {"",S_FALSE,FALSE},
3098 {"#Te012",S_OK,FALSE},
3099 {"www.winehq.org",S_OK,FALSE},
3100 {"",S_FALSE,FALSE},
3101 {"/tests/",S_OK,FALSE},
3102 {"/tests/",S_OK,FALSE},
3103 {"",S_FALSE,FALSE},
3104 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3105 {"http",S_OK,FALSE},
3106 {"",S_FALSE,FALSE},
3107 {"",S_FALSE,FALSE}
3110 {Uri_HOST_DNS,S_OK,FALSE},
3111 {80,S_OK,FALSE},
3112 {URL_SCHEME_HTTP,S_OK,FALSE},
3113 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3116 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3117 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3119 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3120 {"www.winehq.org",S_OK,FALSE},
3121 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3122 {"winehq.org",S_OK,FALSE},
3123 {"",S_FALSE,FALSE},
3124 {"#Te012",S_OK,FALSE},
3125 {"www.winehq.org",S_OK,FALSE},
3126 {"",S_FALSE,FALSE},
3127 {"/tests/",S_OK,FALSE},
3128 {"/tests/",S_OK,FALSE},
3129 {"",S_FALSE,FALSE},
3130 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3131 {"http",S_OK,FALSE},
3132 {"",S_FALSE,FALSE},
3133 {"",S_FALSE,FALSE}
3136 {Uri_HOST_DNS,S_OK,FALSE},
3137 {80,S_OK,FALSE},
3138 {URL_SCHEME_HTTP,S_OK,FALSE},
3139 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3142 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3143 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3145 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3146 {"www.winehq.org",S_OK,FALSE},
3147 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3148 {"winehq.org",S_OK,FALSE},
3149 {"",S_FALSE,FALSE},
3150 {"#Te%30%31%32",S_OK,FALSE},
3151 {"www.winehq.org",S_OK,FALSE},
3152 {"",S_FALSE,FALSE},
3153 {"/tests/",S_OK,FALSE},
3154 {"/tests/",S_OK,FALSE},
3155 {"",S_FALSE,FALSE},
3156 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3157 {"http",S_OK,FALSE},
3158 {"",S_FALSE,FALSE},
3159 {"",S_FALSE,FALSE}
3162 {Uri_HOST_DNS,S_OK,FALSE},
3163 {80,S_OK,FALSE},
3164 {URL_SCHEME_HTTP,S_OK,FALSE},
3165 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3168 /* Leading/Trailing whitespace is removed. */
3169 { " http://google.com/ ", 0, S_OK, FALSE,
3171 {"http://google.com/",S_OK,FALSE},
3172 {"google.com",S_OK,FALSE},
3173 {"http://google.com/",S_OK,FALSE},
3174 {"google.com",S_OK,FALSE},
3175 {"",S_FALSE,FALSE},
3176 {"",S_FALSE,FALSE},
3177 {"google.com",S_OK,FALSE},
3178 {"",S_FALSE,FALSE},
3179 {"/",S_OK,FALSE},
3180 {"/",S_OK,FALSE},
3181 {"",S_FALSE,FALSE},
3182 {"http://google.com/",S_OK,FALSE},
3183 {"http",S_OK,FALSE},
3184 {"",S_FALSE,FALSE},
3185 {"",S_FALSE,FALSE}
3188 {Uri_HOST_DNS,S_OK,FALSE},
3189 {80,S_OK,FALSE},
3190 {URL_SCHEME_HTTP,S_OK,FALSE},
3191 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3194 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3196 {"http://google.com/",S_OK,FALSE},
3197 {"google.com",S_OK,FALSE},
3198 {"http://google.com/",S_OK,FALSE},
3199 {"google.com",S_OK,FALSE},
3200 {"",S_FALSE,FALSE},
3201 {"",S_FALSE,FALSE},
3202 {"google.com",S_OK,FALSE},
3203 {"",S_FALSE,FALSE},
3204 {"/",S_OK,FALSE},
3205 {"/",S_OK,FALSE},
3206 {"",S_FALSE,FALSE},
3207 {"http://google.com/",S_OK,FALSE},
3208 {"http",S_OK,FALSE},
3209 {"",S_FALSE,FALSE},
3210 {"",S_FALSE,FALSE}
3213 {Uri_HOST_DNS,S_OK,FALSE},
3214 {80,S_OK,FALSE},
3215 {URL_SCHEME_HTTP,S_OK,FALSE},
3216 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3219 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3221 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3222 {"g%0aoogle.co%0dm",S_OK,FALSE},
3223 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3224 {"g%0aoogle.co%0dm",S_OK,FALSE},
3225 {"",S_FALSE,FALSE},
3226 {"",S_FALSE,FALSE},
3227 {"g%0aoogle.co%0dm",S_OK,FALSE},
3228 {"",S_FALSE,FALSE},
3229 {"/%0A%0A%0A",S_OK,FALSE},
3230 {"/%0A%0A%0A",S_OK,FALSE},
3231 {"",S_FALSE,FALSE},
3232 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3233 {"http",S_OK,FALSE},
3234 {"",S_FALSE,FALSE},
3235 {"",S_FALSE,FALSE}
3238 {Uri_HOST_DNS,S_OK,FALSE},
3239 {80,S_OK,FALSE},
3240 {URL_SCHEME_HTTP,S_OK,FALSE},
3241 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3244 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3246 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3247 {"g\noogle.co\rm",S_OK,FALSE},
3248 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3249 {"g\noogle.co\rm",S_OK,FALSE},
3250 {"",S_FALSE,FALSE},
3251 {"",S_FALSE,FALSE},
3252 {"g\noogle.co\rm",S_OK,FALSE},
3253 {"",S_FALSE,FALSE},
3254 {"/\n\n\n",S_OK,FALSE},
3255 {"/\n\n\n",S_OK,FALSE},
3256 {"",S_FALSE,FALSE},
3257 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3258 {"zip",S_OK,FALSE},
3259 {"",S_FALSE,FALSE},
3260 {"",S_FALSE,FALSE}
3263 {Uri_HOST_DNS,S_OK,FALSE},
3264 {0,S_FALSE,FALSE},
3265 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3266 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3269 /* Since file URLs are usually hierarchical, it returns an empty string
3270 * for the absolute URI property since it was declared as an opaque URI.
3272 { "file:index.html", 0, S_OK, FALSE,
3274 {"",S_FALSE,FALSE},
3275 {"",S_FALSE,FALSE},
3276 {"file:index.html",S_OK,FALSE},
3277 {"",S_FALSE,FALSE},
3278 {".html",S_OK,FALSE},
3279 {"",S_FALSE,FALSE},
3280 {"",S_FALSE,FALSE},
3281 {"",S_FALSE,FALSE},
3282 {"index.html",S_OK,FALSE},
3283 {"index.html",S_OK,FALSE},
3284 {"",S_FALSE,FALSE},
3285 {"file:index.html",S_OK,FALSE},
3286 {"file",S_OK,FALSE},
3287 {"",S_FALSE,FALSE},
3288 {"",S_FALSE,FALSE}
3291 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3292 {0,S_FALSE,FALSE},
3293 {URL_SCHEME_FILE,S_OK,FALSE},
3294 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3297 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3298 { "http:test.com/index.html", 0, S_OK, FALSE,
3300 {"",S_FALSE,FALSE},
3301 {"",S_FALSE,FALSE},
3302 {"http:test.com/index.html",S_OK,FALSE},
3303 {"",S_FALSE,FALSE},
3304 {".html",S_OK,FALSE},
3305 {"",S_FALSE,FALSE},
3306 {"",S_FALSE,FALSE},
3307 {"",S_FALSE,FALSE},
3308 {"test.com/index.html",S_OK,FALSE},
3309 {"test.com/index.html",S_OK,FALSE},
3310 {"",S_FALSE,FALSE},
3311 {"http:test.com/index.html",S_OK,FALSE},
3312 {"http",S_OK,FALSE},
3313 {"",S_FALSE,FALSE},
3314 {"",S_FALSE,FALSE}
3317 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3318 {80,S_OK,FALSE},
3319 {URL_SCHEME_HTTP,S_OK,FALSE},
3320 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3323 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3325 {"",S_FALSE,FALSE},
3326 {"",S_FALSE,FALSE},
3327 {"ftp:test.com/index.html",S_OK,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {".html",S_OK,FALSE},
3330 {"",S_FALSE,FALSE},
3331 {"",S_FALSE,FALSE},
3332 {"",S_FALSE,FALSE},
3333 {"test.com/index.html",S_OK,FALSE},
3334 {"test.com/index.html",S_OK,FALSE},
3335 {"",S_FALSE,FALSE},
3336 {"ftp:test.com/index.html",S_OK,FALSE},
3337 {"ftp",S_OK,FALSE},
3338 {"",S_FALSE,FALSE},
3339 {"",S_FALSE,FALSE}
3342 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3343 {21,S_OK,FALSE},
3344 {URL_SCHEME_FTP,S_OK,FALSE},
3345 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3348 { "file://C|/test.mp3", 0, S_OK, FALSE,
3350 {"file:///C:/test.mp3",S_OK,FALSE},
3351 {"",S_FALSE,FALSE},
3352 {"file:///C:/test.mp3",S_OK,FALSE},
3353 {"",S_FALSE,FALSE},
3354 {".mp3",S_OK,FALSE},
3355 {"",S_FALSE,FALSE},
3356 {"",S_FALSE,FALSE},
3357 {"",S_FALSE,FALSE},
3358 {"/C:/test.mp3",S_OK,FALSE},
3359 {"/C:/test.mp3",S_OK,FALSE},
3360 {"",S_FALSE,FALSE},
3361 {"file://C|/test.mp3",S_OK,FALSE},
3362 {"file",S_OK,FALSE},
3363 {"",S_FALSE,FALSE},
3364 {"",S_FALSE,FALSE}
3367 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3368 {0,S_FALSE,FALSE},
3369 {URL_SCHEME_FILE,S_OK,FALSE},
3370 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3373 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3375 {"file:///C:/test.mp3",S_OK,FALSE},
3376 {"",S_FALSE,FALSE},
3377 {"file:///C:/test.mp3",S_OK,FALSE},
3378 {"",S_FALSE,FALSE},
3379 {".mp3",S_OK,FALSE},
3380 {"",S_FALSE,FALSE},
3381 {"",S_FALSE,FALSE},
3382 {"",S_FALSE,FALSE},
3383 {"/C:/test.mp3",S_OK,FALSE},
3384 {"/C:/test.mp3",S_OK,FALSE},
3385 {"",S_FALSE,FALSE},
3386 {"file:///C|/test.mp3",S_OK,FALSE},
3387 {"file",S_OK,FALSE},
3388 {"",S_FALSE,FALSE},
3389 {"",S_FALSE,FALSE}
3392 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3393 {0,S_FALSE,FALSE},
3394 {URL_SCHEME_FILE,S_OK,FALSE},
3395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3398 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3399 * to '\\'.
3401 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3403 {"file://c:\\dir\\index.html",S_OK,FALSE},
3404 {"",S_FALSE,FALSE},
3405 {"file://c:\\dir\\index.html",S_OK,FALSE},
3406 {"",S_FALSE,FALSE},
3407 {".html",S_OK,FALSE},
3408 {"",S_FALSE,FALSE},
3409 {"",S_FALSE,FALSE},
3410 {"",S_FALSE,FALSE},
3411 {"c:\\dir\\index.html",S_OK,FALSE},
3412 {"c:\\dir\\index.html",S_OK,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {"file://c:/dir/index.html",S_OK,FALSE},
3415 {"file",S_OK,FALSE},
3416 {"",S_FALSE,FALSE},
3417 {"",S_FALSE,FALSE}
3420 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3421 {0,S_FALSE,FALSE},
3422 {URL_SCHEME_FILE,S_OK,FALSE},
3423 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3426 /* Extra '/' after "file://" is removed. */
3427 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3429 {"file://c:\\dir\\index.html",S_OK,FALSE},
3430 {"",S_FALSE,FALSE},
3431 {"file://c:\\dir\\index.html",S_OK,FALSE},
3432 {"",S_FALSE,FALSE},
3433 {".html",S_OK,FALSE},
3434 {"",S_FALSE,FALSE},
3435 {"",S_FALSE,FALSE},
3436 {"",S_FALSE,FALSE},
3437 {"c:\\dir\\index.html",S_OK,FALSE},
3438 {"c:\\dir\\index.html",S_OK,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {"file:///c:/dir/index.html",S_OK,FALSE},
3441 {"file",S_OK,FALSE},
3442 {"",S_FALSE,FALSE},
3443 {"",S_FALSE,FALSE}
3446 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3447 {0,S_FALSE,FALSE},
3448 {URL_SCHEME_FILE,S_OK,FALSE},
3449 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3452 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3453 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3455 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3456 {"",S_FALSE,FALSE},
3457 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3458 {"",S_FALSE,FALSE},
3459 {".html",S_OK,FALSE},
3460 {"",S_FALSE,FALSE},
3461 {"",S_FALSE,FALSE},
3462 {"",S_FALSE,FALSE},
3463 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3464 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3465 {"",S_FALSE,FALSE},
3466 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3467 {"file",S_OK,FALSE},
3468 {"",S_FALSE,FALSE},
3469 {"",S_FALSE,FALSE}
3472 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3473 {0,S_FALSE,FALSE},
3474 {URL_SCHEME_FILE,S_OK,FALSE},
3475 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3478 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3480 {"file://c:\\dir\\index.html",S_OK,FALSE},
3481 {"",S_FALSE,FALSE},
3482 {"file://c:\\dir\\index.html",S_OK,FALSE},
3483 {"",S_FALSE,FALSE},
3484 {".html",S_OK,FALSE},
3485 {"",S_FALSE,FALSE},
3486 {"",S_FALSE,FALSE},
3487 {"",S_FALSE,FALSE},
3488 {"c:\\dir\\index.html",S_OK,FALSE},
3489 {"c:\\dir\\index.html",S_OK,FALSE},
3490 {"",S_FALSE,FALSE},
3491 {"file://c|/dir\\index.html",S_OK,FALSE},
3492 {"file",S_OK,FALSE},
3493 {"",S_FALSE,FALSE},
3494 {"",S_FALSE,FALSE}
3497 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3498 {0,S_FALSE,FALSE},
3499 {URL_SCHEME_FILE,S_OK,FALSE},
3500 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3503 /* The backslashes after the scheme name are converted to forward slashes. */
3504 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3506 {"file://c:\\dir\\index.html",S_OK,FALSE},
3507 {"",S_FALSE,FALSE},
3508 {"file://c:\\dir\\index.html",S_OK,FALSE},
3509 {"",S_FALSE,FALSE},
3510 {".html",S_OK,FALSE},
3511 {"",S_FALSE,FALSE},
3512 {"",S_FALSE,FALSE},
3513 {"",S_FALSE,FALSE},
3514 {"c:\\dir\\index.html",S_OK,FALSE},
3515 {"c:\\dir\\index.html",S_OK,FALSE},
3516 {"",S_FALSE,FALSE},
3517 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3518 {"file",S_OK,FALSE},
3519 {"",S_FALSE,FALSE},
3520 {"",S_FALSE,FALSE}
3523 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3524 {0,S_FALSE,FALSE},
3525 {URL_SCHEME_FILE,S_OK,FALSE},
3526 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3529 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3531 {"file:///c:/dir/index.html",S_OK,FALSE},
3532 {"",S_FALSE,FALSE},
3533 {"file:///c:/dir/index.html",S_OK,FALSE},
3534 {"",S_FALSE,FALSE},
3535 {".html",S_OK,FALSE},
3536 {"",S_FALSE,FALSE},
3537 {"",S_FALSE,FALSE},
3538 {"",S_FALSE,FALSE},
3539 {"/c:/dir/index.html",S_OK,FALSE},
3540 {"/c:/dir/index.html",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3543 {"file",S_OK,FALSE},
3544 {"",S_FALSE,FALSE},
3545 {"",S_FALSE,FALSE}
3548 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3549 {0,S_FALSE,FALSE},
3550 {URL_SCHEME_FILE,S_OK,FALSE},
3551 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3554 { "http:\\\\google.com", 0, S_OK, FALSE,
3556 {"http://google.com/",S_OK,FALSE},
3557 {"google.com",S_OK,FALSE},
3558 {"http://google.com/",S_OK,FALSE},
3559 {"google.com",S_OK,FALSE},
3560 {"",S_FALSE,FALSE},
3561 {"",S_FALSE,FALSE},
3562 {"google.com",S_OK,FALSE},
3563 {"",S_FALSE,FALSE},
3564 {"/",S_OK,FALSE},
3565 {"/",S_OK,FALSE},
3566 {"",S_FALSE,FALSE},
3567 {"http:\\\\google.com",S_OK,FALSE},
3568 {"http",S_OK,FALSE},
3569 {"",S_FALSE,FALSE},
3570 {"",S_FALSE,FALSE}
3573 {Uri_HOST_DNS,S_OK,FALSE},
3574 {80,S_OK,FALSE},
3575 {URL_SCHEME_HTTP,S_OK,FALSE},
3576 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3579 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3580 { "zip:\\\\google.com", 0, S_OK, FALSE,
3582 {"zip:\\\\google.com",S_OK,FALSE},
3583 {"",S_FALSE,FALSE},
3584 {"zip:\\\\google.com",S_OK,FALSE},
3585 {"",S_FALSE,FALSE},
3586 {".com",S_OK,FALSE},
3587 {"",S_FALSE,FALSE},
3588 {"",S_FALSE,FALSE},
3589 {"",S_FALSE,FALSE},
3590 {"\\\\google.com",S_OK,FALSE},
3591 {"\\\\google.com",S_OK,FALSE},
3592 {"",S_FALSE,FALSE},
3593 {"zip:\\\\google.com",S_OK,FALSE},
3594 {"zip",S_OK,FALSE},
3595 {"",S_FALSE,FALSE},
3596 {"",S_FALSE,FALSE}
3599 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3600 {0,S_FALSE,FALSE},
3601 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3602 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3605 /* Dot segments aren't removed. */
3606 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3608 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3609 {"",S_FALSE,FALSE},
3610 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3611 {"",S_FALSE,FALSE},
3612 {".html",S_OK,FALSE},
3613 {"",S_FALSE,FALSE},
3614 {"",S_FALSE,FALSE},
3615 {"",S_FALSE,FALSE},
3616 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3617 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3618 {"",S_FALSE,FALSE},
3619 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3620 {"file",S_OK,FALSE},
3621 {"",S_FALSE,FALSE},
3622 {"",S_FALSE,FALSE}
3625 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3626 {0,S_FALSE,FALSE},
3627 {URL_SCHEME_FILE,S_OK,FALSE},
3628 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3631 /* Forbidden characters aren't percent encoded. */
3632 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3634 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3635 {"",S_FALSE,FALSE},
3636 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3637 {"",S_FALSE,FALSE},
3638 {".html",S_OK,FALSE},
3639 {"",S_FALSE,FALSE},
3640 {"",S_FALSE,FALSE},
3641 {"",S_FALSE,FALSE},
3642 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3643 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3644 {"",S_FALSE,FALSE},
3645 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3646 {"file",S_OK,FALSE},
3647 {"",S_FALSE,FALSE},
3648 {"",S_FALSE,FALSE}
3651 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3652 {0,S_FALSE,FALSE},
3653 {URL_SCHEME_FILE,S_OK,FALSE},
3654 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3657 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3658 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3660 {"",S_FALSE,FALSE},
3661 {"",S_FALSE,FALSE},
3662 {"file:c:/dir/../../index.html",S_OK,FALSE},
3663 {"",S_FALSE,FALSE},
3664 {".html",S_OK,FALSE},
3665 {"",S_FALSE,FALSE},
3666 {"",S_FALSE,FALSE},
3667 {"",S_FALSE,FALSE},
3668 {"c:/dir/../../index.html",S_OK,FALSE},
3669 {"c:/dir/../../index.html",S_OK,FALSE},
3670 {"",S_FALSE,FALSE},
3671 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3672 {"file",S_OK,FALSE},
3673 {"",S_FALSE,FALSE},
3674 {"",S_FALSE,FALSE}
3677 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3678 {0,S_FALSE,FALSE},
3679 {URL_SCHEME_FILE,S_OK,FALSE},
3680 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3683 /* '/' are still converted to '\' even though it's an opaque URI. */
3684 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3686 {"",S_FALSE,FALSE},
3687 {"",S_FALSE,FALSE},
3688 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3689 {"",S_FALSE,FALSE},
3690 {".html",S_OK,FALSE},
3691 {"",S_FALSE,FALSE},
3692 {"",S_FALSE,FALSE},
3693 {"",S_FALSE,FALSE},
3694 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3695 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3696 {"",S_FALSE,FALSE},
3697 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3698 {"file",S_OK,FALSE},
3699 {"",S_FALSE,FALSE},
3700 {"",S_FALSE,FALSE}
3703 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3704 {0,S_FALSE,FALSE},
3705 {URL_SCHEME_FILE,S_OK,FALSE},
3706 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3709 /* Forbidden characters aren't percent encoded. */
3710 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3712 {"",S_FALSE,FALSE},
3713 {"",S_FALSE,FALSE},
3714 {"file:c:\\in^|dex.html",S_OK,FALSE},
3715 {"",S_FALSE,FALSE},
3716 {".html",S_OK,FALSE},
3717 {"",S_FALSE,FALSE},
3718 {"",S_FALSE,FALSE},
3719 {"",S_FALSE,FALSE},
3720 {"c:\\in^|dex.html",S_OK,FALSE},
3721 {"c:\\in^|dex.html",S_OK,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {"file:c:\\in^|dex.html",S_OK,FALSE},
3724 {"file",S_OK,FALSE},
3725 {"",S_FALSE,FALSE},
3726 {"",S_FALSE,FALSE}
3729 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3730 {0,S_FALSE,FALSE},
3731 {URL_SCHEME_FILE,S_OK,FALSE},
3732 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3735 /* Doesn't have a UserName since the ':' appears at the beginning of the
3736 * userinfo section.
3738 { "http://:password@gov.uk", 0, S_OK, FALSE,
3740 {"http://:password@gov.uk/",S_OK,FALSE},
3741 {":password@gov.uk",S_OK,FALSE},
3742 {"http://gov.uk/",S_OK,FALSE},
3743 {"",S_FALSE,FALSE},
3744 {"",S_FALSE,FALSE},
3745 {"",S_FALSE,FALSE},
3746 {"gov.uk",S_OK,FALSE},
3747 {"password",S_OK,FALSE},
3748 {"/",S_OK,FALSE},
3749 {"/",S_OK,FALSE},
3750 {"",S_FALSE,FALSE},
3751 {"http://:password@gov.uk",S_OK,FALSE},
3752 {"http",S_OK,FALSE},
3753 {":password",S_OK,FALSE},
3754 {"",S_FALSE,FALSE}
3757 {Uri_HOST_DNS,S_OK,FALSE},
3758 {80,S_OK,FALSE},
3759 {URL_SCHEME_HTTP,S_OK,FALSE},
3760 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3763 /* Has a UserName since the userinfo section doesn't contain a password. */
3764 { "http://@gov.uk", 0, S_OK, FALSE,
3766 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3767 {"@gov.uk",S_OK,FALSE},
3768 {"http://gov.uk/",S_OK,FALSE},
3769 {"",S_FALSE,FALSE},
3770 {"",S_FALSE,FALSE},
3771 {"",S_FALSE,FALSE},
3772 {"gov.uk",S_OK,FALSE},
3773 {"",S_FALSE,FALSE},
3774 {"/",S_OK,FALSE},
3775 {"/",S_OK,FALSE},
3776 {"",S_FALSE,FALSE},
3777 {"http://@gov.uk",S_OK,FALSE},
3778 {"http",S_OK,FALSE},
3779 {"",S_OK,FALSE},
3780 {"",S_OK,FALSE}
3783 {Uri_HOST_DNS,S_OK,FALSE},
3784 {80,S_OK,FALSE},
3785 {URL_SCHEME_HTTP,S_OK,FALSE},
3786 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3789 /* ":@" not included in the absolute URI. */
3790 { "http://:@gov.uk", 0, S_OK, FALSE,
3792 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3793 {":@gov.uk",S_OK,FALSE},
3794 {"http://gov.uk/",S_OK,FALSE},
3795 {"",S_FALSE,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {"",S_FALSE,FALSE},
3798 {"gov.uk",S_OK,FALSE},
3799 {"",S_OK,FALSE},
3800 {"/",S_OK,FALSE},
3801 {"/",S_OK,FALSE},
3802 {"",S_FALSE,FALSE},
3803 {"http://:@gov.uk",S_OK,FALSE},
3804 {"http",S_OK,FALSE},
3805 {":",S_OK,FALSE},
3806 {"",S_FALSE,FALSE}
3809 {Uri_HOST_DNS,S_OK,FALSE},
3810 {80,S_OK,FALSE},
3811 {URL_SCHEME_HTTP,S_OK,FALSE},
3812 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3815 /* '@' is included because it's an unknown scheme type. */
3816 { "zip://@gov.uk", 0, S_OK, FALSE,
3818 {"zip://@gov.uk/",S_OK,FALSE},
3819 {"@gov.uk",S_OK,FALSE},
3820 {"zip://@gov.uk/",S_OK,FALSE},
3821 {"",S_FALSE,FALSE},
3822 {"",S_FALSE,FALSE},
3823 {"",S_FALSE,FALSE},
3824 {"gov.uk",S_OK,FALSE},
3825 {"",S_FALSE,FALSE},
3826 {"/",S_OK,FALSE},
3827 {"/",S_OK,FALSE},
3828 {"",S_FALSE,FALSE},
3829 {"zip://@gov.uk",S_OK,FALSE},
3830 {"zip",S_OK,FALSE},
3831 {"",S_OK,FALSE},
3832 {"",S_OK,FALSE}
3835 {Uri_HOST_DNS,S_OK,FALSE},
3836 {0,S_FALSE,FALSE},
3837 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3838 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3841 /* ":@" are included because it's an unknown scheme type. */
3842 { "zip://:@gov.uk", 0, S_OK, FALSE,
3844 {"zip://:@gov.uk/",S_OK,FALSE},
3845 {":@gov.uk",S_OK,FALSE},
3846 {"zip://:@gov.uk/",S_OK,FALSE},
3847 {"",S_FALSE,FALSE},
3848 {"",S_FALSE,FALSE},
3849 {"",S_FALSE,FALSE},
3850 {"gov.uk",S_OK,FALSE},
3851 {"",S_OK,FALSE},
3852 {"/",S_OK,FALSE},
3853 {"/",S_OK,FALSE},
3854 {"",S_FALSE,FALSE},
3855 {"zip://:@gov.uk",S_OK,FALSE},
3856 {"zip",S_OK,FALSE},
3857 {":",S_OK,FALSE},
3858 {"",S_FALSE,FALSE}
3861 {Uri_HOST_DNS,S_OK,FALSE},
3862 {0,S_FALSE,FALSE},
3863 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3864 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3867 { "about:blank", 0, S_OK, FALSE,
3869 {"about:blank",S_OK,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"about:blank",S_OK,FALSE},
3872 {"",S_FALSE,FALSE},
3873 {"",S_FALSE,FALSE},
3874 {"",S_FALSE,FALSE},
3875 {"",S_FALSE,FALSE},
3876 {"",S_FALSE,FALSE},
3877 {"blank",S_OK,FALSE},
3878 {"blank",S_OK,FALSE},
3879 {"",S_FALSE,FALSE},
3880 {"about:blank",S_OK,FALSE},
3881 {"about",S_OK,FALSE},
3882 {"",S_FALSE,FALSE},
3883 {"",S_FALSE,FALSE}
3886 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3887 {0,S_FALSE,FALSE},
3888 {URL_SCHEME_ABOUT,S_OK,FALSE},
3889 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3892 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3894 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3895 {"",S_FALSE,FALSE},
3896 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3897 {"",S_FALSE,FALSE},
3898 {".htm",S_OK,FALSE},
3899 {"",S_FALSE,FALSE},
3900 {"",S_FALSE,FALSE},
3901 {"",S_FALSE,FALSE},
3902 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3903 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3904 {"",S_FALSE,FALSE},
3905 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3906 {"mk",S_OK,FALSE},
3907 {"",S_FALSE,FALSE},
3908 {"",S_FALSE,FALSE}
3911 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3912 {0,S_FALSE,FALSE},
3913 {URL_SCHEME_MK,S_OK,FALSE},
3914 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3917 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3919 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3920 {"",S_FALSE,FALSE},
3921 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3922 {"",S_FALSE,FALSE},
3923 {".htm",S_OK,FALSE},
3924 {"",S_FALSE,FALSE},
3925 {"",S_FALSE,FALSE},
3926 {"",S_FALSE,FALSE},
3927 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3928 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3931 {"mk",S_OK,FALSE},
3932 {"",S_FALSE,FALSE},
3933 {"",S_FALSE,FALSE}
3936 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3937 {0,S_FALSE,FALSE},
3938 {URL_SCHEME_MK,S_OK,FALSE},
3939 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3942 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3943 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3945 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3946 {"server",S_OK,FALSE},
3947 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3948 {"",S_FALSE,FALSE},
3949 {".html",S_OK,FALSE},
3950 {"",S_FALSE,FALSE},
3951 {"server",S_OK,FALSE},
3952 {"",S_FALSE,FALSE},
3953 {"\\dir\\index.html",S_OK,FALSE},
3954 {"\\dir\\index.html",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"file://server/dir/index.html",S_OK,FALSE},
3957 {"file",S_OK,FALSE},
3958 {"",S_FALSE,FALSE},
3959 {"",S_FALSE,FALSE}
3962 {Uri_HOST_DNS,S_OK,FALSE},
3963 {0,S_FALSE,FALSE},
3964 {URL_SCHEME_FILE,S_OK,FALSE},
3965 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3968 /* When CreateUri generates an IUri, it still displays the default port in the
3969 * authority.
3971 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3973 {"http://google.com:80/",S_OK,FALSE},
3974 {"google.com:80",S_OK,FALSE},
3975 {"http://google.com:80/",S_OK,FALSE},
3976 {"google.com",S_OK,FALSE},
3977 {"",S_FALSE,FALSE},
3978 {"",S_FALSE,FALSE},
3979 {"google.com",S_OK,FALSE},
3980 {"",S_FALSE,FALSE},
3981 {"/",S_OK,FALSE},
3982 {"/",S_OK,FALSE},
3983 {"",S_FALSE,FALSE},
3984 {"http://google.com:80/",S_OK,FALSE},
3985 {"http",S_OK,FALSE},
3986 {"",S_FALSE,FALSE},
3987 {"",S_FALSE,FALSE}
3990 {Uri_HOST_DNS,S_OK,FALSE},
3991 {80,S_OK,FALSE},
3992 {URL_SCHEME_HTTP,S_OK,FALSE},
3993 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3996 /* For res URIs the host is everything up until the first '/'. */
3997 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3999 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4000 {"C:\\dir\\file.exe",S_OK,FALSE},
4001 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4002 {"",S_FALSE,FALSE},
4003 {".html",S_OK,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {"C:\\dir\\file.exe",S_OK,FALSE},
4006 {"",S_FALSE,FALSE},
4007 {"/DATA/test.html",S_OK,FALSE},
4008 {"/DATA/test.html",S_OK,FALSE},
4009 {"",S_FALSE,FALSE},
4010 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
4011 {"res",S_OK,FALSE},
4012 {"",S_FALSE,FALSE},
4013 {"",S_FALSE,FALSE}
4016 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4017 {0,S_FALSE,FALSE},
4018 {URL_SCHEME_RES,S_OK,FALSE},
4019 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4022 /* Res URI can contain a '|' in the host name. */
4023 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4025 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4026 {"c:\\di|r\\file.exe",S_OK,FALSE},
4027 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4028 {"",S_FALSE,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"",S_FALSE,FALSE},
4031 {"c:\\di|r\\file.exe",S_OK,FALSE},
4032 {"",S_FALSE,FALSE},
4033 {"/test",S_OK,FALSE},
4034 {"/test",S_OK,FALSE},
4035 {"",S_FALSE,FALSE},
4036 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4037 {"res",S_OK,FALSE},
4038 {"",S_FALSE,FALSE},
4039 {"",S_FALSE,FALSE}
4042 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4043 {0,S_FALSE,FALSE},
4044 {URL_SCHEME_RES,S_OK,FALSE},
4045 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4048 /* Res URIs can have invalid percent encoded values. */
4049 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4051 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4052 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4053 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4054 {"",S_FALSE,FALSE},
4055 {"",S_FALSE,FALSE},
4056 {"",S_FALSE,FALSE},
4057 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4058 {"",S_FALSE,FALSE},
4059 {"/test",S_OK,FALSE},
4060 {"/test",S_OK,FALSE},
4061 {"",S_FALSE,FALSE},
4062 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4063 {"res",S_OK,FALSE},
4064 {"",S_FALSE,FALSE},
4065 {"",S_FALSE,FALSE}
4068 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4069 {0,S_FALSE,FALSE},
4070 {URL_SCHEME_RES,S_OK,FALSE},
4071 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4074 /* Res doesn't get forbidden characters percent encoded in its path. */
4075 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4077 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4078 {"c:\\test",S_OK,FALSE},
4079 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4080 {"",S_FALSE,FALSE},
4081 {"",S_FALSE,FALSE},
4082 {"",S_FALSE,FALSE},
4083 {"c:\\test",S_OK,FALSE},
4084 {"",S_FALSE,FALSE},
4085 {"/tes<|>t",S_OK,FALSE},
4086 {"/tes<|>t",S_OK,FALSE},
4087 {"",S_FALSE,FALSE},
4088 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4089 {"res",S_OK,FALSE},
4090 {"",S_FALSE,FALSE},
4091 {"",S_FALSE,FALSE}
4094 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4095 {0,S_FALSE,FALSE},
4096 {URL_SCHEME_RES,S_OK,FALSE},
4097 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4100 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4102 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4103 {"",S_FALSE,FALSE},
4104 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4105 {"",S_FALSE,FALSE},
4106 {".jpg",S_OK,FALSE},
4107 {"",S_FALSE,FALSE},
4108 {"",S_FALSE,FALSE},
4109 {"",S_FALSE,FALSE},
4110 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4111 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4112 {"",S_FALSE,FALSE},
4113 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4114 {"mk",S_OK,FALSE},
4115 {"",S_FALSE,FALSE},
4116 {"",S_FALSE,FALSE}
4119 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4120 {0,S_FALSE,FALSE},
4121 {URL_SCHEME_MK,S_OK,FALSE},
4122 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4125 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4127 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4128 {"",S_FALSE,FALSE},
4129 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4130 {"",S_FALSE,FALSE},
4131 {".jpg",S_OK,FALSE},
4132 {"",S_FALSE,FALSE},
4133 {"",S_FALSE,FALSE},
4134 {"",S_FALSE,FALSE},
4135 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4136 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4137 {"",S_FALSE,FALSE},
4138 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4139 {"mk",S_OK,FALSE},
4140 {"",S_FALSE,FALSE},
4141 {"",S_FALSE,FALSE}
4144 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4145 {0,S_FALSE,FALSE},
4146 {URL_SCHEME_MK,S_OK,FALSE},
4147 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4150 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4152 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4153 {"",S_FALSE,FALSE},
4154 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4155 {"",S_FALSE,FALSE},
4156 {".jpg",S_OK,FALSE},
4157 {"",S_FALSE,FALSE},
4158 {"",S_FALSE,FALSE},
4159 {"",S_FALSE,FALSE},
4160 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4161 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4164 {"xx",S_OK,FALSE},
4165 {"",S_FALSE,FALSE},
4166 {"",S_FALSE,FALSE}
4169 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4170 {0,S_FALSE,FALSE},
4171 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4172 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4175 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4177 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4178 {"",S_FALSE,FALSE},
4179 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4180 {"",S_FALSE,FALSE},
4181 {".jpg",S_OK,FALSE},
4182 {"",S_FALSE,FALSE},
4183 {"",S_FALSE,FALSE},
4184 {"",S_FALSE,FALSE},
4185 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4186 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4187 {"",S_FALSE,FALSE},
4188 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4189 {"mk",S_OK,FALSE},
4190 {"",S_FALSE,FALSE},
4191 {"",S_FALSE,FALSE}
4194 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4195 {0,S_FALSE,FALSE},
4196 {URL_SCHEME_MK,S_OK,FALSE},
4197 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4200 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4202 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4203 {"",S_FALSE,FALSE},
4204 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4205 {"",S_FALSE,FALSE},
4206 {".jpg",S_OK,FALSE},
4207 {"",S_FALSE,FALSE},
4208 {"",S_FALSE,FALSE},
4209 {"",S_FALSE,FALSE},
4210 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4211 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4212 {"",S_FALSE,FALSE},
4213 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4214 {"mk",S_OK,FALSE},
4215 {"",S_FALSE,FALSE},
4216 {"",S_FALSE,FALSE}
4219 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4220 {0,S_FALSE,FALSE},
4221 {URL_SCHEME_MK,S_OK,FALSE},
4222 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4225 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4227 {"mk:images/xxx.jpg",S_OK,FALSE},
4228 {"",S_FALSE,FALSE},
4229 {"mk:images/xxx.jpg",S_OK,FALSE},
4230 {"",S_FALSE,FALSE},
4231 {".jpg",S_OK,FALSE},
4232 {"",S_FALSE,FALSE},
4233 {"",S_FALSE,FALSE},
4234 {"",S_FALSE,FALSE},
4235 {"images/xxx.jpg",S_OK,FALSE},
4236 {"images/xxx.jpg",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4239 {"mk",S_OK,FALSE},
4240 {"",S_FALSE,FALSE},
4241 {"",S_FALSE,FALSE}
4244 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4245 {0,S_FALSE,FALSE},
4246 {URL_SCHEME_MK,S_OK,FALSE},
4247 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4250 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4252 {"",S_OK,FALSE},
4253 {"",S_FALSE,FALSE},
4254 {"",S_OK,FALSE},
4255 {"",S_FALSE,FALSE},
4256 {"",S_FALSE,FALSE},
4257 {"",S_FALSE,FALSE},
4258 {"",S_FALSE,FALSE},
4259 {"",S_FALSE,FALSE},
4260 {"",S_OK,FALSE},
4261 {"",S_OK,FALSE},
4262 {"",S_FALSE,FALSE},
4263 {"",S_OK,FALSE},
4264 {"",S_FALSE,FALSE},
4265 {"",S_FALSE,FALSE},
4266 {"",S_FALSE,FALSE}
4269 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4270 {0,S_FALSE,FALSE},
4271 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4272 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4275 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4277 {"",S_OK,FALSE},
4278 {"",S_FALSE,FALSE},
4279 {"",S_OK,FALSE},
4280 {"",S_FALSE,FALSE},
4281 {"",S_FALSE,FALSE},
4282 {"",S_FALSE,FALSE},
4283 {"",S_FALSE,FALSE},
4284 {"",S_FALSE,FALSE},
4285 {"",S_OK,FALSE},
4286 {"",S_OK,FALSE},
4287 {"",S_FALSE,FALSE},
4288 {"",S_OK,FALSE},
4289 {"",S_FALSE,FALSE},
4290 {"",S_FALSE,FALSE},
4291 {"",S_FALSE,FALSE}
4294 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4295 {0,S_FALSE,FALSE},
4296 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4297 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4300 { "javascript:void", 0, S_OK, FALSE,
4302 {"javascript:void",S_OK},
4303 {"",S_FALSE},
4304 {"javascript:void",S_OK},
4305 {"",S_FALSE},
4306 {"",S_FALSE},
4307 {"",S_FALSE},
4308 {"",S_FALSE},
4309 {"",S_FALSE},
4310 {"void",S_OK},
4311 {"void",S_OK},
4312 {"",S_FALSE},
4313 {"javascript:void",S_OK},
4314 {"javascript",S_OK},
4315 {"",S_FALSE},
4316 {"",S_FALSE}
4319 {Uri_HOST_UNKNOWN,S_OK},
4320 {0,S_FALSE},
4321 {URL_SCHEME_JAVASCRIPT,S_OK},
4322 {URLZONE_INVALID,E_NOTIMPL}
4325 { "javascript://undefined", 0, S_OK, FALSE,
4327 {"javascript://undefined",S_OK},
4328 {"",S_FALSE},
4329 {"javascript://undefined",S_OK},
4330 {"",S_FALSE},
4331 {"",S_FALSE},
4332 {"",S_FALSE},
4333 {"",S_FALSE},
4334 {"",S_FALSE},
4335 {"//undefined",S_OK},
4336 {"//undefined",S_OK},
4337 {"",S_FALSE},
4338 {"javascript://undefined",S_OK},
4339 {"javascript",S_OK},
4340 {"",S_FALSE},
4341 {"",S_FALSE}
4344 {Uri_HOST_UNKNOWN,S_OK},
4345 {0,S_FALSE},
4346 {URL_SCHEME_JAVASCRIPT,S_OK},
4347 {URLZONE_INVALID,E_NOTIMPL}
4350 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4352 {"javascript:escape('/\\?#?')",S_OK},
4353 {"",S_FALSE},
4354 {"javascript:escape('/\\?#?')",S_OK},
4355 {"",S_FALSE},
4356 {"",S_FALSE},
4357 {"",S_FALSE},
4358 {"",S_FALSE},
4359 {"",S_FALSE},
4360 {"escape('/\\?#?')",S_OK},
4361 {"escape('/\\?#?')",S_OK},
4362 {"",S_FALSE},
4363 {"JavaSCript:escape('/\\?#?')",S_OK},
4364 {"javascript",S_OK},
4365 {"",S_FALSE},
4366 {"",S_FALSE}
4369 {Uri_HOST_UNKNOWN,S_OK},
4370 {0,S_FALSE},
4371 {URL_SCHEME_JAVASCRIPT,S_OK},
4372 {URLZONE_INVALID,E_NOTIMPL}
4375 { "*://google.com", 0, S_OK, FALSE,
4377 {"*:google.com/",S_OK,FALSE},
4378 {"google.com",S_OK},
4379 {"*:google.com/",S_OK,FALSE},
4380 {"google.com",S_OK,FALSE},
4381 {"",S_FALSE,FALSE},
4382 {"",S_FALSE,FALSE},
4383 {"google.com",S_OK,FALSE},
4384 {"",S_FALSE,FALSE},
4385 {"/",S_OK,FALSE},
4386 {"/",S_OK,FALSE},
4387 {"",S_FALSE,FALSE},
4388 {"*://google.com",S_OK,FALSE},
4389 {"*",S_OK,FALSE},
4390 {"",S_FALSE,FALSE},
4391 {"",S_FALSE,FALSE}
4394 {Uri_HOST_DNS,S_OK,FALSE},
4395 {0,S_FALSE,FALSE},
4396 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4397 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4400 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4402 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4403 {"",S_FALSE},
4404 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4405 {"",S_FALSE},
4406 {".txt",S_OK},
4407 {"",S_FALSE},
4408 {"",S_FALSE},
4409 {"",S_FALSE},
4410 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4411 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4412 {"",S_FALSE},
4413 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4414 {"mk",S_OK},
4415 {"",S_FALSE},
4416 {"",S_FALSE}
4419 {Uri_HOST_UNKNOWN,S_OK},
4420 {0,S_FALSE},
4421 {URL_SCHEME_MK,S_OK},
4422 {URLZONE_INVALID,E_NOTIMPL}
4425 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4427 {"gopher://test.winehq.org:151/file.txt",S_OK},
4428 {"test.winehq.org:151",S_OK},
4429 {"gopher://test.winehq.org:151/file.txt",S_OK},
4430 {"winehq.org",S_OK},
4431 {".txt",S_OK},
4432 {"",S_FALSE},
4433 {"test.winehq.org",S_OK},
4434 {"",S_FALSE},
4435 {"/file.txt",S_OK},
4436 {"/file.txt",S_OK},
4437 {"",S_FALSE},
4438 {"gopher://test.winehq.org:151/file.txt",S_OK},
4439 {"gopher",S_OK},
4440 {"",S_FALSE},
4441 {"",S_FALSE}
4444 {Uri_HOST_DNS,S_OK},
4445 {151,S_OK},
4446 {URL_SCHEME_GOPHER,S_OK},
4447 {URLZONE_INVALID,E_NOTIMPL}
4450 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4452 {"//host.com/path/file.txt?query",S_OK},
4453 {"host.com",S_OK},
4454 {"//host.com/path/file.txt?query",S_OK},
4455 {"host.com",S_OK},
4456 {".txt",S_OK},
4457 {"",S_FALSE},
4458 {"host.com",S_OK},
4459 {"",S_FALSE},
4460 {"/path/file.txt",S_OK},
4461 {"/path/file.txt?query",S_OK},
4462 {"?query",S_OK},
4463 {"//host.com/path/file.txt?query",S_OK},
4464 {"",S_FALSE},
4465 {"",S_FALSE},
4466 {"",S_FALSE},
4469 {Uri_HOST_DNS,S_OK},
4470 {0,S_FALSE},
4471 {URL_SCHEME_UNKNOWN,S_OK},
4472 {URLZONE_INVALID,E_NOTIMPL}
4475 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4477 {"//host/path/file.txt?query",S_OK},
4478 {"host",S_OK},
4479 {"//host/path/file.txt?query",S_OK},
4480 {"",S_FALSE},
4481 {".txt",S_OK},
4482 {"",S_FALSE},
4483 {"host",S_OK},
4484 {"",S_FALSE},
4485 {"/path/file.txt",S_OK},
4486 {"/path/file.txt?query",S_OK},
4487 {"?query",S_OK},
4488 {"//host/path/file.txt?query",S_OK},
4489 {"",S_FALSE},
4490 {"",S_FALSE},
4491 {"",S_FALSE},
4494 {Uri_HOST_DNS,S_OK},
4495 {0,S_FALSE},
4496 {URL_SCHEME_UNKNOWN,S_OK},
4497 {URLZONE_INVALID,E_NOTIMPL}
4500 { "//host", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4502 {"//host/",S_OK},
4503 {"host",S_OK},
4504 {"//host/",S_OK},
4505 {"",S_FALSE},
4506 {"",S_FALSE},
4507 {"",S_FALSE},
4508 {"host",S_OK},
4509 {"",S_FALSE},
4510 {"/",S_OK},
4511 {"/",S_OK},
4512 {"",S_FALSE},
4513 {"//host",S_OK},
4514 {"",S_FALSE},
4515 {"",S_FALSE},
4516 {"",S_FALSE},
4519 {Uri_HOST_DNS,S_OK},
4520 {0,S_FALSE},
4521 {URL_SCHEME_UNKNOWN,S_OK},
4522 {URLZONE_INVALID,E_NOTIMPL}
4525 { "mailto://", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4527 {"mailto:",S_OK},
4528 {"",S_FALSE},
4529 {"mailto:",S_OK},
4530 {"",S_FALSE},
4531 {"",S_FALSE},
4532 {"",S_FALSE},
4533 {"",S_FALSE},
4534 {"",S_FALSE},
4535 {"",S_FALSE},
4536 {"",S_FALSE},
4537 {"",S_FALSE},
4538 {"mailto://",S_OK,FALSE,"mailto:"},
4539 {"mailto",S_OK},
4540 {"",S_FALSE},
4541 {"",S_FALSE}
4544 {Uri_HOST_UNKNOWN,S_OK},
4545 {0,S_FALSE},
4546 {URL_SCHEME_MAILTO,S_OK},
4547 {URLZONE_INVALID,E_NOTIMPL}
4550 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4552 {"mailto:a@b.com",S_OK},
4553 {"",S_FALSE},
4554 {"mailto:a@b.com",S_OK},
4555 {"",S_FALSE},
4556 {".com",S_OK},
4557 {"",S_FALSE},
4558 {"",S_FALSE},
4559 {"",S_FALSE},
4560 {"a@b.com",S_OK},
4561 {"a@b.com",S_OK},
4562 {"",S_FALSE},
4563 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
4564 {"mailto",S_OK},
4565 {"",S_FALSE},
4566 {"",S_FALSE}
4569 {Uri_HOST_UNKNOWN,S_OK},
4570 {0,S_FALSE},
4571 {URL_SCHEME_MAILTO,S_OK},
4572 {URLZONE_INVALID,E_NOTIMPL}
4575 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4577 {"file://c:\\test file.html",S_OK,FALSE},
4578 {"",S_FALSE,FALSE},
4579 {"file://c:\\test file.html",S_OK,FALSE},
4580 {"",S_FALSE,FALSE},
4581 {".html",S_OK,FALSE},
4582 {"",S_FALSE,FALSE},
4583 {"",S_FALSE,FALSE},
4584 {"",S_FALSE,FALSE},
4585 {"c:\\test file.html",S_OK,FALSE},
4586 {"c:\\test file.html",S_OK,FALSE},
4587 {"",S_FALSE,FALSE},
4588 {"c:\\test file.html",S_OK,FALSE},
4589 {"file",S_OK,FALSE},
4590 {"",S_FALSE,FALSE},
4591 {"",S_FALSE,FALSE}
4594 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4595 {0,S_FALSE,FALSE},
4596 {URL_SCHEME_FILE,S_OK,FALSE},
4597 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4600 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4602 {"file://c:\\test%20file.html",S_OK,FALSE},
4603 {"",S_FALSE,FALSE},
4604 {"file://c:\\test%20file.html",S_OK,FALSE},
4605 {"",S_FALSE,FALSE},
4606 {".html",S_OK,FALSE},
4607 {"",S_FALSE,FALSE},
4608 {"",S_FALSE,FALSE},
4609 {"",S_FALSE,FALSE},
4610 {"c:\\test%20file.html",S_OK,FALSE},
4611 {"c:\\test%20file.html",S_OK,FALSE},
4612 {"",S_FALSE,FALSE},
4613 {"c:\\test%20file.html",S_OK,FALSE},
4614 {"file",S_OK,FALSE},
4615 {"",S_FALSE,FALSE},
4616 {"",S_FALSE,FALSE}
4619 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4620 {0,S_FALSE,FALSE},
4621 {URL_SCHEME_FILE,S_OK,FALSE},
4622 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4625 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4627 {"file:///c:/test%20file.html",S_OK,FALSE},
4628 {"",S_FALSE,FALSE},
4629 {"file:///c:/test%20file.html",S_OK,FALSE},
4630 {"",S_FALSE,FALSE},
4631 {".html",S_OK,FALSE},
4632 {"",S_FALSE,FALSE},
4633 {"",S_FALSE,FALSE},
4634 {"",S_FALSE,FALSE},
4635 {"/c:/test%20file.html",S_OK,FALSE},
4636 {"/c:/test%20file.html",S_OK,FALSE},
4637 {"",S_FALSE,FALSE},
4638 {"c:\\test file.html",S_OK,FALSE},
4639 {"file",S_OK,FALSE},
4640 {"",S_FALSE,FALSE},
4641 {"",S_FALSE,FALSE}
4644 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4645 {0,S_FALSE,FALSE},
4646 {URL_SCHEME_FILE,S_OK,FALSE},
4647 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4650 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
4652 {"file:///c:/test%2520file.html",S_OK,FALSE},
4653 {"",S_FALSE,FALSE},
4654 {"file:///c:/test%2520file.html",S_OK,FALSE},
4655 {"",S_FALSE,FALSE},
4656 {".html",S_OK,FALSE},
4657 {"",S_FALSE,FALSE},
4658 {"",S_FALSE,FALSE},
4659 {"",S_FALSE,FALSE},
4660 {"/c:/test%2520file.html",S_OK,FALSE},
4661 {"/c:/test%2520file.html",S_OK,FALSE},
4662 {"",S_FALSE,FALSE},
4663 {"c:\\test%20file.html",S_OK,FALSE},
4664 {"file",S_OK,FALSE},
4665 {"",S_FALSE,FALSE},
4666 {"",S_FALSE,FALSE}
4669 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4670 {0,S_FALSE,FALSE},
4671 {URL_SCHEME_FILE,S_OK,FALSE},
4672 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4677 typedef struct _invalid_uri {
4678 const char* uri;
4679 DWORD flags;
4680 BOOL todo;
4681 } invalid_uri;
4683 static const invalid_uri invalid_uri_tests[] = {
4684 /* Has to have a scheme name. */
4685 {"://www.winehq.org",0,FALSE},
4686 /* Windows doesn't like URIs which are implicitly file paths without the
4687 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4689 {"C:/test/test.mp3",0,FALSE},
4690 {"\\\\Server/test/test.mp3",0,FALSE},
4691 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4692 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4693 /* Invalid schemes. */
4694 {"*abcd://not.valid.com",0,FALSE},
4695 {"*a*b*c*d://not.valid.com",0,FALSE},
4696 /* Not allowed to have invalid % encoded data. */
4697 {"ftp://google.co%XX/",0,FALSE},
4698 /* Too many h16 components. */
4699 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4700 /* Not enough room for IPv4 address. */
4701 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4702 /* Not enough h16 components. */
4703 {"http://[1:2:3:4]",0,FALSE},
4704 /* Not enough components including IPv4. */
4705 {"http://[1:192.0.1.0]",0,FALSE},
4706 /* Not allowed to have partial IPv4 in IPv6. */
4707 {"http://[::192.0]",0,FALSE},
4708 /* Can't have elision of 1 h16 at beginning of address. */
4709 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4710 /* Expects a valid IP Literal. */
4711 {"ftp://[not.valid.uri]/",0,FALSE},
4712 /* Expects valid port for a known scheme type. */
4713 {"ftp://www.winehq.org:123fgh",0,FALSE},
4714 /* Port exceeds USHORT_MAX for known scheme type. */
4715 {"ftp://www.winehq.org:65536",0,FALSE},
4716 /* Invalid port with IPv4 address. */
4717 {"http://www.winehq.org:1abcd",0,FALSE},
4718 /* Invalid port with IPv6 address. */
4719 {"http://[::ffff]:32xy",0,FALSE},
4720 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4721 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4722 /* Not allowed to have invalid % encoded data in opaque URI path. */
4723 {"news:test%XX",0,FALSE},
4724 {"mailto:wine@winehq%G8.com",0,FALSE},
4725 /* Known scheme types can't have invalid % encoded data in query string. */
4726 {"http://google.com/?query=te%xx",0,FALSE},
4727 /* Invalid % encoded data in fragment of know scheme type. */
4728 {"ftp://google.com/#Test%xx",0,FALSE},
4729 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4730 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4731 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4732 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4733 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4734 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4735 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4736 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4737 /* res URIs aren't allowed to have forbidden dos path characters in the
4738 * hostname.
4740 {"res://c:\\te<st\\test/test",0,FALSE},
4741 {"res://c:\\te>st\\test/test",0,FALSE},
4742 {"res://c:\\te\"st\\test/test",0,FALSE},
4743 {"res://c:\\test/te%xxst",0,FALSE}
4746 typedef struct _uri_equality {
4747 const char* a;
4748 DWORD create_flags_a;
4749 const char* b;
4750 DWORD create_flags_b;
4751 BOOL equal;
4752 BOOL todo;
4753 } uri_equality;
4755 static const uri_equality equality_tests[] = {
4757 "HTTP://www.winehq.org/test dir/./",0,
4758 "http://www.winehq.org/test dir/../test dir/",0,
4759 TRUE
4762 /* http://www.winehq.org/test%20dir */
4763 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4764 "http://www.winehq.org/test dir",0,
4765 TRUE
4768 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4769 "file:///c:/test.mp3",0,
4770 TRUE
4773 "ftp://ftp.winehq.org/",0,
4774 "ftp://ftp.winehq.org",0,
4775 TRUE
4778 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4779 "ftp://ftp.winehq.org/t%45stB/",0,
4780 FALSE
4783 "http://google.com/TEST",0,
4784 "http://google.com/test",0,
4785 FALSE
4788 "http://GOOGLE.com/",0,
4789 "http://google.com/",0,
4790 TRUE
4792 /* Performs case insensitive compare of host names (for known scheme types). */
4794 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4795 "ftp://google.com/",0,
4796 TRUE
4799 "zip://GOOGLE.com/",0,
4800 "zip://google.com/",0,
4801 FALSE
4804 "file:///c:/TEST/TeST/",0,
4805 "file:///c:/test/test/",0,
4806 TRUE
4809 "file:///server/TEST",0,
4810 "file:///SERVER/TEST",0,
4811 TRUE
4814 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4815 "http://google.com/",0,
4816 TRUE
4819 "ftp://google.com:21/",0,
4820 "ftp://google.com/",0,
4821 TRUE
4824 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4825 "http://google.com/",0,
4826 TRUE
4829 "http://google.com:70/",0,
4830 "http://google.com:71/",0,
4831 FALSE
4834 "file:///c:/dir/file.txt", 0,
4835 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4836 TRUE
4839 "file:///c:/dir/file.txt", 0,
4840 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4841 TRUE
4844 "file:///c:/dir/file.txt", 0,
4845 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4846 TRUE
4849 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4850 "file:///c:/%20dir/file.txt", 0,
4851 TRUE
4854 "file:///c:/Dir/file.txt", 0,
4855 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4856 TRUE
4859 "file:///c:/dir/file.txt", 0,
4860 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4861 TRUE
4864 "file:///c:/dir/file.txt#a", 0,
4865 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4866 FALSE
4868 /* Tests of an empty hash/fragment part */
4870 "http://google.com/test",0,
4871 "http://google.com/test#",0,
4872 FALSE
4875 "ftp://ftp.winehq.org/",0,
4876 "ftp://ftp.winehq.org/#",0,
4877 FALSE
4880 "file:///c:/dir/file.txt#", 0,
4881 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4882 FALSE
4886 typedef struct _uri_with_fragment {
4887 const char* uri;
4888 const char* fragment;
4889 DWORD create_flags;
4890 HRESULT create_expected;
4891 BOOL create_todo;
4893 const char* expected_uri;
4894 BOOL expected_todo;
4895 } uri_with_fragment;
4897 static const uri_with_fragment uri_fragment_tests[] = {
4899 "http://google.com/","#fragment",0,S_OK,FALSE,
4900 "http://google.com/#fragment",FALSE
4903 "http://google.com/","fragment",0,S_OK,FALSE,
4904 "http://google.com/#fragment",FALSE
4907 "zip://test.com/","?test",0,S_OK,FALSE,
4908 "zip://test.com/#?test",FALSE
4910 /* The fragment can be empty. */
4912 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4913 "ftp://ftp.google.com/#",FALSE
4917 typedef struct _uri_builder_property {
4918 BOOL change;
4919 const char *value;
4920 const char *expected_value;
4921 Uri_PROPERTY property;
4922 HRESULT expected;
4923 BOOL todo;
4924 } uri_builder_property;
4926 typedef struct _uri_builder_port {
4927 BOOL change;
4928 BOOL set;
4929 DWORD value;
4930 HRESULT expected;
4931 BOOL todo;
4932 } uri_builder_port;
4934 typedef struct _uri_builder_str_property {
4935 const char* expected;
4936 HRESULT result;
4937 BOOL todo;
4938 } uri_builder_str_property;
4940 typedef struct _uri_builder_dword_property {
4941 DWORD expected;
4942 HRESULT result;
4943 BOOL todo;
4944 } uri_builder_dword_property;
4946 typedef struct _uri_builder_test {
4947 const char *uri;
4948 DWORD create_flags;
4949 HRESULT create_builder_expected;
4950 BOOL create_builder_todo;
4952 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4954 uri_builder_port port_prop;
4956 DWORD uri_flags;
4957 HRESULT uri_hres;
4958 BOOL uri_todo;
4960 DWORD uri_simple_encode_flags;
4961 HRESULT uri_simple_hres;
4962 BOOL uri_simple_todo;
4964 DWORD uri_with_flags;
4965 DWORD uri_with_builder_flags;
4966 DWORD uri_with_encode_flags;
4967 HRESULT uri_with_hres;
4968 BOOL uri_with_todo;
4970 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4971 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4972 } uri_builder_test;
4974 static const uri_builder_test uri_builder_tests[] = {
4975 { "http://google.com/",0,S_OK,FALSE,
4977 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4978 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4979 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4980 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4982 {FALSE},
4983 0,S_OK,FALSE,
4984 0,S_OK,FALSE,
4985 0,0,0,S_OK,FALSE,
4987 {"http://username:password@google.com/?query=x#fragment",S_OK},
4988 {"username:password@google.com",S_OK},
4989 {"http://google.com/?query=x#fragment",S_OK},
4990 {"google.com",S_OK},
4991 {"",S_FALSE},
4992 {"#fragment",S_OK},
4993 {"google.com",S_OK},
4994 {"password",S_OK},
4995 {"/",S_OK},
4996 {"/?query=x",S_OK},
4997 {"?query=x",S_OK},
4998 {"http://username:password@google.com/?query=x#fragment",S_OK},
4999 {"http",S_OK},
5000 {"username:password",S_OK},
5001 {"username",S_OK}
5004 {Uri_HOST_DNS,S_OK},
5005 {80,S_OK},
5006 {URL_SCHEME_HTTP,S_OK},
5007 {URLZONE_INVALID,E_NOTIMPL}
5010 { "http://google.com/",0,S_OK,FALSE,
5012 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5014 {TRUE,TRUE,120,S_OK,FALSE},
5015 0,S_OK,FALSE,
5016 0,S_OK,FALSE,
5017 0,0,0,S_OK,FALSE,
5019 {"test://google.com:120/",S_OK},
5020 {"google.com:120",S_OK},
5021 {"test://google.com:120/",S_OK},
5022 {"google.com",S_OK},
5023 {"",S_FALSE},
5024 {"",S_FALSE},
5025 {"google.com",S_OK},
5026 {"",S_FALSE},
5027 {"/",S_OK},
5028 {"/",S_OK},
5029 {"",S_FALSE},
5030 {"test://google.com:120/",S_OK},
5031 {"test",S_OK},
5032 {"",S_FALSE},
5033 {"",S_FALSE}
5036 {Uri_HOST_DNS,S_OK},
5037 {120,S_OK},
5038 {URL_SCHEME_UNKNOWN,S_OK},
5039 {URLZONE_INVALID,E_NOTIMPL}
5042 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5044 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5045 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5046 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5048 {FALSE},
5049 0,S_OK,FALSE,
5050 0,S_OK,FALSE,
5051 0,0,0,S_OK,FALSE,
5053 {"http://[::192.2.3.4]/",S_OK},
5054 {"[::192.2.3.4]",S_OK},
5055 {"http://[::192.2.3.4]/",S_OK},
5056 {"",S_FALSE},
5057 {"",S_FALSE},
5058 {"",S_FALSE},
5059 {"::192.2.3.4",S_OK},
5060 {"",S_FALSE},
5061 {"/",S_OK},
5062 {"/",S_OK},
5063 {"",S_FALSE},
5064 {"http://[::192.2.3.4]/",S_OK},
5065 {"http",S_OK},
5066 {"",S_FALSE},
5067 {"",S_FALSE}
5070 {Uri_HOST_IPV6,S_OK},
5071 {80,S_OK},
5072 {URL_SCHEME_HTTP,S_OK},
5073 {URLZONE_INVALID,E_NOTIMPL}
5076 { "http://google.com/",0,S_OK,FALSE,
5078 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5080 {FALSE},
5081 0,S_OK,FALSE,
5082 0,S_OK,FALSE,
5083 0,0,0,S_OK,FALSE,
5085 {"http://google.com/#Frag",S_OK},
5086 {"google.com",S_OK},
5087 {"http://google.com/#Frag",S_OK},
5088 {"google.com",S_OK},
5089 {"",S_FALSE},
5090 {"#Frag",S_OK},
5091 {"google.com",S_OK},
5092 {"",S_FALSE},
5093 {"/",S_OK},
5094 {"/",S_OK},
5095 {"",S_FALSE},
5096 {"http://google.com/#Frag",S_OK},
5097 {"http",S_OK},
5098 {"",S_FALSE},
5099 {"",S_FALSE}
5102 {Uri_HOST_DNS,S_OK},
5103 {80,S_OK},
5104 {URL_SCHEME_HTTP,S_OK},
5105 {URLZONE_INVALID,E_NOTIMPL}
5108 { "http://google.com/",0,S_OK,FALSE,
5110 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
5112 {FALSE},
5113 0,S_OK,FALSE,
5114 0,S_OK,FALSE,
5115 0,0,0,S_OK,FALSE,
5117 {"http://google.com/#",S_OK},
5118 {"google.com",S_OK},
5119 {"http://google.com/#",S_OK},
5120 {"google.com",S_OK},
5121 {"",S_FALSE},
5122 {"#",S_OK},
5123 {"google.com",S_OK},
5124 {"",S_FALSE},
5125 {"/",S_OK},
5126 {"/",S_OK},
5127 {"",S_FALSE},
5128 {"http://google.com/#",S_OK},
5129 {"http",S_OK},
5130 {"",S_FALSE},
5131 {"",S_FALSE}
5134 {Uri_HOST_DNS,S_OK},
5135 {80,S_OK},
5136 {URL_SCHEME_HTTP,S_OK},
5137 {URLZONE_INVALID,E_NOTIMPL}
5140 { "http://google.com/",0,S_OK,FALSE,
5142 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5144 {FALSE},
5145 0,S_OK,FALSE,
5146 0,S_OK,FALSE,
5147 0,0,0,S_OK,FALSE,
5149 {"http://::password@google.com/",S_OK},
5150 {"::password@google.com",S_OK},
5151 {"http://google.com/",S_OK},
5152 {"google.com",S_OK},
5153 {"",S_FALSE},
5154 {"",S_FALSE},
5155 {"google.com",S_OK},
5156 {":password",S_OK},
5157 {"/",S_OK},
5158 {"/",S_OK},
5159 {"",S_FALSE},
5160 {"http://::password@google.com/",S_OK},
5161 {"http",S_OK},
5162 {"::password",S_OK},
5163 {"",S_FALSE}
5166 {Uri_HOST_DNS,S_OK},
5167 {80,S_OK},
5168 {URL_SCHEME_HTTP,S_OK},
5169 {URLZONE_INVALID,E_NOTIMPL}
5172 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5174 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5176 {FALSE},
5177 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
5178 0,S_OK,FALSE,
5179 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
5181 {":password@test/test",S_OK},
5182 {":password@",S_OK},
5183 {":password@test/test",S_OK},
5184 {"",S_FALSE},
5185 {"",S_FALSE},
5186 {"",S_FALSE},
5187 {"",S_FALSE},
5188 {"password",S_OK},
5189 {"test/test",S_OK},
5190 {"test/test",S_OK},
5191 {"",S_FALSE},
5192 {":password@test/test",S_OK},
5193 {"",S_FALSE},
5194 {":password",S_OK},
5195 {"",S_FALSE}
5198 {Uri_HOST_UNKNOWN,S_OK},
5199 {0,S_FALSE},
5200 {URL_SCHEME_UNKNOWN,S_OK},
5201 {URLZONE_INVALID,E_NOTIMPL}
5204 { "http://google.com/",0,S_OK,FALSE,
5206 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5208 {FALSE},
5209 0,S_OK,FALSE,
5210 0,S_OK,FALSE,
5211 0,0,0,S_OK,FALSE,
5213 {"http://google.com/test/test",S_OK},
5214 {"google.com",S_OK},
5215 {"http://google.com/test/test",S_OK},
5216 {"google.com",S_OK},
5217 {"",S_FALSE},
5218 {"",S_FALSE},
5219 {"google.com",S_OK},
5220 {"",S_FALSE},
5221 {"/test/test",S_OK},
5222 {"/test/test",S_OK},
5223 {"",S_FALSE},
5224 {"http://google.com/test/test",S_OK},
5225 {"http",S_OK},
5226 {"",S_FALSE},
5227 {"",S_FALSE}
5230 {Uri_HOST_DNS,S_OK},
5231 {80,S_OK},
5232 {URL_SCHEME_HTTP,S_OK},
5233 {URLZONE_INVALID,E_NOTIMPL}
5236 { "zip:testing/test",0,S_OK,FALSE,
5238 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5240 {FALSE},
5241 0,S_OK,FALSE,
5242 0,S_OK,FALSE,
5243 0,0,0,S_OK,FALSE,
5245 {"zip:test",S_OK},
5246 {"",S_FALSE},
5247 {"zip:test",S_OK},
5248 {"",S_FALSE},
5249 {"",S_FALSE},
5250 {"",S_FALSE},
5251 {"",S_FALSE},
5252 {"",S_FALSE},
5253 {"test",S_OK},
5254 {"test",S_OK},
5255 {"",S_FALSE},
5256 {"zip:test",S_OK},
5257 {"zip",S_OK},
5258 {"",S_FALSE},
5259 {"",S_FALSE}
5262 {Uri_HOST_UNKNOWN,S_OK},
5263 {0,S_FALSE},
5264 {URL_SCHEME_UNKNOWN,S_OK},
5265 {URLZONE_INVALID,E_NOTIMPL}
5268 { "http://google.com/",0,S_OK,FALSE,
5270 {FALSE},
5272 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5273 {TRUE,FALSE,555,S_OK,FALSE},
5274 0,S_OK,FALSE,
5275 0,S_OK,FALSE,
5276 0,0,0,S_OK,FALSE,
5278 {"http://google.com/",S_OK},
5279 {"google.com",S_OK},
5280 {"http://google.com/",S_OK},
5281 {"google.com",S_OK},
5282 {"",S_FALSE},
5283 {"",S_FALSE},
5284 {"google.com",S_OK},
5285 {"",S_FALSE},
5286 {"/",S_OK},
5287 {"/",S_OK},
5288 {"",S_FALSE},
5289 {"http://google.com/",S_OK},
5290 {"http",S_OK},
5291 {"",S_FALSE},
5292 {"",S_FALSE}
5295 {Uri_HOST_DNS,S_OK},
5296 /* Still returns 80, even though earlier the port was disabled. */
5297 {80,S_OK},
5298 {URL_SCHEME_HTTP,S_OK},
5299 {URLZONE_INVALID,E_NOTIMPL}
5302 { "http://google.com/",0,S_OK,FALSE,
5304 {FALSE},
5306 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5307 * you'll get 122345 instead.
5309 {TRUE,122345,222,S_OK,FALSE},
5310 0,S_OK,FALSE,
5311 0,S_OK,FALSE,
5312 0,0,0,S_OK,FALSE,
5314 {"http://google.com:222/",S_OK},
5315 {"google.com:222",S_OK},
5316 {"http://google.com:222/",S_OK},
5317 {"google.com",S_OK},
5318 {"",S_FALSE},
5319 {"",S_FALSE},
5320 {"google.com",S_OK},
5321 {"",S_FALSE},
5322 {"/",S_OK},
5323 {"/",S_OK},
5324 {"",S_FALSE},
5325 {"http://google.com:222/",S_OK},
5326 {"http",S_OK},
5327 {"",S_FALSE},
5328 {"",S_FALSE}
5331 {Uri_HOST_DNS,S_OK},
5332 {222,S_OK},
5333 {URL_SCHEME_HTTP,S_OK},
5334 {URLZONE_INVALID,E_NOTIMPL}
5337 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5338 { "http://google.com/",0,S_OK,FALSE,
5340 {FALSE},
5342 {TRUE,TRUE,999999,S_OK,FALSE},
5343 0,S_OK,FALSE,
5344 0,S_OK,FALSE,
5345 0,0,0,S_OK,FALSE,
5347 {"http://google.com:999999/",S_OK},
5348 {"google.com:999999",S_OK},
5349 {"http://google.com:999999/",S_OK},
5350 {"google.com",S_OK},
5351 {"",S_FALSE},
5352 {"",S_FALSE},
5353 {"google.com",S_OK},
5354 {"",S_FALSE},
5355 {"/",S_OK},
5356 {"/",S_OK},
5357 {"",S_FALSE},
5358 {"http://google.com:999999/",S_OK},
5359 {"http",S_OK},
5360 {"",S_FALSE},
5361 {"",S_FALSE}
5364 {Uri_HOST_DNS,S_OK},
5365 {999999,S_OK},
5366 {URL_SCHEME_HTTP,S_OK},
5367 {URLZONE_INVALID,E_NOTIMPL}
5370 { "http://google.com/",0,S_OK,FALSE,
5372 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5375 {FALSE},
5376 0,S_OK,FALSE,
5377 0,S_OK,FALSE,
5378 0,0,0,S_OK,FALSE,
5380 {"http://google.com/?test",S_OK},
5381 {"google.com",S_OK},
5382 {"http://google.com/?test",S_OK},
5383 {"google.com",S_OK},
5384 {"",S_FALSE},
5385 {"",S_FALSE},
5386 {"google.com",S_OK},
5387 {"",S_FALSE},
5388 {"/",S_OK},
5389 {"/?test",S_OK},
5390 {"?test",S_OK},
5391 {"http://google.com/?test",S_OK},
5392 {"http",S_OK},
5393 {"",S_FALSE},
5394 {"",S_FALSE}
5397 {Uri_HOST_DNS,S_OK},
5398 {80,S_OK},
5399 {URL_SCHEME_HTTP,S_OK},
5400 {URLZONE_INVALID,E_NOTIMPL}
5403 { "http://:password@google.com/",0,S_OK,FALSE,
5405 {FALSE},
5407 {FALSE},
5408 0,S_OK,FALSE,
5409 0,S_OK,FALSE,
5410 0,0,0,S_OK,FALSE,
5412 {"http://:password@google.com/",S_OK},
5413 {":password@google.com",S_OK},
5414 {"http://google.com/",S_OK},
5415 {"google.com",S_OK},
5416 {"",S_FALSE},
5417 {"",S_FALSE},
5418 {"google.com",S_OK},
5419 {"password",S_OK},
5420 {"/",S_OK},
5421 {"/",S_OK},
5422 {"",S_FALSE},
5423 {"http://:password@google.com/",S_OK},
5424 {"http",S_OK},
5425 {":password",S_OK},
5426 {"",S_FALSE}
5429 {Uri_HOST_DNS,S_OK},
5430 {80,S_OK},
5431 {URL_SCHEME_HTTP,S_OK},
5432 {URLZONE_INVALID,E_NOTIMPL}
5435 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5436 { NULL,0,S_OK,FALSE,
5438 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5439 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5441 {FALSE},
5442 0,S_OK,FALSE,
5443 0,S_OK,FALSE,
5444 0,0,0,S_OK,FALSE,
5446 {"http://google.com/",S_OK},
5447 {"google.com",S_OK},
5448 {"http://google.com/",S_OK},
5449 {"google.com",S_OK},
5450 {"",S_FALSE},
5451 {"",S_FALSE},
5452 {"google.com",S_OK},
5453 {"",S_FALSE},
5454 {"/",S_OK},
5455 {"/",S_OK},
5456 {"",S_FALSE},
5457 {"http://google.com/",S_OK},
5458 {"http",S_OK},
5459 {"",S_FALSE},
5460 {"",S_FALSE}
5463 {Uri_HOST_DNS,S_OK},
5464 {80,S_OK},
5465 {URL_SCHEME_HTTP,S_OK},
5466 {URLZONE_INVALID,E_NOTIMPL}
5469 /* Can't set the scheme name to NULL. */
5470 { "zip://google.com/",0,S_OK,FALSE,
5472 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5474 {FALSE},
5475 0,S_OK,FALSE,
5476 0,S_OK,FALSE,
5477 0,0,0,S_OK,FALSE,
5479 {"zip://google.com/",S_OK},
5480 {"google.com",S_OK},
5481 {"zip://google.com/",S_OK},
5482 {"google.com",S_OK},
5483 {"",S_FALSE},
5484 {"",S_FALSE},
5485 {"google.com",S_OK},
5486 {"",S_FALSE},
5487 {"/",S_OK},
5488 {"/",S_OK},
5489 {"",S_FALSE},
5490 {"zip://google.com/",S_OK},
5491 {"zip",S_OK},
5492 {"",S_FALSE},
5493 {"",S_FALSE}
5496 {Uri_HOST_DNS,S_OK},
5497 {0,S_FALSE},
5498 {URL_SCHEME_UNKNOWN,S_OK},
5499 {URLZONE_INVALID,E_NOTIMPL}
5502 /* Can't set the scheme name to an empty string. */
5503 { "zip://google.com/",0,S_OK,FALSE,
5505 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5507 {FALSE},
5508 0,S_OK,FALSE,
5509 0,S_OK,FALSE,
5510 0,0,0,S_OK,FALSE,
5512 {"zip://google.com/",S_OK},
5513 {"google.com",S_OK},
5514 {"zip://google.com/",S_OK},
5515 {"google.com",S_OK},
5516 {"",S_FALSE},
5517 {"",S_FALSE},
5518 {"google.com",S_OK},
5519 {"",S_FALSE},
5520 {"/",S_OK},
5521 {"/",S_OK},
5522 {"",S_FALSE},
5523 {"zip://google.com/",S_OK},
5524 {"zip",S_OK},
5525 {"",S_FALSE},
5526 {"",S_FALSE}
5529 {Uri_HOST_DNS,S_OK},
5530 {0,S_FALSE},
5531 {URL_SCHEME_UNKNOWN,S_OK},
5532 {URLZONE_INVALID,E_NOTIMPL}
5535 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5536 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5538 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5539 {{FALSE}},
5540 {FALSE},
5541 -1,S_OK,FALSE,
5542 0,S_OK,FALSE,
5543 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5545 {"http://google.com/../../",S_OK},
5546 {"google.com",S_OK},
5547 {"http://google.com/../../",S_OK},
5548 {"google.com",S_OK},
5549 {"",S_FALSE},
5550 {"",S_FALSE},
5551 {"google.com",S_OK},
5552 {"",S_FALSE},
5553 {"/../../",S_OK},
5554 {"/../../",S_OK},
5555 {"",S_FALSE},
5556 {"http://google.com/../../",S_OK},
5557 {"http",S_OK},
5558 {"",S_FALSE},
5559 {"",S_FALSE}
5562 {Uri_HOST_DNS,S_OK},
5563 {80,S_OK},
5564 {URL_SCHEME_HTTP,S_OK},
5565 {URLZONE_INVALID,E_NOTIMPL}
5568 { "http://google.com/",0,S_OK,FALSE,
5570 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5572 {FALSE},
5573 -1,S_OK,FALSE,
5574 0,S_OK,FALSE,
5575 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5577 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5578 {"google.com",S_OK},
5579 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5580 {"google.com",S_OK},
5581 {"",S_FALSE},
5582 {"#Fr%3C%7C%3Eg",S_OK},
5583 {"google.com",S_OK},
5584 {"",S_FALSE},
5585 {"/",S_OK},
5586 {"/",S_OK},
5587 {"",S_FALSE},
5588 {"http://google.com/#Fr<|>g",S_OK},
5589 {"http",S_OK},
5590 {"",S_FALSE},
5591 {"",S_FALSE}
5594 {Uri_HOST_DNS,S_OK},
5595 {80,S_OK},
5596 {URL_SCHEME_HTTP,S_OK},
5597 {URLZONE_INVALID,E_NOTIMPL}
5600 { "http://google.com/",0,S_OK,FALSE,
5602 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5604 {FALSE},
5605 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5606 0,S_OK,FALSE,
5607 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5609 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5610 {"google.com",S_OK},
5611 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5612 {"google.com",S_OK},
5613 {"",S_FALSE},
5614 {"#Fr%3C%7C%3Eg",S_OK},
5615 {"google.com",S_OK},
5616 {"",S_FALSE},
5617 {"/",S_OK},
5618 {"/",S_OK},
5619 {"",S_FALSE},
5620 {"http://google.com/#Fr<|>g",S_OK},
5621 {"http",S_OK},
5622 {"",S_FALSE},
5623 {"",S_FALSE}
5626 {Uri_HOST_DNS,S_OK},
5627 {80,S_OK},
5628 {URL_SCHEME_HTTP,S_OK},
5629 {URLZONE_INVALID,E_NOTIMPL}
5632 { NULL,0,S_OK,FALSE,
5634 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5635 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5637 {FALSE},
5638 0,INET_E_INVALID_URL,FALSE,
5639 0,INET_E_INVALID_URL,FALSE,
5640 0,0,0,INET_E_INVALID_URL,FALSE
5642 { "http://google.com/",0,S_OK,FALSE,
5644 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5646 {FALSE},
5647 0,INET_E_INVALID_URL,FALSE,
5648 0,INET_E_INVALID_URL,FALSE,
5649 0,0,0,INET_E_INVALID_URL,FALSE
5651 /* File scheme's can't have a username set. */
5652 { "file://google.com/",0,S_OK,FALSE,
5654 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5656 {FALSE},
5657 0,INET_E_INVALID_URL,FALSE,
5658 0,INET_E_INVALID_URL,FALSE,
5659 0,0,0,INET_E_INVALID_URL,FALSE
5661 /* File schemes can't have a password set. */
5662 { "file://google.com/",0,S_OK,FALSE,
5664 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
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
5671 /* UserName can't contain any character that is a delimeter for another
5672 * component that appears after it in a normal URI.
5674 { "http://google.com/",0,S_OK,FALSE,
5676 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5678 {FALSE},
5679 0,INET_E_INVALID_URL,FALSE,
5680 0,INET_E_INVALID_URL,FALSE,
5681 0,0,0,INET_E_INVALID_URL,FALSE
5683 { "http://google.com/",0,S_OK,FALSE,
5685 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5687 {FALSE},
5688 0,INET_E_INVALID_URL,FALSE,
5689 0,INET_E_INVALID_URL,FALSE,
5690 0,0,0,INET_E_INVALID_URL,FALSE
5692 { "http://google.com/",0,S_OK,FALSE,
5694 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5696 {FALSE},
5697 0,INET_E_INVALID_URL,FALSE,
5698 0,INET_E_INVALID_URL,FALSE,
5699 0,0,0,INET_E_INVALID_URL,FALSE
5701 { "http://google.com/",0,S_OK,FALSE,
5703 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5705 {FALSE},
5706 0,INET_E_INVALID_URL,FALSE,
5707 0,INET_E_INVALID_URL,FALSE,
5708 0,0,0,INET_E_INVALID_URL,FALSE
5710 { "http://google.com/",0,S_OK,FALSE,
5712 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5714 {FALSE},
5715 0,INET_E_INVALID_URL,FALSE,
5716 0,INET_E_INVALID_URL,FALSE,
5717 0,0,0,INET_E_INVALID_URL,FALSE
5719 { "http://google.com/",0,S_OK,FALSE,
5721 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5723 {FALSE},
5724 0,INET_E_INVALID_URL,FALSE,
5725 0,INET_E_INVALID_URL,FALSE,
5726 0,0,0,INET_E_INVALID_URL,FALSE
5728 { "http://google.com/",0,S_OK,FALSE,
5730 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5732 {FALSE},
5733 0,INET_E_INVALID_URL,FALSE,
5734 0,INET_E_INVALID_URL,FALSE,
5735 0,0,0,INET_E_INVALID_URL,FALSE
5737 { "http://google.com/",0,S_OK,FALSE,
5739 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5741 {FALSE},
5742 0,INET_E_INVALID_URL,FALSE,
5743 0,INET_E_INVALID_URL,FALSE,
5744 0,0,0,INET_E_INVALID_URL,FALSE
5746 { "http://google.com/",0,S_OK,FALSE,
5748 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5750 {FALSE},
5751 0,INET_E_INVALID_URL,FALSE,
5752 0,INET_E_INVALID_URL,FALSE,
5753 0,0,0,INET_E_INVALID_URL,FALSE
5755 { "http://google.com/",0,S_OK,FALSE,
5757 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5759 {FALSE},
5760 0,INET_E_INVALID_URL,FALSE,
5761 0,INET_E_INVALID_URL,FALSE,
5762 0,0,0,INET_E_INVALID_URL,FALSE
5764 { "http://google.com/",0,S_OK,FALSE,
5766 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5768 {FALSE},
5769 0,INET_E_INVALID_URL,FALSE,
5770 0,INET_E_INVALID_URL,FALSE,
5771 0,0,0,INET_E_INVALID_URL,FALSE
5773 { "http://google.com/",0,S_OK,FALSE,
5775 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5777 {FALSE},
5778 0,INET_E_INVALID_URL,FALSE,
5779 0,INET_E_INVALID_URL,FALSE,
5780 0,0,0,INET_E_INVALID_URL,FALSE
5782 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5783 { "http://google.com/",0,S_OK,FALSE,
5785 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5787 {FALSE},
5788 0,S_OK,FALSE,
5789 0,S_OK,FALSE,
5790 0,0,0,S_OK,FALSE,
5792 {"http://winehq.org:test/",S_OK},
5793 {"winehq.org:test",S_OK},
5794 {"http://winehq.org:test/",S_OK},
5795 {"winehq.org:test",S_OK},
5796 {"",S_FALSE},
5797 {"",S_FALSE},
5798 {"winehq.org:test",S_OK},
5799 {"",S_FALSE},
5800 {"/",S_OK},
5801 {"/",S_OK},
5802 {"",S_FALSE},
5803 {"http://winehq.org:test/",S_OK},
5804 {"http",S_OK},
5805 {"",S_FALSE},
5806 {"",S_FALSE}
5809 {Uri_HOST_DNS,S_OK},
5810 {80,S_OK},
5811 {URL_SCHEME_HTTP,S_OK},
5812 {URLZONE_INVALID,E_NOTIMPL}
5815 /* Can't set the host name to NULL. */
5816 { "http://google.com/",0,S_OK,FALSE,
5818 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5820 {FALSE},
5821 0,S_OK,FALSE,
5822 0,S_OK,FALSE,
5823 0,0,0,S_OK,FALSE,
5825 {"http://google.com/",S_OK},
5826 {"google.com",S_OK},
5827 {"http://google.com/",S_OK},
5828 {"google.com",S_OK},
5829 {"",S_FALSE},
5830 {"",S_FALSE},
5831 {"google.com",S_OK},
5832 {"",S_FALSE},
5833 {"/",S_OK},
5834 {"/",S_OK},
5835 {"",S_FALSE},
5836 {"http://google.com/",S_OK},
5837 {"http",S_OK},
5838 {"",S_FALSE},
5839 {"",S_FALSE}
5842 {Uri_HOST_DNS,S_OK},
5843 {80,S_OK},
5844 {URL_SCHEME_HTTP,S_OK},
5845 {URLZONE_INVALID,E_NOTIMPL}
5848 /* Can set the host name to an empty string. */
5849 { "http://google.com/",0,S_OK,FALSE,
5851 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5853 {FALSE},
5854 0,S_OK,FALSE,
5855 0,S_OK,FALSE,
5856 0,0,0,S_OK,FALSE,
5858 {"http:///",S_OK},
5859 {"",S_OK},
5860 {"http:///",S_OK},
5861 {"",S_FALSE},
5862 {"",S_FALSE},
5863 {"",S_FALSE},
5864 {"",S_OK},
5865 {"",S_FALSE},
5866 {"/",S_OK},
5867 {"/",S_OK},
5868 {"",S_FALSE},
5869 {"http:///",S_OK},
5870 {"http",S_OK},
5871 {"",S_FALSE},
5872 {"",S_FALSE}
5875 {Uri_HOST_UNKNOWN,S_OK},
5876 {80,S_OK},
5877 {URL_SCHEME_HTTP,S_OK},
5878 {URLZONE_INVALID,E_NOTIMPL}
5881 { "http://google.com/",0,S_OK,FALSE,
5883 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5885 {FALSE},
5886 0,INET_E_INVALID_URL,FALSE,
5887 0,INET_E_INVALID_URL,FALSE,
5888 0,0,0,INET_E_INVALID_URL,FALSE
5890 { "http://google.com/",0,S_OK,FALSE,
5892 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5894 {FALSE},
5895 0,INET_E_INVALID_URL,FALSE,
5896 0,INET_E_INVALID_URL,FALSE,
5897 0,0,0,INET_E_INVALID_URL,FALSE
5899 { "http://google.com/",0,S_OK,FALSE,
5901 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5903 {FALSE},
5904 0,INET_E_INVALID_URL,FALSE,
5905 0,INET_E_INVALID_URL,FALSE,
5906 0,0,0,INET_E_INVALID_URL,FALSE
5908 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5910 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5912 {FALSE},
5913 0,S_OK,FALSE,
5914 0,S_OK,FALSE,
5915 0,0,0,S_OK,FALSE,
5917 {"file:///c:/dir/file.html",S_OK},
5918 {"",S_FALSE},
5919 {"file:///c:/dir/file.html",S_OK},
5920 {"",S_FALSE},
5921 {".html",S_OK},
5922 {"",S_FALSE},
5923 {"",S_FALSE},
5924 {"",S_FALSE},
5925 {"/c:/dir/file.html",S_OK},
5926 {"/c:/dir/file.html",S_OK},
5927 {"",S_FALSE},
5928 {"file:///c:/dir/file.html",S_OK},
5929 {"file",S_OK},
5930 {"",S_FALSE},
5931 {"",S_FALSE}
5934 {Uri_HOST_UNKNOWN,S_OK},
5935 {0,S_FALSE},
5936 {URL_SCHEME_FILE,S_OK},
5937 {URLZONE_INVALID,E_NOTIMPL}
5940 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5942 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5944 {FALSE},
5945 0,S_OK,FALSE,
5946 0,S_OK,FALSE,
5947 0,0,0,S_OK,FALSE,
5949 {"file:///c:/dir/file.html#",S_OK},
5950 {"",S_FALSE},
5951 {"file:///c:/dir/file.html#",S_OK},
5952 {"",S_FALSE},
5953 {".html",S_OK},
5954 {"#",S_OK},
5955 {"",S_FALSE},
5956 {"",S_FALSE},
5957 {"/c:/dir/file.html",S_OK},
5958 {"/c:/dir/file.html",S_OK},
5959 {"",S_FALSE},
5960 {"file:///c:/dir/file.html#",S_OK},
5961 {"file",S_OK},
5962 {"",S_FALSE},
5963 {"",S_FALSE}
5966 {Uri_HOST_UNKNOWN,S_OK},
5967 {0,S_FALSE},
5968 {URL_SCHEME_FILE,S_OK},
5969 {URLZONE_INVALID,E_NOTIMPL}
5974 typedef struct _uri_builder_remove_test {
5975 const char *uri;
5976 DWORD create_flags;
5977 HRESULT create_builder_expected;
5978 BOOL create_builder_todo;
5980 DWORD remove_properties;
5981 HRESULT remove_expected;
5982 BOOL remove_todo;
5984 const char *expected_uri;
5985 DWORD expected_flags;
5986 HRESULT expected_hres;
5987 BOOL expected_todo;
5988 } uri_builder_remove_test;
5990 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5991 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5992 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5993 "http://google.com/",0,S_OK,FALSE
5995 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5996 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5997 "http://winehq.org/",0,S_OK,FALSE
5999 { "zip://google.com?Test=x",0,S_OK,FALSE,
6000 Uri_HAS_HOST,S_OK,FALSE,
6001 "zip:/?Test=x",0,S_OK,FALSE
6003 /* Doesn't remove the whole userinfo component. */
6004 { "http://username:pass@google.com/",0,S_OK,FALSE,
6005 Uri_HAS_USER_INFO,S_OK,FALSE,
6006 "http://username:pass@google.com/",0,S_OK,FALSE
6008 /* Doesn't remove the domain. */
6009 { "http://google.com/",0,S_OK,FALSE,
6010 Uri_HAS_DOMAIN,S_OK,FALSE,
6011 "http://google.com/",0,S_OK,FALSE
6013 { "http://google.com:120/",0,S_OK,FALSE,
6014 Uri_HAS_AUTHORITY,S_OK,FALSE,
6015 "http://google.com:120/",0,S_OK,FALSE
6017 { "http://google.com/test.com/",0,S_OK,FALSE,
6018 Uri_HAS_EXTENSION,S_OK,FALSE,
6019 "http://google.com/test.com/",0,S_OK,FALSE
6021 { "http://google.com/?test=x",0,S_OK,FALSE,
6022 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
6023 "http://google.com/?test=x",0,S_OK,FALSE
6025 /* Can't remove the scheme name. */
6026 { "http://google.com/?test=x",0,S_OK,FALSE,
6027 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
6028 "http://google.com/?test=x",0,S_OK,FALSE
6032 typedef struct _uri_combine_str_property {
6033 const char *value;
6034 HRESULT expected;
6035 BOOL todo;
6036 const char *broken_value;
6037 const char *value_ex;
6038 } uri_combine_str_property;
6040 typedef struct _uri_combine_test {
6041 const char *base_uri;
6042 DWORD base_create_flags;
6043 const char *relative_uri;
6044 DWORD relative_create_flags;
6045 DWORD combine_flags;
6046 HRESULT expected;
6047 BOOL todo;
6049 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
6050 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
6051 } uri_combine_test;
6053 static const uri_combine_test uri_combine_tests[] = {
6054 { "http://google.com/fun/stuff",0,
6055 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
6056 0,S_OK,FALSE,
6058 {"http://google.com/not/fun/stuff",S_OK},
6059 {"google.com",S_OK},
6060 {"http://google.com/not/fun/stuff",S_OK},
6061 {"google.com",S_OK},
6062 {"",S_FALSE},
6063 {"",S_FALSE},
6064 {"google.com",S_OK},
6065 {"",S_FALSE},
6066 {"/not/fun/stuff",S_OK},
6067 {"/not/fun/stuff",S_OK},
6068 {"",S_FALSE},
6069 {"http://google.com/not/fun/stuff",S_OK},
6070 {"http",S_OK},
6071 {"",S_FALSE},
6072 {"",S_FALSE}
6075 {Uri_HOST_DNS,S_OK},
6076 {80,S_OK},
6077 {URL_SCHEME_HTTP,S_OK},
6078 {URLZONE_INVALID,E_NOTIMPL}
6081 { "http://google.com/test",0,
6082 "zip://test.com/cool",0,
6083 0,S_OK,FALSE,
6085 {"zip://test.com/cool",S_OK},
6086 {"test.com",S_OK},
6087 {"zip://test.com/cool",S_OK},
6088 {"test.com",S_OK},
6089 {"",S_FALSE},
6090 {"",S_FALSE},
6091 {"test.com",S_OK},
6092 {"",S_FALSE},
6093 {"/cool",S_OK},
6094 {"/cool",S_OK},
6095 {"",S_FALSE},
6096 {"zip://test.com/cool",S_OK},
6097 {"zip",S_OK},
6098 {"",S_FALSE},
6099 {"",S_FALSE}
6102 {Uri_HOST_DNS,S_OK},
6103 {0,S_FALSE},
6104 {URL_SCHEME_UNKNOWN,S_OK},
6105 {URLZONE_INVALID,E_NOTIMPL}
6108 { "http://google.com/use/base/path",0,
6109 "?relative",Uri_CREATE_ALLOW_RELATIVE,
6110 0,S_OK,FALSE,
6112 {"http://google.com/use/base/path?relative",S_OK},
6113 {"google.com",S_OK},
6114 {"http://google.com/use/base/path?relative",S_OK},
6115 {"google.com",S_OK},
6116 {"",S_FALSE},
6117 {"",S_FALSE},
6118 {"google.com",S_OK},
6119 {"",S_FALSE},
6120 {"/use/base/path",S_OK},
6121 {"/use/base/path?relative",S_OK},
6122 {"?relative",S_OK},
6123 {"http://google.com/use/base/path?relative",S_OK},
6124 {"http",S_OK},
6125 {"",S_FALSE},
6126 {"",S_FALSE}
6129 {Uri_HOST_DNS,S_OK},
6130 {80,S_OK},
6131 {URL_SCHEME_HTTP,S_OK},
6132 {URLZONE_INVALID,E_NOTIMPL}
6135 { "http://google.com/path",0,
6136 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6137 0,S_OK,FALSE,
6139 {"http://google.com/testing",S_OK},
6140 {"google.com",S_OK},
6141 {"http://google.com/testing",S_OK},
6142 {"google.com",S_OK},
6143 {"",S_FALSE},
6144 {"",S_FALSE},
6145 {"google.com",S_OK},
6146 {"",S_FALSE},
6147 {"/testing",S_OK},
6148 {"/testing",S_OK},
6149 {"",S_FALSE},
6150 {"http://google.com/testing",S_OK},
6151 {"http",S_OK},
6152 {"",S_FALSE},
6153 {"",S_FALSE}
6156 {Uri_HOST_DNS,S_OK},
6157 {80,S_OK},
6158 {URL_SCHEME_HTTP,S_OK},
6159 {URLZONE_INVALID,E_NOTIMPL}
6162 { "http://google.com/path",0,
6163 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
6164 URL_DONT_SIMPLIFY,S_OK,FALSE,
6166 {"http://google.com:80/test/../test/.././testing",S_OK},
6167 {"google.com",S_OK},
6168 {"http://google.com:80/test/../test/.././testing",S_OK},
6169 {"google.com",S_OK},
6170 {"",S_FALSE},
6171 {"",S_FALSE},
6172 {"google.com",S_OK},
6173 {"",S_FALSE},
6174 {"/test/../test/.././testing",S_OK},
6175 {"/test/../test/.././testing",S_OK},
6176 {"",S_FALSE},
6177 {"http://google.com:80/test/../test/.././testing",S_OK},
6178 {"http",S_OK},
6179 {"",S_FALSE},
6180 {"",S_FALSE}
6183 {Uri_HOST_DNS,S_OK},
6184 {80,S_OK},
6185 {URL_SCHEME_HTTP,S_OK},
6186 {URLZONE_INVALID,E_NOTIMPL}
6189 { "http://winehq.org/test/abc",0,
6190 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6191 0,S_OK,FALSE,
6193 {"http://winehq.org/test/testing/test",S_OK},
6194 {"winehq.org",S_OK},
6195 {"http://winehq.org/test/testing/test",S_OK},
6196 {"winehq.org",S_OK},
6197 {"",S_FALSE},
6198 {"",S_FALSE},
6199 {"winehq.org",S_OK},
6200 {"",S_FALSE},
6201 {"/test/testing/test",S_OK},
6202 {"/test/testing/test",S_OK},
6203 {"",S_FALSE},
6204 {"http://winehq.org/test/testing/test",S_OK},
6205 {"http",S_OK},
6206 {"",S_FALSE},
6207 {"",S_FALSE}
6210 {Uri_HOST_DNS,S_OK},
6211 {80,S_OK},
6212 {URL_SCHEME_HTTP,S_OK},
6213 {URLZONE_INVALID,E_NOTIMPL}
6216 { "http://winehq.org/test/abc",0,
6217 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6218 URL_DONT_SIMPLIFY,S_OK,FALSE,
6220 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6221 /* Default port is hidden in the authority. */
6222 {"winehq.org",S_OK},
6223 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6224 {"winehq.org",S_OK},
6225 {"",S_FALSE},
6226 {"",S_FALSE},
6227 {"winehq.org",S_OK},
6228 {"",S_FALSE},
6229 {"/test/testing/abc/../test",S_OK},
6230 {"/test/testing/abc/../test",S_OK},
6231 {"",S_FALSE},
6232 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6233 {"http",S_OK},
6234 {"",S_FALSE},
6235 {"",S_FALSE}
6238 {Uri_HOST_DNS,S_OK},
6239 {80,S_OK},
6240 {URL_SCHEME_HTTP,S_OK},
6241 {URLZONE_INVALID,E_NOTIMPL}
6244 { "http://winehq.org/test?query",0,
6245 "testing",Uri_CREATE_ALLOW_RELATIVE,
6246 0,S_OK,FALSE,
6248 {"http://winehq.org/testing",S_OK},
6249 {"winehq.org",S_OK},
6250 {"http://winehq.org/testing",S_OK},
6251 {"winehq.org",S_OK},
6252 {"",S_FALSE},
6253 {"",S_FALSE},
6254 {"winehq.org",S_OK},
6255 {"",S_FALSE},
6256 {"/testing",S_OK},
6257 {"/testing",S_OK},
6258 {"",S_FALSE},
6259 {"http://winehq.org/testing",S_OK},
6260 {"http",S_OK},
6261 {"",S_FALSE},
6262 {"",S_FALSE}
6265 {Uri_HOST_DNS,S_OK},
6266 {80,S_OK},
6267 {URL_SCHEME_HTTP,S_OK},
6268 {URLZONE_INVALID,E_NOTIMPL}
6271 { "http://winehq.org/test#frag",0,
6272 "testing",Uri_CREATE_ALLOW_RELATIVE,
6273 0,S_OK,FALSE,
6275 {"http://winehq.org/testing",S_OK},
6276 {"winehq.org",S_OK},
6277 {"http://winehq.org/testing",S_OK},
6278 {"winehq.org",S_OK},
6279 {"",S_FALSE},
6280 {"",S_FALSE},
6281 {"winehq.org",S_OK},
6282 {"",S_FALSE},
6283 {"/testing",S_OK},
6284 {"/testing",S_OK},
6285 {"",S_FALSE},
6286 {"http://winehq.org/testing",S_OK},
6287 {"http",S_OK},
6288 {"",S_FALSE},
6289 {"",S_FALSE}
6292 {Uri_HOST_DNS,S_OK},
6293 {80,S_OK},
6294 {URL_SCHEME_HTTP,S_OK},
6295 {URLZONE_INVALID,E_NOTIMPL}
6298 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6299 "test",Uri_CREATE_ALLOW_RELATIVE,
6300 0,S_OK,FALSE,
6302 {"test",S_OK},
6303 {"",S_FALSE},
6304 {"test",S_OK},
6305 {"",S_FALSE},
6306 {"",S_FALSE},
6307 {"",S_FALSE},
6308 {"",S_FALSE},
6309 {"",S_FALSE},
6310 {"test",S_OK},
6311 {"test",S_OK},
6312 {"",S_FALSE},
6313 {"test",S_OK},
6314 {"",S_FALSE},
6315 {"",S_FALSE},
6316 {"",S_FALSE}
6319 {Uri_HOST_UNKNOWN,S_OK},
6320 {0,S_FALSE},
6321 {URL_SCHEME_UNKNOWN,S_OK},
6322 {URLZONE_INVALID,E_NOTIMPL}
6325 { "file:///c:/test/test",0,
6326 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6327 URL_FILE_USE_PATHURL,S_OK,FALSE,
6329 {"file://c:\\testing.mp3",S_OK},
6330 {"",S_FALSE},
6331 {"file://c:\\testing.mp3",S_OK},
6332 {"",S_FALSE},
6333 {".mp3",S_OK},
6334 {"",S_FALSE},
6335 {"",S_FALSE},
6336 {"",S_FALSE},
6337 {"c:\\testing.mp3",S_OK},
6338 {"c:\\testing.mp3",S_OK},
6339 {"",S_FALSE},
6340 {"file://c:\\testing.mp3",S_OK},
6341 {"file",S_OK},
6342 {"",S_FALSE},
6343 {"",S_FALSE}
6346 {Uri_HOST_UNKNOWN,S_OK},
6347 {0,S_FALSE},
6348 {URL_SCHEME_FILE,S_OK},
6349 {URLZONE_INVALID,E_NOTIMPL}
6352 { "file:///c:/test/test",0,
6353 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6354 0,S_OK,FALSE,
6356 {"file:///c:/testing.mp3",S_OK},
6357 {"",S_FALSE},
6358 {"file:///c:/testing.mp3",S_OK},
6359 {"",S_FALSE},
6360 {".mp3",S_OK},
6361 {"",S_FALSE},
6362 {"",S_FALSE},
6363 {"",S_FALSE},
6364 {"/c:/testing.mp3",S_OK},
6365 {"/c:/testing.mp3",S_OK},
6366 {"",S_FALSE},
6367 {"file:///c:/testing.mp3",S_OK},
6368 {"file",S_OK},
6369 {"",S_FALSE},
6370 {"",S_FALSE}
6373 {Uri_HOST_UNKNOWN,S_OK},
6374 {0,S_FALSE},
6375 {URL_SCHEME_FILE,S_OK},
6376 {URLZONE_INVALID,E_NOTIMPL}
6379 { "file://test.com/test/test",0,
6380 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6381 URL_FILE_USE_PATHURL,S_OK,FALSE,
6383 {"file://\\\\test.com\\testing.mp3",S_OK},
6384 {"test.com",S_OK},
6385 {"file://\\\\test.com\\testing.mp3",S_OK},
6386 {"test.com",S_OK},
6387 {".mp3",S_OK},
6388 {"",S_FALSE},
6389 {"test.com",S_OK},
6390 {"",S_FALSE},
6391 {"\\testing.mp3",S_OK},
6392 {"\\testing.mp3",S_OK},
6393 {"",S_FALSE},
6394 {"file://\\\\test.com\\testing.mp3",S_OK},
6395 {"file",S_OK},
6396 {"",S_FALSE},
6397 {"",S_FALSE}
6400 {Uri_HOST_DNS,S_OK},
6401 {0,S_FALSE},
6402 {URL_SCHEME_FILE,S_OK},
6403 {URLZONE_INVALID,E_NOTIMPL}
6406 /* URL_DONT_SIMPLIFY has no effect. */
6407 { "http://google.com/test",0,
6408 "zip://test.com/cool/../cool/test",0,
6409 URL_DONT_SIMPLIFY,S_OK,FALSE,
6411 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6412 {"test.com",S_OK},
6413 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6414 {"test.com",S_OK},
6415 {"",S_FALSE},
6416 {"",S_FALSE},
6417 {"test.com",S_OK},
6418 {"",S_FALSE},
6419 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6420 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6421 {"",S_FALSE},
6422 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6423 * On IE 7 it reduces the path in the Raw URI.
6425 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6426 {"zip",S_OK},
6427 {"",S_FALSE},
6428 {"",S_FALSE}
6431 {Uri_HOST_DNS,S_OK},
6432 {0,S_FALSE},
6433 {URL_SCHEME_UNKNOWN,S_OK},
6434 {URLZONE_INVALID,E_NOTIMPL}
6437 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6438 * resulting URI is converted into a dos path.
6440 { "http://google.com/test",0,
6441 "file:///c:/test/",0,
6442 URL_FILE_USE_PATHURL,S_OK,FALSE,
6444 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6445 {"",S_FALSE},
6446 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6447 {"",S_FALSE},
6448 {"",S_FALSE},
6449 {"",S_FALSE},
6450 {"",S_FALSE},
6451 {"",S_FALSE},
6452 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6453 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6454 {"",S_FALSE},
6455 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6456 {"file",S_OK},
6457 {"",S_FALSE},
6458 {"",S_FALSE}
6461 {Uri_HOST_UNKNOWN,S_OK},
6462 {0,S_FALSE},
6463 {URL_SCHEME_FILE,S_OK},
6464 {URLZONE_INVALID,E_NOTIMPL}
6467 { "http://google.com/test",0,
6468 "http://test.com/test#%30test",0,
6469 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6471 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6472 {"test.com",S_OK},
6473 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6474 {"test.com",S_OK},
6475 {"",S_FALSE},
6476 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6477 {"test.com",S_OK},
6478 {"",S_FALSE},
6479 {"/test",S_OK},
6480 {"/test",S_OK},
6481 {"",S_FALSE},
6482 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6483 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6484 {"http",S_OK},
6485 {"",S_FALSE},
6486 {"",S_FALSE}
6489 {Uri_HOST_DNS,S_OK},
6490 {80,S_OK},
6491 {URL_SCHEME_HTTP,S_OK},
6492 {URLZONE_INVALID,E_NOTIMPL}
6495 /* Windows validates the path component from the relative Uri. */
6496 { "http://google.com/test",0,
6497 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6498 0,E_INVALIDARG,FALSE
6500 /* Windows doesn't validate the query from the relative Uri. */
6501 { "http://google.com/test",0,
6502 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6503 0,S_OK,FALSE,
6505 {"http://google.com/test?Tes%XXt",S_OK},
6506 {"google.com",S_OK},
6507 {"http://google.com/test?Tes%XXt",S_OK},
6508 {"google.com",S_OK},
6509 {"",S_FALSE},
6510 {"",S_FALSE},
6511 {"google.com",S_OK},
6512 {"",S_FALSE},
6513 {"/test",S_OK},
6514 {"/test?Tes%XXt",S_OK},
6515 {"?Tes%XXt",S_OK},
6516 {"http://google.com/test?Tes%XXt",S_OK},
6517 {"http",S_OK},
6518 {"",S_FALSE},
6519 {"",S_FALSE}
6522 {Uri_HOST_DNS,S_OK},
6523 {80,S_OK},
6524 {URL_SCHEME_HTTP,S_OK},
6525 {URLZONE_INVALID,E_NOTIMPL}
6528 /* Windows doesn't validate the fragment from the relative Uri. */
6529 { "http://google.com/test",0,
6530 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6531 0,S_OK,FALSE,
6533 {"http://google.com/test#Tes%XXt",S_OK},
6534 {"google.com",S_OK},
6535 {"http://google.com/test#Tes%XXt",S_OK},
6536 {"google.com",S_OK},
6537 {"",S_FALSE},
6538 {"#Tes%XXt",S_OK},
6539 {"google.com",S_OK},
6540 {"",S_FALSE},
6541 {"/test",S_OK},
6542 {"/test",S_OK},
6543 {"",S_FALSE},
6544 {"http://google.com/test#Tes%XXt",S_OK},
6545 {"http",S_OK},
6546 {"",S_FALSE},
6547 {"",S_FALSE}
6550 {Uri_HOST_DNS,S_OK},
6551 {80,S_OK},
6552 {URL_SCHEME_HTTP,S_OK},
6553 {URLZONE_INVALID,E_NOTIMPL}
6556 /* Creates an IUri which contains an invalid dos path char. */
6557 { "file:///c:/test",0,
6558 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6559 URL_FILE_USE_PATHURL,S_OK,FALSE,
6561 {"file://c:\\test<ing",S_OK},
6562 {"",S_FALSE},
6563 {"file://c:\\test<ing",S_OK},
6564 {"",S_FALSE},
6565 {"",S_FALSE},
6566 {"",S_FALSE},
6567 {"",S_FALSE},
6568 {"",S_FALSE},
6569 {"c:\\test<ing",S_OK},
6570 {"c:\\test<ing",S_OK},
6571 {"",S_FALSE},
6572 {"file://c:\\test<ing",S_OK},
6573 {"file",S_OK},
6574 {"",S_FALSE},
6575 {"",S_FALSE}
6578 {Uri_HOST_UNKNOWN,S_OK},
6579 {0,S_FALSE},
6580 {URL_SCHEME_FILE,S_OK},
6581 {URLZONE_INVALID,E_NOTIMPL}
6584 /* Appends the path after the drive letter (if any). */
6585 { "file:///c:/test",0,
6586 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6587 0,S_OK,FALSE,
6589 {"file:///c:/c:/testing",S_OK},
6590 {"",S_FALSE},
6591 {"file:///c:/c:/testing",S_OK},
6592 {"",S_FALSE},
6593 {"",S_FALSE},
6594 {"",S_FALSE},
6595 {"",S_FALSE},
6596 {"",S_FALSE},
6597 {"/c:/c:/testing",S_OK},
6598 {"/c:/c:/testing",S_OK},
6599 {"",S_FALSE},
6600 {"file:///c:/c:/testing",S_OK},
6601 {"file",S_OK},
6602 {"",S_FALSE},
6603 {"",S_FALSE}
6606 {Uri_HOST_UNKNOWN,S_OK},
6607 {0,S_FALSE},
6608 {URL_SCHEME_FILE,S_OK},
6609 {URLZONE_INVALID,E_NOTIMPL}
6612 /* A '/' is added if the base URI doesn't have a path and the
6613 * relative URI doesn't contain a path (since the base URI is
6614 * hierarchical.
6616 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6617 "?test",Uri_CREATE_ALLOW_RELATIVE,
6618 0,S_OK,FALSE,
6620 {"http://google.com/?test",S_OK},
6621 {"google.com",S_OK},
6622 {"http://google.com/?test",S_OK},
6623 {"google.com",S_OK},
6624 {"",S_FALSE},
6625 {"",S_FALSE},
6626 {"google.com",S_OK},
6627 {"",S_FALSE},
6628 {"/",S_OK},
6629 {"/?test",S_OK},
6630 {"?test",S_OK},
6631 {"http://google.com/?test",S_OK},
6632 {"http",S_OK},
6633 {"",S_FALSE},
6634 {"",S_FALSE}
6637 {Uri_HOST_DNS,S_OK},
6638 {80,S_OK},
6639 {URL_SCHEME_HTTP,S_OK},
6640 {URLZONE_INVALID,E_NOTIMPL}
6643 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6644 "?test",Uri_CREATE_ALLOW_RELATIVE,
6645 0,S_OK,FALSE,
6647 {"zip://google.com/?test",S_OK},
6648 {"google.com",S_OK},
6649 {"zip://google.com/?test",S_OK},
6650 {"google.com",S_OK},
6651 {"",S_FALSE},
6652 {"",S_FALSE},
6653 {"google.com",S_OK},
6654 {"",S_FALSE},
6655 {"/",S_OK},
6656 {"/?test",S_OK},
6657 {"?test",S_OK},
6658 {"zip://google.com/?test",S_OK},
6659 {"zip",S_OK},
6660 {"",S_FALSE},
6661 {"",S_FALSE}
6664 {Uri_HOST_DNS,S_OK},
6665 {0,S_FALSE},
6666 {URL_SCHEME_UNKNOWN,S_OK},
6667 {URLZONE_INVALID,E_NOTIMPL}
6670 /* No path is appended since the base URI is opaque. */
6671 { "zip:?testing",0,
6672 "?test",Uri_CREATE_ALLOW_RELATIVE,
6673 0,S_OK,FALSE,
6675 {"zip:?test",S_OK},
6676 {"",S_FALSE},
6677 {"zip:?test",S_OK},
6678 {"",S_FALSE},
6679 {"",S_FALSE},
6680 {"",S_FALSE},
6681 {"",S_FALSE},
6682 {"",S_FALSE},
6683 {"",S_OK},
6684 {"?test",S_OK},
6685 {"?test",S_OK},
6686 {"zip:?test",S_OK},
6687 {"zip",S_OK},
6688 {"",S_FALSE},
6689 {"",S_FALSE}
6692 {Uri_HOST_UNKNOWN,S_OK},
6693 {0,S_FALSE},
6694 {URL_SCHEME_UNKNOWN,S_OK},
6695 {URLZONE_INVALID,E_NOTIMPL}
6698 { "file:///c:/",0,
6699 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6700 0,S_OK,FALSE,
6702 {"file:///c:/testing/test",S_OK},
6703 {"",S_FALSE},
6704 {"file:///c:/testing/test",S_OK},
6705 {"",S_FALSE},
6706 {"",S_FALSE},
6707 {"",S_FALSE},
6708 {"",S_FALSE},
6709 {"",S_FALSE},
6710 {"/c:/testing/test",S_OK},
6711 {"/c:/testing/test",S_OK},
6712 {"",S_FALSE},
6713 {"file:///c:/testing/test",S_OK},
6714 {"file",S_OK},
6715 {"",S_FALSE},
6716 {"",S_FALSE}
6719 {Uri_HOST_UNKNOWN,S_OK},
6720 {0,S_FALSE},
6721 {URL_SCHEME_FILE,S_OK},
6722 {URLZONE_INVALID,E_NOTIMPL}
6725 { "http://winehq.org/dir/testfile",0,
6726 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6727 0,S_OK,FALSE,
6729 {"http://winehq.org/dir/test?querystring",S_OK},
6730 {"winehq.org",S_OK},
6731 {"http://winehq.org/dir/test?querystring",S_OK},
6732 {"winehq.org",S_OK},
6733 {"",S_FALSE},
6734 {"",S_FALSE},
6735 {"winehq.org",S_OK},
6736 {"",S_FALSE},
6737 {"/dir/test",S_OK},
6738 {"/dir/test?querystring",S_OK},
6739 {"?querystring",S_OK},
6740 {"http://winehq.org/dir/test?querystring",S_OK},
6741 {"http",S_OK},
6742 {"",S_FALSE},
6743 {"",S_FALSE}
6746 {Uri_HOST_DNS,S_OK},
6747 {80,S_OK},
6748 {URL_SCHEME_HTTP,S_OK},
6749 {URLZONE_INVALID,E_NOTIMPL}
6752 { "http://winehq.org/dir/test",0,
6753 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6754 0,S_OK,FALSE,
6756 {"http://winehq.org/dir/test?querystring",S_OK},
6757 {"winehq.org",S_OK},
6758 {"http://winehq.org/dir/test?querystring",S_OK},
6759 {"winehq.org",S_OK},
6760 {"",S_FALSE},
6761 {"",S_FALSE},
6762 {"winehq.org",S_OK},
6763 {"",S_FALSE},
6764 {"/dir/test",S_OK},
6765 {"/dir/test?querystring",S_OK},
6766 {"?querystring",S_OK},
6767 {"http://winehq.org/dir/test?querystring",S_OK},
6768 {"http",S_OK},
6769 {"",S_FALSE},
6770 {"",S_FALSE}
6773 {Uri_HOST_DNS,S_OK},
6774 {80,S_OK},
6775 {URL_SCHEME_HTTP,S_OK},
6776 {URLZONE_INVALID,E_NOTIMPL}
6779 { "http://winehq.org/dir/test?querystring",0,
6780 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6781 0,S_OK,FALSE,
6783 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6784 {"winehq.org",S_OK},
6785 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6786 {"winehq.org",S_OK},
6787 {"",S_FALSE},
6788 {"#hash",S_OK},
6789 {"winehq.org",S_OK},
6790 {"",S_FALSE},
6791 {"/dir/test",S_OK},
6792 {"/dir/test?querystring",S_OK},
6793 {"?querystring",S_OK},
6794 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6795 {"http",S_OK},
6796 {"",S_FALSE},
6797 {"",S_FALSE}
6800 {Uri_HOST_DNS,S_OK},
6801 {80,S_OK},
6802 {URL_SCHEME_HTTP,S_OK},
6803 {URLZONE_INVALID,E_NOTIMPL}
6806 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6807 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6808 0,S_OK,FALSE,
6810 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6811 {"",S_FALSE},
6812 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6813 {"",S_FALSE},
6814 {".txt",S_OK},
6815 {"",S_FALSE},
6816 {"",S_FALSE},
6817 {"",S_FALSE},
6818 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6819 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6820 {"",S_FALSE},
6821 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6822 {"mk",S_OK},
6823 {"",S_FALSE},
6824 {"",S_FALSE}
6827 {Uri_HOST_UNKNOWN,S_OK},
6828 {0,S_FALSE},
6829 {URL_SCHEME_MK,S_OK},
6830 {URLZONE_INVALID,E_NOTIMPL}
6833 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6834 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6835 0,S_OK,FALSE,
6837 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6838 {"",S_FALSE},
6839 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6840 {"",S_FALSE},
6841 {".txt",S_OK},
6842 {"",S_FALSE},
6843 {"",S_FALSE},
6844 {"",S_FALSE},
6845 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6846 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6847 {"",S_FALSE},
6848 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6849 {"mk",S_OK},
6850 {"",S_FALSE},
6851 {"",S_FALSE}
6854 {Uri_HOST_UNKNOWN,S_OK},
6855 {0,S_FALSE},
6856 {URL_SCHEME_MK,S_OK},
6857 {URLZONE_INVALID,E_NOTIMPL}
6860 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6861 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6862 0,S_OK,FALSE,
6864 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6865 {"",S_FALSE},
6866 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6867 {"",S_FALSE},
6868 {".txt",S_OK},
6869 {"",S_FALSE},
6870 {"",S_FALSE},
6871 {"",S_FALSE},
6872 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6873 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6874 {"",S_FALSE},
6875 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6876 {"mk",S_OK},
6877 {"",S_FALSE},
6878 {"",S_FALSE}
6881 {Uri_HOST_UNKNOWN,S_OK},
6882 {0,S_FALSE},
6883 {URL_SCHEME_MK,S_OK},
6884 {URLZONE_INVALID,E_NOTIMPL}
6887 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6888 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6889 0,S_OK,FALSE,
6891 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6892 {"",S_FALSE},
6893 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6894 {"",S_FALSE},
6895 {".txt",S_OK},
6896 {"",S_FALSE},
6897 {"",S_FALSE},
6898 {"",S_FALSE},
6899 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6900 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6901 {"",S_FALSE},
6902 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6903 {"mk",S_OK},
6904 {"",S_FALSE},
6905 {"",S_FALSE}
6908 {Uri_HOST_UNKNOWN,S_OK},
6909 {0,S_FALSE},
6910 {URL_SCHEME_MK,S_OK},
6911 {URLZONE_INVALID,E_NOTIMPL}
6914 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6915 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6916 0,S_OK,FALSE,
6918 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6919 {"",S_FALSE},
6920 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6921 {"",S_FALSE},
6922 {".txt",S_OK},
6923 {"",S_FALSE},
6924 {"",S_FALSE},
6925 {"",S_FALSE},
6926 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6927 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6928 {"",S_FALSE},
6929 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK},
6930 {"mk",S_OK},
6931 {"",S_FALSE},
6932 {"",S_FALSE}
6935 {Uri_HOST_UNKNOWN,S_OK},
6936 {0,S_FALSE},
6937 {URL_SCHEME_MK,S_OK},
6938 {URLZONE_INVALID,E_NOTIMPL}
6941 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6942 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6943 0,S_OK,FALSE,
6945 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6946 {"",S_FALSE},
6947 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6948 {"",S_FALSE},
6949 {".txt",S_OK},
6950 {"",S_FALSE},
6951 {"",S_FALSE},
6952 {"",S_FALSE},
6953 {"@MSITSTORE:/relative/path.txt",S_OK},
6954 {"@MSITSTORE:/relative/path.txt",S_OK},
6955 {"",S_FALSE},
6956 {"mk:@MSITSTORE:/relative/path.txt",S_OK},
6957 {"mk",S_OK},
6958 {"",S_FALSE},
6959 {"",S_FALSE}
6962 {Uri_HOST_UNKNOWN,S_OK},
6963 {0,S_FALSE},
6964 {URL_SCHEME_MK,S_OK},
6965 {URLZONE_INVALID,E_NOTIMPL}
6968 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6969 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6970 0,S_OK,FALSE,
6972 {"mk:@xxx:/relative/path.txt",S_OK},
6973 {"",S_FALSE},
6974 {"mk:@xxx:/relative/path.txt",S_OK},
6975 {"",S_FALSE},
6976 {".txt",S_OK},
6977 {"",S_FALSE},
6978 {"",S_FALSE},
6979 {"",S_FALSE},
6980 {"@xxx:/relative/path.txt",S_OK},
6981 {"@xxx:/relative/path.txt",S_OK},
6982 {"",S_FALSE},
6983 {"mk:@xxx:/relative/path.txt",S_OK},
6984 {"mk",S_OK},
6985 {"",S_FALSE},
6986 {"",S_FALSE}
6989 {Uri_HOST_UNKNOWN,S_OK},
6990 {0,S_FALSE},
6991 {URL_SCHEME_MK,S_OK},
6992 {URLZONE_INVALID,E_NOTIMPL}
6995 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
6996 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6997 0,S_OK,FALSE,
6999 {"mk:/relative/path.txt",S_OK},
7000 {"",S_FALSE},
7001 {"mk:/relative/path.txt",S_OK},
7002 {"",S_FALSE},
7003 {".txt",S_OK},
7004 {"",S_FALSE},
7005 {"",S_FALSE},
7006 {"",S_FALSE},
7007 {"/relative/path.txt",S_OK},
7008 {"/relative/path.txt",S_OK},
7009 {"",S_FALSE},
7010 {"mk:/relative/path.txt",S_OK},
7011 {"mk",S_OK},
7012 {"",S_FALSE},
7013 {"",S_FALSE}
7016 {Uri_HOST_UNKNOWN,S_OK},
7017 {0,S_FALSE},
7018 {URL_SCHEME_MK,S_OK},
7019 {URLZONE_INVALID,E_NOTIMPL}
7022 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7023 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
7024 0,S_OK,FALSE,
7026 {"ml:/relative/path.txt",S_OK},
7027 {"",S_FALSE},
7028 {"ml:/relative/path.txt",S_OK},
7029 {"",S_FALSE},
7030 {".txt",S_OK},
7031 {"",S_FALSE},
7032 {"",S_FALSE},
7033 {"",S_FALSE},
7034 {"/relative/path.txt",S_OK},
7035 {"/relative/path.txt",S_OK},
7036 {"",S_FALSE},
7037 {"ml:/relative/path.txt",S_OK},
7038 {"ml",S_OK},
7039 {"",S_FALSE},
7040 {"",S_FALSE}
7043 {Uri_HOST_UNKNOWN,S_OK},
7044 {0,S_FALSE},
7045 {URL_SCHEME_UNKNOWN,S_OK},
7046 {URLZONE_INVALID,E_NOTIMPL}
7049 { "http://winehq.org/dir/test?querystring",0,
7050 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
7051 0,S_OK,FALSE,
7053 {"http://winehq.com/#hash",S_OK},
7054 {"winehq.com",S_OK},
7055 {"http://winehq.com/#hash",S_OK},
7056 {"winehq.com",S_OK},
7057 {"",S_FALSE},
7058 {"#hash",S_OK},
7059 {"winehq.com",S_OK},
7060 {"",S_FALSE},
7061 {"/",S_OK},
7062 {"/",S_OK},
7063 {"",S_FALSE},
7064 {"http://winehq.com/#hash",S_OK},
7065 {"http",S_OK},
7066 {"",S_FALSE},
7067 {"",S_FALSE}
7070 {Uri_HOST_DNS,S_OK},
7071 {80,S_OK,FALSE,TRUE},
7072 {URL_SCHEME_HTTP,S_OK},
7073 {URLZONE_INVALID,E_NOTIMPL}
7076 { "http://winehq.org/dir/test?querystring",0,
7077 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
7078 0,S_OK,FALSE,
7080 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7081 {"winehq.com",S_OK},
7082 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7083 {"winehq.com",S_OK},
7084 {".txt",S_OK},
7085 {"#hash",S_OK},
7086 {"winehq.com",S_OK},
7087 {"",S_FALSE},
7088 {"/dir/file.txt",S_OK},
7089 {"/dir/file.txt?query",S_OK},
7090 {"?query",S_OK},
7091 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
7092 {"http",S_OK},
7093 {"",S_FALSE},
7094 {"",S_FALSE}
7097 {Uri_HOST_DNS,S_OK},
7098 {80,S_OK,FALSE,TRUE},
7099 {URL_SCHEME_HTTP,S_OK},
7100 {URLZONE_INVALID,E_NOTIMPL}
7103 { "http://google.com/test",0,
7104 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7105 0,S_OK,FALSE,
7107 {"file:///c:/test/",S_OK},
7108 {"",S_FALSE},
7109 {"file:///c:/test/",S_OK},
7110 {"",S_FALSE},
7111 {"",S_FALSE},
7112 {"",S_FALSE},
7113 {"",S_FALSE},
7114 {"",S_FALSE},
7115 {"/c:/test/",S_OK},
7116 {"/c:/test/",S_OK},
7117 {"",S_FALSE},
7118 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7119 {"file",S_OK},
7120 {"",S_FALSE},
7121 {"",S_FALSE}
7124 {Uri_HOST_UNKNOWN,S_OK},
7125 {0,S_FALSE},
7126 {URL_SCHEME_FILE,S_OK},
7127 {URLZONE_INVALID,E_NOTIMPL}
7130 { "http://google.com/test",0,
7131 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
7132 0,S_OK,FALSE,
7134 {"file:///c:/test/",S_OK},
7135 {"",S_FALSE},
7136 {"file:///c:/test/",S_OK},
7137 {"",S_FALSE},
7138 {"",S_FALSE},
7139 {"",S_FALSE},
7140 {"",S_FALSE},
7141 {"",S_FALSE},
7142 {"/c:/test/",S_OK},
7143 {"/c:/test/",S_OK},
7144 {"",S_FALSE},
7145 {"c:\\test\\",S_OK,FALSE,"file:///c:/test/"},
7146 {"file",S_OK},
7147 {"",S_FALSE},
7148 {"",S_FALSE}
7151 {Uri_HOST_UNKNOWN,S_OK},
7152 {0,S_FALSE},
7153 {URL_SCHEME_FILE,S_OK},
7154 {URLZONE_INVALID,E_NOTIMPL}
7157 { "http://winehq.org",0,
7158 "mailto://",Uri_CREATE_NO_CANONICALIZE,
7159 0,S_OK,FALSE,
7161 {"mailto:",S_OK},
7162 {"",S_FALSE},
7163 {"mailto:",S_OK},
7164 {"",S_FALSE},
7165 {"",S_FALSE},
7166 {"",S_FALSE},
7167 {"",S_FALSE},
7168 {"",S_FALSE},
7169 {"",S_FALSE},
7170 {"",S_FALSE},
7171 {"",S_FALSE},
7172 {"mailto://",S_OK,FALSE,"mailto:"},
7173 {"mailto",S_OK},
7174 {"",S_FALSE},
7175 {"",S_FALSE}
7178 {Uri_HOST_UNKNOWN,S_OK},
7179 {0,S_FALSE},
7180 {URL_SCHEME_MAILTO,S_OK},
7181 {URLZONE_INVALID,E_NOTIMPL}
7184 { "http://winehq.org",0,
7185 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE,
7186 0,S_OK,FALSE,
7188 {"mailto:a@b.com",S_OK},
7189 {"",S_FALSE},
7190 {"mailto:a@b.com",S_OK},
7191 {"",S_FALSE},
7192 {".com",S_OK},
7193 {"",S_FALSE},
7194 {"",S_FALSE},
7195 {"",S_FALSE},
7196 {"a@b.com",S_OK},
7197 {"a@b.com",S_OK},
7198 {"",S_FALSE},
7199 {"mailto://a@b.com",S_OK,FALSE,"mailto:a@b.com"},
7200 {"mailto",S_OK},
7201 {"",S_FALSE},
7202 {"",S_FALSE}
7205 {Uri_HOST_UNKNOWN,S_OK},
7206 {0,S_FALSE},
7207 {URL_SCHEME_MAILTO,S_OK},
7208 {URLZONE_INVALID,E_NOTIMPL}
7213 typedef struct _uri_parse_test {
7214 const char *uri;
7215 DWORD uri_flags;
7216 PARSEACTION action;
7217 DWORD flags;
7218 const char *property;
7219 HRESULT expected;
7220 BOOL todo;
7221 } uri_parse_test;
7223 static const uri_parse_test uri_parse_tests[] = {
7224 /* PARSE_CANONICALIZE tests. */
7225 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
7226 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
7227 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
7228 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
7229 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
7230 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
7231 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
7232 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
7233 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
7234 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
7235 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
7236 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
7238 /* PARSE_FRIENDLY tests. */
7239 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
7240 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
7242 /* PARSE_ROOTDOCUMENT tests. */
7243 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
7244 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
7245 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7246 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7247 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7248 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
7250 /* PARSE_DOCUMENT tests. */
7251 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
7252 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7253 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7254 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7255 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7256 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
7258 /* PARSE_PATH_FROM_URL tests. */
7259 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
7260 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
7261 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
7262 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
7263 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
7265 /* PARSE_URL_FROM_PATH tests. */
7266 /* This function almost seems to useless (just returns the absolute uri). */
7267 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
7268 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
7269 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
7270 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7271 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
7273 /* PARSE_SCHEMA tests. */
7274 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
7275 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
7277 /* PARSE_SITE tests. */
7278 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
7279 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
7280 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
7281 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
7283 /* PARSE_DOMAIN tests. */
7284 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
7285 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
7286 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
7287 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
7289 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7290 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
7291 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
7292 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
7293 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
7296 static inline LPWSTR a2w(LPCSTR str) {
7297 LPWSTR ret = NULL;
7299 if(str) {
7300 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
7301 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
7302 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
7305 return ret;
7308 static inline BOOL heap_free(void* mem) {
7309 return HeapFree(GetProcessHeap(), 0, mem);
7312 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
7313 LPWSTR strAW = a2w(strA);
7314 DWORD ret = lstrcmpW(strAW, strB);
7315 heap_free(strAW);
7316 return ret;
7319 static inline ULONG get_refcnt(IUri *uri) {
7320 IUri_AddRef(uri);
7321 return IUri_Release(uri);
7324 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
7325 DWORD test_index) {
7326 HRESULT hr;
7327 LPWSTR valueW;
7329 valueW = a2w(prop->value);
7330 switch(prop->property) {
7331 case Uri_PROPERTY_FRAGMENT:
7332 hr = IUriBuilder_SetFragment(builder, valueW);
7333 if(prop->todo) {
7334 todo_wine {
7335 ok(hr == prop->expected,
7336 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7337 hr, prop->expected, test_index);
7339 } else {
7340 ok(hr == prop->expected,
7341 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7342 hr, prop->expected, test_index);
7344 break;
7345 case Uri_PROPERTY_HOST:
7346 hr = IUriBuilder_SetHost(builder, valueW);
7347 if(prop->todo) {
7348 todo_wine {
7349 ok(hr == prop->expected,
7350 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7351 hr, prop->expected, test_index);
7353 } else {
7354 ok(hr == prop->expected,
7355 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7356 hr, prop->expected, test_index);
7358 break;
7359 case Uri_PROPERTY_PASSWORD:
7360 hr = IUriBuilder_SetPassword(builder, valueW);
7361 if(prop->todo) {
7362 todo_wine {
7363 ok(hr == prop->expected,
7364 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7365 hr, prop->expected, test_index);
7367 } else {
7368 ok(hr == prop->expected,
7369 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7370 hr, prop->expected, test_index);
7372 break;
7373 case Uri_PROPERTY_PATH:
7374 hr = IUriBuilder_SetPath(builder, valueW);
7375 if(prop->todo) {
7376 todo_wine {
7377 ok(hr == prop->expected,
7378 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7379 hr, prop->expected, test_index);
7381 } else {
7382 ok(hr == prop->expected,
7383 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7384 hr, prop->expected, test_index);
7386 break;
7387 case Uri_PROPERTY_QUERY:
7388 hr = IUriBuilder_SetQuery(builder, valueW);
7389 if(prop->todo) {
7390 todo_wine {
7391 ok(hr == prop->expected,
7392 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7393 hr, prop->expected, test_index);
7395 } else {
7396 ok(hr == prop->expected,
7397 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7398 hr, prop->expected, test_index);
7400 break;
7401 case Uri_PROPERTY_SCHEME_NAME:
7402 hr = IUriBuilder_SetSchemeName(builder, valueW);
7403 if(prop->todo) {
7404 todo_wine {
7405 ok(hr == prop->expected,
7406 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7407 hr, prop->expected, test_index);
7409 } else {
7410 ok(hr == prop->expected,
7411 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7412 hr, prop->expected, test_index);
7414 break;
7415 case Uri_PROPERTY_USER_NAME:
7416 hr = IUriBuilder_SetUserName(builder, valueW);
7417 if(prop->todo) {
7418 todo_wine {
7419 ok(hr == prop->expected,
7420 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7421 hr, prop->expected, test_index);
7423 } else {
7424 ok(hr == prop->expected,
7425 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7426 hr, prop->expected, test_index);
7428 break;
7429 default:
7430 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
7433 heap_free(valueW);
7437 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7438 * correctly.
7440 static void test_CreateUri_InvalidFlags(void) {
7441 DWORD i;
7443 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7444 HRESULT hr;
7445 IUri *uri = (void*) 0xdeadbeef;
7447 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
7448 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7449 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7450 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
7454 static void test_CreateUri_InvalidArgs(void) {
7455 HRESULT hr;
7456 IUri *uri = (void*) 0xdeadbeef;
7458 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7459 static const WCHAR emptyW[] = {0};
7461 hr = pCreateUri(http_urlW, 0, 0, NULL);
7462 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7464 hr = pCreateUri(NULL, 0, 0, &uri);
7465 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7466 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7468 uri = (void*) 0xdeadbeef;
7469 hr = pCreateUri(invalidW, 0, 0, &uri);
7470 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7471 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7473 uri = (void*) 0xdeadbeef;
7474 hr = pCreateUri(emptyW, 0, 0, &uri);
7475 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7476 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7479 static void test_CreateUri_InvalidUri(void) {
7480 DWORD i;
7482 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7483 invalid_uri test = invalid_uri_tests[i];
7484 IUri *uri = NULL;
7485 LPWSTR uriW;
7486 HRESULT hr;
7488 uriW = a2w(test.uri);
7489 hr = pCreateUri(uriW, test.flags, 0, &uri);
7490 if(test.todo) {
7491 todo_wine {
7492 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7493 hr, E_INVALIDARG, i);
7495 } else {
7496 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7497 hr, E_INVALIDARG, i);
7499 if(uri) IUri_Release(uri);
7501 heap_free(uriW);
7505 static void test_IUri_GetPropertyBSTR(void) {
7506 IUri *uri = NULL;
7507 HRESULT hr;
7508 DWORD i;
7510 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7511 hr = pCreateUri(http_urlW, 0, 0, &uri);
7512 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7513 if(SUCCEEDED(hr)) {
7514 BSTR received = NULL;
7516 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7517 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7519 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7520 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7521 ok(hr == E_INVALIDARG /* IE10 */ || broken(hr == S_OK), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr);
7522 if(SUCCEEDED(hr)) {
7523 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7524 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7525 SysFreeString(received);
7526 }else {
7527 ok(!received, "received = %s\n", wine_dbgstr_w(received));
7530 /* Make sure it handles the ZONE property correctly. */
7531 received = NULL;
7532 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7533 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7534 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7535 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7536 SysFreeString(received);
7538 if(uri) IUri_Release(uri);
7540 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7541 uri_properties test = uri_tests[i];
7542 LPWSTR uriW;
7543 uri = NULL;
7545 uriW = a2w(test.uri);
7546 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7547 if(test.create_todo) {
7548 todo_wine {
7549 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7550 hr, test.create_expected, i);
7552 } else {
7553 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7554 hr, test.create_expected, i);
7557 if(SUCCEEDED(hr)) {
7558 DWORD j;
7560 /* Checks all the string properties of the uri. */
7561 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7562 BSTR received = NULL;
7563 uri_str_property prop = test.str_props[j];
7565 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7566 if(prop.todo) {
7567 todo_wine {
7568 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7569 hr, prop.expected, i, j);
7571 todo_wine {
7572 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7573 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7574 prop.value, wine_dbgstr_w(received), i, j);
7576 } else {
7577 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7578 hr, prop.expected, i, j);
7579 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7580 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7581 prop.value, wine_dbgstr_w(received), i, j);
7584 SysFreeString(received);
7588 if(uri) IUri_Release(uri);
7590 heap_free(uriW);
7594 static void test_IUri_GetPropertyDWORD(void) {
7595 IUri *uri = NULL;
7596 HRESULT hr;
7597 DWORD i;
7599 hr = pCreateUri(http_urlW, 0, 0, &uri);
7600 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7601 if(SUCCEEDED(hr)) {
7602 DWORD received = 0xdeadbeef;
7604 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7605 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7607 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7608 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7609 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7611 if(uri) IUri_Release(uri);
7613 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7614 uri_properties test = uri_tests[i];
7615 LPWSTR uriW;
7616 uri = NULL;
7618 uriW = a2w(test.uri);
7619 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7620 if(test.create_todo) {
7621 todo_wine {
7622 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7623 hr, test.create_expected, i);
7625 } else {
7626 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7627 hr, test.create_expected, i);
7630 if(SUCCEEDED(hr)) {
7631 DWORD j;
7633 /* Checks all the DWORD properties of the uri. */
7634 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7635 DWORD received;
7636 uri_dword_property prop = test.dword_props[j];
7638 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7639 if(prop.todo) {
7640 todo_wine {
7641 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7642 hr, prop.expected, i, j);
7644 todo_wine {
7645 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7646 prop.value, received, i, j);
7648 } else {
7649 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7650 hr, prop.expected, i, j);
7651 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7652 prop.value, received, i, j);
7657 if(uri) IUri_Release(uri);
7659 heap_free(uriW);
7663 /* Tests all the 'Get*' property functions which deal with strings. */
7664 static void test_IUri_GetStrProperties(void) {
7665 IUri *uri = NULL;
7666 HRESULT hr;
7667 DWORD i;
7669 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7670 hr = pCreateUri(http_urlW, 0, 0, &uri);
7671 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7672 if(SUCCEEDED(hr)) {
7673 hr = IUri_GetAbsoluteUri(uri, NULL);
7674 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7676 hr = IUri_GetAuthority(uri, NULL);
7677 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7679 hr = IUri_GetDisplayUri(uri, NULL);
7680 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7682 hr = IUri_GetDomain(uri, NULL);
7683 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7685 hr = IUri_GetExtension(uri, NULL);
7686 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7688 hr = IUri_GetFragment(uri, NULL);
7689 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7691 hr = IUri_GetHost(uri, NULL);
7692 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7694 hr = IUri_GetPassword(uri, NULL);
7695 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7697 hr = IUri_GetPath(uri, NULL);
7698 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7700 hr = IUri_GetPathAndQuery(uri, NULL);
7701 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7703 hr = IUri_GetQuery(uri, NULL);
7704 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7706 hr = IUri_GetRawUri(uri, NULL);
7707 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7709 hr = IUri_GetSchemeName(uri, NULL);
7710 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7712 hr = IUri_GetUserInfo(uri, NULL);
7713 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7715 hr = IUri_GetUserName(uri, NULL);
7716 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7718 if(uri) IUri_Release(uri);
7720 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7721 uri_properties test = uri_tests[i];
7722 LPWSTR uriW;
7723 uri = NULL;
7725 uriW = a2w(test.uri);
7726 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7727 if(test.create_todo) {
7728 todo_wine {
7729 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7730 hr, test.create_expected, i);
7732 } else {
7733 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7734 hr, test.create_expected, i);
7737 if(SUCCEEDED(hr)) {
7738 uri_str_property prop;
7739 BSTR received = NULL;
7741 /* GetAbsoluteUri() tests. */
7742 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7743 hr = IUri_GetAbsoluteUri(uri, &received);
7744 if(prop.todo) {
7745 todo_wine {
7746 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7747 hr, prop.expected, i);
7749 todo_wine {
7750 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7751 "Error: Expected %s but got %s on uri_tests[%d].\n",
7752 prop.value, wine_dbgstr_w(received), i);
7754 } else {
7755 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7756 hr, prop.expected, i);
7757 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7758 "Error: Expected %s but got %s on uri_tests[%d].\n",
7759 prop.value, wine_dbgstr_w(received), i);
7761 SysFreeString(received);
7762 received = NULL;
7764 /* GetAuthority() tests. */
7765 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7766 hr = IUri_GetAuthority(uri, &received);
7767 if(prop.todo) {
7768 todo_wine {
7769 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7770 hr, prop.expected, i);
7772 todo_wine {
7773 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7774 prop.value, wine_dbgstr_w(received), i);
7776 } else {
7777 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7778 hr, prop.expected, i);
7779 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7780 prop.value, wine_dbgstr_w(received), i);
7782 SysFreeString(received);
7783 received = NULL;
7785 /* GetDisplayUri() tests. */
7786 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7787 hr = IUri_GetDisplayUri(uri, &received);
7788 if(prop.todo) {
7789 todo_wine {
7790 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7791 hr, prop.expected, i);
7793 todo_wine {
7794 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7795 "Error: Expected %s but got %s on uri_test[%d].\n",
7796 prop.value, wine_dbgstr_w(received), i);
7798 } else {
7799 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7800 hr, prop.expected, i);
7801 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7802 "Error: Expected %s but got %s on uri_tests[%d].\n",
7803 prop.value, wine_dbgstr_w(received), i);
7805 SysFreeString(received);
7806 received = NULL;
7808 /* GetDomain() tests. */
7809 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7810 hr = IUri_GetDomain(uri, &received);
7811 if(prop.todo) {
7812 todo_wine {
7813 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7814 hr, prop.expected, i);
7816 todo_wine {
7817 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7818 prop.value, wine_dbgstr_w(received), i);
7820 } else {
7821 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7822 hr, prop.expected, i);
7823 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7824 prop.value, wine_dbgstr_w(received), i);
7826 SysFreeString(received);
7827 received = NULL;
7829 /* GetExtension() tests. */
7830 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7831 hr = IUri_GetExtension(uri, &received);
7832 if(prop.todo) {
7833 todo_wine {
7834 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7835 hr, prop.expected, i);
7837 todo_wine {
7838 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7839 prop.value, wine_dbgstr_w(received), i);
7841 } else {
7842 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7843 hr, prop.expected, i);
7844 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7845 prop.value, wine_dbgstr_w(received), i);
7847 SysFreeString(received);
7848 received = NULL;
7850 /* GetFragment() tests. */
7851 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7852 hr = IUri_GetFragment(uri, &received);
7853 if(prop.todo) {
7854 todo_wine {
7855 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7856 hr, prop.expected, i);
7858 todo_wine {
7859 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7860 prop.value, wine_dbgstr_w(received), i);
7862 } else {
7863 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7864 hr, prop.expected, i);
7865 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7866 prop.value, wine_dbgstr_w(received), i);
7868 SysFreeString(received);
7869 received = NULL;
7871 /* GetHost() tests. */
7872 prop = test.str_props[Uri_PROPERTY_HOST];
7873 hr = IUri_GetHost(uri, &received);
7874 if(prop.todo) {
7875 todo_wine {
7876 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7877 hr, prop.expected, i);
7879 todo_wine {
7880 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7881 prop.value, wine_dbgstr_w(received), i);
7883 } else {
7884 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7885 hr, prop.expected, i);
7886 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7887 prop.value, wine_dbgstr_w(received), i);
7889 SysFreeString(received);
7890 received = NULL;
7892 /* GetPassword() tests. */
7893 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7894 hr = IUri_GetPassword(uri, &received);
7895 if(prop.todo) {
7896 todo_wine {
7897 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7898 hr, prop.expected, i);
7900 todo_wine {
7901 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7902 prop.value, wine_dbgstr_w(received), i);
7904 } else {
7905 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7906 hr, prop.expected, i);
7907 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7908 prop.value, wine_dbgstr_w(received), i);
7910 SysFreeString(received);
7911 received = NULL;
7913 /* GetPath() tests. */
7914 prop = test.str_props[Uri_PROPERTY_PATH];
7915 hr = IUri_GetPath(uri, &received);
7916 if(prop.todo) {
7917 todo_wine {
7918 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7919 hr, prop.expected, i);
7921 todo_wine {
7922 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7923 prop.value, wine_dbgstr_w(received), i);
7925 } else {
7926 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7927 hr, prop.expected, i);
7928 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7929 prop.value, wine_dbgstr_w(received), i);
7931 SysFreeString(received);
7932 received = NULL;
7934 /* GetPathAndQuery() tests. */
7935 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7936 hr = IUri_GetPathAndQuery(uri, &received);
7937 if(prop.todo) {
7938 todo_wine {
7939 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7940 hr, prop.expected, i);
7942 todo_wine {
7943 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7944 prop.value, wine_dbgstr_w(received), i);
7946 } else {
7947 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7948 hr, prop.expected, i);
7949 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7950 prop.value, wine_dbgstr_w(received), i);
7952 SysFreeString(received);
7953 received = NULL;
7955 /* GetQuery() tests. */
7956 prop = test.str_props[Uri_PROPERTY_QUERY];
7957 hr = IUri_GetQuery(uri, &received);
7958 if(prop.todo) {
7959 todo_wine {
7960 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7961 hr, prop.expected, i);
7963 todo_wine {
7964 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7965 prop.value, wine_dbgstr_w(received), i);
7967 } else {
7968 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7969 hr, prop.expected, i);
7970 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7971 prop.value, wine_dbgstr_w(received), i);
7973 SysFreeString(received);
7974 received = NULL;
7976 /* GetRawUri() tests. */
7977 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7978 hr = IUri_GetRawUri(uri, &received);
7979 if(prop.todo) {
7980 todo_wine {
7981 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7982 hr, prop.expected, i);
7984 todo_wine {
7985 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7986 prop.value, wine_dbgstr_w(received), i);
7988 } else {
7989 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7990 hr, prop.expected, i);
7991 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7992 prop.value, wine_dbgstr_w(received), i);
7994 SysFreeString(received);
7995 received = NULL;
7997 /* GetSchemeName() tests. */
7998 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7999 hr = IUri_GetSchemeName(uri, &received);
8000 if(prop.todo) {
8001 todo_wine {
8002 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8003 hr, prop.expected, i);
8005 todo_wine {
8006 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8007 prop.value, wine_dbgstr_w(received), i);
8009 } else {
8010 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8011 hr, prop.expected, i);
8012 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8013 prop.value, wine_dbgstr_w(received), i);
8015 SysFreeString(received);
8016 received = NULL;
8018 /* GetUserInfo() tests. */
8019 prop = test.str_props[Uri_PROPERTY_USER_INFO];
8020 hr = IUri_GetUserInfo(uri, &received);
8021 if(prop.todo) {
8022 todo_wine {
8023 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8024 hr, prop.expected, i);
8026 todo_wine {
8027 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8028 prop.value, wine_dbgstr_w(received), i);
8030 } else {
8031 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8032 hr, prop.expected, i);
8033 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8034 prop.value, wine_dbgstr_w(received), i);
8036 SysFreeString(received);
8037 received = NULL;
8039 /* GetUserName() tests. */
8040 prop = test.str_props[Uri_PROPERTY_USER_NAME];
8041 hr = IUri_GetUserName(uri, &received);
8042 if(prop.todo) {
8043 todo_wine {
8044 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8045 hr, prop.expected, i);
8047 todo_wine {
8048 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8049 prop.value, wine_dbgstr_w(received), i);
8051 } else {
8052 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8053 hr, prop.expected, i);
8054 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
8055 prop.value, wine_dbgstr_w(received), i);
8057 SysFreeString(received);
8060 if(uri) IUri_Release(uri);
8062 heap_free(uriW);
8066 static void test_IUri_GetDwordProperties(void) {
8067 IUri *uri = NULL;
8068 HRESULT hr;
8069 DWORD i;
8071 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8072 hr = pCreateUri(http_urlW, 0, 0, &uri);
8073 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8074 if(SUCCEEDED(hr)) {
8075 hr = IUri_GetHostType(uri, NULL);
8076 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8078 hr = IUri_GetPort(uri, NULL);
8079 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8081 hr = IUri_GetScheme(uri, NULL);
8082 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8084 hr = IUri_GetZone(uri, NULL);
8085 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8087 if(uri) IUri_Release(uri);
8089 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8090 uri_properties test = uri_tests[i];
8091 LPWSTR uriW;
8092 uri = NULL;
8094 uriW = a2w(test.uri);
8095 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8096 if(test.create_todo) {
8097 todo_wine {
8098 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8099 hr, test.create_expected, i);
8101 } else {
8102 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8103 hr, test.create_expected, i);
8106 if(SUCCEEDED(hr)) {
8107 uri_dword_property prop;
8108 DWORD received;
8110 /* Assign an insane value so tests don't accidentally pass when
8111 * they shouldn't!
8113 received = -9999999;
8115 /* GetHostType() tests. */
8116 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
8117 hr = IUri_GetHostType(uri, &received);
8118 if(prop.todo) {
8119 todo_wine {
8120 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8121 hr, prop.expected, i);
8123 todo_wine {
8124 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8126 } else {
8127 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8128 hr, prop.expected, i);
8129 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8131 received = -9999999;
8133 /* GetPort() tests. */
8134 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
8135 hr = IUri_GetPort(uri, &received);
8136 if(prop.todo) {
8137 todo_wine {
8138 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8139 hr, prop.expected, i);
8141 todo_wine {
8142 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8144 } else {
8145 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8146 hr, prop.expected, i);
8147 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8149 received = -9999999;
8151 /* GetScheme() tests. */
8152 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
8153 hr = IUri_GetScheme(uri, &received);
8154 if(prop.todo) {
8155 todo_wine {
8156 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8157 hr, prop.expected, i);
8159 todo_wine {
8160 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8162 } else {
8163 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8164 hr, prop.expected, i);
8165 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8167 received = -9999999;
8169 /* GetZone() tests. */
8170 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
8171 hr = IUri_GetZone(uri, &received);
8172 if(prop.todo) {
8173 todo_wine {
8174 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8175 hr, prop.expected, i);
8177 todo_wine {
8178 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8180 } else {
8181 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8182 hr, prop.expected, i);
8183 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
8187 if(uri) IUri_Release(uri);
8189 heap_free(uriW);
8193 static void test_IUri_GetPropertyLength(void) {
8194 IUri *uri = NULL;
8195 HRESULT hr;
8196 DWORD i;
8198 /* Make sure it handles invalid args correctly. */
8199 hr = pCreateUri(http_urlW, 0, 0, &uri);
8200 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8201 if(SUCCEEDED(hr)) {
8202 DWORD received = 0xdeadbeef;
8204 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
8205 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8207 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
8208 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8209 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
8211 if(uri) IUri_Release(uri);
8213 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8214 uri_properties test = uri_tests[i];
8215 LPWSTR uriW;
8216 uri = NULL;
8218 uriW = a2w(test.uri);
8219 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8220 if(test.create_todo) {
8221 todo_wine {
8222 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8223 hr, test.create_expected, i);
8225 } else {
8226 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8227 hr, test.create_expected, i);
8230 if(SUCCEEDED(hr)) {
8231 DWORD j;
8233 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
8234 DWORD expectedLen, receivedLen;
8235 uri_str_property prop = test.str_props[j];
8237 expectedLen = lstrlenA(prop.value);
8239 /* This won't be necessary once GetPropertyLength is implemented. */
8240 receivedLen = -1;
8242 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
8243 if(prop.todo) {
8244 todo_wine {
8245 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8246 hr, prop.expected, i, j);
8248 todo_wine {
8249 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8250 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8251 expectedLen, receivedLen, i, j);
8253 } else {
8254 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8255 hr, prop.expected, i, j);
8256 ok(receivedLen == expectedLen || broken(prop.broken_value && receivedLen == lstrlenA(prop.broken_value)),
8257 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8258 expectedLen, receivedLen, i, j);
8263 if(uri) IUri_Release(uri);
8265 heap_free(uriW);
8269 static DWORD compute_expected_props(uri_properties *test)
8271 DWORD ret = 0, i;
8273 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
8274 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
8275 ret |= 1<<i;
8278 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
8279 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
8280 ret |= 1<<i;
8283 return ret;
8286 static void test_IUri_GetProperties(void) {
8287 IUri *uri = NULL;
8288 HRESULT hr;
8289 DWORD i;
8291 hr = pCreateUri(http_urlW, 0, 0, &uri);
8292 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8293 if(SUCCEEDED(hr)) {
8294 hr = IUri_GetProperties(uri, NULL);
8295 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8297 if(uri) IUri_Release(uri);
8299 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8300 uri_properties test = uri_tests[i];
8301 LPWSTR uriW;
8302 uri = NULL;
8304 uriW = a2w(test.uri);
8305 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8306 if(test.create_todo) {
8307 todo_wine {
8308 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8310 } else {
8311 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8314 if(SUCCEEDED(hr)) {
8315 DWORD received = 0, expected_props;
8316 DWORD j;
8318 hr = IUri_GetProperties(uri, &received);
8319 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8321 expected_props = compute_expected_props(&test);
8323 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8324 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8325 if(expected_props & (1 << j))
8326 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
8327 else
8328 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
8332 if(uri) IUri_Release(uri);
8334 heap_free(uriW);
8338 static void test_IUri_HasProperty(void) {
8339 IUri *uri = NULL;
8340 HRESULT hr;
8341 DWORD i;
8343 hr = pCreateUri(http_urlW, 0, 0, &uri);
8344 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8345 if(SUCCEEDED(hr)) {
8346 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
8347 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8349 if(uri) IUri_Release(uri);
8351 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
8352 uri_properties test = uri_tests[i];
8353 LPWSTR uriW;
8354 uri = NULL;
8356 uriW = a2w(test.uri);
8358 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
8359 if(test.create_todo) {
8360 todo_wine {
8361 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8363 } else {
8364 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
8367 if(SUCCEEDED(hr)) {
8368 DWORD expected_props, j;
8370 expected_props = compute_expected_props(&test);
8372 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
8373 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8374 BOOL received = -1;
8376 hr = IUri_HasProperty(uri, j, &received);
8377 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8378 hr, S_OK, j, i);
8380 if(expected_props & (1 << j)) {
8381 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
8382 } else {
8383 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
8388 if(uri) IUri_Release(uri);
8390 heap_free(uriW);
8394 static void test_IUri_IsEqual(void) {
8395 IUri *uriA, *uriB;
8396 BOOL equal;
8397 HRESULT hres;
8398 DWORD i;
8400 uriA = uriB = NULL;
8402 /* Make sure IsEqual handles invalid args correctly. */
8403 hres = pCreateUri(http_urlW, 0, 0, &uriA);
8404 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8405 hres = pCreateUri(http_urlW, 0, 0, &uriB);
8406 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8408 equal = -1;
8409 hres = IUri_IsEqual(uriA, NULL, &equal);
8410 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
8411 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
8413 hres = IUri_IsEqual(uriA, uriB, NULL);
8414 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
8416 IUri_Release(uriA);
8417 IUri_Release(uriB);
8419 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
8420 uri_equality test = equality_tests[i];
8421 LPWSTR uriA_W, uriB_W;
8423 uriA = uriB = NULL;
8425 uriA_W = a2w(test.a);
8426 uriB_W = a2w(test.b);
8428 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
8429 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
8431 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
8432 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
8434 equal = -1;
8435 hres = IUri_IsEqual(uriA, uriB, &equal);
8436 if(test.todo) todo_wine {
8437 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8438 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8439 } else {
8440 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
8441 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
8443 if(uriA) IUri_Release(uriA);
8444 if(uriB) IUri_Release(uriB);
8446 heap_free(uriA_W);
8447 heap_free(uriB_W);
8451 static void test_CreateUriWithFragment_InvalidArgs(void) {
8452 HRESULT hr;
8453 IUri *uri = (void*) 0xdeadbeef;
8454 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
8456 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
8457 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8458 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8460 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
8461 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8463 /* Original URI can't already contain a fragment component. */
8464 uri = (void*) 0xdeadbeef;
8465 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8466 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8467 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8470 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8471 static void test_CreateUriWithFragment_InvalidFlags(void) {
8472 DWORD i;
8474 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8475 HRESULT hr;
8476 IUri *uri = (void*) 0xdeadbeef;
8478 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8479 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8480 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8481 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8485 static void test_CreateUriWithFragment(void) {
8486 DWORD i;
8488 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8489 HRESULT hr;
8490 IUri *uri = NULL;
8491 LPWSTR uriW, fragW;
8492 uri_with_fragment test = uri_fragment_tests[i];
8494 uriW = a2w(test.uri);
8495 fragW = a2w(test.fragment);
8497 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8498 if(test.expected_todo) {
8499 todo_wine {
8500 ok(hr == test.create_expected,
8501 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8502 hr, test.create_expected, i);
8504 } else
8505 ok(hr == test.create_expected,
8506 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8507 hr, test.create_expected, i);
8509 if(SUCCEEDED(hr)) {
8510 BSTR received = NULL;
8512 hr = IUri_GetAbsoluteUri(uri, &received);
8513 if(test.expected_todo) {
8514 todo_wine {
8515 ok(hr == S_OK,
8516 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8517 hr, S_OK, i);
8519 todo_wine {
8520 ok(!strcmp_aw(test.expected_uri, received),
8521 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8522 test.expected_uri, wine_dbgstr_w(received), i);
8524 } else {
8525 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8526 hr, S_OK, i);
8527 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8528 test.expected_uri, wine_dbgstr_w(received), i);
8531 SysFreeString(received);
8534 if(uri) IUri_Release(uri);
8535 heap_free(uriW);
8536 heap_free(fragW);
8540 static void test_CreateIUriBuilder(void) {
8541 HRESULT hr;
8542 IUriBuilder *builder = NULL;
8543 IUri *uri;
8545 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8546 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8547 hr, E_POINTER);
8549 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8550 hr = pCreateUri(http_urlW, 0, 0, &uri);
8551 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8552 if(SUCCEEDED(hr)) {
8553 ULONG cur_count, orig_count;
8555 orig_count = get_refcnt(uri);
8556 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8557 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8558 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8560 cur_count = get_refcnt(uri);
8561 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8563 if(builder) IUriBuilder_Release(builder);
8564 cur_count = get_refcnt(uri);
8565 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8567 if(uri) IUri_Release(uri);
8570 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8571 DWORD test_index) {
8572 HRESULT hr;
8573 IUri *uri = NULL;
8575 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8576 if(test->uri_todo) {
8577 todo_wine {
8578 ok(hr == test->uri_hres,
8579 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8580 hr, test->uri_hres, test_index);
8582 } else {
8583 ok(hr == test->uri_hres,
8584 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8585 hr, test->uri_hres, test_index);
8588 if(SUCCEEDED(hr)) {
8589 DWORD i;
8591 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8592 uri_builder_str_property prop = test->expected_str_props[i];
8593 BSTR received = NULL;
8595 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8596 if(prop.todo) {
8597 todo_wine {
8598 ok(hr == prop.result,
8599 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8600 hr, prop.result, test_index, i);
8602 } else {
8603 ok(hr == prop.result,
8604 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8605 hr, prop.result, test_index, i);
8607 if(SUCCEEDED(hr)) {
8608 if(prop.todo) {
8609 todo_wine {
8610 ok(!strcmp_aw(prop.expected, received),
8611 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8612 prop.expected, wine_dbgstr_w(received), test_index, i);
8614 } else {
8615 ok(!strcmp_aw(prop.expected, received),
8616 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8617 prop.expected, wine_dbgstr_w(received), test_index, i);
8620 SysFreeString(received);
8623 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8624 uri_builder_dword_property prop = test->expected_dword_props[i];
8625 DWORD received = -2;
8627 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8628 if(prop.todo) {
8629 todo_wine {
8630 ok(hr == prop.result,
8631 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8632 hr, prop.result, test_index, i);
8634 } else {
8635 ok(hr == prop.result,
8636 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8637 hr, prop.result, test_index, i);
8639 if(SUCCEEDED(hr)) {
8640 if(prop.todo) {
8641 todo_wine {
8642 ok(received == prop.expected,
8643 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8644 prop.expected, received, test_index, i);
8646 } else {
8647 ok(received == prop.expected,
8648 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8649 prop.expected, received, test_index, i);
8654 if(uri) IUri_Release(uri);
8657 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8658 DWORD test_index) {
8659 HRESULT hr;
8660 IUri *uri = NULL;
8662 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8663 if(test->uri_simple_todo) {
8664 todo_wine {
8665 ok(hr == test->uri_simple_hres,
8666 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8667 hr, test->uri_simple_hres, test_index);
8669 } else {
8670 ok(hr == test->uri_simple_hres,
8671 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8672 hr, test->uri_simple_hres, test_index);
8675 if(SUCCEEDED(hr)) {
8676 DWORD i;
8678 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8679 uri_builder_str_property prop = test->expected_str_props[i];
8680 BSTR received = NULL;
8682 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8683 if(prop.todo) {
8684 todo_wine {
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);
8689 } else {
8690 ok(hr == prop.result,
8691 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8692 hr, prop.result, test_index, i);
8694 if(SUCCEEDED(hr)) {
8695 if(prop.todo) {
8696 todo_wine {
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);
8701 } else {
8702 ok(!strcmp_aw(prop.expected, received),
8703 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8704 prop.expected, wine_dbgstr_w(received), test_index, i);
8707 SysFreeString(received);
8710 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8711 uri_builder_dword_property prop = test->expected_dword_props[i];
8712 DWORD received = -2;
8714 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8715 if(prop.todo) {
8716 todo_wine {
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);
8721 } else {
8722 ok(hr == prop.result,
8723 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8724 hr, prop.result, test_index, i);
8726 if(SUCCEEDED(hr)) {
8727 if(prop.todo) {
8728 todo_wine {
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);
8733 } else {
8734 ok(received == prop.expected,
8735 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8736 prop.expected, received, test_index, i);
8741 if(uri) IUri_Release(uri);
8744 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8745 DWORD test_index) {
8746 HRESULT hr;
8747 IUri *uri = NULL;
8749 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8750 test->uri_with_encode_flags, 0, &uri);
8751 if(test->uri_with_todo) {
8752 todo_wine {
8753 ok(hr == test->uri_with_hres,
8754 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8755 hr, test->uri_with_hres, test_index);
8757 } else {
8758 ok(hr == test->uri_with_hres,
8759 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8760 hr, test->uri_with_hres, test_index);
8763 if(SUCCEEDED(hr)) {
8764 DWORD i;
8766 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8767 uri_builder_str_property prop = test->expected_str_props[i];
8768 BSTR received = NULL;
8770 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8771 if(prop.todo) {
8772 todo_wine {
8773 ok(hr == prop.result,
8774 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8775 hr, prop.result, test_index, i);
8777 } else {
8778 ok(hr == prop.result,
8779 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8780 hr, prop.result, test_index, i);
8782 if(SUCCEEDED(hr)) {
8783 if(prop.todo) {
8784 todo_wine {
8785 ok(!strcmp_aw(prop.expected, received),
8786 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8787 prop.expected, wine_dbgstr_w(received), test_index, i);
8789 } else {
8790 ok(!strcmp_aw(prop.expected, received),
8791 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8792 prop.expected, wine_dbgstr_w(received), test_index, i);
8795 SysFreeString(received);
8798 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8799 uri_builder_dword_property prop = test->expected_dword_props[i];
8800 DWORD received = -2;
8802 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8803 if(prop.todo) {
8804 todo_wine {
8805 ok(hr == prop.result,
8806 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8807 hr, prop.result, test_index, i);
8809 } else {
8810 ok(hr == prop.result,
8811 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8812 hr, prop.result, test_index, i);
8814 if(SUCCEEDED(hr)) {
8815 if(prop.todo) {
8816 todo_wine {
8817 ok(received == prop.expected,
8818 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8819 prop.expected, received, test_index, i);
8821 } else {
8822 ok(received == prop.expected,
8823 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8824 prop.expected, received, test_index, i);
8829 if(uri) IUri_Release(uri);
8832 static void test_IUriBuilder_CreateInvalidArgs(void) {
8833 IUriBuilder *builder;
8834 HRESULT hr;
8836 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8837 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8838 if(SUCCEEDED(hr)) {
8839 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8841 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8842 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8843 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8845 uri = (void*) 0xdeadbeef;
8846 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8847 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8848 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8850 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8851 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8852 hr, E_POINTER);
8854 uri = (void*) 0xdeadbeef;
8855 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8856 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8857 hr, E_NOTIMPL);
8858 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8860 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8861 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8862 hr, E_POINTER);
8864 uri = (void*) 0xdeadbeef;
8865 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8866 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8867 hr, E_NOTIMPL);
8868 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8870 hr = pCreateUri(http_urlW, 0, 0, &test);
8871 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8872 if(SUCCEEDED(hr)) {
8873 hr = IUriBuilder_SetIUri(builder, test);
8874 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8876 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8877 uri = NULL;
8878 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8879 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8880 ok(uri != NULL, "Error: The uri was NULL.\n");
8881 if(uri) IUri_Release(uri);
8883 uri = NULL;
8884 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8885 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8886 hr, S_OK);
8887 ok(uri != NULL, "Error: uri was NULL.\n");
8888 if(uri) IUri_Release(uri);
8890 uri = NULL;
8891 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8892 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8893 hr, S_OK);
8894 ok(uri != NULL, "Error: uri was NULL.\n");
8895 if(uri) IUri_Release(uri);
8897 hr = IUriBuilder_SetFragment(builder, NULL);
8898 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8900 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8901 uri = (void*) 0xdeadbeef;
8902 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8903 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8904 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8906 uri = (void*) 0xdeadbeef;
8907 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8908 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8909 hr, S_OK);
8910 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8912 uri = (void*) 0xdeadbeef;
8913 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8914 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8915 hr, E_NOTIMPL);
8916 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8918 if(test) IUri_Release(test);
8920 if(builder) IUriBuilder_Release(builder);
8923 /* Tests invalid args to the "Get*" functions. */
8924 static void test_IUriBuilder_GetInvalidArgs(void) {
8925 IUriBuilder *builder = NULL;
8926 HRESULT hr;
8928 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8929 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8930 if(SUCCEEDED(hr)) {
8931 LPCWSTR received = (void*) 0xdeadbeef;
8932 DWORD len = -1, port = -1;
8933 BOOL set = -1;
8935 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8936 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8937 hr, E_POINTER);
8938 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8939 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8940 hr, E_POINTER);
8941 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8942 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8943 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8944 hr, E_POINTER);
8945 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8947 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8948 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8949 hr, E_POINTER);
8950 received = (void*) 0xdeadbeef;
8951 hr = IUriBuilder_GetHost(builder, NULL, &received);
8952 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8953 hr, E_POINTER);
8954 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8955 len = -1;
8956 hr = IUriBuilder_GetHost(builder, &len, NULL);
8957 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8958 hr, E_POINTER);
8959 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8961 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8962 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8963 hr, E_POINTER);
8964 received = (void*) 0xdeadbeef;
8965 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8966 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8967 hr, E_POINTER);
8968 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8969 len = -1;
8970 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8971 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8972 hr, E_POINTER);
8973 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8975 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8976 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8977 hr, E_POINTER);
8978 received = (void*) 0xdeadbeef;
8979 hr = IUriBuilder_GetPath(builder, NULL, &received);
8980 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8981 hr, E_POINTER);
8982 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8983 len = -1;
8984 hr = IUriBuilder_GetPath(builder, &len, NULL);
8985 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8986 hr, E_POINTER);
8987 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8989 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8990 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8991 hr, E_POINTER);
8992 hr = IUriBuilder_GetPort(builder, NULL, &port);
8993 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8994 hr, E_POINTER);
8995 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8996 hr = IUriBuilder_GetPort(builder, &set, NULL);
8997 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8998 hr, E_POINTER);
8999 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
9001 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
9002 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9003 hr, E_POINTER);
9004 received = (void*) 0xdeadbeef;
9005 hr = IUriBuilder_GetQuery(builder, NULL, &received);
9006 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9007 hr, E_POINTER);
9008 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9009 len = -1;
9010 hr = IUriBuilder_GetQuery(builder, &len, NULL);
9011 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9012 hr, E_POINTER);
9013 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9015 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
9016 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9017 hr, E_POINTER);
9018 received = (void*) 0xdeadbeef;
9019 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
9020 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9021 hr, E_POINTER);
9022 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9023 len = -1;
9024 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
9025 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9026 hr, E_POINTER);
9027 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9029 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
9030 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9031 hr, E_POINTER);
9032 received = (void*) 0xdeadbeef;
9033 hr = IUriBuilder_GetUserName(builder, NULL, &received);
9034 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9035 hr, E_POINTER);
9036 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
9037 len = -1;
9038 hr = IUriBuilder_GetUserName(builder, &len, NULL);
9039 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9040 hr, E_POINTER);
9041 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
9043 if(builder) IUriBuilder_Release(builder);
9046 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
9047 DWORD test_index) {
9048 HRESULT hr;
9049 DWORD i;
9050 LPCWSTR received = NULL;
9051 DWORD len = -1;
9052 const uri_builder_property *prop = NULL;
9054 /* Check if the property was set earlier. */
9055 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9056 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
9057 prop = &(test->properties[i]);
9060 if(prop) {
9061 /* Use expected_value unless it's NULL, then use value. */
9062 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9063 DWORD expected_len = expected ? strlen(expected) : 0;
9064 hr = IUriBuilder_GetFragment(builder, &len, &received);
9065 if(prop->todo) {
9066 todo_wine {
9067 ok(hr == (expected ? S_OK : S_FALSE),
9068 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9069 hr, (expected ? S_OK : S_FALSE), test_index);
9071 if(SUCCEEDED(hr)) {
9072 todo_wine {
9073 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9074 expected, wine_dbgstr_w(received), test_index);
9076 todo_wine {
9077 ok(expected_len == len,
9078 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9079 expected_len, len, test_index);
9082 } else {
9083 ok(hr == (expected ? S_OK : S_FALSE),
9084 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9085 hr, (expected ? S_OK : S_FALSE), test_index);
9086 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9087 expected, wine_dbgstr_w(received), test_index);
9088 ok(expected_len == len,
9089 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9090 expected_len, len, test_index);
9092 } else {
9093 /* The property wasn't set earlier, so it should return whatever
9094 * the base IUri contains (if anything).
9096 IUri *uri = NULL;
9097 hr = IUriBuilder_GetIUri(builder, &uri);
9098 ok(hr == S_OK,
9099 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9100 hr, S_OK, test_index);
9101 if(SUCCEEDED(hr)) {
9102 if(!uri) {
9103 received = (void*) 0xdeadbeef;
9104 len = -1;
9106 hr = IUriBuilder_GetFragment(builder, &len, &received);
9107 ok(hr == S_FALSE,
9108 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9109 hr, S_FALSE, test_index);
9110 if(SUCCEEDED(hr)) {
9111 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9112 len, test_index);
9113 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9114 received, test_index);
9116 } else {
9117 BOOL has_prop = FALSE;
9118 BSTR expected = NULL;
9120 hr = IUri_GetFragment(uri, &expected);
9121 ok(SUCCEEDED(hr),
9122 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9123 hr, test_index);
9124 has_prop = hr == S_OK;
9126 hr = IUriBuilder_GetFragment(builder, &len, &received);
9127 if(has_prop) {
9128 ok(hr == S_OK,
9129 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9130 hr, S_OK, test_index);
9131 if(SUCCEEDED(hr)) {
9132 ok(!lstrcmpW(expected, received),
9133 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9134 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9135 ok(lstrlenW(expected) == len,
9136 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9137 lstrlenW(expected), len, test_index);
9139 } else {
9140 ok(hr == S_FALSE,
9141 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9142 hr, S_FALSE, test_index);
9143 if(SUCCEEDED(hr)) {
9144 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9145 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9146 len, test_index);
9149 SysFreeString(expected);
9152 if(uri) IUri_Release(uri);
9156 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
9157 DWORD test_index) {
9158 HRESULT hr;
9159 DWORD i;
9160 LPCWSTR received = NULL;
9161 DWORD len = -1;
9162 const uri_builder_property *prop = NULL;
9164 /* Check if the property was set earlier. */
9165 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9166 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
9167 prop = &(test->properties[i]);
9170 if(prop) {
9171 /* Use expected_value unless it's NULL, then use value. */
9172 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9173 DWORD expected_len = expected ? strlen(expected) : 0;
9174 hr = IUriBuilder_GetHost(builder, &len, &received);
9175 if(prop->todo) {
9176 todo_wine {
9177 ok(hr == (expected ? S_OK : S_FALSE),
9178 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9179 hr, (expected ? S_OK : S_FALSE), test_index);
9181 if(SUCCEEDED(hr)) {
9182 todo_wine {
9183 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9184 expected, wine_dbgstr_w(received), test_index);
9186 todo_wine {
9187 ok(expected_len == len,
9188 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9189 expected_len, len, test_index);
9192 } else {
9193 ok(hr == (expected ? S_OK : S_FALSE),
9194 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9195 hr, (expected ? S_OK : S_FALSE), test_index);
9196 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9197 expected, wine_dbgstr_w(received), test_index);
9198 ok(expected_len == len,
9199 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9200 expected_len, len, test_index);
9202 } else {
9203 /* The property wasn't set earlier, so it should return whatever
9204 * the base IUri contains (if anything).
9206 IUri *uri = NULL;
9207 hr = IUriBuilder_GetIUri(builder, &uri);
9208 ok(hr == S_OK,
9209 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9210 hr, S_OK, test_index);
9211 if(SUCCEEDED(hr)) {
9212 if(!uri) {
9213 received = (void*) 0xdeadbeef;
9214 len = -1;
9216 hr = IUriBuilder_GetHost(builder, &len, &received);
9217 ok(hr == S_FALSE,
9218 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9219 hr, S_FALSE, test_index);
9220 if(SUCCEEDED(hr)) {
9221 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9222 len, test_index);
9223 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9224 received, test_index);
9226 } else {
9227 BOOL has_prop = FALSE;
9228 BSTR expected = NULL;
9230 hr = IUri_GetHost(uri, &expected);
9231 ok(SUCCEEDED(hr),
9232 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9233 hr, test_index);
9234 has_prop = hr == S_OK;
9236 hr = IUriBuilder_GetHost(builder, &len, &received);
9237 if(has_prop) {
9238 ok(hr == S_OK,
9239 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9240 hr, S_OK, test_index);
9241 if(SUCCEEDED(hr)) {
9242 ok(!lstrcmpW(expected, received),
9243 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9244 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9245 ok(lstrlenW(expected) == len,
9246 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9247 lstrlenW(expected), len, test_index);
9249 } else {
9250 ok(hr == S_FALSE,
9251 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9252 hr, S_FALSE, test_index);
9253 if(SUCCEEDED(hr)) {
9254 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9255 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9256 len, test_index);
9259 SysFreeString(expected);
9262 if(uri) IUri_Release(uri);
9266 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
9267 DWORD test_index) {
9268 HRESULT hr;
9269 DWORD i;
9270 LPCWSTR received = NULL;
9271 DWORD len = -1;
9272 const uri_builder_property *prop = NULL;
9274 /* Check if the property was set earlier. */
9275 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9276 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
9277 prop = &(test->properties[i]);
9280 if(prop) {
9281 /* Use expected_value unless it's NULL, then use value. */
9282 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9283 DWORD expected_len = expected ? strlen(expected) : 0;
9284 hr = IUriBuilder_GetPassword(builder, &len, &received);
9285 if(prop->todo) {
9286 todo_wine {
9287 ok(hr == (expected ? S_OK : S_FALSE),
9288 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9289 hr, (expected ? S_OK : S_FALSE), test_index);
9291 if(SUCCEEDED(hr)) {
9292 todo_wine {
9293 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9294 expected, wine_dbgstr_w(received), test_index);
9296 todo_wine {
9297 ok(expected_len == len,
9298 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9299 expected_len, len, test_index);
9302 } else {
9303 ok(hr == (expected ? S_OK : S_FALSE),
9304 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9305 hr, (expected ? S_OK : S_FALSE), test_index);
9306 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9307 expected, wine_dbgstr_w(received), test_index);
9308 ok(expected_len == len,
9309 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9310 expected_len, len, test_index);
9312 } else {
9313 /* The property wasn't set earlier, so it should return whatever
9314 * the base IUri contains (if anything).
9316 IUri *uri = NULL;
9317 hr = IUriBuilder_GetIUri(builder, &uri);
9318 ok(hr == S_OK,
9319 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9320 hr, S_OK, test_index);
9321 if(SUCCEEDED(hr)) {
9322 if(!uri) {
9323 received = (void*) 0xdeadbeef;
9324 len = -1;
9326 hr = IUriBuilder_GetPassword(builder, &len, &received);
9327 ok(hr == S_FALSE,
9328 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9329 hr, S_FALSE, test_index);
9330 if(SUCCEEDED(hr)) {
9331 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9332 len, test_index);
9333 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9334 received, test_index);
9336 } else {
9337 BOOL has_prop = FALSE;
9338 BSTR expected = NULL;
9340 hr = IUri_GetPassword(uri, &expected);
9341 ok(SUCCEEDED(hr),
9342 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9343 hr, test_index);
9344 has_prop = hr == S_OK;
9346 hr = IUriBuilder_GetPassword(builder, &len, &received);
9347 if(has_prop) {
9348 ok(hr == S_OK,
9349 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9350 hr, S_OK, test_index);
9351 if(SUCCEEDED(hr)) {
9352 ok(!lstrcmpW(expected, received),
9353 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9354 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9355 ok(lstrlenW(expected) == len,
9356 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9357 lstrlenW(expected), len, test_index);
9359 } else {
9360 ok(hr == S_FALSE,
9361 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9362 hr, S_FALSE, test_index);
9363 if(SUCCEEDED(hr)) {
9364 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9365 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9366 len, test_index);
9369 SysFreeString(expected);
9372 if(uri) IUri_Release(uri);
9376 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
9377 DWORD test_index) {
9378 HRESULT hr;
9379 DWORD i;
9380 LPCWSTR received = NULL;
9381 DWORD len = -1;
9382 const uri_builder_property *prop = NULL;
9384 /* Check if the property was set earlier. */
9385 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9386 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
9387 prop = &(test->properties[i]);
9390 if(prop) {
9391 /* Use expected_value unless it's NULL, then use value. */
9392 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9393 DWORD expected_len = expected ? strlen(expected) : 0;
9394 hr = IUriBuilder_GetPath(builder, &len, &received);
9395 if(prop->todo) {
9396 todo_wine {
9397 ok(hr == (expected ? S_OK : S_FALSE),
9398 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9399 hr, (expected ? S_OK : S_FALSE), test_index);
9401 if(SUCCEEDED(hr)) {
9402 todo_wine {
9403 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9404 expected, wine_dbgstr_w(received), test_index);
9406 todo_wine {
9407 ok(expected_len == len,
9408 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9409 expected_len, len, test_index);
9412 } else {
9413 ok(hr == (expected ? S_OK : S_FALSE),
9414 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9415 hr, (expected ? S_OK : S_FALSE), test_index);
9416 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9417 expected, wine_dbgstr_w(received), test_index);
9418 ok(expected_len == len,
9419 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9420 expected_len, len, test_index);
9422 } else {
9423 /* The property wasn't set earlier, so it should return whatever
9424 * the base IUri contains (if anything).
9426 IUri *uri = NULL;
9427 hr = IUriBuilder_GetIUri(builder, &uri);
9428 ok(hr == S_OK,
9429 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9430 hr, S_OK, test_index);
9431 if(SUCCEEDED(hr)) {
9432 if(!uri) {
9433 received = (void*) 0xdeadbeef;
9434 len = -1;
9436 hr = IUriBuilder_GetPath(builder, &len, &received);
9437 ok(hr == S_FALSE,
9438 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9439 hr, S_FALSE, test_index);
9440 if(SUCCEEDED(hr)) {
9441 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9442 len, test_index);
9443 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9444 received, test_index);
9446 } else {
9447 BOOL has_prop = FALSE;
9448 BSTR expected = NULL;
9450 hr = IUri_GetPath(uri, &expected);
9451 ok(SUCCEEDED(hr),
9452 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9453 hr, test_index);
9454 has_prop = hr == S_OK;
9456 hr = IUriBuilder_GetPath(builder, &len, &received);
9457 if(has_prop) {
9458 ok(hr == S_OK,
9459 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9460 hr, S_OK, test_index);
9461 if(SUCCEEDED(hr)) {
9462 ok(!lstrcmpW(expected, received),
9463 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9464 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9465 ok(lstrlenW(expected) == len,
9466 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9467 lstrlenW(expected), len, test_index);
9469 } else {
9470 ok(hr == S_FALSE,
9471 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9472 hr, S_FALSE, test_index);
9473 if(SUCCEEDED(hr)) {
9474 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9475 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9476 len, test_index);
9479 SysFreeString(expected);
9482 if(uri) IUri_Release(uri);
9486 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9487 DWORD test_index) {
9488 HRESULT hr;
9489 BOOL has_port = FALSE;
9490 DWORD received = -1;
9492 if(test->port_prop.change) {
9493 DWORD expected = test->port_prop.value;
9495 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9496 if(test->port_prop.todo) {
9497 todo_wine {
9498 ok(hr == S_OK,
9499 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9500 hr, S_OK, test_index);
9502 if(SUCCEEDED(hr)) {
9503 todo_wine {
9504 ok(has_port == test->port_prop.set,
9505 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9506 test->port_prop.set, has_port, test_index);
9508 todo_wine {
9509 ok(received == expected,
9510 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9511 expected, received, test_index);
9514 } else {
9515 ok(hr == S_OK,
9516 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9517 hr, S_OK, test_index);
9518 ok(has_port == test->port_prop.set,
9519 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9520 test->port_prop.set, has_port, test_index);
9521 ok(received == test->port_prop.value,
9522 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9523 test->port_prop.value, received, test_index);
9525 } else {
9526 IUri *uri = NULL;
9528 hr = IUriBuilder_GetIUri(builder, &uri);
9529 ok(hr == S_OK,
9530 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9531 hr, S_OK, test_index);
9532 if(SUCCEEDED(hr)) {
9533 if(!uri) {
9534 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9535 ok(hr == S_OK,
9536 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9537 hr, S_OK, test_index);
9538 if(SUCCEEDED(hr)) {
9539 ok(has_port == FALSE,
9540 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9541 has_port, test_index);
9542 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9543 received, test_index);
9545 } else {
9546 DWORD expected;
9548 hr = IUri_GetPort(uri, &expected);
9549 ok(SUCCEEDED(hr),
9550 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9551 hr, test_index);
9553 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9554 ok(hr == S_OK,
9555 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9556 hr, S_OK, test_index);
9557 if(SUCCEEDED(hr)) {
9558 ok(!has_port,
9559 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9560 test_index);
9561 ok(received == expected,
9562 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9563 expected, received, test_index);
9567 if(uri) IUri_Release(uri);
9571 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9572 DWORD test_index) {
9573 HRESULT hr;
9574 DWORD i;
9575 LPCWSTR received = NULL;
9576 DWORD len = -1;
9577 const uri_builder_property *prop = NULL;
9579 /* Check if the property was set earlier. */
9580 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9581 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9582 prop = &(test->properties[i]);
9585 if(prop) {
9586 /* Use expected_value unless it's NULL, then use value. */
9587 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9588 DWORD expected_len = expected ? strlen(expected) : 0;
9589 hr = IUriBuilder_GetQuery(builder, &len, &received);
9590 if(prop->todo) {
9591 todo_wine {
9592 ok(hr == (expected ? S_OK : S_FALSE),
9593 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9594 hr, (expected ? S_OK : S_FALSE), test_index);
9596 if(SUCCEEDED(hr)) {
9597 todo_wine {
9598 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9599 expected, wine_dbgstr_w(received), test_index);
9601 todo_wine {
9602 ok(expected_len == len,
9603 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9604 expected_len, len, test_index);
9607 } else {
9608 ok(hr == (expected ? S_OK : S_FALSE),
9609 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9610 hr, (expected ? S_OK : S_FALSE), test_index);
9611 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9612 expected, wine_dbgstr_w(received), test_index);
9613 ok(expected_len == len,
9614 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9615 expected_len, len, test_index);
9617 } else {
9618 /* The property wasn't set earlier, so it should return whatever
9619 * the base IUri contains (if anything).
9621 IUri *uri = NULL;
9622 hr = IUriBuilder_GetIUri(builder, &uri);
9623 ok(hr == S_OK,
9624 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9625 hr, S_OK, test_index);
9626 if(SUCCEEDED(hr)) {
9627 if(!uri) {
9628 received = (void*) 0xdeadbeef;
9629 len = -1;
9631 hr = IUriBuilder_GetQuery(builder, &len, &received);
9632 ok(hr == S_FALSE,
9633 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9634 hr, S_FALSE, test_index);
9635 if(SUCCEEDED(hr)) {
9636 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9637 len, test_index);
9638 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9639 received, test_index);
9641 } else {
9642 BOOL has_prop = FALSE;
9643 BSTR expected = NULL;
9645 hr = IUri_GetQuery(uri, &expected);
9646 ok(SUCCEEDED(hr),
9647 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9648 hr, test_index);
9649 has_prop = hr == S_OK;
9651 hr = IUriBuilder_GetQuery(builder, &len, &received);
9652 if(has_prop) {
9653 ok(hr == S_OK,
9654 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9655 hr, S_OK, test_index);
9656 if(SUCCEEDED(hr)) {
9657 ok(!lstrcmpW(expected, received),
9658 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9659 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9660 ok(lstrlenW(expected) == len,
9661 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9662 lstrlenW(expected), len, test_index);
9664 } else {
9665 ok(hr == S_FALSE,
9666 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9667 hr, S_FALSE, test_index);
9668 if(SUCCEEDED(hr)) {
9669 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9670 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9671 len, test_index);
9674 SysFreeString(expected);
9677 if(uri) IUri_Release(uri);
9681 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9682 DWORD test_index) {
9683 HRESULT hr;
9684 DWORD i;
9685 LPCWSTR received = NULL;
9686 DWORD len = -1;
9687 const uri_builder_property *prop = NULL;
9689 /* Check if the property was set earlier. */
9690 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9691 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9692 prop = &(test->properties[i]);
9695 if(prop) {
9696 /* Use expected_value unless it's NULL, then use value. */
9697 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9698 DWORD expected_len = expected ? strlen(expected) : 0;
9699 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9700 if(prop->todo) {
9701 todo_wine {
9702 ok(hr == (expected ? S_OK : S_FALSE),
9703 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9704 hr, (expected ? S_OK : S_FALSE), test_index);
9706 if(SUCCEEDED(hr)) {
9707 todo_wine {
9708 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9709 expected, wine_dbgstr_w(received), test_index);
9711 todo_wine {
9712 ok(expected_len == len,
9713 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9714 expected_len, len, test_index);
9717 } else {
9718 ok(hr == (expected ? S_OK : S_FALSE),
9719 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9720 hr, (expected ? S_OK : S_FALSE), test_index);
9721 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9722 expected, wine_dbgstr_w(received), test_index);
9723 ok(expected_len == len,
9724 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9725 expected_len, len, test_index);
9727 } else {
9728 /* The property wasn't set earlier, so it should return whatever
9729 * the base IUri contains (if anything).
9731 IUri *uri = NULL;
9732 hr = IUriBuilder_GetIUri(builder, &uri);
9733 ok(hr == S_OK,
9734 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9735 hr, S_OK, test_index);
9736 if(SUCCEEDED(hr)) {
9737 if(!uri) {
9738 received = (void*) 0xdeadbeef;
9739 len = -1;
9741 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9742 ok(hr == S_FALSE,
9743 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9744 hr, S_FALSE, test_index);
9745 if(SUCCEEDED(hr)) {
9746 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9747 len, test_index);
9748 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9749 received, test_index);
9751 } else {
9752 BOOL has_prop = FALSE;
9753 BSTR expected = NULL;
9755 hr = IUri_GetSchemeName(uri, &expected);
9756 ok(SUCCEEDED(hr),
9757 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9758 hr, test_index);
9759 has_prop = hr == S_OK;
9761 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9762 if(has_prop) {
9763 ok(hr == S_OK,
9764 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9765 hr, S_OK, test_index);
9766 if(SUCCEEDED(hr)) {
9767 ok(!lstrcmpW(expected, received),
9768 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9769 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9770 ok(lstrlenW(expected) == len,
9771 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9772 lstrlenW(expected), len, test_index);
9774 } else {
9775 ok(hr == S_FALSE,
9776 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9777 hr, S_FALSE, test_index);
9778 if(SUCCEEDED(hr)) {
9779 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9780 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9781 len, test_index);
9784 SysFreeString(expected);
9787 if(uri) IUri_Release(uri);
9791 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9792 DWORD test_index) {
9793 HRESULT hr;
9794 DWORD i;
9795 LPCWSTR received = NULL;
9796 DWORD len = -1;
9797 const uri_builder_property *prop = NULL;
9799 /* Check if the property was set earlier. */
9800 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9801 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9802 prop = &(test->properties[i]);
9805 if(prop && prop->value && *prop->value) {
9806 /* Use expected_value unless it's NULL, then use value. */
9807 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9808 DWORD expected_len = expected ? strlen(expected) : 0;
9809 hr = IUriBuilder_GetUserName(builder, &len, &received);
9810 if(prop->todo) {
9811 todo_wine {
9812 ok(hr == (expected ? S_OK : S_FALSE),
9813 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9814 hr, (expected ? S_OK : S_FALSE), test_index);
9816 if(SUCCEEDED(hr)) {
9817 todo_wine {
9818 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9819 expected, wine_dbgstr_w(received), test_index);
9821 todo_wine {
9822 ok(expected_len == len,
9823 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9824 expected_len, len, test_index);
9827 } else {
9828 ok(hr == (expected ? S_OK : S_FALSE),
9829 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9830 hr, (expected ? S_OK : S_FALSE), test_index);
9831 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9832 expected, wine_dbgstr_w(received), test_index);
9833 ok(expected_len == len,
9834 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9835 expected_len, len, test_index);
9837 } else {
9838 /* The property wasn't set earlier, so it should return whatever
9839 * the base IUri contains (if anything).
9841 IUri *uri = NULL;
9842 hr = IUriBuilder_GetIUri(builder, &uri);
9843 ok(hr == S_OK,
9844 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9845 hr, S_OK, test_index);
9846 if(SUCCEEDED(hr)) {
9847 if(!uri) {
9848 received = (void*) 0xdeadbeef;
9849 len = -1;
9851 hr = IUriBuilder_GetUserName(builder, &len, &received);
9852 ok(hr == S_FALSE,
9853 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9854 hr, S_FALSE, test_index);
9855 if(SUCCEEDED(hr)) {
9856 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9857 len, test_index);
9858 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9859 received, test_index);
9861 } else {
9862 BSTR expected = NULL;
9863 BOOL has_prop = FALSE;
9865 hr = IUri_GetUserName(uri, &expected);
9866 ok(SUCCEEDED(hr),
9867 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9868 hr, test_index);
9869 has_prop = hr == S_OK;
9871 hr = IUriBuilder_GetUserName(builder, &len, &received);
9872 if(has_prop) {
9873 ok(hr == S_OK,
9874 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9875 hr, S_OK, test_index);
9876 if(SUCCEEDED(hr)) {
9877 ok(!lstrcmpW(expected, received),
9878 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9879 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9880 ok(lstrlenW(expected) == len,
9881 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9882 lstrlenW(expected), len, test_index);
9884 } else {
9885 ok(hr == S_FALSE,
9886 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9887 hr, S_FALSE, test_index);
9888 if(SUCCEEDED(hr)) {
9889 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9890 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9891 len, test_index);
9894 SysFreeString(expected);
9897 if(uri) IUri_Release(uri);
9901 /* Tests IUriBuilder functions. */
9902 static void test_IUriBuilder(void) {
9903 HRESULT hr;
9904 IUriBuilder *builder;
9905 DWORD i;
9907 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9908 IUri *uri = NULL;
9909 uri_builder_test test = uri_builder_tests[i];
9910 LPWSTR uriW = NULL;
9912 if(test.uri) {
9913 uriW = a2w(test.uri);
9914 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9915 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9916 hr, S_OK, i);
9917 if(FAILED(hr)) continue;
9919 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9920 if(test.create_builder_todo) {
9921 todo_wine {
9922 ok(hr == test.create_builder_expected,
9923 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9924 hr, test.create_builder_expected, i);
9926 } else {
9927 ok(hr == test.create_builder_expected,
9928 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9929 hr, test.create_builder_expected, i);
9931 if(SUCCEEDED(hr)) {
9932 DWORD j;
9933 BOOL modified = FALSE, received = FALSE;
9935 /* Perform all the string property changes. */
9936 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9937 uri_builder_property prop = test.properties[j];
9938 if(prop.change) {
9939 change_property(builder, &prop, i);
9940 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9941 prop.property != Uri_PROPERTY_HOST)
9942 modified = TRUE;
9943 else if(prop.value && *prop.value)
9944 modified = TRUE;
9945 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9946 /* Host name property can't be NULL, but it can be empty. */
9947 modified = TRUE;
9951 if(test.port_prop.change) {
9952 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9953 modified = TRUE;
9954 if(test.port_prop.todo) {
9955 todo_wine {
9956 ok(hr == test.port_prop.expected,
9957 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9958 hr, test.port_prop.expected, i);
9960 } else {
9961 ok(hr == test.port_prop.expected,
9962 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9963 hr, test.port_prop.expected, i);
9967 hr = IUriBuilder_HasBeenModified(builder, &received);
9968 ok(hr == S_OK,
9969 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9970 hr, S_OK, i);
9971 if(SUCCEEDED(hr))
9972 ok(received == modified,
9973 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9974 modified, received, i);
9976 /* Test the "Get*" functions. */
9977 test_IUriBuilder_GetFragment(builder, &test, i);
9978 test_IUriBuilder_GetHost(builder, &test, i);
9979 test_IUriBuilder_GetPassword(builder, &test, i);
9980 test_IUriBuilder_GetPath(builder, &test, i);
9981 test_IUriBuilder_GetPort(builder, &test, i);
9982 test_IUriBuilder_GetQuery(builder, &test, i);
9983 test_IUriBuilder_GetSchemeName(builder, &test, i);
9984 test_IUriBuilder_GetUserName(builder, &test, i);
9986 test_IUriBuilder_CreateUri(builder, &test, i);
9987 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9988 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9990 if(builder) IUriBuilder_Release(builder);
9991 if(uri) IUri_Release(uri);
9992 heap_free(uriW);
9996 static void test_IUriBuilder_HasBeenModified(void) {
9997 HRESULT hr;
9998 IUriBuilder *builder = NULL;
10000 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10001 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10002 if(SUCCEEDED(hr)) {
10003 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
10004 IUri *uri = NULL;
10005 BOOL received;
10007 hr = IUriBuilder_HasBeenModified(builder, NULL);
10008 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10009 hr, E_POINTER);
10011 hr = IUriBuilder_SetHost(builder, hostW);
10012 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10013 hr, S_OK);
10015 hr = IUriBuilder_HasBeenModified(builder, &received);
10016 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10017 hr, S_OK);
10018 if(SUCCEEDED(hr))
10019 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10021 hr = pCreateUri(http_urlW, 0, 0, &uri);
10022 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10023 if(SUCCEEDED(hr)) {
10024 LPCWSTR prop;
10025 DWORD len = -1;
10027 hr = IUriBuilder_SetIUri(builder, uri);
10028 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10029 hr, S_OK);
10031 hr = IUriBuilder_HasBeenModified(builder, &received);
10032 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10033 hr, S_OK);
10034 if(SUCCEEDED(hr))
10035 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
10037 /* Test what happens with you call SetIUri with the same IUri again. */
10038 hr = IUriBuilder_SetHost(builder, hostW);
10039 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10041 hr = IUriBuilder_HasBeenModified(builder, &received);
10042 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10043 hr, S_OK);
10044 if(SUCCEEDED(hr))
10045 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10047 hr = IUriBuilder_SetIUri(builder, uri);
10048 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10050 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10051 * reset any of the changes that were made to the IUriBuilder.
10053 hr = IUriBuilder_HasBeenModified(builder, &received);
10054 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10055 if(SUCCEEDED(hr))
10056 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10058 hr = IUriBuilder_GetHost(builder, &len, &prop);
10059 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10060 if(SUCCEEDED(hr)) {
10061 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10062 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10063 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
10064 lstrlenW(hostW), len);
10067 hr = IUriBuilder_SetIUri(builder, NULL);
10068 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10070 hr = IUriBuilder_SetHost(builder, hostW);
10071 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10072 hr = IUriBuilder_HasBeenModified(builder, &received);
10073 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10074 hr, S_OK);
10075 if(SUCCEEDED(hr))
10076 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10078 hr = IUriBuilder_SetIUri(builder, NULL);
10079 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
10081 hr = IUriBuilder_HasBeenModified(builder, &received);
10082 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10083 hr, S_OK);
10084 if(SUCCEEDED(hr))
10085 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
10087 hr = IUriBuilder_GetHost(builder, &len, &prop);
10088 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10089 if(SUCCEEDED(hr)) {
10090 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
10091 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
10092 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
10093 lstrlenW(hostW), len);
10096 if(uri) IUri_Release(uri);
10098 if(builder) IUriBuilder_Release(builder);
10101 /* Test IUriBuilder {Get,Set}IUri functions. */
10102 static void test_IUriBuilder_IUriProperty(void) {
10103 IUriBuilder *builder = NULL;
10104 HRESULT hr;
10106 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10107 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10108 if(SUCCEEDED(hr)) {
10109 IUri *uri = NULL;
10111 hr = IUriBuilder_GetIUri(builder, NULL);
10112 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10113 hr, E_POINTER);
10115 hr = pCreateUri(http_urlW, 0, 0, &uri);
10116 if(SUCCEEDED(hr)) {
10117 IUri *test = NULL;
10118 ULONG cur_count, orig_count;
10120 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10121 orig_count = get_refcnt(uri);
10122 hr = IUriBuilder_SetIUri(builder, uri);
10123 cur_count = get_refcnt(uri);
10124 if(SUCCEEDED(hr))
10125 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10126 orig_count+1, cur_count);
10128 hr = IUriBuilder_SetIUri(builder, NULL);
10129 cur_count = get_refcnt(uri);
10130 if(SUCCEEDED(hr))
10131 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10132 orig_count, cur_count);
10134 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10135 hr = IUriBuilder_SetIUri(builder, uri);
10136 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10137 orig_count = get_refcnt(uri);
10139 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
10140 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10141 if(SUCCEEDED(hr)) {
10142 cur_count = get_refcnt(uri);
10143 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10144 orig_count+1, cur_count);
10145 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
10146 uri, test);
10148 if(test) IUri_Release(test);
10150 test = NULL;
10151 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
10152 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10153 if(SUCCEEDED(hr)) {
10154 cur_count = get_refcnt(uri);
10155 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10156 orig_count+1, cur_count);
10157 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10159 if(test) IUri_Release(test);
10161 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10162 * the base IUri.
10164 test = NULL;
10165 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
10166 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10167 if(SUCCEEDED(hr))
10168 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10170 if(test) IUri_Release(test);
10172 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10173 * explicitly set (because it's a default flag).
10175 test = NULL;
10176 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
10177 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10178 if(SUCCEEDED(hr)) {
10179 cur_count = get_refcnt(uri);
10180 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10181 orig_count+1, cur_count);
10182 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10184 if(test) IUri_Release(test);
10186 test = NULL;
10187 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
10188 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10189 if(SUCCEEDED(hr)) {
10190 cur_count = get_refcnt(uri);
10191 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10192 orig_count+1, cur_count);
10193 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10195 if(test) IUri_Release(test);
10197 test = NULL;
10198 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
10199 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10200 hr, S_OK);
10201 if(SUCCEEDED(hr)) {
10202 cur_count = get_refcnt(uri);
10203 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10204 orig_count+1, cur_count);
10205 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
10207 if(test) IUri_Release(test);
10209 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10210 * the base IUri.
10212 test = NULL;
10213 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
10214 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10215 if(SUCCEEDED(hr))
10216 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
10218 if(test) IUri_Release(test);
10220 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10221 * explicitly set (because it's a default flag).
10223 test = NULL;
10224 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
10225 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10226 if(SUCCEEDED(hr)) {
10227 cur_count = get_refcnt(uri);
10228 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10229 orig_count+1, cur_count);
10230 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
10232 if(test) IUri_Release(test);
10234 if(uri) IUri_Release(uri);
10236 if(builder) IUriBuilder_Release(builder);
10239 static void test_IUriBuilder_RemoveProperties(void) {
10240 IUriBuilder *builder = NULL;
10241 HRESULT hr;
10242 DWORD i;
10244 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
10245 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10246 if(SUCCEEDED(hr)) {
10247 /* Properties that can't be removed. */
10248 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
10249 Uri_HAS_SCHEME|Uri_HAS_ZONE;
10251 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
10252 hr = IUriBuilder_RemoveProperties(builder, i << 1);
10253 if((i << 1) & invalid) {
10254 ok(hr == E_INVALIDARG,
10255 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10256 hr, E_INVALIDARG, i);
10257 } else {
10258 ok(hr == S_OK,
10259 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10260 hr, S_OK, i);
10264 /* Also doesn't accept anything that's outside the range of the
10265 * Uri_HAS flags.
10267 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
10268 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10269 hr, E_INVALIDARG);
10271 if(builder) IUriBuilder_Release(builder);
10273 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
10274 uri_builder_remove_test test = uri_builder_remove_tests[i];
10275 IUri *uri = NULL;
10276 LPWSTR uriW;
10278 uriW = a2w(test.uri);
10279 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
10280 if(SUCCEEDED(hr)) {
10281 builder = NULL;
10283 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10284 if(test.create_builder_todo) {
10285 todo_wine {
10286 ok(hr == test.create_builder_expected,
10287 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10288 hr, test.create_builder_expected, i);
10290 } else {
10291 ok(hr == test.create_builder_expected,
10292 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10293 hr, test.create_builder_expected, i);
10295 if(SUCCEEDED(hr)) {
10296 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
10297 if(test.remove_todo) {
10298 todo_wine {
10299 ok(hr == test.remove_expected,
10300 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10301 hr, test.remove_expected, i);
10303 } else {
10304 ok(hr == test.remove_expected,
10305 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10306 hr, test.remove_expected, i);
10308 if(SUCCEEDED(hr)) {
10309 IUri *result = NULL;
10311 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
10312 if(test.expected_todo) {
10313 todo_wine {
10314 ok(hr == test.expected_hres,
10315 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10316 hr, test.expected_hres, i);
10318 } else {
10319 ok(hr == test.expected_hres,
10320 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10321 hr, test.expected_hres, i);
10323 if(SUCCEEDED(hr)) {
10324 BSTR received = NULL;
10326 hr = IUri_GetAbsoluteUri(result, &received);
10327 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10328 ok(!strcmp_aw(test.expected_uri, received),
10329 "Error: Expected %s but got %s instead on test %d.\n",
10330 test.expected_uri, wine_dbgstr_w(received), i);
10331 SysFreeString(received);
10333 if(result) IUri_Release(result);
10336 if(builder) IUriBuilder_Release(builder);
10338 if(uri) IUri_Release(uri);
10339 heap_free(uriW);
10343 static void test_IUriBuilder_Misc(void) {
10344 HRESULT hr;
10345 IUri *uri;
10347 hr = pCreateUri(http_urlW, 0, 0, &uri);
10348 if(SUCCEEDED(hr)) {
10349 IUriBuilder *builder;
10351 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
10352 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10353 if(SUCCEEDED(hr)) {
10354 BOOL has = -1;
10355 DWORD port = -1;
10357 hr = IUriBuilder_GetPort(builder, &has, &port);
10358 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10359 if(SUCCEEDED(hr)) {
10360 /* 'has' will be set to FALSE, even though uri had a port. */
10361 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
10362 /* Still sets 'port' to 80. */
10363 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
10366 if(builder) IUriBuilder_Release(builder);
10368 if(uri) IUri_Release(uri);
10371 static void test_IUriBuilderFactory(void) {
10372 HRESULT hr;
10373 IUri *uri;
10374 IUriBuilderFactory *factory;
10375 IUriBuilder *builder;
10377 hr = pCreateUri(http_urlW, 0, 0, &uri);
10378 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10379 if(SUCCEEDED(hr)) {
10380 factory = NULL;
10381 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
10382 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
10383 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
10385 if(SUCCEEDED(hr)) {
10386 builder = (void*) 0xdeadbeef;
10387 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
10388 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10389 hr, E_INVALIDARG);
10390 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10392 builder = (void*) 0xdeadbeef;
10393 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
10394 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10395 hr, E_INVALIDARG);
10396 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10398 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
10399 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10400 hr, E_POINTER);
10402 builder = NULL;
10403 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
10404 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10405 hr, S_OK);
10406 if(SUCCEEDED(hr)) {
10407 IUri *tmp = (void*) 0xdeadbeef;
10408 LPCWSTR result;
10409 DWORD result_len;
10411 hr = IUriBuilder_GetIUri(builder, &tmp);
10412 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10413 hr, S_OK);
10414 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
10416 hr = IUriBuilder_GetHost(builder, &result_len, &result);
10417 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10418 hr, S_FALSE);
10420 if(builder) IUriBuilder_Release(builder);
10422 builder = (void*) 0xdeadbeef;
10423 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
10424 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10425 hr, E_INVALIDARG);
10426 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10428 builder = (void*) 0xdeadbeef;
10429 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
10430 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10431 hr, E_INVALIDARG);
10432 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
10434 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
10435 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10436 hr, E_POINTER);
10438 builder = NULL;
10439 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
10440 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10441 hr, S_OK);
10442 if(SUCCEEDED(hr)) {
10443 IUri *tmp = NULL;
10445 hr = IUriBuilder_GetIUri(builder, &tmp);
10446 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10447 hr, S_OK);
10448 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
10449 if(uri) IUri_Release(uri);
10451 if(builder) IUriBuilder_Release(builder);
10453 if(factory) IUriBuilderFactory_Release(factory);
10455 if(uri) IUri_Release(uri);
10458 static void test_CoInternetCombineIUri(void) {
10459 HRESULT hr;
10460 IUri *base, *relative, *result;
10461 DWORD i;
10463 base = NULL;
10464 hr = pCreateUri(http_urlW, 0, 0, &base);
10465 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10466 if(SUCCEEDED(hr)) {
10467 result = (void*) 0xdeadbeef;
10468 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10469 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10470 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10473 relative = NULL;
10474 hr = pCreateUri(http_urlW, 0, 0, &relative);
10475 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10476 if(SUCCEEDED(hr)) {
10477 result = (void*) 0xdeadbeef;
10478 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10479 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10480 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10483 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10484 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10486 if(base) IUri_Release(base);
10487 if(relative) IUri_Release(relative);
10489 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10490 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10492 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10493 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10494 if(SUCCEEDED(hr)) {
10495 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10497 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10498 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10499 if(SUCCEEDED(hr)) {
10500 result = NULL;
10502 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10503 if(uri_combine_tests[i].todo) {
10504 todo_wine {
10505 ok(hr == uri_combine_tests[i].expected,
10506 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10507 hr, uri_combine_tests[i].expected, i);
10509 } else {
10510 ok(hr == uri_combine_tests[i].expected,
10511 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10512 hr, uri_combine_tests[i]. expected, i);
10514 if(SUCCEEDED(hr)) {
10515 DWORD j;
10517 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10518 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10519 BSTR received;
10521 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10522 if(prop.todo) {
10523 todo_wine {
10524 ok(hr == prop.expected,
10525 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10526 hr, prop.expected, i, j);
10528 todo_wine {
10529 ok(!strcmp_aw(prop.value, received) ||
10530 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10531 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10532 prop.value, wine_dbgstr_w(received), i, j);
10534 } else {
10535 ok(hr == prop.expected,
10536 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10537 hr, prop.expected, i, j);
10538 ok(!strcmp_aw(prop.value, received) ||
10539 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10540 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10541 prop.value, wine_dbgstr_w(received), i, j);
10543 SysFreeString(received);
10546 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10547 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10548 DWORD received;
10550 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10551 if(prop.todo) {
10552 todo_wine {
10553 ok(hr == prop.expected,
10554 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10555 hr, prop.expected, i, j);
10557 todo_wine {
10558 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10559 prop.value, received, i, j);
10561 } else {
10562 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10563 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10564 hr, prop.expected, i, j);
10565 if(!prop.broken_combine_hres || hr != S_FALSE)
10566 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10567 prop.value, received, i, j);
10571 if(result) IUri_Release(result);
10573 if(relative) IUri_Release(relative);
10574 heap_free(relativeW);
10576 if(base) IUri_Release(base);
10577 heap_free(baseW);
10581 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10582 REFIID riid, void **ppv)
10584 ok(0, "unexpected call\n");
10585 return E_NOINTERFACE;
10588 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10590 return 2;
10593 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10595 return 1;
10598 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10599 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10600 DWORD *pcchResult, DWORD dwReserved)
10602 CHECK_EXPECT(ParseUrl);
10603 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10604 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10605 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10606 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10607 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10609 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10610 *pcchResult = lstrlenW(parse_resultW);
10612 return S_OK;
10615 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10616 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10617 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10619 CHECK_EXPECT(CombineUrl);
10620 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10621 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10622 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10623 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10624 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10625 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10626 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10628 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10629 *pcchResult = lstrlenW(combine_resultW);
10631 return S_OK;
10634 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10635 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10637 ok(0, "unexpected call\n");
10638 return E_NOTIMPL;
10641 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10642 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10643 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10645 ok(0, "unexpected call\n");
10646 return E_NOTIMPL;
10649 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10650 InternetProtocolInfo_QueryInterface,
10651 InternetProtocolInfo_AddRef,
10652 InternetProtocolInfo_Release,
10653 InternetProtocolInfo_ParseUrl,
10654 InternetProtocolInfo_CombineUrl,
10655 InternetProtocolInfo_CompareUrl,
10656 InternetProtocolInfo_QueryInfo
10659 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10661 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10663 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10664 *ppv = &protocol_info;
10665 return S_OK;
10668 ok(0, "unexpected call\n");
10669 return E_NOINTERFACE;
10672 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10674 return 2;
10677 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10679 return 1;
10682 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10683 REFIID riid, void **ppv)
10685 ok(0, "unexpected call\n");
10686 return E_NOTIMPL;
10689 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10691 ok(0, "unexpected call\n");
10692 return S_OK;
10695 static const IClassFactoryVtbl ClassFactoryVtbl = {
10696 ClassFactory_QueryInterface,
10697 ClassFactory_AddRef,
10698 ClassFactory_Release,
10699 ClassFactory_CreateInstance,
10700 ClassFactory_LockServer
10703 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10705 static void register_protocols(void)
10707 IInternetSession *session;
10708 HRESULT hres;
10710 hres = pCoInternetGetSession(0, &session, 0);
10711 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10712 if(FAILED(hres))
10713 return;
10715 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10716 winetestW, 0, NULL, 0);
10717 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10719 IInternetSession_Release(session);
10722 static void unregister_protocols(void) {
10723 IInternetSession *session;
10724 HRESULT hr;
10726 hr = pCoInternetGetSession(0, &session, 0);
10727 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10728 if(FAILED(hr))
10729 return;
10731 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10732 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10734 IInternetSession_Release(session);
10737 static void test_CoInternetCombineIUri_Pluggable(void) {
10738 HRESULT hr;
10739 IUri *base = NULL;
10741 hr = pCreateUri(combine_baseW, 0, 0, &base);
10742 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10743 if(SUCCEEDED(hr)) {
10744 IUri *relative = NULL;
10746 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10747 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10748 if(SUCCEEDED(hr)) {
10749 IUri *result = NULL;
10751 SET_EXPECT(CombineUrl);
10753 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10754 &result, 0);
10755 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10757 CHECK_CALLED(CombineUrl);
10759 if(SUCCEEDED(hr)) {
10760 BSTR received = NULL;
10761 hr = IUri_GetAbsoluteUri(result, &received);
10762 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10763 if(SUCCEEDED(hr)) {
10764 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10765 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10767 SysFreeString(received);
10769 if(result) IUri_Release(result);
10771 if(relative) IUri_Release(relative);
10773 if(base) IUri_Release(base);
10776 static void test_CoInternetCombineUrlEx(void) {
10777 HRESULT hr;
10778 IUri *base, *result;
10779 DWORD i;
10781 base = NULL;
10782 hr = pCreateUri(http_urlW, 0, 0, &base);
10783 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10784 if(SUCCEEDED(hr)) {
10785 result = (void*) 0xdeadbeef;
10786 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10787 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10788 hr, E_UNEXPECTED);
10789 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10792 result = (void*) 0xdeadbeef;
10793 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10794 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10795 hr, E_INVALIDARG);
10796 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10798 result = (void*) 0xdeadbeef;
10799 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10800 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10801 hr, E_UNEXPECTED);
10802 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10804 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10805 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10806 hr, E_POINTER);
10807 if(base) IUri_Release(base);
10809 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10810 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10812 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10813 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10814 if(SUCCEEDED(hr)) {
10815 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10817 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10818 &result, 0);
10819 if(uri_combine_tests[i].todo) {
10820 todo_wine {
10821 ok(hr == uri_combine_tests[i].expected,
10822 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10823 hr, uri_combine_tests[i].expected, i);
10825 } else {
10826 ok(hr == uri_combine_tests[i].expected,
10827 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10828 hr, uri_combine_tests[i]. expected, i);
10830 if(SUCCEEDED(hr)) {
10831 DWORD j;
10833 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10834 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10835 BSTR received;
10836 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10838 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10839 if(prop.todo) {
10840 todo_wine {
10841 ok(hr == prop.expected,
10842 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10843 hr, prop.expected, i, j);
10845 todo_wine {
10846 ok(!strcmp_aw(value, received) ||
10847 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10848 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10849 value, wine_dbgstr_w(received), i, j);
10851 } else {
10852 ok(hr == prop.expected,
10853 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10854 hr, prop.expected, i, j);
10855 ok(!strcmp_aw(value, received) ||
10856 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10857 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10858 value, wine_dbgstr_w(received), i, j);
10860 SysFreeString(received);
10863 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10864 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10865 DWORD received;
10867 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10868 if(prop.todo) {
10869 todo_wine {
10870 ok(hr == prop.expected,
10871 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10872 hr, prop.expected, i, j);
10874 todo_wine {
10875 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10876 prop.value, received, i, j);
10878 } else {
10879 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10880 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10881 hr, prop.expected, i, j);
10882 if(!prop.broken_combine_hres || hr != S_FALSE)
10883 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10884 prop.value, received, i, j);
10888 if(result) IUri_Release(result);
10889 heap_free(relativeW);
10891 if(base) IUri_Release(base);
10892 heap_free(baseW);
10896 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10897 HRESULT hr;
10898 IUri *base = NULL;
10900 hr = pCreateUri(combine_baseW, 0, 0, &base);
10901 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10902 if(SUCCEEDED(hr)) {
10903 IUri *result = NULL;
10905 SET_EXPECT(CombineUrl);
10907 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10908 &result, 0);
10909 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10911 CHECK_CALLED(CombineUrl);
10913 if(SUCCEEDED(hr)) {
10914 BSTR received = NULL;
10915 hr = IUri_GetAbsoluteUri(result, &received);
10916 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10917 if(SUCCEEDED(hr)) {
10918 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10919 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10921 SysFreeString(received);
10923 if(result) IUri_Release(result);
10925 if(base) IUri_Release(base);
10928 static void test_CoInternetParseIUri_InvalidArgs(void) {
10929 HRESULT hr;
10930 IUri *uri = NULL;
10931 WCHAR tmp[3];
10932 DWORD result = -1;
10934 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10935 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10936 hr, E_INVALIDARG);
10937 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10939 hr = pCreateUri(http_urlW, 0, 0, &uri);
10940 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10941 if(SUCCEEDED(hr)) {
10942 DWORD expected_len;
10944 result = -1;
10945 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10946 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10947 hr, E_INVALIDARG);
10948 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10950 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10951 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10952 hr, E_POINTER);
10954 result = -1;
10955 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10956 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10957 hr, E_FAIL);
10958 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10960 result = -1;
10961 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10962 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10963 hr, E_FAIL);
10964 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10966 result = -1;
10967 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10968 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10969 hr, E_FAIL);
10970 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10972 result = -1;
10973 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10974 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10975 hr, E_FAIL);
10976 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10978 expected_len = lstrlenW(http_urlW);
10979 result = -1;
10980 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10981 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10982 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10983 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10984 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10985 expected_len, result);
10987 if(uri) IUri_Release(uri);
10990 static void test_CoInternetParseIUri(void) {
10991 DWORD i;
10993 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10994 HRESULT hr;
10995 IUri *uri;
10996 LPWSTR uriW;
10997 uri_parse_test test = uri_parse_tests[i];
10999 uriW = a2w(test.uri);
11000 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
11001 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
11002 if(SUCCEEDED(hr)) {
11003 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
11004 DWORD result_len = -1;
11006 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
11007 if(test.todo) {
11008 todo_wine {
11009 ok(hr == test.expected,
11010 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11011 hr, test.expected, i);
11013 } else {
11014 ok(hr == test.expected,
11015 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11016 hr, test.expected, i);
11018 if(SUCCEEDED(hr)) {
11019 DWORD len = lstrlenA(test.property);
11020 ok(!strcmp_aw(test.property, result),
11021 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
11022 test.property, wine_dbgstr_w(result), i);
11023 ok(len == result_len,
11024 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
11025 len, result_len, i);
11026 } else {
11027 ok(!result_len,
11028 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11029 result_len, i);
11032 if(uri) IUri_Release(uri);
11033 heap_free(uriW);
11037 static void test_CoInternetParseIUri_Pluggable(void) {
11038 HRESULT hr;
11039 IUri *uri = NULL;
11041 hr = pCreateUri(parse_urlW, 0, 0, &uri);
11042 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
11043 if(SUCCEEDED(hr)) {
11044 WCHAR result[200];
11045 DWORD result_len;
11047 SET_EXPECT(ParseUrl);
11049 parse_action = PARSE_CANONICALIZE;
11050 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
11052 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
11053 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
11055 CHECK_CALLED(ParseUrl);
11057 if(SUCCEEDED(hr)) {
11058 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
11059 lstrlenW(parse_resultW), result_len);
11060 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
11061 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
11064 if(uri) IUri_Release(uri);
11067 typedef struct {
11068 const char *url;
11069 DWORD uri_flags;
11070 const char *base_url;
11071 DWORD base_uri_flags;
11072 const char *legacy_url;
11073 const char *uniform_url;
11074 const char *no_canon_url;
11075 const char *uri_url;
11076 } create_urlmon_test_t;
11078 static const create_urlmon_test_t create_urlmon_tests[] = {
11080 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
11081 NULL,0,
11082 "http://www.winehq.org/",
11083 "http://www.winehq.org/",
11084 "http://www.winehq.org",
11085 "http://www.winehq.org"
11088 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
11089 NULL,0,
11090 "file://c:\\dir\\file.txt",
11091 "file:///c:/dir/file.txt",
11092 "file:///c:/dir/file.txt",
11093 "file:///c:/dir/file.txt"
11096 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
11097 NULL,0,
11098 "file://c:\\dir\\file.txt",
11099 "file:///c:/dir/file.txt",
11100 "file:///c:/dir/file.txt",
11101 "file://c:\\dir\\file.txt"
11104 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
11105 "http://www.winehq.org",0,
11106 "http://www.winehq.org/data",
11107 "http://www.winehq.org/data",
11108 "http://www.winehq.org:80/data",
11111 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
11112 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
11113 "file://c:\\dir\\file.txt",
11114 "file:///c:/dir/file.txt",
11115 "file:///c:/dir/file.txt",
11118 "",Uri_CREATE_ALLOW_RELATIVE,
11119 NULL,0,
11126 "test",Uri_CREATE_ALLOW_RELATIVE,
11127 NULL,0,
11128 "test",
11129 "test",
11130 "test",
11131 "test"
11134 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
11135 NULL,0,
11136 "file://c:\\dir\\file.txt",
11137 "file:///c:/dir/file.txt",
11138 "file:///c:/dir/file.txt",
11139 "file:///c:/dir/file.txt",
11143 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11144 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
11146 WCHAR *display_name;
11147 HRESULT hres;
11149 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
11150 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
11151 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
11152 wine_dbgstr_w(display_name), exurl);
11154 CoTaskMemFree(display_name);
11157 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11158 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
11160 IUriContainer *uri_container;
11161 IUri *uri;
11162 BSTR display_uri;
11163 HRESULT hres;
11165 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
11166 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
11168 uri = NULL;
11169 hres = IUriContainer_GetIUri(uri_container, &uri);
11170 IUriContainer_Release(uri_container);
11171 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
11172 ok(uri != NULL, "uri == NULL\n");
11174 hres = IUri_GetDisplayUri(uri, &display_uri);
11175 IUri_Release(uri);
11176 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
11177 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
11178 wine_dbgstr_w(display_uri), exurl);
11179 SysFreeString(display_uri);
11182 static void test_CreateURLMoniker(void)
11184 const create_urlmon_test_t *test;
11185 IMoniker *mon, *base_mon;
11186 WCHAR *url, *base_url;
11187 IUri *uri, *base_uri;
11188 HRESULT hres;
11190 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
11191 url = a2w(test->url);
11192 base_url = a2w(test->base_url);
11194 if(base_url) {
11195 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
11196 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11198 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
11199 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11200 }else {
11201 base_uri = NULL;
11202 base_mon = NULL;
11205 hres = CreateURLMoniker(base_mon, url, &mon);
11206 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11207 test_urlmon_display_name(mon, test->legacy_url);
11208 test_display_uri(mon, test->legacy_url);
11209 IMoniker_Release(mon);
11211 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
11212 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11213 test_urlmon_display_name(mon, test->legacy_url);
11214 test_display_uri(mon, test->legacy_url);
11215 IMoniker_Release(mon);
11217 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
11218 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11219 test_urlmon_display_name(mon, test->uniform_url);
11220 test_display_uri(mon, test->uniform_url);
11221 IMoniker_Release(mon);
11223 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
11224 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
11225 test_urlmon_display_name(mon, test->no_canon_url);
11226 test_display_uri(mon, test->no_canon_url);
11227 IMoniker_Release(mon);
11229 hres = pCreateUri(url, test->uri_flags, 0, &uri);
11230 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
11232 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
11233 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11234 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
11235 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
11236 IMoniker_Release(mon);
11238 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
11239 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11240 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
11241 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
11242 IMoniker_Release(mon);
11244 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
11245 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
11246 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
11247 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
11248 IMoniker_Release(mon);
11250 IUri_Release(uri);
11251 heap_free(url);
11252 heap_free(base_url);
11253 if(base_uri)
11254 IUri_Release(base_uri);
11255 if(base_mon)
11256 IMoniker_Release(base_mon);
11260 static int add_default_flags(DWORD flags) {
11261 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
11262 flags |= Uri_CREATE_CANONICALIZE;
11263 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
11264 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
11265 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
11266 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
11267 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
11268 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
11269 if(!(flags & Uri_CREATE_IE_SETTINGS))
11270 flags |= Uri_CREATE_NO_IE_SETTINGS;
11272 return flags;
11275 static void test_IPersistStream(void)
11277 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
11279 props_order[Uri_PROPERTY_RAW_URI] = 1;
11280 props_order[Uri_PROPERTY_FRAGMENT] = 2;
11281 props_order[Uri_PROPERTY_HOST] = 3;
11282 props_order[Uri_PROPERTY_PASSWORD] = 4;
11283 props_order[Uri_PROPERTY_PATH] = 5;
11284 props_order[Uri_PROPERTY_PORT] = 6;
11285 props_order[Uri_PROPERTY_QUERY] = 7;
11286 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
11287 props_order[Uri_PROPERTY_USER_NAME] = 9;
11289 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
11290 const uri_properties *test = uri_tests+i;
11291 LPWSTR uriW;
11292 IUri *uri;
11293 IPersistStream *persist_stream;
11294 IStream *stream;
11295 IMarshal *marshal;
11296 DWORD props, props_no, dw_data[6];
11297 WCHAR str_data[1024];
11298 ULARGE_INTEGER size, max_size;
11299 LARGE_INTEGER no_off;
11300 CLSID curi;
11301 BSTR raw_uri;
11302 HRESULT hr;
11304 if(test->create_todo || test->create_expected!=S_OK)
11305 continue;
11307 uriW = a2w(test->uri);
11308 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
11309 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
11311 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11312 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11314 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
11315 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
11316 hr = IPersistStream_IsDirty(persist_stream);
11317 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11318 hr = IPersistStream_Save(persist_stream, stream, FALSE);
11319 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
11320 hr = IPersistStream_IsDirty(persist_stream);
11321 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
11322 no_off.QuadPart = 0;
11323 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11324 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11325 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11326 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11327 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
11328 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
11329 ok(U(size).LowPart+2 == U(max_size).LowPart,
11330 "%d) Written data size is %d, max_size %d.\n",
11331 i, U(size).LowPart, U(max_size).LowPart);
11333 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
11334 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11335 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11336 i, dw_data[0]-2, U(size).LowPart);
11337 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
11338 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11339 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
11340 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
11341 ok(dw_data[2] == add_default_flags(test->create_flags),
11342 "%d) Incorrect value %x, expected %x (creation flags).\n",
11343 i, dw_data[2], add_default_flags(test->create_flags));
11344 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
11345 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
11346 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
11348 props_no = 0;
11349 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
11350 if(!props_order[props])
11351 continue;
11353 if(props <= Uri_PROPERTY_STRING_LAST) {
11354 if(test->str_props[props].expected == S_OK)
11355 props_no++;
11356 } else {
11357 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
11358 props_no++;
11361 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
11362 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
11363 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
11364 props_no = 1;
11366 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
11367 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11368 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
11370 dw_data[2] = 0;
11371 dw_data[3] = -1;
11372 while(props) {
11373 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
11374 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11375 props--;
11376 ok(dw_data[2]<props_order[dw_data[0]],
11377 "%d) Incorrect properties order (%d, %d)\n",
11378 i, dw_data[0], dw_data[3]);
11379 dw_data[2] = props_order[dw_data[0]];
11380 dw_data[3] = dw_data[0];
11382 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
11383 const uri_str_property *prop = test->str_props+dw_data[0];
11384 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
11385 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11386 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
11387 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
11388 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
11389 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
11390 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
11391 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
11392 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11393 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
11394 } else {
11395 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
11396 break;
11399 ok(props == 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11400 i, props, dw_data[0]);
11402 IUri_Release(uri);
11404 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11405 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11406 hr = IPersistStream_GetClassID(persist_stream, &curi);
11407 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
11408 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
11409 IPersistStream_Release(persist_stream);
11411 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11412 &IID_IUri, (void**)&uri);
11413 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11414 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
11415 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11416 hr = IPersistStream_Load(persist_stream, stream);
11417 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
11418 hr = IUri_GetRawUri(uri, &raw_uri);
11419 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11420 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11421 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11422 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11423 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11424 wine_dbgstr_w(raw_uri));
11425 SysFreeString(raw_uri);
11426 IPersistStream_Release(persist_stream);
11428 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11429 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
11430 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11431 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11432 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11433 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
11434 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11435 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11436 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
11437 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11438 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11439 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
11440 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11441 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11442 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
11443 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11444 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11445 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
11446 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11447 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
11448 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
11449 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11450 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11451 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
11452 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
11453 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
11454 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
11455 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
11456 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
11458 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
11459 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11460 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11461 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11462 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
11463 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
11464 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
11465 i, dw_data[0]-2, U(size).LowPart);
11466 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11467 i, dw_data[1]);
11468 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11469 i, dw_data[2], dw_data[0]-8);
11470 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11471 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11472 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11473 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11474 U(max_size).LowPart += 3*sizeof(DWORD);
11475 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11476 i, dw_data[2], U(max_size).LowPart);
11477 IMarshal_Release(marshal);
11478 IUri_Release(uri);
11480 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11481 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11482 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11483 &IID_IUri, (void**)&uri);
11484 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11485 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11486 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11487 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11488 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11489 hr = IUri_GetRawUri(uri, &raw_uri);
11490 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11491 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11492 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11493 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11494 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11495 wine_dbgstr_w(raw_uri));
11496 SysFreeString(raw_uri);
11498 IMarshal_Release(marshal);
11499 IStream_Release(stream);
11500 IUri_Release(uri);
11501 heap_free(uriW);
11505 static void test_UninitializedUri(void)
11507 IUri *uri;
11508 IUriBuilderFactory *ubf;
11509 IPersistStream *ps;
11510 IUriBuilder *ub;
11511 BSTR bstr;
11512 DWORD dword;
11513 BOOL eq;
11514 ULARGE_INTEGER ui;
11515 HRESULT hr;
11517 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11518 &IID_IUri, (void**)&uri);
11519 if(FAILED(hr)) {
11520 win_skip("Skipping uninitialized Uri tests.\n");
11521 return;
11524 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11525 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11526 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11527 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11529 hr = IUri_GetAbsoluteUri(uri, NULL);
11530 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11531 hr = IUri_GetAbsoluteUri(uri, &bstr);
11532 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11533 hr = IUri_GetAuthority(uri, &bstr);
11534 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11535 hr = IUri_GetDisplayUri(uri, &bstr);
11536 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11537 hr = IUri_GetDomain(uri, &bstr);
11538 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11539 hr = IUri_GetExtension(uri, &bstr);
11540 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11541 hr = IUri_GetFragment(uri, &bstr);
11542 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11543 hr = IUri_GetHost(uri, &bstr);
11544 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11545 hr = IUri_GetHostType(uri, &dword);
11546 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11547 hr = IUri_GetPassword(uri, &bstr);
11548 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11549 hr = IUri_GetPassword(uri, &bstr);
11550 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11551 hr = IUri_GetPathAndQuery(uri, &bstr);
11552 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11553 hr = IUri_GetPort(uri, &dword);
11554 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11555 hr = IUri_GetProperties(uri, &dword);
11556 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11557 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11558 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11559 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11560 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11561 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11562 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11563 hr = IUri_GetQuery(uri, &bstr);
11564 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11565 hr = IUri_GetRawUri(uri, &bstr);
11566 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11567 hr = IUri_GetScheme(uri, &dword);
11568 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11569 hr = IUri_GetSchemeName(uri, &bstr);
11570 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11571 hr = IUri_GetUserInfo(uri, &bstr);
11572 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11573 hr = IUri_GetUserName(uri, &bstr);
11574 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11575 hr = IUri_GetZone(uri, &dword);
11576 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11577 hr = IUri_IsEqual(uri, uri, &eq);
11578 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11580 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11581 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11582 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11583 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11584 IUriBuilder_Release(ub);
11586 hr = IPersistStream_GetSizeMax(ps, &ui);
11587 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11588 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11589 hr = IPersistStream_IsDirty(ps);
11590 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11592 IPersistStream_Release(ps);
11593 IUriBuilderFactory_Release(ubf);
11594 IUri_Release(uri);
11597 START_TEST(uri) {
11598 HMODULE hurlmon;
11600 hurlmon = GetModuleHandleA("urlmon.dll");
11601 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11602 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11603 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11604 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11605 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11606 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11607 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11608 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11609 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11611 if(!pCreateUri) {
11612 win_skip("CreateUri is not present, skipping tests.\n");
11613 return;
11616 trace("test CreateUri invalid flags...\n");
11617 test_CreateUri_InvalidFlags();
11619 trace("test CreateUri invalid args...\n");
11620 test_CreateUri_InvalidArgs();
11622 trace("test CreateUri invalid URIs...\n");
11623 test_CreateUri_InvalidUri();
11625 trace("test IUri_GetPropertyBSTR...\n");
11626 test_IUri_GetPropertyBSTR();
11628 trace("test IUri_GetPropertyDWORD...\n");
11629 test_IUri_GetPropertyDWORD();
11631 trace("test IUri_GetStrProperties...\n");
11632 test_IUri_GetStrProperties();
11634 trace("test IUri_GetDwordProperties...\n");
11635 test_IUri_GetDwordProperties();
11637 trace("test IUri_GetPropertyLength...\n");
11638 test_IUri_GetPropertyLength();
11640 trace("test IUri_GetProperties...\n");
11641 test_IUri_GetProperties();
11643 trace("test IUri_HasProperty...\n");
11644 test_IUri_HasProperty();
11646 trace("test IUri_IsEqual...\n");
11647 test_IUri_IsEqual();
11649 trace("test CreateUriWithFragment invalid args...\n");
11650 test_CreateUriWithFragment_InvalidArgs();
11652 trace("test CreateUriWithFragment invalid flags...\n");
11653 test_CreateUriWithFragment_InvalidFlags();
11655 trace("test CreateUriWithFragment...\n");
11656 test_CreateUriWithFragment();
11658 trace("test CreateIUriBuilder...\n");
11659 test_CreateIUriBuilder();
11661 trace("test IUriBuilder_CreateInvalidArgs...\n");
11662 test_IUriBuilder_CreateInvalidArgs();
11664 trace("test IUriBuilder...\n");
11665 test_IUriBuilder();
11667 trace("test IUriBuilder_GetInvalidArgs...\n");
11668 test_IUriBuilder_GetInvalidArgs();
11670 trace("test IUriBuilder_HasBeenModified...\n");
11671 test_IUriBuilder_HasBeenModified();
11673 trace("test IUriBuilder_IUriProperty...\n");
11674 test_IUriBuilder_IUriProperty();
11676 trace("test IUriBuilder_RemoveProperties...\n");
11677 test_IUriBuilder_RemoveProperties();
11679 trace("test IUriBuilder miscellaneous...\n");
11680 test_IUriBuilder_Misc();
11682 trace("test IUriBuilderFactory...\n");
11683 test_IUriBuilderFactory();
11685 trace("test CoInternetCombineIUri...\n");
11686 test_CoInternetCombineIUri();
11688 trace("test CoInternetCombineUrlEx...\n");
11689 test_CoInternetCombineUrlEx();
11691 trace("test CoInternetParseIUri Invalid Args...\n");
11692 test_CoInternetParseIUri_InvalidArgs();
11694 trace("test CoInternetParseIUri...\n");
11695 test_CoInternetParseIUri();
11697 register_protocols();
11699 trace("test CoInternetCombineIUri pluggable...\n");
11700 test_CoInternetCombineIUri_Pluggable();
11702 trace("test CoInternetCombineUrlEx Pluggable...\n");
11703 test_CoInternetCombineUrlEx_Pluggable();
11705 trace("test CoInternetParseIUri pluggable...\n");
11706 test_CoInternetParseIUri_Pluggable();
11708 trace("test CreateURLMoniker...\n");
11709 test_CreateURLMoniker();
11711 CoInitialize(NULL);
11713 trace("test IPersistStream...\n");
11714 test_IPersistStream();
11716 trace("test uninitialized Uri...\n");
11717 test_UninitializedUri();
11719 CoUninitialize();
11720 unregister_protocols();