urlmon: Properly handle relative URIs with specified host in combine_uri.
[wine/multimedia.git] / dlls / urlmon / tests / uri.c
blob4b0e7885f0c6afe58d6e38d8b4ea037b39adbfc5
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 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
365 {"urn:nothing:should:happen here",S_OK,FALSE},
366 {"",S_FALSE,FALSE},
367 {"urn:nothing:should:happen here",S_OK,FALSE},
368 {"",S_FALSE,FALSE},
369 {"",S_FALSE,FALSE},
370 {"",S_FALSE,FALSE},
371 {"",S_FALSE,FALSE},
372 {"",S_FALSE,FALSE},
373 {"nothing:should:happen here",S_OK,FALSE},
374 {"nothing:should:happen here",S_OK,FALSE},
375 {"",S_FALSE,FALSE},
376 {"urn:nothing:should:happen here",S_OK,FALSE},
377 {"urn",S_OK,FALSE},
378 {"",S_FALSE,FALSE},
379 {"",S_FALSE,FALSE}
382 {Uri_HOST_UNKNOWN,S_OK,FALSE},
383 {0,S_FALSE,FALSE},
384 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
388 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
390 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
391 {"127.0.0.1",S_OK,FALSE},
392 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
393 {"",S_FALSE,FALSE},
394 {".txt",S_OK,FALSE},
395 {"",S_FALSE,FALSE},
396 {"127.0.0.1",S_OK,FALSE},
397 {"",S_FALSE,FALSE},
398 {"/test%20dir/test.txt",S_OK,FALSE},
399 {"/test%20dir/test.txt",S_OK,FALSE},
400 {"",S_FALSE,FALSE},
401 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
402 {"http",S_OK,FALSE},
403 {"",S_FALSE,FALSE},
404 {"",S_FALSE,FALSE}
407 {Uri_HOST_IPV4,S_OK,FALSE},
408 {80,S_OK,FALSE},
409 {URL_SCHEME_HTTP,S_OK,FALSE},
410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
413 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
415 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
416 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
417 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
418 {"",S_FALSE,FALSE},
419 {"",S_FALSE,FALSE},
420 {"",S_FALSE,FALSE},
421 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
422 {"",S_FALSE,FALSE},
423 {"/",S_OK,FALSE},
424 {"/",S_OK,FALSE},
425 {"",S_FALSE,FALSE},
426 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
427 {"http",S_OK,FALSE},
428 {"",S_FALSE,FALSE},
429 {"",S_FALSE,FALSE}
432 {Uri_HOST_IPV6,S_OK,FALSE},
433 {80,S_OK,FALSE},
434 {URL_SCHEME_HTTP,S_OK,FALSE},
435 {URLZONE_INVALID,E_NOTIMPL,FALSE}
438 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
440 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
441 {"[::13.1.68.3]",S_OK,FALSE},
442 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
443 {"",S_FALSE,FALSE},
444 {"",S_FALSE,FALSE},
445 {"",S_FALSE,FALSE},
446 {"::13.1.68.3",S_OK,FALSE},
447 {"",S_FALSE,FALSE},
448 {"/",S_OK,FALSE},
449 {"/",S_OK,FALSE},
450 {"",S_FALSE,FALSE},
451 {"ftp://[::13.1.68.3]",S_OK,FALSE},
452 {"ftp",S_OK,FALSE},
453 {"",S_FALSE,FALSE},
454 {"",S_FALSE,FALSE}
457 {Uri_HOST_IPV6,S_OK,FALSE},
458 {21,S_OK,FALSE},
459 {URL_SCHEME_FTP,S_OK,FALSE},
460 {URLZONE_INVALID,E_NOTIMPL,FALSE}
463 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
465 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
466 {"[fedc:ba98::3210]",S_OK,FALSE},
467 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
468 {"",S_FALSE,FALSE},
469 {"",S_FALSE,FALSE},
470 {"",S_FALSE,FALSE},
471 {"fedc:ba98::3210",S_OK,FALSE},
472 {"",S_FALSE,FALSE},
473 {"/",S_OK,FALSE},
474 {"/",S_OK,FALSE},
475 {"",S_FALSE,FALSE},
476 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
477 {"http",S_OK,FALSE},
478 {"",S_FALSE,FALSE},
479 {"",S_FALSE,FALSE},
482 {Uri_HOST_IPV6,S_OK,FALSE},
483 {80,S_OK,FALSE},
484 {URL_SCHEME_HTTP,S_OK,FALSE},
485 {URLZONE_INVALID,E_NOTIMPL,FALSE}
488 { "1234://www.winehq.org", 0, S_OK, FALSE,
490 {"1234://www.winehq.org/",S_OK,FALSE},
491 {"www.winehq.org",S_OK,FALSE},
492 {"1234://www.winehq.org/",S_OK,FALSE},
493 {"winehq.org",S_OK,FALSE},
494 {"",S_FALSE,FALSE},
495 {"",S_FALSE,FALSE},
496 {"www.winehq.org",S_OK,FALSE},
497 {"",S_FALSE,FALSE},
498 {"/",S_OK,FALSE},
499 {"/",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"1234://www.winehq.org",S_OK,FALSE},
502 {"1234",S_OK,FALSE},
503 {"",S_FALSE,FALSE},
504 {"",S_FALSE,FALSE}
507 {Uri_HOST_DNS,S_OK,FALSE},
508 {0,S_FALSE,FALSE},
509 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
510 {URLZONE_INVALID,E_NOTIMPL,FALSE}
513 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
514 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
516 {"file:///C:/test/test.mp3",S_OK,FALSE},
517 {"",S_FALSE,FALSE},
518 {"file:///C:/test/test.mp3",S_OK,FALSE},
519 {"",S_FALSE,FALSE},
520 {".mp3",S_OK,FALSE},
521 {"",S_FALSE,FALSE},
522 {"",S_FALSE,FALSE},
523 {"",S_FALSE,FALSE},
524 {"/C:/test/test.mp3",S_OK,FALSE},
525 {"/C:/test/test.mp3",S_OK,FALSE},
526 {"",S_FALSE,FALSE},
527 {"C:/test/test.mp3",S_OK,FALSE},
528 {"file",S_OK,FALSE},
529 {"",S_FALSE,FALSE},
530 {"",S_FALSE,FALSE}
533 {Uri_HOST_UNKNOWN,S_OK,FALSE},
534 {0,S_FALSE,FALSE},
535 {URL_SCHEME_FILE,S_OK,FALSE},
536 {URLZONE_INVALID,E_NOTIMPL,FALSE}
539 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
540 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
542 {"file://server/test.mp3",S_OK,FALSE},
543 {"server",S_OK,FALSE},
544 {"file://server/test.mp3",S_OK,FALSE},
545 {"",S_FALSE,FALSE},
546 {".mp3",S_OK,FALSE},
547 {"",S_FALSE,FALSE},
548 {"server",S_OK,FALSE},
549 {"",S_FALSE,FALSE},
550 {"/test.mp3",S_OK,FALSE},
551 {"/test.mp3",S_OK,FALSE},
552 {"",S_FALSE,FALSE},
553 {"\\\\Server/test.mp3",S_OK,FALSE},
554 {"file",S_OK,FALSE},
555 {"",S_FALSE,FALSE},
556 {"",S_FALSE,FALSE}
559 {Uri_HOST_DNS,S_OK,FALSE},
560 {0,S_FALSE,FALSE},
561 {URL_SCHEME_FILE,S_OK,FALSE},
562 {URLZONE_INVALID,E_NOTIMPL,FALSE}
565 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
567 {"*:www.winehq.org/test",S_OK,FALSE},
568 {"www.winehq.org",S_OK,FALSE},
569 {"*:www.winehq.org/test",S_OK,FALSE},
570 {"winehq.org",S_OK,FALSE},
571 {"",S_FALSE,FALSE},
572 {"",S_FALSE,FALSE},
573 {"www.winehq.org",S_OK,FALSE},
574 {"",S_FALSE,FALSE},
575 {"/test",S_OK,FALSE},
576 {"/test",S_OK,FALSE},
577 {"",S_FALSE,FALSE},
578 {"www.winehq.org/test",S_OK,FALSE},
579 {"*",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_WILDCARD,S_OK,FALSE},
587 {URLZONE_INVALID,E_NOTIMPL,FALSE}
590 /* Valid since the '*' is the only character in the scheme name. */
591 { "*:www.winehq.org/test", 0, S_OK, FALSE,
593 {"*:www.winehq.org/test",S_OK,FALSE},
594 {"www.winehq.org",S_OK,FALSE},
595 {"*:www.winehq.org/test",S_OK,FALSE},
596 {"winehq.org",S_OK,FALSE},
597 {"",S_FALSE,FALSE},
598 {"",S_FALSE,FALSE},
599 {"www.winehq.org",S_OK,FALSE},
600 {"",S_FALSE,FALSE},
601 {"/test",S_OK,FALSE},
602 {"/test",S_OK,FALSE},
603 {"",S_FALSE,FALSE},
604 {"*:www.winehq.org/test",S_OK,FALSE},
605 {"*",S_OK,FALSE},
606 {"",S_FALSE,FALSE},
607 {"",S_FALSE,FALSE}
610 {Uri_HOST_DNS,S_OK,FALSE},
611 {0,S_FALSE,FALSE},
612 {URL_SCHEME_WILDCARD,S_OK,FALSE},
613 {URLZONE_INVALID,E_NOTIMPL,FALSE}
616 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
618 {"/../some dir/test.ext",S_OK,FALSE},
619 {"",S_FALSE,FALSE},
620 {"/../some dir/test.ext",S_OK,FALSE},
621 {"",S_FALSE,FALSE},
622 {".ext",S_OK,FALSE},
623 {"",S_FALSE,FALSE},
624 {"",S_FALSE,FALSE},
625 {"",S_FALSE,FALSE},
626 {"/../some dir/test.ext",S_OK,FALSE},
627 {"/../some dir/test.ext",S_OK,FALSE},
628 {"",S_FALSE,FALSE},
629 {"/../some dir/test.ext",S_OK,FALSE},
630 {"",S_FALSE,FALSE},
631 {"",S_FALSE,FALSE},
632 {"",S_FALSE,FALSE}
635 {Uri_HOST_UNKNOWN,S_OK,FALSE},
636 {0,S_FALSE,FALSE},
637 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
638 {URLZONE_INVALID,E_NOTIMPL,FALSE}
641 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
643 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
644 {"",S_OK,FALSE},
645 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
646 {"",S_FALSE,FALSE},
647 {"",S_FALSE,FALSE},
648 {"",S_FALSE,FALSE},
649 {"",S_OK,FALSE},
650 {"",S_FALSE,FALSE},
651 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
652 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
653 {"",S_FALSE,FALSE},
654 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
655 {"*",S_OK,FALSE},
656 {"",S_FALSE,FALSE},
657 {"",S_FALSE,FALSE},
660 {Uri_HOST_UNKNOWN,S_OK,FALSE},
661 {0,S_FALSE,FALSE},
662 {URL_SCHEME_WILDCARD,S_OK,FALSE},
663 {URLZONE_INVALID,E_NOTIMPL,FALSE}
666 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
667 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
669 {"zip:/.//google.com",S_OK,FALSE},
670 {"",S_FALSE,FALSE},
671 {"zip:/.//google.com",S_OK,FALSE},
672 {"",S_FALSE,FALSE},
673 {".com",S_OK,FALSE},
674 {"",S_FALSE,FALSE},
675 {"",S_FALSE,FALSE},
676 {"",S_FALSE,FALSE},
677 {"/.//google.com",S_OK,FALSE},
678 {"/.//google.com",S_OK,FALSE},
679 {"",S_FALSE,FALSE},
680 {"zip://google.com",S_OK,FALSE},
681 {"zip",S_OK,FALSE},
682 {"",S_FALSE,FALSE},
683 {"",S_FALSE,FALSE}
686 {Uri_HOST_UNKNOWN,S_OK,FALSE},
687 {0,S_FALSE,FALSE},
688 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
689 {URLZONE_INVALID,E_NOTIMPL,FALSE}
692 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
693 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
695 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
696 {"user:pass:word@winehq.org",S_OK,FALSE},
697 {"ftp://winehq.org/",S_OK,FALSE},
698 {"winehq.org",S_OK,FALSE},
699 {"",S_FALSE,FALSE},
700 {"",S_FALSE,FALSE},
701 {"winehq.org",S_OK,FALSE},
702 {"pass:word",S_OK,FALSE},
703 {"/",S_OK,FALSE},
704 {"/",S_OK,FALSE},
705 {"",S_FALSE,FALSE},
706 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
707 {"ftp",S_OK,FALSE},
708 {"user:pass:word",S_OK,FALSE},
709 {"user",S_OK,FALSE}
712 {Uri_HOST_DNS,S_OK,FALSE},
713 {21,S_OK,FALSE},
714 {URL_SCHEME_FTP,S_OK,FALSE},
715 {URLZONE_INVALID,E_NOTIMPL,FALSE}
718 /* Make sure % encoded unreserved characters are decoded. */
719 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
721 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
722 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
723 {"ftp://ftp.google.com/",S_OK,FALSE},
724 {"google.com",S_OK,FALSE},
725 {"",S_FALSE,FALSE},
726 {"",S_FALSE,FALSE},
727 {"ftp.google.com",S_OK,FALSE},
728 {"PASS",S_OK,FALSE},
729 {"/",S_OK,FALSE},
730 {"/",S_OK,FALSE},
731 {"",S_FALSE,FALSE},
732 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
733 {"ftp",S_OK,FALSE},
734 {"wINe:PASS",S_OK,FALSE},
735 {"wINe",S_OK,FALSE}
738 {Uri_HOST_DNS,S_OK,FALSE},
739 {21,S_OK,FALSE},
740 {URL_SCHEME_FTP,S_OK,FALSE},
741 {URLZONE_INVALID,E_NOTIMPL,FALSE}
744 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
745 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
747 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
748 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
749 {"ftp://ftp.google.com/",S_OK,FALSE},
750 {"google.com",S_OK,FALSE},
751 {"",S_FALSE,FALSE},
752 {"",S_FALSE,FALSE},
753 {"ftp.google.com",S_OK,FALSE},
754 {"PA%7B%7D",S_OK,FALSE},
755 {"/",S_OK,FALSE},
756 {"/",S_OK,FALSE},
757 {"",S_FALSE,FALSE},
758 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
759 {"ftp",S_OK,FALSE},
760 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
761 {"w%5D%5Be",S_OK,FALSE}
764 {Uri_HOST_DNS,S_OK,FALSE},
765 {21,S_OK,FALSE},
766 {URL_SCHEME_FTP,S_OK,FALSE},
767 {URLZONE_INVALID,E_NOTIMPL,FALSE}
770 /* You're allowed to have an empty password portion in the userinfo section. */
771 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
773 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
774 {"empty:@ftp.google.com",S_OK,FALSE},
775 {"ftp://ftp.google.com/",S_OK,FALSE},
776 {"google.com",S_OK,FALSE},
777 {"",S_FALSE,FALSE},
778 {"",S_FALSE,FALSE},
779 {"ftp.google.com",S_OK,FALSE},
780 {"",S_OK,FALSE},
781 {"/",S_OK,FALSE},
782 {"/",S_OK,FALSE},
783 {"",S_FALSE,FALSE},
784 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
785 {"ftp",S_OK,FALSE},
786 {"empty:",S_OK,FALSE},
787 {"empty",S_OK,FALSE}
790 {Uri_HOST_DNS,S_OK,FALSE},
791 {21,S_OK,FALSE},
792 {URL_SCHEME_FTP,S_OK,FALSE},
793 {URLZONE_INVALID,E_NOTIMPL,FALSE}
796 /* Make sure forbidden characters in "userinfo" get encoded. */
797 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
799 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
800 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
801 {"ftp://ftp.google.com/",S_OK,FALSE},
802 {"google.com",S_OK,FALSE},
803 {"",S_FALSE,FALSE},
804 {"",S_FALSE,FALSE},
805 {"ftp.google.com",S_OK,FALSE},
806 {"",S_FALSE,FALSE},
807 {"/",S_OK,FALSE},
808 {"/",S_OK,FALSE},
809 {"",S_FALSE,FALSE},
810 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
811 {"ftp",S_OK,FALSE},
812 {"%22%20%22weird",S_OK,FALSE},
813 {"%22%20%22weird",S_OK,FALSE}
816 {Uri_HOST_DNS,S_OK,FALSE},
817 {21,S_OK,FALSE},
818 {URL_SCHEME_FTP,S_OK,FALSE},
819 {URLZONE_INVALID,E_NOTIMPL,FALSE}
822 /* Make sure the forbidden characters don't get percent encoded. */
823 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
825 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
826 {"\" \"weird@ftp.google.com",S_OK,FALSE},
827 {"ftp://ftp.google.com/",S_OK,FALSE},
828 {"google.com",S_OK,FALSE},
829 {"",S_FALSE,FALSE},
830 {"",S_FALSE,FALSE},
831 {"ftp.google.com",S_OK,FALSE},
832 {"",S_FALSE,FALSE},
833 {"/",S_OK,FALSE},
834 {"/",S_OK,FALSE},
835 {"",S_FALSE,FALSE},
836 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
837 {"ftp",S_OK,FALSE},
838 {"\" \"weird",S_OK,FALSE},
839 {"\" \"weird",S_OK,FALSE}
842 {Uri_HOST_DNS,S_OK,FALSE},
843 {21,S_OK,FALSE},
844 {URL_SCHEME_FTP,S_OK,FALSE},
845 {URLZONE_INVALID,E_NOTIMPL,FALSE}
848 /* Make sure already percent encoded characters don't get unencoded. */
849 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
851 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
852 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
853 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
854 {"google.com",S_OK,FALSE},
855 {"",S_FALSE,FALSE},
856 {"",S_FALSE,FALSE},
857 {"ftp.google.com",S_OK,FALSE},
858 {"",S_FALSE,FALSE},
859 {"/\"%20\"weird",S_OK,FALSE},
860 {"/\"%20\"weird",S_OK,FALSE},
861 {"",S_FALSE,FALSE},
862 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
863 {"ftp",S_OK,FALSE},
864 {"\"%20\"weird",S_OK,FALSE},
865 {"\"%20\"weird",S_OK,FALSE}
868 {Uri_HOST_DNS,S_OK,FALSE},
869 {21,S_OK,FALSE},
870 {URL_SCHEME_FTP,S_OK,FALSE},
871 {URLZONE_INVALID,E_NOTIMPL,FALSE}
874 /* Allowed to have invalid % encoded because its an unknown scheme type. */
875 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
877 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
878 {"%xy:word@winehq.org",S_OK,FALSE},
879 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
880 {"winehq.org",S_OK,FALSE},
881 {"",S_FALSE,FALSE},
882 {"",S_FALSE,FALSE},
883 {"winehq.org",S_OK,FALSE},
884 {"word",S_OK,FALSE},
885 {"/",S_OK,FALSE},
886 {"/",S_OK,FALSE},
887 {"",S_FALSE,FALSE},
888 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
889 {"zip",S_OK,FALSE},
890 {"%xy:word",S_OK,FALSE},
891 {"%xy",S_OK,FALSE}
894 {Uri_HOST_DNS,S_OK,FALSE},
895 {0,S_FALSE,FALSE},
896 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
897 {URLZONE_INVALID,E_NOTIMPL,FALSE}
900 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
901 * isn't known.
903 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
905 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
906 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
907 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
908 {"winehq.org",S_OK,FALSE},
909 {"",S_FALSE,FALSE},
910 {"",S_FALSE,FALSE},
911 {"winehq.org",S_OK,FALSE},
912 {"%52%53ord",S_OK,FALSE},
913 {"/",S_OK,FALSE},
914 {"/",S_OK,FALSE},
915 {"",S_FALSE,FALSE},
916 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
917 {"zip",S_OK,FALSE},
918 {"%2E:%52%53ord",S_OK,FALSE},
919 {"%2E",S_OK,FALSE}
922 {Uri_HOST_DNS,S_OK,FALSE},
923 {0,S_FALSE,FALSE},
924 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
925 {URLZONE_INVALID,E_NOTIMPL,FALSE}
928 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
930 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
931 {"[](),'test':word@winehq.org",S_OK,FALSE},
932 {"ftp://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 {"word",S_OK,FALSE},
938 {"/",S_OK,FALSE},
939 {"/",S_OK,FALSE},
940 {"",S_FALSE,FALSE},
941 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
942 {"ftp",S_OK,FALSE},
943 {"[](),'test':word",S_OK,FALSE},
944 {"[](),'test'",S_OK,FALSE}
947 {Uri_HOST_DNS,S_OK,FALSE},
948 {21,S_OK,FALSE},
949 {URL_SCHEME_FTP,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",S_OK,FALSE},
957 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
958 {"",S_FALSE,FALSE},
959 {"",S_FALSE,FALSE},
960 {"",S_FALSE,FALSE},
961 {"test",S_OK,FALSE},
962 {"",S_FALSE,FALSE},
963 {"/",S_OK,FALSE},
964 {"/?:word@winehq.org/",S_OK,FALSE},
965 {"?:word@winehq.org/",S_OK,FALSE},
966 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
967 {"ftp",S_OK,FALSE},
968 {"",S_FALSE,FALSE},
969 {"",S_FALSE,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 {"#:word@winehq.org/",S_OK,FALSE},
986 {"test",S_OK,FALSE},
987 {"",S_FALSE,FALSE},
988 {"/",S_OK,FALSE},
989 {"/",S_OK,FALSE},
990 {"",S_FALSE,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 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1004 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
1006 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1007 {"test\\:word@winehq.org",S_OK,FALSE},
1008 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1009 {"winehq.org",S_OK,FALSE},
1010 {"",S_FALSE,FALSE},
1011 {"",S_FALSE,FALSE},
1012 {"winehq.org",S_OK,FALSE},
1013 {"word",S_OK,FALSE},
1014 {"/",S_OK,FALSE},
1015 {"/",S_OK,FALSE},
1016 {"",S_FALSE,FALSE},
1017 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
1018 {"zip",S_OK,FALSE},
1019 {"test\\:word",S_OK,FALSE},
1020 {"test\\",S_OK,FALSE}
1023 {Uri_HOST_DNS,S_OK,FALSE},
1024 {0,S_FALSE,FALSE},
1025 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1026 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1029 /* It normalizes IPv4 addresses correctly. */
1030 { "http://127.000.000.100/", 0, S_OK, FALSE,
1032 {"http://127.0.0.100/",S_OK,FALSE},
1033 {"127.0.0.100",S_OK,FALSE},
1034 {"http://127.0.0.100/",S_OK,FALSE},
1035 {"",S_FALSE,FALSE},
1036 {"",S_FALSE,FALSE},
1037 {"",S_FALSE,FALSE},
1038 {"127.0.0.100",S_OK,FALSE},
1039 {"",S_FALSE,FALSE},
1040 {"/",S_OK,FALSE},
1041 {"/",S_OK,FALSE},
1042 {"",S_FALSE,FALSE},
1043 {"http://127.000.000.100/",S_OK,FALSE},
1044 {"http",S_OK,FALSE},
1045 {"",S_FALSE,FALSE},
1046 {"",S_FALSE,FALSE}
1049 {Uri_HOST_IPV4,S_OK,FALSE},
1050 {80,S_OK,FALSE},
1051 {URL_SCHEME_HTTP,S_OK,FALSE},
1052 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1055 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1057 {"http://127.0.0.1:8000/",S_OK},
1058 {"127.0.0.1:8000",S_OK},
1059 {"http://127.0.0.1:8000/",S_OK},
1060 {"",S_FALSE},
1061 {"",S_FALSE},
1062 {"",S_FALSE},
1063 {"127.0.0.1",S_OK},
1064 {"",S_FALSE},
1065 {"/",S_OK},
1066 {"/",S_OK},
1067 {"",S_FALSE},
1068 {"http://127.0.0.1:8000",S_OK},
1069 {"http",S_OK},
1070 {"",S_FALSE},
1071 {"",S_FALSE}
1074 {Uri_HOST_IPV4,S_OK,FALSE},
1075 {8000,S_OK,FALSE},
1076 {URL_SCHEME_HTTP,S_OK,FALSE},
1077 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1080 /* Make sure it normalizes partial IPv4 addresses correctly. */
1081 { "http://127.0/", 0, S_OK, FALSE,
1083 {"http://127.0.0.0/",S_OK,FALSE},
1084 {"127.0.0.0",S_OK,FALSE},
1085 {"http://127.0.0.0/",S_OK,FALSE},
1086 {"",S_FALSE,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"",S_FALSE,FALSE},
1089 {"127.0.0.0",S_OK,FALSE},
1090 {"",S_FALSE,FALSE},
1091 {"/",S_OK,FALSE},
1092 {"/",S_OK,FALSE},
1093 {"",S_FALSE,FALSE},
1094 {"http://127.0/",S_OK,FALSE},
1095 {"http",S_OK,FALSE},
1096 {"",S_FALSE,FALSE},
1097 {"",S_FALSE,FALSE}
1100 {Uri_HOST_IPV4,S_OK,FALSE},
1101 {80,S_OK,FALSE},
1102 {URL_SCHEME_HTTP,S_OK,FALSE},
1103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1106 /* Make sure it converts implicit IPv4's correctly. */
1107 { "http://123456/", 0, S_OK, FALSE,
1109 {"http://0.1.226.64/",S_OK,FALSE},
1110 {"0.1.226.64",S_OK,FALSE},
1111 {"http://0.1.226.64/",S_OK,FALSE},
1112 {"",S_FALSE,FALSE},
1113 {"",S_FALSE,FALSE},
1114 {"",S_FALSE,FALSE},
1115 {"0.1.226.64",S_OK,FALSE},
1116 {"",S_FALSE,FALSE},
1117 {"/",S_OK,FALSE},
1118 {"/",S_OK,FALSE},
1119 {"",S_FALSE,FALSE},
1120 {"http://123456/",S_OK,FALSE},
1121 {"http",S_OK,FALSE},
1122 {"",S_FALSE,FALSE},
1123 {"",S_FALSE,FALSE}
1126 {Uri_HOST_IPV4,S_OK,FALSE},
1127 {80,S_OK,FALSE},
1128 {URL_SCHEME_HTTP,S_OK,FALSE},
1129 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1132 /* UINT_MAX */
1133 { "http://4294967295/", 0, S_OK, FALSE,
1135 {"http://255.255.255.255/",S_OK,FALSE},
1136 {"255.255.255.255",S_OK,FALSE},
1137 {"http://255.255.255.255/",S_OK,FALSE},
1138 {"",S_FALSE,FALSE},
1139 {"",S_FALSE,FALSE},
1140 {"",S_FALSE,FALSE},
1141 {"255.255.255.255",S_OK,FALSE},
1142 {"",S_FALSE,FALSE},
1143 {"/",S_OK,FALSE},
1144 {"/",S_OK,FALSE},
1145 {"",S_FALSE,FALSE},
1146 {"http://4294967295/",S_OK,FALSE},
1147 {"http",S_OK,FALSE},
1148 {"",S_FALSE,FALSE},
1149 {"",S_FALSE,FALSE}
1152 {Uri_HOST_IPV4,S_OK,FALSE},
1153 {80,S_OK,FALSE},
1154 {URL_SCHEME_HTTP,S_OK,FALSE},
1155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1158 /* UINT_MAX+1 */
1159 { "http://4294967296/", 0, S_OK, FALSE,
1161 {"http://4294967296/",S_OK,FALSE},
1162 {"4294967296",S_OK,FALSE},
1163 {"http://4294967296/",S_OK,FALSE},
1164 {"",S_FALSE,FALSE},
1165 {"",S_FALSE,FALSE},
1166 {"",S_FALSE,FALSE},
1167 {"4294967296",S_OK,FALSE},
1168 {"",S_FALSE,FALSE},
1169 {"/",S_OK,FALSE},
1170 {"/",S_OK,FALSE},
1171 {"",S_FALSE,FALSE},
1172 {"http://4294967296/",S_OK,FALSE},
1173 {"http",S_OK,FALSE},
1174 {"",S_FALSE,FALSE},
1175 {"",S_FALSE,FALSE}
1178 {Uri_HOST_DNS,S_OK,FALSE},
1179 {80,S_OK,FALSE},
1180 {URL_SCHEME_HTTP,S_OK,FALSE},
1181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1184 /* Window's doesn't normalize IP address for unknown schemes. */
1185 { "1234://4294967295/", 0, S_OK, FALSE,
1187 {"1234://4294967295/",S_OK,FALSE},
1188 {"4294967295",S_OK,FALSE},
1189 {"1234://4294967295/",S_OK,FALSE},
1190 {"",S_FALSE,FALSE},
1191 {"",S_FALSE,FALSE},
1192 {"",S_FALSE,FALSE},
1193 {"4294967295",S_OK,FALSE},
1194 {"",S_FALSE,FALSE},
1195 {"/",S_OK,FALSE},
1196 {"/",S_OK,FALSE},
1197 {"",S_FALSE,FALSE},
1198 {"1234://4294967295/",S_OK,FALSE},
1199 {"1234",S_OK,FALSE},
1200 {"",S_FALSE,FALSE},
1201 {"",S_FALSE,FALSE}
1204 {Uri_HOST_IPV4,S_OK,FALSE},
1205 {0,S_FALSE,FALSE},
1206 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1207 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1210 /* Window's doesn't normalize IP address for unknown schemes. */
1211 { "1234://127.001/", 0, S_OK, FALSE,
1213 {"1234://127.001/",S_OK,FALSE},
1214 {"127.001",S_OK,FALSE},
1215 {"1234://127.001/",S_OK,FALSE},
1216 {"",S_FALSE,FALSE},
1217 {"",S_FALSE,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"127.001",S_OK,FALSE},
1220 {"",S_FALSE,FALSE},
1221 {"/",S_OK,FALSE},
1222 {"/",S_OK,FALSE},
1223 {"",S_FALSE,FALSE},
1224 {"1234://127.001/",S_OK,FALSE},
1225 {"1234",S_OK,FALSE},
1226 {"",S_FALSE,FALSE},
1227 {"",S_FALSE,FALSE}
1230 {Uri_HOST_IPV4,S_OK,FALSE},
1231 {0,S_FALSE,FALSE},
1232 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1236 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1238 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1239 {"[fedc:ba98::3210]",S_OK,FALSE},
1240 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1241 {"",S_FALSE,FALSE},
1242 {"",S_FALSE,FALSE},
1243 {"",S_FALSE,FALSE},
1244 {"fedc:ba98::3210",S_OK,FALSE},
1245 {"",S_FALSE,FALSE},
1246 {"/",S_OK,FALSE},
1247 {"/",S_OK,FALSE},
1248 {"",S_FALSE,FALSE},
1249 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1250 {"http",S_OK,FALSE},
1251 {"",S_FALSE,FALSE},
1252 {"",S_FALSE,FALSE},
1255 {Uri_HOST_IPV6,S_OK,FALSE},
1256 {80,S_OK,FALSE},
1257 {URL_SCHEME_HTTP,S_OK,FALSE},
1258 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1261 { "http://[::]", 0, S_OK, FALSE,
1263 {"http://[::]/",S_OK,FALSE},
1264 {"[::]",S_OK,FALSE},
1265 {"http://[::]/",S_OK,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"",S_FALSE,FALSE},
1268 {"",S_FALSE,FALSE},
1269 {"::",S_OK,FALSE},
1270 {"",S_FALSE,FALSE},
1271 {"/",S_OK,FALSE},
1272 {"/",S_OK,FALSE},
1273 {"",S_FALSE,FALSE},
1274 {"http://[::]",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://[FEDC:BA98::]", 0, S_OK, FALSE,
1288 {"http://[fedc:ba98::]/",S_OK,FALSE},
1289 {"[fedc:ba98::]",S_OK,FALSE},
1290 {"http://[fedc:ba98::]/",S_OK,FALSE},
1291 {"",S_FALSE,FALSE},
1292 {"",S_FALSE,FALSE},
1293 {"",S_FALSE,FALSE},
1294 {"fedc:ba98::",S_OK,FALSE},
1295 {"",S_FALSE,FALSE},
1296 {"/",S_OK,FALSE},
1297 {"/",S_OK,FALSE},
1298 {"",S_FALSE,FALSE},
1299 {"http://[FEDC:BA98::]",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 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1312 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1314 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1315 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1316 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1317 {"",S_FALSE,FALSE},
1318 {"",S_FALSE,FALSE},
1319 {"",S_FALSE,FALSE},
1320 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1321 {"",S_FALSE,FALSE},
1322 {"/",S_OK,FALSE},
1323 {"/",S_OK,FALSE},
1324 {"",S_FALSE,FALSE},
1325 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1326 {"http",S_OK,FALSE},
1327 {"",S_FALSE,FALSE},
1328 {"",S_FALSE,FALSE},
1331 {Uri_HOST_IPV6,S_OK,FALSE},
1332 {80,S_OK,FALSE},
1333 {URL_SCHEME_HTTP,S_OK,FALSE},
1334 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1337 { "http://[v2.34]/", 0, S_OK, FALSE,
1339 {"http://[v2.34]/",S_OK,FALSE},
1340 {"[v2.34]",S_OK,FALSE},
1341 {"http://[v2.34]/",S_OK,FALSE},
1342 {"",S_FALSE,FALSE},
1343 {"",S_FALSE,FALSE},
1344 {"",S_FALSE,FALSE},
1345 {"[v2.34]",S_OK,FALSE},
1346 {"",S_FALSE,FALSE},
1347 {"/",S_OK,FALSE},
1348 {"/",S_OK,FALSE},
1349 {"",S_FALSE,FALSE},
1350 {"http://[v2.34]/",S_OK,FALSE},
1351 {"http",S_OK,FALSE},
1352 {"",S_FALSE,FALSE},
1353 {"",S_FALSE,FALSE}
1356 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1357 {80,S_OK,FALSE},
1358 {URL_SCHEME_HTTP,S_OK,FALSE},
1359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1362 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1363 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1365 {"http://[xyz:12345.com/test",S_OK,FALSE},
1366 {"[xyz:12345.com",S_OK,FALSE},
1367 {"http://[xyz:12345.com/test",S_OK,FALSE},
1368 {"[xyz:12345.com",S_OK,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"",S_FALSE,FALSE},
1371 {"[xyz:12345.com",S_OK,FALSE},
1372 {"",S_FALSE,FALSE},
1373 {"/test",S_OK,FALSE},
1374 {"/test",S_OK,FALSE},
1375 {"",S_FALSE,FALSE},
1376 {"http://[xyz:12345.com/test",S_OK,FALSE},
1377 {"http",S_OK,FALSE},
1378 {"",S_FALSE,FALSE},
1379 {"",S_FALSE,FALSE}
1382 {Uri_HOST_DNS,S_OK,FALSE},
1383 {80,S_OK,FALSE},
1384 {URL_SCHEME_HTTP,S_OK,FALSE},
1385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1388 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1389 * of the host name (respectively).
1391 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1393 {"ftp://www.[works].com/",S_OK,FALSE},
1394 {"www.[works].com",S_OK,FALSE},
1395 {"ftp://www.[works].com/",S_OK,FALSE},
1396 {"[works].com",S_OK,FALSE},
1397 {"",S_FALSE,FALSE},
1398 {"",S_FALSE,FALSE},
1399 {"www.[works].com",S_OK,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"/",S_OK,FALSE},
1402 {"/",S_OK,FALSE},
1403 {"",S_FALSE,FALSE},
1404 {"ftp://www.[works].com/",S_OK,FALSE},
1405 {"ftp",S_OK,FALSE},
1406 {"",S_FALSE,FALSE},
1407 {"",S_FALSE,FALSE}
1410 {Uri_HOST_DNS,S_OK,FALSE},
1411 {21,S_OK,FALSE},
1412 {URL_SCHEME_FTP,S_OK,FALSE},
1413 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1416 /* Considers ':' a delimiter since it appears after the ']'. */
1417 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1419 {"http://www.google.com]:12345/",S_OK,FALSE},
1420 {"www.google.com]:12345",S_OK,FALSE},
1421 {"http://www.google.com]:12345/",S_OK,FALSE},
1422 {"google.com]",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"",S_FALSE,FALSE},
1425 {"www.google.com]",S_OK,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"/",S_OK,FALSE},
1428 {"/",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"http://www.google.com]:12345/",S_OK,FALSE},
1431 {"http",S_OK,FALSE},
1432 {"",S_FALSE,FALSE},
1433 {"",S_FALSE,FALSE}
1436 {Uri_HOST_DNS,S_OK,FALSE},
1437 {12345,S_OK,FALSE},
1438 {URL_SCHEME_HTTP,S_OK,FALSE},
1439 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1442 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1443 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1445 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1446 {"w%XXw%GEw.google.com",S_OK,FALSE},
1447 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1448 {"google.com",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"",S_FALSE,FALSE},
1451 {"w%XXw%GEw.google.com",S_OK,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"/",S_OK,FALSE},
1454 {"/",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1457 {"zip",S_OK,FALSE},
1458 {"",S_FALSE,FALSE},
1459 {"",S_FALSE,FALSE}
1462 {Uri_HOST_DNS,S_OK,FALSE},
1463 {0,S_FALSE,FALSE},
1464 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1465 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1468 /* Unknown scheme types hostname doesn't get lower cased. */
1469 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1471 {"zip://GOOGLE.com/",S_OK,FALSE},
1472 {"GOOGLE.com",S_OK,FALSE},
1473 {"zip://GOOGLE.com/",S_OK,FALSE},
1474 {"GOOGLE.com",S_OK,FALSE},
1475 {"",S_FALSE,FALSE},
1476 {"",S_FALSE,FALSE},
1477 {"GOOGLE.com",S_OK,FALSE},
1478 {"",S_FALSE,FALSE},
1479 {"/",S_OK,FALSE},
1480 {"/",S_OK,FALSE},
1481 {"",S_FALSE,FALSE},
1482 {"zip://GOOGLE.com/",S_OK,FALSE},
1483 {"zip",S_OK,FALSE},
1484 {"",S_FALSE,FALSE},
1485 {"",S_FALSE,FALSE}
1488 {Uri_HOST_DNS,S_OK,FALSE},
1489 {0,S_FALSE,FALSE},
1490 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1491 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1494 /* Hostname gets lower-cased for known scheme types. */
1495 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1497 {"http://www.google.com/",S_OK,FALSE},
1498 {"www.google.com",S_OK,FALSE},
1499 {"http://www.google.com/",S_OK,FALSE},
1500 {"google.com",S_OK,FALSE},
1501 {"",S_FALSE,FALSE},
1502 {"",S_FALSE,FALSE},
1503 {"www.google.com",S_OK,FALSE},
1504 {"",S_FALSE,FALSE},
1505 {"/",S_OK,FALSE},
1506 {"/",S_OK,FALSE},
1507 {"",S_FALSE,FALSE},
1508 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1509 {"http",S_OK,FALSE},
1510 {"",S_FALSE,FALSE},
1511 {"",S_FALSE,FALSE}
1514 {Uri_HOST_DNS,S_OK,FALSE},
1515 {80,S_OK,FALSE},
1516 {URL_SCHEME_HTTP,S_OK,FALSE},
1517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1520 /* Characters that get % encoded in the hostname also have their percent
1521 * encoded forms lower cased.
1523 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1525 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1526 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1527 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1528 {"%7cgoogle%7c.com",S_OK,FALSE},
1529 {"",S_FALSE,FALSE},
1530 {"",S_FALSE,FALSE},
1531 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1532 {"",S_FALSE,FALSE},
1533 {"/",S_OK,FALSE},
1534 {"/",S_OK,FALSE},
1535 {"",S_FALSE,FALSE},
1536 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1537 {"http",S_OK,FALSE},
1538 {"",S_FALSE,FALSE},
1539 {"",S_FALSE,FALSE}
1542 {Uri_HOST_DNS,S_OK,FALSE},
1543 {80,S_OK,FALSE},
1544 {URL_SCHEME_HTTP,S_OK,FALSE},
1545 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1548 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1549 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1551 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1552 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1553 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1554 {"",S_FALSE,FALSE},
1555 {"",S_FALSE,FALSE},
1556 {"",S_FALSE,FALSE},
1557 {"1:2:3:4:5:6::",S_OK,FALSE},
1558 {"",S_FALSE,FALSE},
1559 {"/",S_OK,FALSE},
1560 {"/",S_OK,FALSE},
1561 {"",S_FALSE,FALSE},
1562 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1563 {"http",S_OK,FALSE},
1564 {"",S_FALSE,FALSE},
1565 {"",S_FALSE,FALSE},
1568 {Uri_HOST_IPV6,S_OK,FALSE},
1569 {80,S_OK,FALSE},
1570 {URL_SCHEME_HTTP,S_OK,FALSE},
1571 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1574 /* IPv4 addresses get normalized. */
1575 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1577 {"http://[::1.2.3.0]/",S_OK,FALSE},
1578 {"[::1.2.3.0]",S_OK,FALSE},
1579 {"http://[::1.2.3.0]/",S_OK,FALSE},
1580 {"",S_FALSE,FALSE},
1581 {"",S_FALSE,FALSE},
1582 {"",S_FALSE,FALSE},
1583 {"::1.2.3.0",S_OK,FALSE},
1584 {"",S_FALSE,FALSE},
1585 {"/",S_OK,FALSE},
1586 {"/",S_OK,FALSE},
1587 {"",S_FALSE,FALSE},
1588 {"http://[::001.002.003.000]",S_OK,FALSE},
1589 {"http",S_OK,FALSE},
1590 {"",S_FALSE,FALSE},
1591 {"",S_FALSE,FALSE},
1594 {Uri_HOST_IPV6,S_OK,FALSE},
1595 {80,S_OK,FALSE},
1596 {URL_SCHEME_HTTP,S_OK,FALSE},
1597 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1600 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1601 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1603 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1604 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1605 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1606 {"",S_FALSE,FALSE},
1607 {"",S_FALSE,FALSE},
1608 {"",S_FALSE,FALSE},
1609 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1610 {"",S_FALSE,FALSE},
1611 {"/",S_OK,FALSE},
1612 {"/",S_OK,FALSE},
1613 {"",S_FALSE,FALSE},
1614 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1615 {"zip",S_OK,FALSE},
1616 {"",S_FALSE,FALSE},
1617 {"",S_FALSE,FALSE},
1620 {Uri_HOST_IPV6,S_OK,FALSE},
1621 {0,S_FALSE,FALSE},
1622 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1623 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1626 /* IPv4 address is converted into 2 h16 components. */
1627 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1629 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1630 {"[ffff::c0de:6f20]",S_OK,FALSE},
1631 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"",S_FALSE,FALSE},
1634 {"",S_FALSE,FALSE},
1635 {"ffff::c0de:6f20",S_OK,FALSE},
1636 {"",S_FALSE,FALSE},
1637 {"/",S_OK,FALSE},
1638 {"/",S_OK,FALSE},
1639 {"",S_FALSE,FALSE},
1640 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1641 {"http",S_OK,FALSE},
1642 {"",S_FALSE,FALSE},
1643 {"",S_FALSE,FALSE},
1646 {Uri_HOST_IPV6,S_OK,FALSE},
1647 {80,S_OK,FALSE},
1648 {URL_SCHEME_HTTP,S_OK,FALSE},
1649 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1652 /* Max value for a port. */
1653 { "http://google.com:65535", 0, S_OK, FALSE,
1655 {"http://google.com:65535/",S_OK,FALSE},
1656 {"google.com:65535",S_OK,FALSE},
1657 {"http://google.com:65535/",S_OK,FALSE},
1658 {"google.com",S_OK,FALSE},
1659 {"",S_FALSE,FALSE},
1660 {"",S_FALSE,FALSE},
1661 {"google.com",S_OK,FALSE},
1662 {"",S_FALSE,FALSE},
1663 {"/",S_OK,FALSE},
1664 {"/",S_OK,FALSE},
1665 {"",S_FALSE,FALSE},
1666 {"http://google.com:65535",S_OK,FALSE},
1667 {"http",S_OK,FALSE},
1668 {"",S_FALSE,FALSE},
1669 {"",S_FALSE,FALSE}
1672 {Uri_HOST_DNS,S_OK,FALSE},
1673 {65535,S_OK,FALSE},
1674 {URL_SCHEME_HTTP,S_OK,FALSE},
1675 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1678 { "zip://google.com:65536", 0, S_OK, FALSE,
1680 {"zip://google.com:65536/",S_OK,FALSE},
1681 {"google.com:65536",S_OK,FALSE},
1682 {"zip://google.com:65536/",S_OK,FALSE},
1683 {"google.com:65536",S_OK,FALSE},
1684 {"",S_FALSE,FALSE},
1685 {"",S_FALSE,FALSE},
1686 {"google.com:65536",S_OK,FALSE},
1687 {"",S_FALSE,FALSE},
1688 {"/",S_OK,FALSE},
1689 {"/",S_OK,FALSE},
1690 {"",S_FALSE,FALSE},
1691 {"zip://google.com:65536",S_OK,FALSE},
1692 {"zip",S_OK,FALSE},
1693 {"",S_FALSE,FALSE},
1694 {"",S_FALSE,FALSE}
1697 {Uri_HOST_DNS,S_OK,FALSE},
1698 {0,S_FALSE,FALSE},
1699 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1700 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1703 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1705 {"zip://google.com:65536:25/",S_OK,FALSE},
1706 {"google.com:65536:25",S_OK,FALSE},
1707 {"zip://google.com:65536:25/",S_OK,FALSE},
1708 {"google.com:65536:25",S_OK,FALSE},
1709 {"",S_FALSE,FALSE},
1710 {"",S_FALSE,FALSE},
1711 {"google.com:65536:25",S_OK,FALSE},
1712 {"",S_FALSE,FALSE},
1713 {"/",S_OK,FALSE},
1714 {"/",S_OK,FALSE},
1715 {"",S_FALSE,FALSE},
1716 {"zip://google.com:65536:25",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://[::ffff]:abcd", 0, S_OK, FALSE,
1730 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1731 {"[::ffff]:abcd",S_OK,FALSE},
1732 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1733 {"",S_FALSE,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"[::ffff]:abcd",S_OK,FALSE},
1737 {"",S_FALSE,FALSE},
1738 {"/",S_OK,FALSE},
1739 {"/",S_OK,FALSE},
1740 {"",S_FALSE,FALSE},
1741 {"zip://[::ffff]:abcd",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://127.0.0.1:abcd", 0, S_OK, FALSE,
1755 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1756 {"127.0.0.1:abcd",S_OK,FALSE},
1757 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1758 {"0.1:abcd",S_OK,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"127.0.0.1:abcd",S_OK,FALSE},
1762 {"",S_FALSE,FALSE},
1763 {"/",S_OK,FALSE},
1764 {"/",S_OK,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"zip://127.0.0.1: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 /* Port is just copied over. */
1779 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1781 {"http://google.com:00035",S_OK,FALSE},
1782 {"google.com:00035",S_OK,FALSE},
1783 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1784 {"google.com",S_OK,FALSE},
1785 {"",S_FALSE,FALSE},
1786 {"",S_FALSE,FALSE},
1787 {"google.com",S_OK,FALSE},
1788 {"",S_FALSE,FALSE},
1789 {"",S_FALSE,FALSE},
1790 {"",S_FALSE,FALSE},
1791 {"",S_FALSE,FALSE},
1792 {"http://google.com:00035",S_OK,FALSE},
1793 {"http",S_OK,FALSE},
1794 {"",S_FALSE,FALSE},
1795 {"",S_FALSE,FALSE}
1798 {Uri_HOST_DNS,S_OK,FALSE},
1799 {35,S_OK,FALSE},
1800 {URL_SCHEME_HTTP,S_OK,FALSE},
1801 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1804 /* Default port is copied over. */
1805 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1807 {"http://google.com:80",S_OK,FALSE},
1808 {"google.com:80",S_OK,FALSE},
1809 {"http://google.com:80",S_OK,FALSE},
1810 {"google.com",S_OK,FALSE},
1811 {"",S_FALSE,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"google.com",S_OK,FALSE},
1814 {"",S_FALSE,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"",S_FALSE,FALSE},
1817 {"",S_FALSE,FALSE},
1818 {"http://google.com:80",S_OK,FALSE},
1819 {"http",S_OK,FALSE},
1820 {"",S_FALSE,FALSE},
1821 {"",S_FALSE,FALSE}
1824 {Uri_HOST_DNS,S_OK,FALSE},
1825 {80,S_OK,FALSE},
1826 {URL_SCHEME_HTTP,S_OK,FALSE},
1827 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1830 { "http://google.com.uk", 0, S_OK, FALSE,
1832 {"http://google.com.uk/",S_OK,FALSE},
1833 {"google.com.uk",S_OK,FALSE},
1834 {"http://google.com.uk/",S_OK,FALSE},
1835 {"google.com.uk",S_OK,FALSE},
1836 {"",S_FALSE,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"google.com.uk",S_OK,FALSE},
1839 {"",S_FALSE,FALSE},
1840 {"/",S_OK,FALSE},
1841 {"/",S_OK,FALSE},
1842 {"",S_FALSE,FALSE},
1843 {"http://google.com.uk",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.com", 0, S_OK, FALSE,
1857 {"http://google.com.com/",S_OK,FALSE},
1858 {"google.com.com",S_OK,FALSE},
1859 {"http://google.com.com/",S_OK,FALSE},
1860 {"com.com",S_OK,FALSE},
1861 {"",S_FALSE,FALSE},
1862 {"",S_FALSE,FALSE},
1863 {"google.com.com",S_OK,FALSE},
1864 {"",S_FALSE,FALSE},
1865 {"/",S_OK,FALSE},
1866 {"/",S_OK,FALSE},
1867 {"",S_FALSE,FALSE},
1868 {"http://google.com.com",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.uk.1", 0, S_OK, FALSE,
1882 {"http://google.uk.1/",S_OK,FALSE},
1883 {"google.uk.1",S_OK,FALSE},
1884 {"http://google.uk.1/",S_OK,FALSE},
1885 {"google.uk.1",S_OK,FALSE},
1886 {"",S_FALSE,FALSE},
1887 {"",S_FALSE,FALSE},
1888 {"google.uk.1",S_OK,FALSE},
1889 {"",S_FALSE,FALSE},
1890 {"/",S_OK,FALSE},
1891 {"/",S_OK,FALSE},
1892 {"",S_FALSE,FALSE},
1893 {"http://google.uk.1",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 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1906 { "http://google.foo.uk", 0, S_OK, FALSE,
1908 {"http://google.foo.uk/",S_OK,FALSE},
1909 {"google.foo.uk",S_OK,FALSE},
1910 {"http://google.foo.uk/",S_OK,FALSE},
1911 {"foo.uk",S_OK,FALSE},
1912 {"",S_FALSE,FALSE},
1913 {"",S_FALSE,FALSE},
1914 {"google.foo.uk",S_OK,FALSE},
1915 {"",S_FALSE,FALSE},
1916 {"/",S_OK,FALSE},
1917 {"/",S_OK,FALSE},
1918 {"",S_FALSE,FALSE},
1919 {"http://google.foo.uk",S_OK,FALSE},
1920 {"http",S_OK,FALSE},
1921 {"",S_FALSE,FALSE},
1922 {"",S_FALSE,FALSE}
1925 {Uri_HOST_DNS,S_OK,FALSE},
1926 {80,S_OK,FALSE},
1927 {URL_SCHEME_HTTP,S_OK,FALSE},
1928 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1931 { "http://.com", 0, S_OK, FALSE,
1933 {"http://.com/",S_OK,FALSE},
1934 {".com",S_OK,FALSE},
1935 {"http://.com/",S_OK,FALSE},
1936 {".com",S_OK,FALSE},
1937 {"",S_FALSE,FALSE},
1938 {"",S_FALSE,FALSE},
1939 {".com",S_OK,FALSE},
1940 {"",S_FALSE,FALSE},
1941 {"/",S_OK,FALSE},
1942 {"/",S_OK,FALSE},
1943 {"",S_FALSE,FALSE},
1944 {"http://.com",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://.uk", 0, S_OK, FALSE,
1958 {"http://.uk/",S_OK,FALSE},
1959 {".uk",S_OK,FALSE},
1960 {"http://.uk/",S_OK,FALSE},
1961 {"",S_FALSE,FALSE},
1962 {"",S_FALSE,FALSE},
1963 {"",S_FALSE,FALSE},
1964 {".uk",S_OK,FALSE},
1965 {"",S_FALSE,FALSE},
1966 {"/",S_OK,FALSE},
1967 {"/",S_OK,FALSE},
1968 {"",S_FALSE,FALSE},
1969 {"http://.uk",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://www.co.google.com.[]", 0, S_OK, FALSE,
1983 {"http://www.co.google.com.[]/",S_OK,FALSE},
1984 {"www.co.google.com.[]",S_OK,FALSE},
1985 {"http://www.co.google.com.[]/",S_OK,FALSE},
1986 {"google.com.[]",S_OK,FALSE},
1987 {"",S_FALSE,FALSE},
1988 {"",S_FALSE,FALSE},
1989 {"www.co.google.com.[]",S_OK,FALSE},
1990 {"",S_FALSE,FALSE},
1991 {"/",S_OK,FALSE},
1992 {"/",S_OK,FALSE},
1993 {"",S_FALSE,FALSE},
1994 {"http://www.co.google.com.[]",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://co.uk", 0, S_OK, FALSE,
2008 {"http://co.uk/",S_OK,FALSE},
2009 {"co.uk",S_OK,FALSE},
2010 {"http://co.uk/",S_OK,FALSE},
2011 {"",S_FALSE,FALSE},
2012 {"",S_FALSE,FALSE},
2013 {"",S_FALSE,FALSE},
2014 {"co.uk",S_OK,FALSE},
2015 {"",S_FALSE,FALSE},
2016 {"/",S_OK,FALSE},
2017 {"/",S_OK,FALSE},
2018 {"",S_FALSE,FALSE},
2019 {"http://co.uk",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://www.co.google.us.test", 0, S_OK, FALSE,
2033 {"http://www.co.google.us.test/",S_OK,FALSE},
2034 {"www.co.google.us.test",S_OK,FALSE},
2035 {"http://www.co.google.us.test/",S_OK,FALSE},
2036 {"us.test",S_OK,FALSE},
2037 {"",S_FALSE,FALSE},
2038 {"",S_FALSE,FALSE},
2039 {"www.co.google.us.test",S_OK,FALSE},
2040 {"",S_FALSE,FALSE},
2041 {"/",S_OK,FALSE},
2042 {"/",S_OK,FALSE},
2043 {"",S_FALSE,FALSE},
2044 {"http://www.co.google.us.test",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://gov.uk", 0, S_OK, FALSE,
2058 {"http://gov.uk/",S_OK,FALSE},
2059 {"gov.uk",S_OK,FALSE},
2060 {"http://gov.uk/",S_OK,FALSE},
2061 {"",S_FALSE,FALSE},
2062 {"",S_FALSE,FALSE},
2063 {"",S_FALSE,FALSE},
2064 {"gov.uk",S_OK,FALSE},
2065 {"",S_FALSE,FALSE},
2066 {"/",S_OK,FALSE},
2067 {"/",S_OK,FALSE},
2068 {"",S_FALSE,FALSE},
2069 {"http://gov.uk",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 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2083 {"zip://www.google.com\\test",S_OK,FALSE},
2084 {"www.google.com\\test",S_OK,FALSE},
2085 {"zip://www.google.com\\test",S_OK,FALSE},
2086 {"google.com\\test",S_OK,FALSE},
2087 {"",S_FALSE,FALSE},
2088 {"",S_FALSE,FALSE},
2089 {"www.google.com\\test",S_OK,FALSE},
2090 {"",S_FALSE,FALSE},
2091 {"",S_FALSE,FALSE},
2092 {"",S_FALSE,FALSE},
2093 {"",S_FALSE,FALSE},
2094 {"zip://www.google.com\\test",S_OK,FALSE},
2095 {"zip",S_OK,FALSE},
2096 {"",S_FALSE,FALSE},
2097 {"",S_FALSE,FALSE}
2100 {Uri_HOST_DNS,S_OK,FALSE},
2101 {0,S_FALSE,FALSE},
2102 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2103 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2106 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2108 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2109 {"",S_FALSE,FALSE},
2110 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2111 {"",S_FALSE,FALSE},
2112 {"",S_FALSE,FALSE},
2113 {"",S_FALSE,FALSE},
2114 {"",S_FALSE,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2117 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2118 {"",S_FALSE,FALSE},
2119 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2120 {"urn",S_OK,FALSE},
2121 {"",S_FALSE,FALSE},
2122 {"",S_FALSE,FALSE}
2125 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2126 {0,S_FALSE,FALSE},
2127 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2128 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2131 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2132 * are decoded and all '%' are encoded.
2134 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2136 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2137 {"",S_FALSE,FALSE},
2138 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2139 {"",S_FALSE,FALSE},
2140 {".mp3",S_OK,FALSE},
2141 {"",S_FALSE,FALSE},
2142 {"",S_FALSE,FALSE},
2143 {"",S_FALSE,FALSE},
2144 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2145 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2146 {"",S_FALSE,FALSE},
2147 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2148 {"file",S_OK,FALSE},
2149 {"",S_FALSE,FALSE},
2150 {"",S_FALSE,FALSE}
2153 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2154 {0,S_FALSE,FALSE},
2155 {URL_SCHEME_FILE,S_OK,FALSE},
2156 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2159 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2160 * is decoded and only %'s in front of invalid hex digits are encoded.
2162 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2164 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2165 {"",S_FALSE,FALSE},
2166 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2167 {"",S_FALSE,FALSE},
2168 {".mp3",S_OK,FALSE},
2169 {"",S_FALSE,FALSE},
2170 {"",S_FALSE,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2173 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2176 {"file",S_OK,FALSE},
2177 {"",S_FALSE,FALSE},
2178 {"",S_FALSE,FALSE}
2181 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2182 {0,S_FALSE,FALSE},
2183 {URL_SCHEME_FILE,S_OK,FALSE},
2184 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2187 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2188 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2190 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2191 {"[::1.2.3.0]",S_OK,FALSE},
2192 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2193 {"",S_FALSE,FALSE},
2194 {"",S_FALSE,FALSE},
2195 {"",S_FALSE,FALSE},
2196 {"::1.2.3.0",S_OK,FALSE},
2197 {"",S_FALSE,FALSE},
2198 {"/%3F%23.T/test",S_OK,FALSE},
2199 {"/%3F%23.T/test",S_OK,FALSE},
2200 {"",S_FALSE,FALSE},
2201 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2202 {"http",S_OK,FALSE},
2203 {"",S_FALSE,FALSE},
2204 {"",S_FALSE,FALSE},
2207 {Uri_HOST_IPV6,S_OK,FALSE},
2208 {80,S_OK,FALSE},
2209 {URL_SCHEME_HTTP,S_OK,FALSE},
2210 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2213 /* Forbidden characters are always encoded for file URIs. */
2214 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2216 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2217 {"",S_FALSE,FALSE},
2218 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2219 {"",S_FALSE,FALSE},
2220 {".mp3",S_OK,FALSE},
2221 {"",S_FALSE,FALSE},
2222 {"",S_FALSE,FALSE},
2223 {"",S_FALSE,FALSE},
2224 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2225 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2226 {"",S_FALSE,FALSE},
2227 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2228 {"file",S_OK,FALSE},
2229 {"",S_FALSE,FALSE},
2230 {"",S_FALSE,FALSE}
2233 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2234 {0,S_FALSE,FALSE},
2235 {URL_SCHEME_FILE,S_OK,FALSE},
2236 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2239 /* Forbidden characters are never encoded for unknown scheme types. */
2240 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2242 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2243 {"4294967295",S_OK,FALSE},
2244 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2245 {"",S_FALSE,FALSE},
2246 {"",S_FALSE,FALSE},
2247 {"",S_FALSE,FALSE},
2248 {"4294967295",S_OK,FALSE},
2249 {"",S_FALSE,FALSE},
2250 {"/<|>\" test<|>",S_OK,FALSE},
2251 {"/<|>\" test<|>",S_OK,FALSE},
2252 {"",S_FALSE,FALSE},
2253 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2254 {"1234",S_OK,FALSE},
2255 {"",S_FALSE,FALSE},
2256 {"",S_FALSE,FALSE}
2259 {Uri_HOST_IPV4,S_OK,FALSE},
2260 {0,S_FALSE,FALSE},
2261 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2262 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2265 /* Make sure forbidden characters are percent encoded. */
2266 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2268 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2269 {"gov.uk",S_OK,FALSE},
2270 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2271 {"",S_FALSE,FALSE},
2272 {"",S_FALSE,FALSE},
2273 {"",S_FALSE,FALSE},
2274 {"gov.uk",S_OK,FALSE},
2275 {"",S_FALSE,FALSE},
2276 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2277 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2278 {"",S_FALSE,FALSE},
2279 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2280 {"http",S_OK,FALSE},
2281 {"",S_FALSE,FALSE},
2282 {"",S_FALSE,FALSE}
2285 {Uri_HOST_DNS,S_OK,FALSE},
2286 {80,S_OK,FALSE},
2287 {URL_SCHEME_HTTP,S_OK,FALSE},
2288 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2291 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2293 {"http://gov.uk/",S_OK,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2295 {"http://gov.uk/",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 {"/",S_OK,FALSE},
2302 {"/",S_OK,FALSE},
2303 {"",S_FALSE,FALSE},
2304 {"http://gov.uk/test/../test2/././../test3/.././././",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/../../..", 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/../../..",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 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2368 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2369 {"",S_FALSE,FALSE},
2370 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2371 {"",S_FALSE,FALSE},
2372 {".mp3",S_OK,FALSE},
2373 {"",S_FALSE,FALSE},
2374 {"",S_FALSE,FALSE},
2375 {"",S_FALSE,FALSE},
2376 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2377 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2380 {"file",S_OK,FALSE},
2381 {"",S_FALSE,FALSE},
2382 {"",S_FALSE,FALSE}
2385 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2386 {0,S_FALSE,FALSE},
2387 {URL_SCHEME_FILE,S_OK,FALSE},
2388 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2391 /* Dot removal happens for unknown scheme types. */
2392 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2394 {"zip://gov.uk/",S_OK,FALSE},
2395 {"gov.uk",S_OK,FALSE},
2396 {"zip://gov.uk/",S_OK,FALSE},
2397 {"",S_FALSE,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"",S_FALSE,FALSE},
2400 {"gov.uk",S_OK,FALSE},
2401 {"",S_FALSE,FALSE},
2402 {"/",S_OK,FALSE},
2403 {"/",S_OK,FALSE},
2404 {"",S_FALSE,FALSE},
2405 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2406 {"zip",S_OK,FALSE},
2407 {"",S_FALSE,FALSE},
2408 {"",S_FALSE,FALSE}
2411 {Uri_HOST_DNS,S_OK,FALSE},
2412 {0,S_FALSE,FALSE},
2413 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2414 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2417 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2418 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2420 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2421 {"gov.uk",S_OK,FALSE},
2422 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {".",S_OK,FALSE},
2425 {"",S_FALSE,FALSE},
2426 {"gov.uk",S_OK,FALSE},
2427 {"",S_FALSE,FALSE},
2428 {"/test/test2/../../.",S_OK,FALSE},
2429 {"/test/test2/../../.",S_OK,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2432 {"http",S_OK,FALSE},
2433 {"",S_FALSE,FALSE},
2434 {"",S_FALSE,FALSE}
2437 {Uri_HOST_DNS,S_OK,FALSE},
2438 {80,S_OK,FALSE},
2439 {URL_SCHEME_HTTP,S_OK,FALSE},
2440 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2443 /* Dot removal doesn't happen for wildcard scheme types. */
2444 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2446 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2447 {"gov.uk",S_OK,FALSE},
2448 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2449 {"",S_FALSE,FALSE},
2450 {".",S_OK,FALSE},
2451 {"",S_FALSE,FALSE},
2452 {"gov.uk",S_OK,FALSE},
2453 {"",S_FALSE,FALSE},
2454 {"/test/test2/../../.",S_OK,FALSE},
2455 {"/test/test2/../../.",S_OK,FALSE},
2456 {"",S_FALSE,FALSE},
2457 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2458 {"*",S_OK,FALSE},
2459 {"",S_FALSE,FALSE},
2460 {"",S_FALSE,FALSE}
2463 {Uri_HOST_DNS,S_OK,FALSE},
2464 {0,S_FALSE,FALSE},
2465 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2466 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2469 /* Forbidden characters are encoded for opaque known scheme types. */
2470 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2472 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2473 {"",S_FALSE,FALSE},
2474 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {".com%22",S_OK,FALSE},
2477 {"",S_FALSE,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"",S_FALSE,FALSE},
2480 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2481 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2482 {"",S_FALSE,FALSE},
2483 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2484 {"mailto",S_OK,FALSE},
2485 {"",S_FALSE,FALSE},
2486 {"",S_FALSE,FALSE}
2489 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2490 {0,S_FALSE,FALSE},
2491 {URL_SCHEME_MAILTO,S_OK,FALSE},
2492 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2495 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2497 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2498 {"",S_FALSE,FALSE},
2499 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {".com",S_OK,FALSE},
2502 {"",S_FALSE,FALSE},
2503 {"",S_FALSE,FALSE},
2504 {"",S_FALSE,FALSE},
2505 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2506 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {"news:test.tes<|>t.com",S_OK,FALSE},
2509 {"news",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_NEWS,S_OK,FALSE},
2517 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2520 /* Don't encode forbidden characters. */
2521 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2523 {"news:test.tes<|>t.com",S_OK,FALSE},
2524 {"",S_FALSE,FALSE},
2525 {"news:test.tes<|>t.com",S_OK,FALSE},
2526 {"",S_FALSE,FALSE},
2527 {".com",S_OK,FALSE},
2528 {"",S_FALSE,FALSE},
2529 {"",S_FALSE,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {"test.tes<|>t.com",S_OK,FALSE},
2532 {"test.tes<|>t.com",S_OK,FALSE},
2533 {"",S_FALSE,FALSE},
2534 {"news:test.tes<|>t.com",S_OK,FALSE},
2535 {"news",S_OK,FALSE},
2536 {"",S_FALSE,FALSE},
2537 {"",S_FALSE,FALSE}
2540 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2541 {0,S_FALSE,FALSE},
2542 {URL_SCHEME_NEWS,S_OK,FALSE},
2543 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2546 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2547 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2549 {"urn:test.tes<|>t.com",S_OK,FALSE},
2550 {"",S_FALSE,FALSE},
2551 {"urn:test.tes<|>t.com",S_OK,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {".com",S_OK,FALSE},
2554 {"",S_FALSE,FALSE},
2555 {"",S_FALSE,FALSE},
2556 {"",S_FALSE,FALSE},
2557 {"test.tes<|>t.com",S_OK,FALSE},
2558 {"test.tes<|>t.com",S_OK,FALSE},
2559 {"",S_FALSE,FALSE},
2560 {"urn:test.tes<|>t.com",S_OK,FALSE},
2561 {"urn",S_OK,FALSE},
2562 {"",S_FALSE,FALSE},
2563 {"",S_FALSE,FALSE}
2566 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2567 {0,S_FALSE,FALSE},
2568 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2569 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2572 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2573 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2575 {"news:test.test.com",S_OK,FALSE},
2576 {"",S_FALSE,FALSE},
2577 {"news:test.test.com",S_OK,FALSE},
2578 {"",S_FALSE,FALSE},
2579 {".com",S_OK,FALSE},
2580 {"",S_FALSE,FALSE},
2581 {"",S_FALSE,FALSE},
2582 {"",S_FALSE,FALSE},
2583 {"test.test.com",S_OK,FALSE},
2584 {"test.test.com",S_OK,FALSE},
2585 {"",S_FALSE,FALSE},
2586 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2587 {"news",S_OK,FALSE},
2588 {"",S_FALSE,FALSE},
2589 {"",S_FALSE,FALSE}
2592 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2593 {0,S_FALSE,FALSE},
2594 {URL_SCHEME_NEWS,S_OK,FALSE},
2595 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2598 /* Percent encoded characters are still decoded for known scheme types. */
2599 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2601 {"news:test.test.com",S_OK,FALSE},
2602 {"",S_FALSE,FALSE},
2603 {"news:test.test.com",S_OK,FALSE},
2604 {"",S_FALSE,FALSE},
2605 {".com",S_OK,FALSE},
2606 {"",S_FALSE,FALSE},
2607 {"",S_FALSE,FALSE},
2608 {"",S_FALSE,FALSE},
2609 {"test.test.com",S_OK,FALSE},
2610 {"test.test.com",S_OK,FALSE},
2611 {"",S_FALSE,FALSE},
2612 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2613 {"news",S_OK,FALSE},
2614 {"",S_FALSE,FALSE},
2615 {"",S_FALSE,FALSE}
2618 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2619 {0,S_FALSE,FALSE},
2620 {URL_SCHEME_NEWS,S_OK,FALSE},
2621 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2624 /* Percent encoded characters aren't decoded for unknown scheme types. */
2625 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2627 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2628 {"",S_FALSE,FALSE},
2629 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2630 {"",S_FALSE,FALSE},
2631 {".com",S_OK,FALSE},
2632 {"",S_FALSE,FALSE},
2633 {"",S_FALSE,FALSE},
2634 {"",S_FALSE,FALSE},
2635 {"test.%74%65%73%74.com",S_OK,FALSE},
2636 {"test.%74%65%73%74.com",S_OK,FALSE},
2637 {"",S_FALSE,FALSE},
2638 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2639 {"urn",S_OK,FALSE},
2640 {"",S_FALSE,FALSE},
2641 {"",S_FALSE,FALSE}
2644 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2645 {0,S_FALSE,FALSE},
2646 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2647 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2650 /* Unknown scheme types can have invalid % encoded data in query string. */
2651 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2653 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2654 {"www.winehq.org",S_OK,FALSE},
2655 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2656 {"winehq.org",S_OK,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"",S_FALSE,FALSE},
2659 {"www.winehq.org",S_OK,FALSE},
2660 {"",S_FALSE,FALSE},
2661 {"/",S_OK,FALSE},
2662 {"/?query=%xx&return=y",S_OK,FALSE},
2663 {"?query=%xx&return=y",S_OK,FALSE},
2664 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2665 {"zip",S_OK,FALSE},
2666 {"",S_FALSE,FALSE},
2667 {"",S_FALSE,FALSE}
2670 {Uri_HOST_DNS,S_OK,FALSE},
2671 {0,S_FALSE,FALSE},
2672 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2673 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2676 /* Known scheme types can have invalid % encoded data with the right flags. */
2677 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2679 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2680 {"www.winehq.org",S_OK,FALSE},
2681 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2682 {"winehq.org",S_OK,FALSE},
2683 {"",S_FALSE,FALSE},
2684 {"",S_FALSE,FALSE},
2685 {"www.winehq.org",S_OK,FALSE},
2686 {"",S_FALSE,FALSE},
2687 {"/",S_OK,FALSE},
2688 {"/?query=%xx&return=y",S_OK,FALSE},
2689 {"?query=%xx&return=y",S_OK,FALSE},
2690 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2691 {"http",S_OK,FALSE},
2692 {"",S_FALSE,FALSE},
2693 {"",S_FALSE,FALSE}
2696 {Uri_HOST_DNS,S_OK,FALSE},
2697 {80,S_OK,FALSE},
2698 {URL_SCHEME_HTTP,S_OK,FALSE},
2699 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2702 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2703 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2705 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2706 {"www.winehq.org",S_OK,FALSE},
2707 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2708 {"winehq.org",S_OK,FALSE},
2709 {"",S_FALSE,FALSE},
2710 {"",S_FALSE,FALSE},
2711 {"www.winehq.org",S_OK,FALSE},
2712 {"",S_FALSE,FALSE},
2713 {"/",S_OK,FALSE},
2714 {"/?query=<|>&return=y",S_OK,FALSE},
2715 {"?query=<|>&return=y",S_OK,FALSE},
2716 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2717 {"http",S_OK,FALSE},
2718 {"",S_FALSE,FALSE},
2719 {"",S_FALSE,FALSE}
2722 {Uri_HOST_DNS,S_OK,FALSE},
2723 {80,S_OK,FALSE},
2724 {URL_SCHEME_HTTP,S_OK,FALSE},
2725 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2728 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2729 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2731 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2732 {"www.winehq.org",S_OK,FALSE},
2733 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2734 {"winehq.org",S_OK,FALSE},
2735 {"",S_FALSE,FALSE},
2736 {"",S_FALSE,FALSE},
2737 {"www.winehq.org",S_OK,FALSE},
2738 {"",S_FALSE,FALSE},
2739 {"/",S_OK,FALSE},
2740 {"/?query=<|>&return=y",S_OK,FALSE},
2741 {"?query=<|>&return=y",S_OK,FALSE},
2742 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2743 {"http",S_OK,FALSE},
2744 {"",S_FALSE,FALSE},
2745 {"",S_FALSE,FALSE}
2748 {Uri_HOST_DNS,S_OK,FALSE},
2749 {80,S_OK,FALSE},
2750 {URL_SCHEME_HTTP,S_OK,FALSE},
2751 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2754 /* Forbidden characters are encoded for known scheme types. */
2755 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2757 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2758 {"www.winehq.org",S_OK,FALSE},
2759 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2760 {"winehq.org",S_OK,FALSE},
2761 {"",S_FALSE,FALSE},
2762 {"",S_FALSE,FALSE},
2763 {"www.winehq.org",S_OK,FALSE},
2764 {"",S_FALSE,FALSE},
2765 {"/",S_OK,FALSE},
2766 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2767 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2768 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2769 {"http",S_OK,FALSE},
2770 {"",S_FALSE,FALSE},
2771 {"",S_FALSE,FALSE}
2774 {Uri_HOST_DNS,S_OK,FALSE},
2775 {80,S_OK,FALSE},
2776 {URL_SCHEME_HTTP,S_OK,FALSE},
2777 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2780 /* Forbidden characters are not encoded for unknown scheme types. */
2781 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2783 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2784 {"www.winehq.org",S_OK,FALSE},
2785 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2786 {"winehq.org",S_OK,FALSE},
2787 {"",S_FALSE,FALSE},
2788 {"",S_FALSE,FALSE},
2789 {"www.winehq.org",S_OK,FALSE},
2790 {"",S_FALSE,FALSE},
2791 {"/",S_OK,FALSE},
2792 {"/?query=<|>&return=y",S_OK,FALSE},
2793 {"?query=<|>&return=y",S_OK,FALSE},
2794 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2795 {"zip",S_OK,FALSE},
2796 {"",S_FALSE,FALSE},
2797 {"",S_FALSE,FALSE}
2800 {Uri_HOST_DNS,S_OK,FALSE},
2801 {0,S_FALSE,FALSE},
2802 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2803 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2806 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2807 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2809 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2810 {"www.winehq.org",S_OK,FALSE},
2811 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2812 {"winehq.org",S_OK,FALSE},
2813 {"",S_FALSE,FALSE},
2814 {"",S_FALSE,FALSE},
2815 {"www.winehq.org",S_OK,FALSE},
2816 {"",S_FALSE,FALSE},
2817 {"/",S_OK,FALSE},
2818 {"/?query=01&return=y",S_OK,FALSE},
2819 {"?query=01&return=y",S_OK,FALSE},
2820 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2821 {"http",S_OK,FALSE},
2822 {"",S_FALSE,FALSE},
2823 {"",S_FALSE,FALSE}
2826 {Uri_HOST_DNS,S_OK,FALSE},
2827 {80,S_OK,FALSE},
2828 {URL_SCHEME_HTTP,S_OK,FALSE},
2829 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2832 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2833 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2835 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2836 {"www.winehq.org",S_OK,FALSE},
2837 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2838 {"winehq.org",S_OK,FALSE},
2839 {"",S_FALSE,FALSE},
2840 {"",S_FALSE,FALSE},
2841 {"www.winehq.org",S_OK,FALSE},
2842 {"",S_FALSE,FALSE},
2843 {"/",S_OK,FALSE},
2844 {"/?query=%30%31&return=y",S_OK,FALSE},
2845 {"?query=%30%31&return=y",S_OK,FALSE},
2846 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2847 {"zip",S_OK,FALSE},
2848 {"",S_FALSE,FALSE},
2849 {"",S_FALSE,FALSE}
2852 {Uri_HOST_DNS,S_OK,FALSE},
2853 {0,S_FALSE,FALSE},
2854 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2855 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2858 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2859 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2861 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2862 {"www.winehq.org",S_OK,FALSE},
2863 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2864 {"winehq.org",S_OK,FALSE},
2865 {"",S_FALSE,FALSE},
2866 {"",S_FALSE,FALSE},
2867 {"www.winehq.org",S_OK,FALSE},
2868 {"",S_FALSE,FALSE},
2869 {"/",S_OK,FALSE},
2870 {"/?query=%30%31&return=y",S_OK,FALSE},
2871 {"?query=%30%31&return=y",S_OK,FALSE},
2872 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2873 {"http",S_OK,FALSE},
2874 {"",S_FALSE,FALSE},
2875 {"",S_FALSE,FALSE}
2878 {Uri_HOST_DNS,S_OK,FALSE},
2879 {80,S_OK,FALSE},
2880 {URL_SCHEME_HTTP,S_OK,FALSE},
2881 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2884 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2886 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2887 {"www.winehq.org",S_OK,FALSE},
2888 {"http://www.winehq.org?query=12&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_FALSE,FALSE},
2895 {"?query=12&return=y",S_OK,FALSE},
2896 {"?query=12&return=y",S_OK,FALSE},
2897 {"http://www.winehq.org?query=12&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 /* Unknown scheme types can have invalid % encoded data in fragments. */
2910 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2912 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2913 {"www.winehq.org",S_OK,FALSE},
2914 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2915 {"winehq.org",S_OK,FALSE},
2916 {"",S_FALSE,FALSE},
2917 {"#Te%xx",S_OK,FALSE},
2918 {"www.winehq.org",S_OK,FALSE},
2919 {"",S_FALSE,FALSE},
2920 {"/tests/",S_OK,FALSE},
2921 {"/tests/",S_OK,FALSE},
2922 {"",S_FALSE,FALSE},
2923 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2924 {"zip",S_OK,FALSE},
2925 {"",S_FALSE,FALSE},
2926 {"",S_FALSE,FALSE}
2929 {Uri_HOST_DNS,S_OK,FALSE},
2930 {0,S_FALSE,FALSE},
2931 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2932 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2935 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2936 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2938 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2939 {"www.winehq.org",S_OK,FALSE},
2940 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2941 {"winehq.org",S_OK,FALSE},
2942 {"",S_FALSE,FALSE},
2943 {"#Te<|>",S_OK,FALSE},
2944 {"www.winehq.org",S_OK,FALSE},
2945 {"",S_FALSE,FALSE},
2946 {"/tests/",S_OK,FALSE},
2947 {"/tests/",S_OK,FALSE},
2948 {"",S_FALSE,FALSE},
2949 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2950 {"zip",S_OK,FALSE},
2951 {"",S_FALSE,FALSE},
2952 {"",S_FALSE,FALSE}
2955 {Uri_HOST_DNS,S_OK,FALSE},
2956 {0,S_FALSE,FALSE},
2957 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2958 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2961 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2962 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2964 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2965 {"www.winehq.org",S_OK,FALSE},
2966 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2967 {"winehq.org",S_OK,FALSE},
2968 {"",S_FALSE,FALSE},
2969 {"#Te%3C%7C%3E",S_OK,FALSE},
2970 {"www.winehq.org",S_OK,FALSE},
2971 {"",S_FALSE,FALSE},
2972 {"/tests/",S_OK,FALSE},
2973 {"/tests/",S_OK,FALSE},
2974 {"",S_FALSE,FALSE},
2975 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2976 {"http",S_OK,FALSE},
2977 {"",S_FALSE,FALSE},
2978 {"",S_FALSE,FALSE}
2981 {Uri_HOST_DNS,S_OK,FALSE},
2982 {80,S_OK,FALSE},
2983 {URL_SCHEME_HTTP,S_OK,FALSE},
2984 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2987 /* Forbidden characters aren't encoded in the fragment with this flag. */
2988 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2990 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2991 {"www.winehq.org",S_OK,FALSE},
2992 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2993 {"winehq.org",S_OK,FALSE},
2994 {"",S_FALSE,FALSE},
2995 {"#Te<|>",S_OK,FALSE},
2996 {"www.winehq.org",S_OK,FALSE},
2997 {"",S_FALSE,FALSE},
2998 {"/tests/",S_OK,FALSE},
2999 {"/tests/",S_OK,FALSE},
3000 {"",S_FALSE,FALSE},
3001 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3002 {"http",S_OK,FALSE},
3003 {"",S_FALSE,FALSE},
3004 {"",S_FALSE,FALSE}
3007 {Uri_HOST_DNS,S_OK,FALSE},
3008 {80,S_OK,FALSE},
3009 {URL_SCHEME_HTTP,S_OK,FALSE},
3010 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3013 /* Forbidden characters aren't encoded in the fragment with this flag. */
3014 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
3016 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3017 {"www.winehq.org",S_OK,FALSE},
3018 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3019 {"winehq.org",S_OK,FALSE},
3020 {"",S_FALSE,FALSE},
3021 {"#Te<|>",S_OK,FALSE},
3022 {"www.winehq.org",S_OK,FALSE},
3023 {"",S_FALSE,FALSE},
3024 {"/tests/",S_OK,FALSE},
3025 {"/tests/",S_OK,FALSE},
3026 {"",S_FALSE,FALSE},
3027 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
3028 {"http",S_OK,FALSE},
3029 {"",S_FALSE,FALSE},
3030 {"",S_FALSE,FALSE}
3033 {Uri_HOST_DNS,S_OK,FALSE},
3034 {80,S_OK,FALSE},
3035 {URL_SCHEME_HTTP,S_OK,FALSE},
3036 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3039 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3040 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3042 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3043 {"www.winehq.org",S_OK,FALSE},
3044 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3045 {"winehq.org",S_OK,FALSE},
3046 {"",S_FALSE,FALSE},
3047 {"#Te%30%31%32",S_OK,FALSE},
3048 {"www.winehq.org",S_OK,FALSE},
3049 {"",S_FALSE,FALSE},
3050 {"/tests/",S_OK,FALSE},
3051 {"/tests/",S_OK,FALSE},
3052 {"",S_FALSE,FALSE},
3053 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3054 {"zip",S_OK,FALSE},
3055 {"",S_FALSE,FALSE},
3056 {"",S_FALSE,FALSE}
3059 {Uri_HOST_DNS,S_OK,FALSE},
3060 {0,S_FALSE,FALSE},
3061 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3062 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3065 /* Percent encoded, unreserved characters are decoded for known schemes. */
3066 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3068 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3069 {"www.winehq.org",S_OK,FALSE},
3070 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3071 {"winehq.org",S_OK,FALSE},
3072 {"",S_FALSE,FALSE},
3073 {"#Te012",S_OK,FALSE},
3074 {"www.winehq.org",S_OK,FALSE},
3075 {"",S_FALSE,FALSE},
3076 {"/tests/",S_OK,FALSE},
3077 {"/tests/",S_OK,FALSE},
3078 {"",S_FALSE,FALSE},
3079 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3080 {"http",S_OK,FALSE},
3081 {"",S_FALSE,FALSE},
3082 {"",S_FALSE,FALSE}
3085 {Uri_HOST_DNS,S_OK,FALSE},
3086 {80,S_OK,FALSE},
3087 {URL_SCHEME_HTTP,S_OK,FALSE},
3088 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3091 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3092 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3094 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3095 {"www.winehq.org",S_OK,FALSE},
3096 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3097 {"winehq.org",S_OK,FALSE},
3098 {"",S_FALSE,FALSE},
3099 {"#Te012",S_OK,FALSE},
3100 {"www.winehq.org",S_OK,FALSE},
3101 {"",S_FALSE,FALSE},
3102 {"/tests/",S_OK,FALSE},
3103 {"/tests/",S_OK,FALSE},
3104 {"",S_FALSE,FALSE},
3105 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3106 {"http",S_OK,FALSE},
3107 {"",S_FALSE,FALSE},
3108 {"",S_FALSE,FALSE}
3111 {Uri_HOST_DNS,S_OK,FALSE},
3112 {80,S_OK,FALSE},
3113 {URL_SCHEME_HTTP,S_OK,FALSE},
3114 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3117 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3118 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3120 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3121 {"www.winehq.org",S_OK,FALSE},
3122 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3123 {"winehq.org",S_OK,FALSE},
3124 {"",S_FALSE,FALSE},
3125 {"#Te%30%31%32",S_OK,FALSE},
3126 {"www.winehq.org",S_OK,FALSE},
3127 {"",S_FALSE,FALSE},
3128 {"/tests/",S_OK,FALSE},
3129 {"/tests/",S_OK,FALSE},
3130 {"",S_FALSE,FALSE},
3131 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3132 {"http",S_OK,FALSE},
3133 {"",S_FALSE,FALSE},
3134 {"",S_FALSE,FALSE}
3137 {Uri_HOST_DNS,S_OK,FALSE},
3138 {80,S_OK,FALSE},
3139 {URL_SCHEME_HTTP,S_OK,FALSE},
3140 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3143 /* Leading/Trailing whitespace is removed. */
3144 { " http://google.com/ ", 0, S_OK, FALSE,
3146 {"http://google.com/",S_OK,FALSE},
3147 {"google.com",S_OK,FALSE},
3148 {"http://google.com/",S_OK,FALSE},
3149 {"google.com",S_OK,FALSE},
3150 {"",S_FALSE,FALSE},
3151 {"",S_FALSE,FALSE},
3152 {"google.com",S_OK,FALSE},
3153 {"",S_FALSE,FALSE},
3154 {"/",S_OK,FALSE},
3155 {"/",S_OK,FALSE},
3156 {"",S_FALSE,FALSE},
3157 {"http://google.com/",S_OK,FALSE},
3158 {"http",S_OK,FALSE},
3159 {"",S_FALSE,FALSE},
3160 {"",S_FALSE,FALSE}
3163 {Uri_HOST_DNS,S_OK,FALSE},
3164 {80,S_OK,FALSE},
3165 {URL_SCHEME_HTTP,S_OK,FALSE},
3166 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3169 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 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 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3196 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3197 {"g%0aoogle.co%0dm",S_OK,FALSE},
3198 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3199 {"g%0aoogle.co%0dm",S_OK,FALSE},
3200 {"",S_FALSE,FALSE},
3201 {"",S_FALSE,FALSE},
3202 {"g%0aoogle.co%0dm",S_OK,FALSE},
3203 {"",S_FALSE,FALSE},
3204 {"/%0A%0A%0A",S_OK,FALSE},
3205 {"/%0A%0A%0A",S_OK,FALSE},
3206 {"",S_FALSE,FALSE},
3207 {"http://g\noogle.co\rm/\n\n\n",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 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3221 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3222 {"g\noogle.co\rm",S_OK,FALSE},
3223 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3224 {"g\noogle.co\rm",S_OK,FALSE},
3225 {"",S_FALSE,FALSE},
3226 {"",S_FALSE,FALSE},
3227 {"g\noogle.co\rm",S_OK,FALSE},
3228 {"",S_FALSE,FALSE},
3229 {"/\n\n\n",S_OK,FALSE},
3230 {"/\n\n\n",S_OK,FALSE},
3231 {"",S_FALSE,FALSE},
3232 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3233 {"zip",S_OK,FALSE},
3234 {"",S_FALSE,FALSE},
3235 {"",S_FALSE,FALSE}
3238 {Uri_HOST_DNS,S_OK,FALSE},
3239 {0,S_FALSE,FALSE},
3240 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3241 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3244 /* Since file URLs are usually hierarchical, it returns an empty string
3245 * for the absolute URI property since it was declared as an opaque URI.
3247 { "file:index.html", 0, S_OK, FALSE,
3249 {"",S_FALSE,FALSE},
3250 {"",S_FALSE,FALSE},
3251 {"file:index.html",S_OK,FALSE},
3252 {"",S_FALSE,FALSE},
3253 {".html",S_OK,FALSE},
3254 {"",S_FALSE,FALSE},
3255 {"",S_FALSE,FALSE},
3256 {"",S_FALSE,FALSE},
3257 {"index.html",S_OK,FALSE},
3258 {"index.html",S_OK,FALSE},
3259 {"",S_FALSE,FALSE},
3260 {"file:index.html",S_OK,FALSE},
3261 {"file",S_OK,FALSE},
3262 {"",S_FALSE,FALSE},
3263 {"",S_FALSE,FALSE}
3266 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3267 {0,S_FALSE,FALSE},
3268 {URL_SCHEME_FILE,S_OK,FALSE},
3269 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3272 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3273 { "http:test.com/index.html", 0, S_OK, FALSE,
3275 {"",S_FALSE,FALSE},
3276 {"",S_FALSE,FALSE},
3277 {"http:test.com/index.html",S_OK,FALSE},
3278 {"",S_FALSE,FALSE},
3279 {".html",S_OK,FALSE},
3280 {"",S_FALSE,FALSE},
3281 {"",S_FALSE,FALSE},
3282 {"",S_FALSE,FALSE},
3283 {"test.com/index.html",S_OK,FALSE},
3284 {"test.com/index.html",S_OK,FALSE},
3285 {"",S_FALSE,FALSE},
3286 {"http:test.com/index.html",S_OK,FALSE},
3287 {"http",S_OK,FALSE},
3288 {"",S_FALSE,FALSE},
3289 {"",S_FALSE,FALSE}
3292 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3293 {80,S_OK,FALSE},
3294 {URL_SCHEME_HTTP,S_OK,FALSE},
3295 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3298 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3300 {"",S_FALSE,FALSE},
3301 {"",S_FALSE,FALSE},
3302 {"ftp: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 {"ftp:test.com/index.html",S_OK,FALSE},
3312 {"ftp",S_OK,FALSE},
3313 {"",S_FALSE,FALSE},
3314 {"",S_FALSE,FALSE}
3317 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3318 {21,S_OK,FALSE},
3319 {URL_SCHEME_FTP,S_OK,FALSE},
3320 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3323 { "file://C|/test.mp3", 0, S_OK, FALSE,
3325 {"file:///C:/test.mp3",S_OK,FALSE},
3326 {"",S_FALSE,FALSE},
3327 {"file:///C:/test.mp3",S_OK,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {".mp3",S_OK,FALSE},
3330 {"",S_FALSE,FALSE},
3331 {"",S_FALSE,FALSE},
3332 {"",S_FALSE,FALSE},
3333 {"/C:/test.mp3",S_OK,FALSE},
3334 {"/C:/test.mp3",S_OK,FALSE},
3335 {"",S_FALSE,FALSE},
3336 {"file://C|/test.mp3",S_OK,FALSE},
3337 {"file",S_OK,FALSE},
3338 {"",S_FALSE,FALSE},
3339 {"",S_FALSE,FALSE}
3342 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3343 {0,S_FALSE,FALSE},
3344 {URL_SCHEME_FILE,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 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3374 * to '\\'.
3376 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3378 {"file://c:\\dir\\index.html",S_OK,FALSE},
3379 {"",S_FALSE,FALSE},
3380 {"file://c:\\dir\\index.html",S_OK,FALSE},
3381 {"",S_FALSE,FALSE},
3382 {".html",S_OK,FALSE},
3383 {"",S_FALSE,FALSE},
3384 {"",S_FALSE,FALSE},
3385 {"",S_FALSE,FALSE},
3386 {"c:\\dir\\index.html",S_OK,FALSE},
3387 {"c:\\dir\\index.html",S_OK,FALSE},
3388 {"",S_FALSE,FALSE},
3389 {"file://c:/dir/index.html",S_OK,FALSE},
3390 {"file",S_OK,FALSE},
3391 {"",S_FALSE,FALSE},
3392 {"",S_FALSE,FALSE}
3395 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3396 {0,S_FALSE,FALSE},
3397 {URL_SCHEME_FILE,S_OK,FALSE},
3398 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3401 /* Extra '/' after "file://" is removed. */
3402 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3404 {"file://c:\\dir\\index.html",S_OK,FALSE},
3405 {"",S_FALSE,FALSE},
3406 {"file://c:\\dir\\index.html",S_OK,FALSE},
3407 {"",S_FALSE,FALSE},
3408 {".html",S_OK,FALSE},
3409 {"",S_FALSE,FALSE},
3410 {"",S_FALSE,FALSE},
3411 {"",S_FALSE,FALSE},
3412 {"c:\\dir\\index.html",S_OK,FALSE},
3413 {"c:\\dir\\index.html",S_OK,FALSE},
3414 {"",S_FALSE,FALSE},
3415 {"file:///c:/dir/index.html",S_OK,FALSE},
3416 {"file",S_OK,FALSE},
3417 {"",S_FALSE,FALSE},
3418 {"",S_FALSE,FALSE}
3421 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3422 {0,S_FALSE,FALSE},
3423 {URL_SCHEME_FILE,S_OK,FALSE},
3424 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3427 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3428 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3430 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3431 {"",S_FALSE,FALSE},
3432 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3433 {"",S_FALSE,FALSE},
3434 {".html",S_OK,FALSE},
3435 {"",S_FALSE,FALSE},
3436 {"",S_FALSE,FALSE},
3437 {"",S_FALSE,FALSE},
3438 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3439 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3440 {"",S_FALSE,FALSE},
3441 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3442 {"file",S_OK,FALSE},
3443 {"",S_FALSE,FALSE},
3444 {"",S_FALSE,FALSE}
3447 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3448 {0,S_FALSE,FALSE},
3449 {URL_SCHEME_FILE,S_OK,FALSE},
3450 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3453 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3455 {"file://c:\\dir\\index.html",S_OK,FALSE},
3456 {"",S_FALSE,FALSE},
3457 {"file://c:\\dir\\index.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\\index.html",S_OK,FALSE},
3464 {"c:\\dir\\index.html",S_OK,FALSE},
3465 {"",S_FALSE,FALSE},
3466 {"file://c|/dir\\index.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 /* The backslashes after the scheme name are converted to forward slashes. */
3479 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3481 {"file://c:\\dir\\index.html",S_OK,FALSE},
3482 {"",S_FALSE,FALSE},
3483 {"file://c:\\dir\\index.html",S_OK,FALSE},
3484 {"",S_FALSE,FALSE},
3485 {".html",S_OK,FALSE},
3486 {"",S_FALSE,FALSE},
3487 {"",S_FALSE,FALSE},
3488 {"",S_FALSE,FALSE},
3489 {"c:\\dir\\index.html",S_OK,FALSE},
3490 {"c:\\dir\\index.html",S_OK,FALSE},
3491 {"",S_FALSE,FALSE},
3492 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3493 {"file",S_OK,FALSE},
3494 {"",S_FALSE,FALSE},
3495 {"",S_FALSE,FALSE}
3498 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3499 {0,S_FALSE,FALSE},
3500 {URL_SCHEME_FILE,S_OK,FALSE},
3501 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3504 { "file:\\\\c:/dir/index.html", 0, 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 { "http:\\\\google.com", 0, S_OK, FALSE,
3531 {"http://google.com/",S_OK,FALSE},
3532 {"google.com",S_OK,FALSE},
3533 {"http://google.com/",S_OK,FALSE},
3534 {"google.com",S_OK,FALSE},
3535 {"",S_FALSE,FALSE},
3536 {"",S_FALSE,FALSE},
3537 {"google.com",S_OK,FALSE},
3538 {"",S_FALSE,FALSE},
3539 {"/",S_OK,FALSE},
3540 {"/",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {"http:\\\\google.com",S_OK,FALSE},
3543 {"http",S_OK,FALSE},
3544 {"",S_FALSE,FALSE},
3545 {"",S_FALSE,FALSE}
3548 {Uri_HOST_DNS,S_OK,FALSE},
3549 {80,S_OK,FALSE},
3550 {URL_SCHEME_HTTP,S_OK,FALSE},
3551 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3554 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3555 { "zip:\\\\google.com", 0, S_OK, FALSE,
3557 {"zip:\\\\google.com",S_OK,FALSE},
3558 {"",S_FALSE,FALSE},
3559 {"zip:\\\\google.com",S_OK,FALSE},
3560 {"",S_FALSE,FALSE},
3561 {".com",S_OK,FALSE},
3562 {"",S_FALSE,FALSE},
3563 {"",S_FALSE,FALSE},
3564 {"",S_FALSE,FALSE},
3565 {"\\\\google.com",S_OK,FALSE},
3566 {"\\\\google.com",S_OK,FALSE},
3567 {"",S_FALSE,FALSE},
3568 {"zip:\\\\google.com",S_OK,FALSE},
3569 {"zip",S_OK,FALSE},
3570 {"",S_FALSE,FALSE},
3571 {"",S_FALSE,FALSE}
3574 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3575 {0,S_FALSE,FALSE},
3576 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3577 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3580 /* Dot segments aren't removed. */
3581 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3583 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3584 {"",S_FALSE,FALSE},
3585 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3586 {"",S_FALSE,FALSE},
3587 {".html",S_OK,FALSE},
3588 {"",S_FALSE,FALSE},
3589 {"",S_FALSE,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3592 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3593 {"",S_FALSE,FALSE},
3594 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3595 {"file",S_OK,FALSE},
3596 {"",S_FALSE,FALSE},
3597 {"",S_FALSE,FALSE}
3600 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3601 {0,S_FALSE,FALSE},
3602 {URL_SCHEME_FILE,S_OK,FALSE},
3603 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3606 /* Forbidden characters aren't percent encoded. */
3607 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3609 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3610 {"",S_FALSE,FALSE},
3611 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3612 {"",S_FALSE,FALSE},
3613 {".html",S_OK,FALSE},
3614 {"",S_FALSE,FALSE},
3615 {"",S_FALSE,FALSE},
3616 {"",S_FALSE,FALSE},
3617 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3618 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3619 {"",S_FALSE,FALSE},
3620 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3621 {"file",S_OK,FALSE},
3622 {"",S_FALSE,FALSE},
3623 {"",S_FALSE,FALSE}
3626 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3627 {0,S_FALSE,FALSE},
3628 {URL_SCHEME_FILE,S_OK,FALSE},
3629 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3632 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3633 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3635 {"",S_FALSE,FALSE},
3636 {"",S_FALSE,FALSE},
3637 {"file:c:/dir/../../index.html",S_OK,FALSE},
3638 {"",S_FALSE,FALSE},
3639 {".html",S_OK,FALSE},
3640 {"",S_FALSE,FALSE},
3641 {"",S_FALSE,FALSE},
3642 {"",S_FALSE,FALSE},
3643 {"c:/dir/../../index.html",S_OK,FALSE},
3644 {"c:/dir/../../index.html",S_OK,FALSE},
3645 {"",S_FALSE,FALSE},
3646 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3647 {"file",S_OK,FALSE},
3648 {"",S_FALSE,FALSE},
3649 {"",S_FALSE,FALSE}
3652 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3653 {0,S_FALSE,FALSE},
3654 {URL_SCHEME_FILE,S_OK,FALSE},
3655 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3658 /* '/' are still converted to '\' even though it's an opaque URI. */
3659 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3661 {"",S_FALSE,FALSE},
3662 {"",S_FALSE,FALSE},
3663 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3664 {"",S_FALSE,FALSE},
3665 {".html",S_OK,FALSE},
3666 {"",S_FALSE,FALSE},
3667 {"",S_FALSE,FALSE},
3668 {"",S_FALSE,FALSE},
3669 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3670 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3671 {"",S_FALSE,FALSE},
3672 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3673 {"file",S_OK,FALSE},
3674 {"",S_FALSE,FALSE},
3675 {"",S_FALSE,FALSE}
3678 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3679 {0,S_FALSE,FALSE},
3680 {URL_SCHEME_FILE,S_OK,FALSE},
3681 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3684 /* Forbidden characters aren't percent encoded. */
3685 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3687 {"",S_FALSE,FALSE},
3688 {"",S_FALSE,FALSE},
3689 {"file:c:\\in^|dex.html",S_OK,FALSE},
3690 {"",S_FALSE,FALSE},
3691 {".html",S_OK,FALSE},
3692 {"",S_FALSE,FALSE},
3693 {"",S_FALSE,FALSE},
3694 {"",S_FALSE,FALSE},
3695 {"c:\\in^|dex.html",S_OK,FALSE},
3696 {"c:\\in^|dex.html",S_OK,FALSE},
3697 {"",S_FALSE,FALSE},
3698 {"file:c:\\in^|dex.html",S_OK,FALSE},
3699 {"file",S_OK,FALSE},
3700 {"",S_FALSE,FALSE},
3701 {"",S_FALSE,FALSE}
3704 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3705 {0,S_FALSE,FALSE},
3706 {URL_SCHEME_FILE,S_OK,FALSE},
3707 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3710 /* Doesn't have a UserName since the ':' appears at the beginning of the
3711 * userinfo section.
3713 { "http://:password@gov.uk", 0, S_OK, FALSE,
3715 {"http://:password@gov.uk/",S_OK,FALSE},
3716 {":password@gov.uk",S_OK,FALSE},
3717 {"http://gov.uk/",S_OK,FALSE},
3718 {"",S_FALSE,FALSE},
3719 {"",S_FALSE,FALSE},
3720 {"",S_FALSE,FALSE},
3721 {"gov.uk",S_OK,FALSE},
3722 {"password",S_OK,FALSE},
3723 {"/",S_OK,FALSE},
3724 {"/",S_OK,FALSE},
3725 {"",S_FALSE,FALSE},
3726 {"http://:password@gov.uk",S_OK,FALSE},
3727 {"http",S_OK,FALSE},
3728 {":password",S_OK,FALSE},
3729 {"",S_FALSE,FALSE}
3732 {Uri_HOST_DNS,S_OK,FALSE},
3733 {80,S_OK,FALSE},
3734 {URL_SCHEME_HTTP,S_OK,FALSE},
3735 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3738 /* Has a UserName since the userinfo section doesn't contain a password. */
3739 { "http://@gov.uk", 0, S_OK, FALSE,
3741 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3742 {"@gov.uk",S_OK,FALSE},
3743 {"http://gov.uk/",S_OK,FALSE},
3744 {"",S_FALSE,FALSE},
3745 {"",S_FALSE,FALSE},
3746 {"",S_FALSE,FALSE},
3747 {"gov.uk",S_OK,FALSE},
3748 {"",S_FALSE,FALSE},
3749 {"/",S_OK,FALSE},
3750 {"/",S_OK,FALSE},
3751 {"",S_FALSE,FALSE},
3752 {"http://@gov.uk",S_OK,FALSE},
3753 {"http",S_OK,FALSE},
3754 {"",S_OK,FALSE},
3755 {"",S_OK,FALSE}
3758 {Uri_HOST_DNS,S_OK,FALSE},
3759 {80,S_OK,FALSE},
3760 {URL_SCHEME_HTTP,S_OK,FALSE},
3761 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3764 /* ":@" not included in the absolute URI. */
3765 { "http://:@gov.uk", 0, S_OK, FALSE,
3767 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3768 {":@gov.uk",S_OK,FALSE},
3769 {"http://gov.uk/",S_OK,FALSE},
3770 {"",S_FALSE,FALSE},
3771 {"",S_FALSE,FALSE},
3772 {"",S_FALSE,FALSE},
3773 {"gov.uk",S_OK,FALSE},
3774 {"",S_OK,FALSE},
3775 {"/",S_OK,FALSE},
3776 {"/",S_OK,FALSE},
3777 {"",S_FALSE,FALSE},
3778 {"http://:@gov.uk",S_OK,FALSE},
3779 {"http",S_OK,FALSE},
3780 {":",S_OK,FALSE},
3781 {"",S_FALSE,FALSE}
3784 {Uri_HOST_DNS,S_OK,FALSE},
3785 {80,S_OK,FALSE},
3786 {URL_SCHEME_HTTP,S_OK,FALSE},
3787 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3790 /* '@' is included because it's an unknown scheme type. */
3791 { "zip://@gov.uk", 0, S_OK, FALSE,
3793 {"zip://@gov.uk/",S_OK,FALSE},
3794 {"@gov.uk",S_OK,FALSE},
3795 {"zip://@gov.uk/",S_OK,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {"",S_FALSE,FALSE},
3798 {"",S_FALSE,FALSE},
3799 {"gov.uk",S_OK,FALSE},
3800 {"",S_FALSE,FALSE},
3801 {"/",S_OK,FALSE},
3802 {"/",S_OK,FALSE},
3803 {"",S_FALSE,FALSE},
3804 {"zip://@gov.uk",S_OK,FALSE},
3805 {"zip",S_OK,FALSE},
3806 {"",S_OK,FALSE},
3807 {"",S_OK,FALSE}
3810 {Uri_HOST_DNS,S_OK,FALSE},
3811 {0,S_FALSE,FALSE},
3812 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3813 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3816 /* ":@" are included because it's an unknown scheme type. */
3817 { "zip://:@gov.uk", 0, S_OK, FALSE,
3819 {"zip://:@gov.uk/",S_OK,FALSE},
3820 {":@gov.uk",S_OK,FALSE},
3821 {"zip://:@gov.uk/",S_OK,FALSE},
3822 {"",S_FALSE,FALSE},
3823 {"",S_FALSE,FALSE},
3824 {"",S_FALSE,FALSE},
3825 {"gov.uk",S_OK,FALSE},
3826 {"",S_OK,FALSE},
3827 {"/",S_OK,FALSE},
3828 {"/",S_OK,FALSE},
3829 {"",S_FALSE,FALSE},
3830 {"zip://:@gov.uk",S_OK,FALSE},
3831 {"zip",S_OK,FALSE},
3832 {":",S_OK,FALSE},
3833 {"",S_FALSE,FALSE}
3836 {Uri_HOST_DNS,S_OK,FALSE},
3837 {0,S_FALSE,FALSE},
3838 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3839 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3842 { "about:blank", 0, S_OK, FALSE,
3844 {"about:blank",S_OK,FALSE},
3845 {"",S_FALSE,FALSE},
3846 {"about:blank",S_OK,FALSE},
3847 {"",S_FALSE,FALSE},
3848 {"",S_FALSE,FALSE},
3849 {"",S_FALSE,FALSE},
3850 {"",S_FALSE,FALSE},
3851 {"",S_FALSE,FALSE},
3852 {"blank",S_OK,FALSE},
3853 {"blank",S_OK,FALSE},
3854 {"",S_FALSE,FALSE},
3855 {"about:blank",S_OK,FALSE},
3856 {"about",S_OK,FALSE},
3857 {"",S_FALSE,FALSE},
3858 {"",S_FALSE,FALSE}
3861 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3862 {0,S_FALSE,FALSE},
3863 {URL_SCHEME_ABOUT,S_OK,FALSE},
3864 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3867 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3869 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3872 {"",S_FALSE,FALSE},
3873 {".htm",S_OK,FALSE},
3874 {"",S_FALSE,FALSE},
3875 {"",S_FALSE,FALSE},
3876 {"",S_FALSE,FALSE},
3877 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3878 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3879 {"",S_FALSE,FALSE},
3880 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3881 {"mk",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_MK,S_OK,FALSE},
3889 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3892 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3894 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3895 {"",S_FALSE,FALSE},
3896 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.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:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3903 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3904 {"",S_FALSE,FALSE},
3905 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.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 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3918 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3920 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3921 {"server",S_OK,FALSE},
3922 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3923 {"",S_FALSE,FALSE},
3924 {".html",S_OK,FALSE},
3925 {"",S_FALSE,FALSE},
3926 {"server",S_OK,FALSE},
3927 {"",S_FALSE,FALSE},
3928 {"\\dir\\index.html",S_OK,FALSE},
3929 {"\\dir\\index.html",S_OK,FALSE},
3930 {"",S_FALSE,FALSE},
3931 {"file://server/dir/index.html",S_OK,FALSE},
3932 {"file",S_OK,FALSE},
3933 {"",S_FALSE,FALSE},
3934 {"",S_FALSE,FALSE}
3937 {Uri_HOST_DNS,S_OK,FALSE},
3938 {0,S_FALSE,FALSE},
3939 {URL_SCHEME_FILE,S_OK,FALSE},
3940 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3943 /* When CreateUri generates an IUri, it still displays the default port in the
3944 * authority.
3946 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3948 {"http://google.com:80/",S_OK,FALSE},
3949 {"google.com:80",S_OK,FALSE},
3950 {"http://google.com:80/",S_OK,FALSE},
3951 {"google.com",S_OK,FALSE},
3952 {"",S_FALSE,FALSE},
3953 {"",S_FALSE,FALSE},
3954 {"google.com",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"/",S_OK,FALSE},
3957 {"/",S_OK,FALSE},
3958 {"",S_FALSE,FALSE},
3959 {"http://google.com:80/",S_OK,FALSE},
3960 {"http",S_OK,FALSE},
3961 {"",S_FALSE,FALSE},
3962 {"",S_FALSE,FALSE}
3965 {Uri_HOST_DNS,S_OK,FALSE},
3966 {80,S_OK,FALSE},
3967 {URL_SCHEME_HTTP,S_OK,FALSE},
3968 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3971 /* For res URIs the host is everything up until the first '/'. */
3972 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3974 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3975 {"C:\\dir\\file.exe",S_OK,FALSE},
3976 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3977 {"",S_FALSE,FALSE},
3978 {".html",S_OK,FALSE},
3979 {"",S_FALSE,FALSE},
3980 {"C:\\dir\\file.exe",S_OK,FALSE},
3981 {"",S_FALSE,FALSE},
3982 {"/DATA/test.html",S_OK,FALSE},
3983 {"/DATA/test.html",S_OK,FALSE},
3984 {"",S_FALSE,FALSE},
3985 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3986 {"res",S_OK,FALSE},
3987 {"",S_FALSE,FALSE},
3988 {"",S_FALSE,FALSE}
3991 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3992 {0,S_FALSE,FALSE},
3993 {URL_SCHEME_RES,S_OK,FALSE},
3994 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3997 /* Res URI can contain a '|' in the host name. */
3998 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
4000 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4001 {"c:\\di|r\\file.exe",S_OK,FALSE},
4002 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4003 {"",S_FALSE,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {"",S_FALSE,FALSE},
4006 {"c:\\di|r\\file.exe",S_OK,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"/test",S_OK,FALSE},
4009 {"/test",S_OK,FALSE},
4010 {"",S_FALSE,FALSE},
4011 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
4012 {"res",S_OK,FALSE},
4013 {"",S_FALSE,FALSE},
4014 {"",S_FALSE,FALSE}
4017 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4018 {0,S_FALSE,FALSE},
4019 {URL_SCHEME_RES,S_OK,FALSE},
4020 {URLZONE_INVALID,E_NOTIMPL,FALSE},
4023 /* Res URIs can have invalid percent encoded values. */
4024 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
4026 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4027 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4028 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"",S_FALSE,FALSE},
4031 {"",S_FALSE,FALSE},
4032 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
4033 {"",S_FALSE,FALSE},
4034 {"/test",S_OK,FALSE},
4035 {"/test",S_OK,FALSE},
4036 {"",S_FALSE,FALSE},
4037 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
4038 {"res",S_OK,FALSE},
4039 {"",S_FALSE,FALSE},
4040 {"",S_FALSE,FALSE}
4043 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4044 {0,S_FALSE,FALSE},
4045 {URL_SCHEME_RES,S_OK,FALSE},
4046 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4049 /* Res doesn't get forbidden characters percent encoded in it's path. */
4050 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
4052 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4053 {"c:\\test",S_OK,FALSE},
4054 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4055 {"",S_FALSE,FALSE},
4056 {"",S_FALSE,FALSE},
4057 {"",S_FALSE,FALSE},
4058 {"c:\\test",S_OK,FALSE},
4059 {"",S_FALSE,FALSE},
4060 {"/tes<|>t",S_OK,FALSE},
4061 {"/tes<|>t",S_OK,FALSE},
4062 {"",S_FALSE,FALSE},
4063 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4064 {"res",S_OK,FALSE},
4065 {"",S_FALSE,FALSE},
4066 {"",S_FALSE,FALSE}
4069 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4070 {0,S_FALSE,FALSE},
4071 {URL_SCHEME_RES,S_OK,FALSE},
4072 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4075 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4077 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4078 {"",S_FALSE,FALSE},
4079 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4080 {"",S_FALSE,FALSE},
4081 {".jpg",S_OK,FALSE},
4082 {"",S_FALSE,FALSE},
4083 {"",S_FALSE,FALSE},
4084 {"",S_FALSE,FALSE},
4085 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4086 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4087 {"",S_FALSE,FALSE},
4088 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4089 {"mk",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_MK,S_OK,FALSE},
4097 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4100 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4102 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4103 {"",S_FALSE,FALSE},
4104 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../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::/html/../images/xxx.jpg",S_OK,FALSE},
4111 {"@MSITStore:Z:\\dir\\test.chm::/html/../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 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4127 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4128 {"",S_FALSE,FALSE},
4129 {"xx:@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 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4139 {"xx",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_UNKNOWN,S_OK,FALSE},
4147 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4150 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4152 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4153 {"",S_FALSE,FALSE},
4154 {"mk:@MSITStore:Z:\\dir\\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\\images/xxx.jpg",S_OK,FALSE},
4161 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4162 {"",S_FALSE,FALSE},
4163 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4164 {"mk",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_MK,S_OK,FALSE},
4172 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4175 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\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\\dir2\\..\\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\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4202 {"mk:images/xxx.jpg",S_OK,FALSE},
4203 {"",S_FALSE,FALSE},
4204 {"mk: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 {"images/xxx.jpg",S_OK,FALSE},
4211 {"images/xxx.jpg",S_OK,FALSE},
4212 {"",S_FALSE,FALSE},
4213 {"mk:@MSITStore:Z:\\dir\\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 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4227 {"",S_OK,FALSE},
4228 {"",S_FALSE,FALSE},
4229 {"",S_OK,FALSE},
4230 {"",S_FALSE,FALSE},
4231 {"",S_FALSE,FALSE},
4232 {"",S_FALSE,FALSE},
4233 {"",S_FALSE,FALSE},
4234 {"",S_FALSE,FALSE},
4235 {"",S_OK,FALSE},
4236 {"",S_OK,FALSE},
4237 {"",S_FALSE,FALSE},
4238 {"",S_OK,FALSE},
4239 {"",S_FALSE,FALSE},
4240 {"",S_FALSE,FALSE},
4241 {"",S_FALSE,FALSE}
4244 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4245 {0,S_FALSE,FALSE},
4246 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4247 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4250 { " \t ", 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 { "javascript:void", 0, S_OK, FALSE,
4277 {"javascript:void",S_OK},
4278 {"",S_FALSE},
4279 {"javascript:void",S_OK},
4280 {"",S_FALSE},
4281 {"",S_FALSE},
4282 {"",S_FALSE},
4283 {"",S_FALSE},
4284 {"",S_FALSE},
4285 {"void",S_OK},
4286 {"void",S_OK},
4287 {"",S_FALSE},
4288 {"javascript:void",S_OK},
4289 {"javascript",S_OK},
4290 {"",S_FALSE},
4291 {"",S_FALSE}
4294 {Uri_HOST_UNKNOWN,S_OK},
4295 {0,S_FALSE},
4296 {URL_SCHEME_JAVASCRIPT,S_OK},
4297 {URLZONE_INVALID,E_NOTIMPL}
4300 { "javascript://undefined", 0, S_OK, FALSE,
4302 {"javascript://undefined",S_OK},
4303 {"",S_FALSE},
4304 {"javascript://undefined",S_OK},
4305 {"",S_FALSE},
4306 {"",S_FALSE},
4307 {"",S_FALSE},
4308 {"",S_FALSE},
4309 {"",S_FALSE},
4310 {"//undefined",S_OK},
4311 {"//undefined",S_OK},
4312 {"",S_FALSE},
4313 {"javascript://undefined",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:escape('/\\?#?')", 0, S_OK, FALSE,
4327 {"javascript:escape('/\\?#?')",S_OK},
4328 {"",S_FALSE},
4329 {"javascript:escape('/\\?#?')",S_OK},
4330 {"",S_FALSE},
4331 {"",S_FALSE},
4332 {"",S_FALSE},
4333 {"",S_FALSE},
4334 {"",S_FALSE},
4335 {"escape('/\\?#?')",S_OK},
4336 {"escape('/\\?#?')",S_OK},
4337 {"",S_FALSE},
4338 {"JavaSCript:escape('/\\?#?')",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 { "*://google.com", 0, S_OK, FALSE,
4352 {"*:google.com/",S_OK,FALSE},
4353 {"google.com",S_OK},
4354 {"*:google.com/",S_OK,FALSE},
4355 {"google.com",S_OK,FALSE},
4356 {"",S_FALSE,FALSE},
4357 {"",S_FALSE,FALSE},
4358 {"google.com",S_OK,FALSE},
4359 {"",S_FALSE,FALSE},
4360 {"/",S_OK,FALSE},
4361 {"/",S_OK,FALSE},
4362 {"",S_FALSE,FALSE},
4363 {"*://google.com",S_OK,FALSE},
4364 {"*",S_OK,FALSE},
4365 {"",S_FALSE,FALSE},
4366 {"",S_FALSE,FALSE}
4369 {Uri_HOST_DNS,S_OK,FALSE},
4370 {0,S_FALSE,FALSE},
4371 {URL_SCHEME_WILDCARD,S_OK,FALSE},
4372 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4375 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK,FALSE,
4377 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4378 {"",S_FALSE},
4379 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4380 {"",S_FALSE},
4381 {".txt",S_OK},
4382 {"",S_FALSE},
4383 {"",S_FALSE},
4384 {"",S_FALSE},
4385 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4386 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4387 {"",S_FALSE},
4388 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK},
4389 {"mk",S_OK},
4390 {"",S_FALSE},
4391 {"",S_FALSE}
4394 {Uri_HOST_UNKNOWN,S_OK},
4395 {0,S_FALSE},
4396 {URL_SCHEME_MK,S_OK},
4397 {URLZONE_INVALID,E_NOTIMPL}
4400 { "gopher://test.winehq.org:151/file.txt",0,S_OK,FALSE,
4402 {"gopher://test.winehq.org:151/file.txt",S_OK},
4403 {"test.winehq.org:151",S_OK},
4404 {"gopher://test.winehq.org:151/file.txt",S_OK},
4405 {"winehq.org",S_OK},
4406 {".txt",S_OK},
4407 {"",S_FALSE},
4408 {"test.winehq.org",S_OK},
4409 {"",S_FALSE},
4410 {"/file.txt",S_OK},
4411 {"/file.txt",S_OK},
4412 {"",S_FALSE},
4413 {"gopher://test.winehq.org:151/file.txt",S_OK},
4414 {"gopher",S_OK},
4415 {"",S_FALSE},
4416 {"",S_FALSE}
4419 {Uri_HOST_DNS,S_OK},
4420 {151,S_OK},
4421 {URL_SCHEME_GOPHER,S_OK},
4422 {URLZONE_INVALID,E_NOTIMPL}
4425 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4427 {"//host.com/path/file.txt?query",S_OK},
4428 {"host.com",S_OK},
4429 {"//host.com/path/file.txt?query",S_OK},
4430 {"host.com",S_OK},
4431 {".txt",S_OK},
4432 {"",S_FALSE},
4433 {"host.com",S_OK},
4434 {"",S_FALSE},
4435 {"/path/file.txt",S_OK},
4436 {"/path/file.txt?query",S_OK},
4437 {"?query",S_OK},
4438 {"//host.com/path/file.txt?query",S_OK},
4439 {"",S_FALSE},
4440 {"",S_FALSE},
4441 {"",S_FALSE},
4444 {Uri_HOST_DNS,S_OK},
4445 {0,S_FALSE},
4446 {URL_SCHEME_UNKNOWN,S_OK},
4447 {URLZONE_INVALID,E_NOTIMPL}
4450 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4452 {"//host/path/file.txt?query",S_OK},
4453 {"host",S_OK},
4454 {"//host/path/file.txt?query",S_OK},
4455 {"",S_FALSE},
4456 {".txt",S_OK},
4457 {"",S_FALSE},
4458 {"host",S_OK},
4459 {"",S_FALSE},
4460 {"/path/file.txt",S_OK},
4461 {"/path/file.txt?query",S_OK},
4462 {"?query",S_OK},
4463 {"//host/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", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4477 {"//host/",S_OK},
4478 {"host",S_OK},
4479 {"//host/",S_OK},
4480 {"",S_FALSE},
4481 {"",S_FALSE},
4482 {"",S_FALSE},
4483 {"host",S_OK},
4484 {"",S_FALSE},
4485 {"/",S_OK},
4486 {"/",S_OK},
4487 {"",S_FALSE},
4488 {"//host",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}
4502 typedef struct _invalid_uri {
4503 const char* uri;
4504 DWORD flags;
4505 BOOL todo;
4506 } invalid_uri;
4508 static const invalid_uri invalid_uri_tests[] = {
4509 /* Has to have a scheme name. */
4510 {"://www.winehq.org",0,FALSE},
4511 /* Window's doesn't like URI's which are implicitly file paths without the
4512 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4514 {"C:/test/test.mp3",0,FALSE},
4515 {"\\\\Server/test/test.mp3",0,FALSE},
4516 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4517 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4518 /* Invalid schemes. */
4519 {"*abcd://not.valid.com",0,FALSE},
4520 {"*a*b*c*d://not.valid.com",0,FALSE},
4521 /* Not allowed to have invalid % encoded data. */
4522 {"ftp://google.co%XX/",0,FALSE},
4523 /* To many h16 components. */
4524 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4525 /* Not enough room for IPv4 address. */
4526 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4527 /* Not enough h16 components. */
4528 {"http://[1:2:3:4]",0,FALSE},
4529 /* Not enough components including IPv4. */
4530 {"http://[1:192.0.1.0]",0,FALSE},
4531 /* Not allowed to have partial IPv4 in IPv6. */
4532 {"http://[::192.0]",0,FALSE},
4533 /* Can't have elision of 1 h16 at beginning of address. */
4534 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4535 /* Can't have elision of 1 h16 at end of address. */
4536 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4537 /* Expects a valid IP Literal. */
4538 {"ftp://[not.valid.uri]/",0,FALSE},
4539 /* Expects valid port for a known scheme type. */
4540 {"ftp://www.winehq.org:123fgh",0,FALSE},
4541 /* Port exceeds USHORT_MAX for known scheme type. */
4542 {"ftp://www.winehq.org:65536",0,FALSE},
4543 /* Invalid port with IPv4 address. */
4544 {"http://www.winehq.org:1abcd",0,FALSE},
4545 /* Invalid port with IPv6 address. */
4546 {"http://[::ffff]:32xy",0,FALSE},
4547 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4548 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4549 /* Not allowed to have invalid % encoded data in opaque URI path. */
4550 {"news:test%XX",0,FALSE},
4551 {"mailto:wine@winehq%G8.com",0,FALSE},
4552 /* Known scheme types can't have invalid % encoded data in query string. */
4553 {"http://google.com/?query=te%xx",0,FALSE},
4554 /* Invalid % encoded data in fragment of know scheme type. */
4555 {"ftp://google.com/#Test%xx",0,FALSE},
4556 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4557 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4558 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4559 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4560 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4561 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4562 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4563 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4564 /* res URIs aren't allowed to have forbidden dos path characters in the
4565 * hostname.
4567 {"res://c:\\te<st\\test/test",0,FALSE},
4568 {"res://c:\\te>st\\test/test",0,FALSE},
4569 {"res://c:\\te\"st\\test/test",0,FALSE},
4570 {"res://c:\\test/te%xxst",0,FALSE}
4573 typedef struct _uri_equality {
4574 const char* a;
4575 DWORD create_flags_a;
4576 const char* b;
4577 DWORD create_flags_b;
4578 BOOL equal;
4579 BOOL todo;
4580 } uri_equality;
4582 static const uri_equality equality_tests[] = {
4584 "HTTP://www.winehq.org/test dir/./",0,
4585 "http://www.winehq.org/test dir/../test dir/",0,
4586 TRUE
4589 /* http://www.winehq.org/test%20dir */
4590 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4591 "http://www.winehq.org/test dir",0,
4592 TRUE
4595 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
4596 "file:///c:/test.mp3",0,
4597 TRUE
4600 "ftp://ftp.winehq.org/",0,
4601 "ftp://ftp.winehq.org",0,
4602 TRUE
4605 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4606 "ftp://ftp.winehq.org/t%45stB/",0,
4607 FALSE
4610 "http://google.com/TEST",0,
4611 "http://google.com/test",0,
4612 FALSE
4615 "http://GOOGLE.com/",0,
4616 "http://google.com/",0,
4617 TRUE
4619 /* Performs case insensitive compare of host names (for known scheme types). */
4621 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,
4622 "ftp://google.com/",0,
4623 TRUE
4626 "zip://GOOGLE.com/",0,
4627 "zip://google.com/",0,
4628 FALSE
4631 "file:///c:/TEST/TeST/",0,
4632 "file:///c:/test/test/",0,
4633 TRUE
4636 "file:///server/TEST",0,
4637 "file:///SERVER/TEST",0,
4638 TRUE
4641 "http://google.com",Uri_CREATE_NO_CANONICALIZE,
4642 "http://google.com/",0,
4643 TRUE
4646 "ftp://google.com:21/",0,
4647 "ftp://google.com/",0,
4648 TRUE
4651 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,
4652 "http://google.com/",0,
4653 TRUE
4656 "http://google.com:70/",0,
4657 "http://google.com:71/",0,
4658 FALSE
4661 "file:///c:/dir/file.txt", 0,
4662 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4663 TRUE
4666 "file:///c:/dir/file.txt", 0,
4667 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4668 TRUE
4671 "file:///c:/dir/file.txt", 0,
4672 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4673 TRUE
4676 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE,
4677 "file:///c:/%20dir/file.txt", 0,
4678 TRUE
4681 "file:///c:/Dir/file.txt", 0,
4682 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH,
4683 TRUE
4686 "file:///c:/dir/file.txt", 0,
4687 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH,
4688 TRUE
4691 "file:///c:/dir/file.txt#a", 0,
4692 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH,
4693 FALSE
4697 typedef struct _uri_with_fragment {
4698 const char* uri;
4699 const char* fragment;
4700 DWORD create_flags;
4701 HRESULT create_expected;
4702 BOOL create_todo;
4704 const char* expected_uri;
4705 BOOL expected_todo;
4706 } uri_with_fragment;
4708 static const uri_with_fragment uri_fragment_tests[] = {
4710 "http://google.com/","#fragment",0,S_OK,FALSE,
4711 "http://google.com/#fragment",FALSE
4714 "http://google.com/","fragment",0,S_OK,FALSE,
4715 "http://google.com/#fragment",FALSE
4718 "zip://test.com/","?test",0,S_OK,FALSE,
4719 "zip://test.com/#?test",FALSE
4721 /* The fragment can be empty. */
4723 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4724 "ftp://ftp.google.com/#",FALSE
4728 typedef struct _uri_builder_property {
4729 BOOL change;
4730 const char *value;
4731 const char *expected_value;
4732 Uri_PROPERTY property;
4733 HRESULT expected;
4734 BOOL todo;
4735 } uri_builder_property;
4737 typedef struct _uri_builder_port {
4738 BOOL change;
4739 BOOL set;
4740 DWORD value;
4741 HRESULT expected;
4742 BOOL todo;
4743 } uri_builder_port;
4745 typedef struct _uri_builder_str_property {
4746 const char* expected;
4747 HRESULT result;
4748 BOOL todo;
4749 } uri_builder_str_property;
4751 typedef struct _uri_builder_dword_property {
4752 DWORD expected;
4753 HRESULT result;
4754 BOOL todo;
4755 } uri_builder_dword_property;
4757 typedef struct _uri_builder_test {
4758 const char *uri;
4759 DWORD create_flags;
4760 HRESULT create_builder_expected;
4761 BOOL create_builder_todo;
4763 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4765 uri_builder_port port_prop;
4767 DWORD uri_flags;
4768 HRESULT uri_hres;
4769 BOOL uri_todo;
4771 DWORD uri_simple_encode_flags;
4772 HRESULT uri_simple_hres;
4773 BOOL uri_simple_todo;
4775 DWORD uri_with_flags;
4776 DWORD uri_with_builder_flags;
4777 DWORD uri_with_encode_flags;
4778 HRESULT uri_with_hres;
4779 BOOL uri_with_todo;
4781 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4782 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4783 } uri_builder_test;
4785 static const uri_builder_test uri_builder_tests[] = {
4786 { "http://google.com/",0,S_OK,FALSE,
4788 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4789 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4790 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4791 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4793 {FALSE},
4794 0,S_OK,FALSE,
4795 0,S_OK,FALSE,
4796 0,0,0,S_OK,FALSE,
4798 {"http://username:password@google.com/?query=x#fragment",S_OK},
4799 {"username:password@google.com",S_OK},
4800 {"http://google.com/?query=x#fragment",S_OK},
4801 {"google.com",S_OK},
4802 {"",S_FALSE},
4803 {"#fragment",S_OK},
4804 {"google.com",S_OK},
4805 {"password",S_OK},
4806 {"/",S_OK},
4807 {"/?query=x",S_OK},
4808 {"?query=x",S_OK},
4809 {"http://username:password@google.com/?query=x#fragment",S_OK},
4810 {"http",S_OK},
4811 {"username:password",S_OK},
4812 {"username",S_OK}
4815 {Uri_HOST_DNS,S_OK},
4816 {80,S_OK},
4817 {URL_SCHEME_HTTP,S_OK},
4818 {URLZONE_INVALID,E_NOTIMPL}
4821 { "http://google.com/",0,S_OK,FALSE,
4823 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4825 {TRUE,TRUE,120,S_OK,FALSE},
4826 0,S_OK,FALSE,
4827 0,S_OK,FALSE,
4828 0,0,0,S_OK,FALSE,
4830 {"test://google.com:120/",S_OK},
4831 {"google.com:120",S_OK},
4832 {"test://google.com:120/",S_OK},
4833 {"google.com",S_OK},
4834 {"",S_FALSE},
4835 {"",S_FALSE},
4836 {"google.com",S_OK},
4837 {"",S_FALSE},
4838 {"/",S_OK},
4839 {"/",S_OK},
4840 {"",S_FALSE},
4841 {"test://google.com:120/",S_OK},
4842 {"test",S_OK},
4843 {"",S_FALSE},
4844 {"",S_FALSE}
4847 {Uri_HOST_DNS,S_OK},
4848 {120,S_OK},
4849 {URL_SCHEME_UNKNOWN,S_OK},
4850 {URLZONE_INVALID,E_NOTIMPL}
4853 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4855 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4856 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4857 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4859 {FALSE},
4860 0,S_OK,FALSE,
4861 0,S_OK,FALSE,
4862 0,0,0,S_OK,FALSE,
4864 {"http://[::192.2.3.4]/",S_OK},
4865 {"[::192.2.3.4]",S_OK},
4866 {"http://[::192.2.3.4]/",S_OK},
4867 {"",S_FALSE},
4868 {"",S_FALSE},
4869 {"",S_FALSE},
4870 {"::192.2.3.4",S_OK},
4871 {"",S_FALSE},
4872 {"/",S_OK},
4873 {"/",S_OK},
4874 {"",S_FALSE},
4875 {"http://[::192.2.3.4]/",S_OK},
4876 {"http",S_OK},
4877 {"",S_FALSE},
4878 {"",S_FALSE}
4881 {Uri_HOST_IPV6,S_OK},
4882 {80,S_OK},
4883 {URL_SCHEME_HTTP,S_OK},
4884 {URLZONE_INVALID,E_NOTIMPL}
4887 { "http://google.com/",0,S_OK,FALSE,
4889 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4891 {FALSE},
4892 0,S_OK,FALSE,
4893 0,S_OK,FALSE,
4894 0,0,0,S_OK,FALSE,
4896 {"http://google.com/#Frag",S_OK},
4897 {"google.com",S_OK},
4898 {"http://google.com/#Frag",S_OK},
4899 {"google.com",S_OK},
4900 {"",S_FALSE},
4901 {"#Frag",S_OK},
4902 {"google.com",S_OK},
4903 {"",S_FALSE},
4904 {"/",S_OK},
4905 {"/",S_OK},
4906 {"",S_FALSE},
4907 {"http://google.com/#Frag",S_OK},
4908 {"http",S_OK},
4909 {"",S_FALSE},
4910 {"",S_FALSE}
4913 {Uri_HOST_DNS,S_OK},
4914 {80,S_OK},
4915 {URL_SCHEME_HTTP,S_OK},
4916 {URLZONE_INVALID,E_NOTIMPL}
4919 { "http://google.com/",0,S_OK,FALSE,
4921 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4923 {FALSE},
4924 0,S_OK,FALSE,
4925 0,S_OK,FALSE,
4926 0,0,0,S_OK,FALSE,
4928 {"http://google.com/#",S_OK},
4929 {"google.com",S_OK},
4930 {"http://google.com/#",S_OK},
4931 {"google.com",S_OK},
4932 {"",S_FALSE},
4933 {"#",S_OK},
4934 {"google.com",S_OK},
4935 {"",S_FALSE},
4936 {"/",S_OK},
4937 {"/",S_OK},
4938 {"",S_FALSE},
4939 {"http://google.com/#",S_OK},
4940 {"http",S_OK},
4941 {"",S_FALSE},
4942 {"",S_FALSE}
4945 {Uri_HOST_DNS,S_OK},
4946 {80,S_OK},
4947 {URL_SCHEME_HTTP,S_OK},
4948 {URLZONE_INVALID,E_NOTIMPL}
4951 { "http://google.com/",0,S_OK,FALSE,
4953 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4955 {FALSE},
4956 0,S_OK,FALSE,
4957 0,S_OK,FALSE,
4958 0,0,0,S_OK,FALSE,
4960 {"http://::password@google.com/",S_OK},
4961 {"::password@google.com",S_OK},
4962 {"http://google.com/",S_OK},
4963 {"google.com",S_OK},
4964 {"",S_FALSE},
4965 {"",S_FALSE},
4966 {"google.com",S_OK},
4967 {":password",S_OK},
4968 {"/",S_OK},
4969 {"/",S_OK},
4970 {"",S_FALSE},
4971 {"http://::password@google.com/",S_OK},
4972 {"http",S_OK},
4973 {"::password",S_OK},
4974 {"",S_FALSE}
4977 {Uri_HOST_DNS,S_OK},
4978 {80,S_OK},
4979 {URL_SCHEME_HTTP,S_OK},
4980 {URLZONE_INVALID,E_NOTIMPL}
4983 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4985 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4987 {FALSE},
4988 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4989 0,S_OK,FALSE,
4990 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4992 {":password@test/test",S_OK},
4993 {":password@",S_OK},
4994 {":password@test/test",S_OK},
4995 {"",S_FALSE},
4996 {"",S_FALSE},
4997 {"",S_FALSE},
4998 {"",S_FALSE},
4999 {"password",S_OK},
5000 {"test/test",S_OK},
5001 {"test/test",S_OK},
5002 {"",S_FALSE},
5003 {":password@test/test",S_OK},
5004 {"",S_FALSE},
5005 {":password",S_OK},
5006 {"",S_FALSE}
5009 {Uri_HOST_UNKNOWN,S_OK},
5010 {0,S_FALSE},
5011 {URL_SCHEME_UNKNOWN,S_OK},
5012 {URLZONE_INVALID,E_NOTIMPL}
5015 { "http://google.com/",0,S_OK,FALSE,
5017 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5019 {FALSE},
5020 0,S_OK,FALSE,
5021 0,S_OK,FALSE,
5022 0,0,0,S_OK,FALSE,
5024 {"http://google.com/test/test",S_OK},
5025 {"google.com",S_OK},
5026 {"http://google.com/test/test",S_OK},
5027 {"google.com",S_OK},
5028 {"",S_FALSE},
5029 {"",S_FALSE},
5030 {"google.com",S_OK},
5031 {"",S_FALSE},
5032 {"/test/test",S_OK},
5033 {"/test/test",S_OK},
5034 {"",S_FALSE},
5035 {"http://google.com/test/test",S_OK},
5036 {"http",S_OK},
5037 {"",S_FALSE},
5038 {"",S_FALSE}
5041 {Uri_HOST_DNS,S_OK},
5042 {80,S_OK},
5043 {URL_SCHEME_HTTP,S_OK},
5044 {URLZONE_INVALID,E_NOTIMPL}
5047 { "zip:testing/test",0,S_OK,FALSE,
5049 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5051 {FALSE},
5052 0,S_OK,FALSE,
5053 0,S_OK,FALSE,
5054 0,0,0,S_OK,FALSE,
5056 {"zip:test",S_OK},
5057 {"",S_FALSE},
5058 {"zip:test",S_OK},
5059 {"",S_FALSE},
5060 {"",S_FALSE},
5061 {"",S_FALSE},
5062 {"",S_FALSE},
5063 {"",S_FALSE},
5064 {"test",S_OK},
5065 {"test",S_OK},
5066 {"",S_FALSE},
5067 {"zip:test",S_OK},
5068 {"zip",S_OK},
5069 {"",S_FALSE},
5070 {"",S_FALSE}
5073 {Uri_HOST_UNKNOWN,S_OK},
5074 {0,S_FALSE},
5075 {URL_SCHEME_UNKNOWN,S_OK},
5076 {URLZONE_INVALID,E_NOTIMPL}
5079 { "http://google.com/",0,S_OK,FALSE,
5081 {FALSE},
5083 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5084 {TRUE,FALSE,555,S_OK,FALSE},
5085 0,S_OK,FALSE,
5086 0,S_OK,FALSE,
5087 0,0,0,S_OK,FALSE,
5089 {"http://google.com/",S_OK},
5090 {"google.com",S_OK},
5091 {"http://google.com/",S_OK},
5092 {"google.com",S_OK},
5093 {"",S_FALSE},
5094 {"",S_FALSE},
5095 {"google.com",S_OK},
5096 {"",S_FALSE},
5097 {"/",S_OK},
5098 {"/",S_OK},
5099 {"",S_FALSE},
5100 {"http://google.com/",S_OK},
5101 {"http",S_OK},
5102 {"",S_FALSE},
5103 {"",S_FALSE}
5106 {Uri_HOST_DNS,S_OK},
5107 /* Still returns 80, even though earlier the port was disabled. */
5108 {80,S_OK},
5109 {URL_SCHEME_HTTP,S_OK},
5110 {URLZONE_INVALID,E_NOTIMPL}
5113 { "http://google.com/",0,S_OK,FALSE,
5115 {FALSE},
5117 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5118 * you'll get 122345 instead.
5120 {TRUE,122345,222,S_OK,FALSE},
5121 0,S_OK,FALSE,
5122 0,S_OK,FALSE,
5123 0,0,0,S_OK,FALSE,
5125 {"http://google.com:222/",S_OK},
5126 {"google.com:222",S_OK},
5127 {"http://google.com:222/",S_OK},
5128 {"google.com",S_OK},
5129 {"",S_FALSE},
5130 {"",S_FALSE},
5131 {"google.com",S_OK},
5132 {"",S_FALSE},
5133 {"/",S_OK},
5134 {"/",S_OK},
5135 {"",S_FALSE},
5136 {"http://google.com:222/",S_OK},
5137 {"http",S_OK},
5138 {"",S_FALSE},
5139 {"",S_FALSE}
5142 {Uri_HOST_DNS,S_OK},
5143 {222,S_OK},
5144 {URL_SCHEME_HTTP,S_OK},
5145 {URLZONE_INVALID,E_NOTIMPL}
5148 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5149 { "http://google.com/",0,S_OK,FALSE,
5151 {FALSE},
5153 {TRUE,TRUE,999999,S_OK,FALSE},
5154 0,S_OK,FALSE,
5155 0,S_OK,FALSE,
5156 0,0,0,S_OK,FALSE,
5158 {"http://google.com:999999/",S_OK},
5159 {"google.com:999999",S_OK},
5160 {"http://google.com:999999/",S_OK},
5161 {"google.com",S_OK},
5162 {"",S_FALSE},
5163 {"",S_FALSE},
5164 {"google.com",S_OK},
5165 {"",S_FALSE},
5166 {"/",S_OK},
5167 {"/",S_OK},
5168 {"",S_FALSE},
5169 {"http://google.com:999999/",S_OK},
5170 {"http",S_OK},
5171 {"",S_FALSE},
5172 {"",S_FALSE}
5175 {Uri_HOST_DNS,S_OK},
5176 {999999,S_OK},
5177 {URL_SCHEME_HTTP,S_OK},
5178 {URLZONE_INVALID,E_NOTIMPL}
5181 { "http://google.com/",0,S_OK,FALSE,
5183 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
5186 {FALSE},
5187 0,S_OK,FALSE,
5188 0,S_OK,FALSE,
5189 0,0,0,S_OK,FALSE,
5191 {"http://google.com/?test",S_OK},
5192 {"google.com",S_OK},
5193 {"http://google.com/?test",S_OK},
5194 {"google.com",S_OK},
5195 {"",S_FALSE},
5196 {"",S_FALSE},
5197 {"google.com",S_OK},
5198 {"",S_FALSE},
5199 {"/",S_OK},
5200 {"/?test",S_OK},
5201 {"?test",S_OK},
5202 {"http://google.com/?test",S_OK},
5203 {"http",S_OK},
5204 {"",S_FALSE},
5205 {"",S_FALSE}
5208 {Uri_HOST_DNS,S_OK},
5209 {80,S_OK},
5210 {URL_SCHEME_HTTP,S_OK},
5211 {URLZONE_INVALID,E_NOTIMPL}
5214 { "http://:password@google.com/",0,S_OK,FALSE,
5216 {FALSE},
5218 {FALSE},
5219 0,S_OK,FALSE,
5220 0,S_OK,FALSE,
5221 0,0,0,S_OK,FALSE,
5223 {"http://:password@google.com/",S_OK},
5224 {":password@google.com",S_OK},
5225 {"http://google.com/",S_OK},
5226 {"google.com",S_OK},
5227 {"",S_FALSE},
5228 {"",S_FALSE},
5229 {"google.com",S_OK},
5230 {"password",S_OK},
5231 {"/",S_OK},
5232 {"/",S_OK},
5233 {"",S_FALSE},
5234 {"http://:password@google.com/",S_OK},
5235 {"http",S_OK},
5236 {":password",S_OK},
5237 {"",S_FALSE}
5240 {Uri_HOST_DNS,S_OK},
5241 {80,S_OK},
5242 {URL_SCHEME_HTTP,S_OK},
5243 {URLZONE_INVALID,E_NOTIMPL}
5246 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5247 { NULL,0,S_OK,FALSE,
5249 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5250 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5252 {FALSE},
5253 0,S_OK,FALSE,
5254 0,S_OK,FALSE,
5255 0,0,0,S_OK,FALSE,
5257 {"http://google.com/",S_OK},
5258 {"google.com",S_OK},
5259 {"http://google.com/",S_OK},
5260 {"google.com",S_OK},
5261 {"",S_FALSE},
5262 {"",S_FALSE},
5263 {"google.com",S_OK},
5264 {"",S_FALSE},
5265 {"/",S_OK},
5266 {"/",S_OK},
5267 {"",S_FALSE},
5268 {"http://google.com/",S_OK},
5269 {"http",S_OK},
5270 {"",S_FALSE},
5271 {"",S_FALSE}
5274 {Uri_HOST_DNS,S_OK},
5275 {80,S_OK},
5276 {URL_SCHEME_HTTP,S_OK},
5277 {URLZONE_INVALID,E_NOTIMPL}
5280 /* Can't set the scheme name to NULL. */
5281 { "zip://google.com/",0,S_OK,FALSE,
5283 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5285 {FALSE},
5286 0,S_OK,FALSE,
5287 0,S_OK,FALSE,
5288 0,0,0,S_OK,FALSE,
5290 {"zip://google.com/",S_OK},
5291 {"google.com",S_OK},
5292 {"zip://google.com/",S_OK},
5293 {"google.com",S_OK},
5294 {"",S_FALSE},
5295 {"",S_FALSE},
5296 {"google.com",S_OK},
5297 {"",S_FALSE},
5298 {"/",S_OK},
5299 {"/",S_OK},
5300 {"",S_FALSE},
5301 {"zip://google.com/",S_OK},
5302 {"zip",S_OK},
5303 {"",S_FALSE},
5304 {"",S_FALSE}
5307 {Uri_HOST_DNS,S_OK},
5308 {0,S_FALSE},
5309 {URL_SCHEME_UNKNOWN,S_OK},
5310 {URLZONE_INVALID,E_NOTIMPL}
5313 /* Can't set the scheme name to an empty string. */
5314 { "zip://google.com/",0,S_OK,FALSE,
5316 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5318 {FALSE},
5319 0,S_OK,FALSE,
5320 0,S_OK,FALSE,
5321 0,0,0,S_OK,FALSE,
5323 {"zip://google.com/",S_OK},
5324 {"google.com",S_OK},
5325 {"zip://google.com/",S_OK},
5326 {"google.com",S_OK},
5327 {"",S_FALSE},
5328 {"",S_FALSE},
5329 {"google.com",S_OK},
5330 {"",S_FALSE},
5331 {"/",S_OK},
5332 {"/",S_OK},
5333 {"",S_FALSE},
5334 {"zip://google.com/",S_OK},
5335 {"zip",S_OK},
5336 {"",S_FALSE},
5337 {"",S_FALSE}
5340 {Uri_HOST_DNS,S_OK},
5341 {0,S_FALSE},
5342 {URL_SCHEME_UNKNOWN,S_OK},
5343 {URLZONE_INVALID,E_NOTIMPL}
5346 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5347 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5349 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5350 {{FALSE}},
5351 {FALSE},
5352 -1,S_OK,FALSE,
5353 0,S_OK,FALSE,
5354 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5356 {"http://google.com/../../",S_OK},
5357 {"google.com",S_OK},
5358 {"http://google.com/../../",S_OK},
5359 {"google.com",S_OK},
5360 {"",S_FALSE},
5361 {"",S_FALSE},
5362 {"google.com",S_OK},
5363 {"",S_FALSE},
5364 {"/../../",S_OK},
5365 {"/../../",S_OK},
5366 {"",S_FALSE},
5367 {"http://google.com/../../",S_OK},
5368 {"http",S_OK},
5369 {"",S_FALSE},
5370 {"",S_FALSE}
5373 {Uri_HOST_DNS,S_OK},
5374 {80,S_OK},
5375 {URL_SCHEME_HTTP,S_OK},
5376 {URLZONE_INVALID,E_NOTIMPL}
5379 { "http://google.com/",0,S_OK,FALSE,
5381 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5383 {FALSE},
5384 -1,S_OK,FALSE,
5385 0,S_OK,FALSE,
5386 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5388 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5389 {"google.com",S_OK},
5390 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5391 {"google.com",S_OK},
5392 {"",S_FALSE},
5393 {"#Fr%3C%7C%3Eg",S_OK},
5394 {"google.com",S_OK},
5395 {"",S_FALSE},
5396 {"/",S_OK},
5397 {"/",S_OK},
5398 {"",S_FALSE},
5399 {"http://google.com/#Fr<|>g",S_OK},
5400 {"http",S_OK},
5401 {"",S_FALSE},
5402 {"",S_FALSE}
5405 {Uri_HOST_DNS,S_OK},
5406 {80,S_OK},
5407 {URL_SCHEME_HTTP,S_OK},
5408 {URLZONE_INVALID,E_NOTIMPL}
5411 { "http://google.com/",0,S_OK,FALSE,
5413 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5415 {FALSE},
5416 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5417 0,S_OK,FALSE,
5418 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5420 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5421 {"google.com",S_OK},
5422 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5423 {"google.com",S_OK},
5424 {"",S_FALSE},
5425 {"#Fr%3C%7C%3Eg",S_OK},
5426 {"google.com",S_OK},
5427 {"",S_FALSE},
5428 {"/",S_OK},
5429 {"/",S_OK},
5430 {"",S_FALSE},
5431 {"http://google.com/#Fr<|>g",S_OK},
5432 {"http",S_OK},
5433 {"",S_FALSE},
5434 {"",S_FALSE}
5437 {Uri_HOST_DNS,S_OK},
5438 {80,S_OK},
5439 {URL_SCHEME_HTTP,S_OK},
5440 {URLZONE_INVALID,E_NOTIMPL}
5443 { NULL,0,S_OK,FALSE,
5445 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5446 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5448 {FALSE},
5449 0,INET_E_INVALID_URL,FALSE,
5450 0,INET_E_INVALID_URL,FALSE,
5451 0,0,0,INET_E_INVALID_URL,FALSE
5453 { "http://google.com/",0,S_OK,FALSE,
5455 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5457 {FALSE},
5458 0,INET_E_INVALID_URL,FALSE,
5459 0,INET_E_INVALID_URL,FALSE,
5460 0,0,0,INET_E_INVALID_URL,FALSE
5462 /* File scheme's can't have a username set. */
5463 { "file://google.com/",0,S_OK,FALSE,
5465 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5467 {FALSE},
5468 0,INET_E_INVALID_URL,FALSE,
5469 0,INET_E_INVALID_URL,FALSE,
5470 0,0,0,INET_E_INVALID_URL,FALSE
5472 /* File schemes can't have a password set. */
5473 { "file://google.com/",0,S_OK,FALSE,
5475 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5477 {FALSE},
5478 0,INET_E_INVALID_URL,FALSE,
5479 0,INET_E_INVALID_URL,FALSE,
5480 0,0,0,INET_E_INVALID_URL,FALSE
5482 /* UserName can't contain any character that is a delimeter for another
5483 * component that appears after it in a normal URI.
5485 { "http://google.com/",0,S_OK,FALSE,
5487 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5489 {FALSE},
5490 0,INET_E_INVALID_URL,FALSE,
5491 0,INET_E_INVALID_URL,FALSE,
5492 0,0,0,INET_E_INVALID_URL,FALSE
5494 { "http://google.com/",0,S_OK,FALSE,
5496 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5498 {FALSE},
5499 0,INET_E_INVALID_URL,FALSE,
5500 0,INET_E_INVALID_URL,FALSE,
5501 0,0,0,INET_E_INVALID_URL,FALSE
5503 { "http://google.com/",0,S_OK,FALSE,
5505 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5507 {FALSE},
5508 0,INET_E_INVALID_URL,FALSE,
5509 0,INET_E_INVALID_URL,FALSE,
5510 0,0,0,INET_E_INVALID_URL,FALSE
5512 { "http://google.com/",0,S_OK,FALSE,
5514 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5516 {FALSE},
5517 0,INET_E_INVALID_URL,FALSE,
5518 0,INET_E_INVALID_URL,FALSE,
5519 0,0,0,INET_E_INVALID_URL,FALSE
5521 { "http://google.com/",0,S_OK,FALSE,
5523 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5525 {FALSE},
5526 0,INET_E_INVALID_URL,FALSE,
5527 0,INET_E_INVALID_URL,FALSE,
5528 0,0,0,INET_E_INVALID_URL,FALSE
5530 { "http://google.com/",0,S_OK,FALSE,
5532 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5534 {FALSE},
5535 0,INET_E_INVALID_URL,FALSE,
5536 0,INET_E_INVALID_URL,FALSE,
5537 0,0,0,INET_E_INVALID_URL,FALSE
5539 { "http://google.com/",0,S_OK,FALSE,
5541 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5543 {FALSE},
5544 0,INET_E_INVALID_URL,FALSE,
5545 0,INET_E_INVALID_URL,FALSE,
5546 0,0,0,INET_E_INVALID_URL,FALSE
5548 { "http://google.com/",0,S_OK,FALSE,
5550 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5552 {FALSE},
5553 0,INET_E_INVALID_URL,FALSE,
5554 0,INET_E_INVALID_URL,FALSE,
5555 0,0,0,INET_E_INVALID_URL,FALSE
5557 { "http://google.com/",0,S_OK,FALSE,
5559 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5561 {FALSE},
5562 0,INET_E_INVALID_URL,FALSE,
5563 0,INET_E_INVALID_URL,FALSE,
5564 0,0,0,INET_E_INVALID_URL,FALSE
5566 { "http://google.com/",0,S_OK,FALSE,
5568 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5570 {FALSE},
5571 0,INET_E_INVALID_URL,FALSE,
5572 0,INET_E_INVALID_URL,FALSE,
5573 0,0,0,INET_E_INVALID_URL,FALSE
5575 { "http://google.com/",0,S_OK,FALSE,
5577 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5579 {FALSE},
5580 0,INET_E_INVALID_URL,FALSE,
5581 0,INET_E_INVALID_URL,FALSE,
5582 0,0,0,INET_E_INVALID_URL,FALSE
5584 { "http://google.com/",0,S_OK,FALSE,
5586 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5588 {FALSE},
5589 0,INET_E_INVALID_URL,FALSE,
5590 0,INET_E_INVALID_URL,FALSE,
5591 0,0,0,INET_E_INVALID_URL,FALSE
5593 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5594 { "http://google.com/",0,S_OK,FALSE,
5596 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5598 {FALSE},
5599 0,S_OK,FALSE,
5600 0,S_OK,FALSE,
5601 0,0,0,S_OK,FALSE,
5603 {"http://winehq.org:test/",S_OK},
5604 {"winehq.org:test",S_OK},
5605 {"http://winehq.org:test/",S_OK},
5606 {"winehq.org:test",S_OK},
5607 {"",S_FALSE},
5608 {"",S_FALSE},
5609 {"winehq.org:test",S_OK},
5610 {"",S_FALSE},
5611 {"/",S_OK},
5612 {"/",S_OK},
5613 {"",S_FALSE},
5614 {"http://winehq.org:test/",S_OK},
5615 {"http",S_OK},
5616 {"",S_FALSE},
5617 {"",S_FALSE}
5620 {Uri_HOST_DNS,S_OK},
5621 {80,S_OK},
5622 {URL_SCHEME_HTTP,S_OK},
5623 {URLZONE_INVALID,E_NOTIMPL}
5626 /* Can't set the host name to NULL. */
5627 { "http://google.com/",0,S_OK,FALSE,
5629 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5631 {FALSE},
5632 0,S_OK,FALSE,
5633 0,S_OK,FALSE,
5634 0,0,0,S_OK,FALSE,
5636 {"http://google.com/",S_OK},
5637 {"google.com",S_OK},
5638 {"http://google.com/",S_OK},
5639 {"google.com",S_OK},
5640 {"",S_FALSE},
5641 {"",S_FALSE},
5642 {"google.com",S_OK},
5643 {"",S_FALSE},
5644 {"/",S_OK},
5645 {"/",S_OK},
5646 {"",S_FALSE},
5647 {"http://google.com/",S_OK},
5648 {"http",S_OK},
5649 {"",S_FALSE},
5650 {"",S_FALSE}
5653 {Uri_HOST_DNS,S_OK},
5654 {80,S_OK},
5655 {URL_SCHEME_HTTP,S_OK},
5656 {URLZONE_INVALID,E_NOTIMPL}
5659 /* Can set the host name to an empty string. */
5660 { "http://google.com/",0,S_OK,FALSE,
5662 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5664 {FALSE},
5665 0,S_OK,FALSE,
5666 0,S_OK,FALSE,
5667 0,0,0,S_OK,FALSE,
5669 {"http:///",S_OK},
5670 {"",S_OK},
5671 {"http:///",S_OK},
5672 {"",S_FALSE},
5673 {"",S_FALSE},
5674 {"",S_FALSE},
5675 {"",S_OK},
5676 {"",S_FALSE},
5677 {"/",S_OK},
5678 {"/",S_OK},
5679 {"",S_FALSE},
5680 {"http:///",S_OK},
5681 {"http",S_OK},
5682 {"",S_FALSE},
5683 {"",S_FALSE}
5686 {Uri_HOST_UNKNOWN,S_OK},
5687 {80,S_OK},
5688 {URL_SCHEME_HTTP,S_OK},
5689 {URLZONE_INVALID,E_NOTIMPL}
5692 { "http://google.com/",0,S_OK,FALSE,
5694 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,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,"/path#test",NULL,Uri_PROPERTY_PATH,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,"?path#test",NULL,Uri_PROPERTY_QUERY,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 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5721 {TRUE,NULL,NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5723 {FALSE},
5724 0,S_OK,FALSE,
5725 0,S_OK,FALSE,
5726 0,0,0,S_OK,FALSE,
5728 {"file:///c:/dir/file.html",S_OK},
5729 {"",S_FALSE},
5730 {"file:///c:/dir/file.html",S_OK},
5731 {"",S_FALSE},
5732 {".html",S_OK},
5733 {"",S_FALSE},
5734 {"",S_FALSE},
5735 {"",S_FALSE},
5736 {"/c:/dir/file.html",S_OK},
5737 {"/c:/dir/file.html",S_OK},
5738 {"",S_FALSE},
5739 {"file:///c:/dir/file.html",S_OK},
5740 {"file",S_OK},
5741 {"",S_FALSE},
5742 {"",S_FALSE}
5745 {Uri_HOST_UNKNOWN,S_OK},
5746 {0,S_FALSE},
5747 {URL_SCHEME_FILE,S_OK},
5748 {URLZONE_INVALID,E_NOTIMPL}
5751 { "file:///c:/dir/file.html",0,S_OK,FALSE,
5753 {TRUE,"#",NULL,Uri_PROPERTY_FRAGMENT,S_OK},
5755 {FALSE},
5756 0,S_OK,FALSE,
5757 0,S_OK,FALSE,
5758 0,0,0,S_OK,FALSE,
5760 {"file:///c:/dir/file.html#",S_OK},
5761 {"",S_FALSE},
5762 {"file:///c:/dir/file.html#",S_OK},
5763 {"",S_FALSE},
5764 {".html",S_OK},
5765 {"#",S_OK},
5766 {"",S_FALSE},
5767 {"",S_FALSE},
5768 {"/c:/dir/file.html",S_OK},
5769 {"/c:/dir/file.html",S_OK},
5770 {"",S_FALSE},
5771 {"file:///c:/dir/file.html#",S_OK},
5772 {"file",S_OK},
5773 {"",S_FALSE},
5774 {"",S_FALSE}
5777 {Uri_HOST_UNKNOWN,S_OK},
5778 {0,S_FALSE},
5779 {URL_SCHEME_FILE,S_OK},
5780 {URLZONE_INVALID,E_NOTIMPL}
5785 typedef struct _uri_builder_remove_test {
5786 const char *uri;
5787 DWORD create_flags;
5788 HRESULT create_builder_expected;
5789 BOOL create_builder_todo;
5791 DWORD remove_properties;
5792 HRESULT remove_expected;
5793 BOOL remove_todo;
5795 const char *expected_uri;
5796 DWORD expected_flags;
5797 HRESULT expected_hres;
5798 BOOL expected_todo;
5799 } uri_builder_remove_test;
5801 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5802 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5803 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5804 "http://google.com/",0,S_OK,FALSE
5806 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5807 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5808 "http://winehq.org/",0,S_OK,FALSE
5810 { "zip://google.com?Test=x",0,S_OK,FALSE,
5811 Uri_HAS_HOST,S_OK,FALSE,
5812 "zip:/?Test=x",0,S_OK,FALSE
5814 /* Doesn't remove the whole userinfo component. */
5815 { "http://username:pass@google.com/",0,S_OK,FALSE,
5816 Uri_HAS_USER_INFO,S_OK,FALSE,
5817 "http://username:pass@google.com/",0,S_OK,FALSE
5819 /* Doesn't remove the domain. */
5820 { "http://google.com/",0,S_OK,FALSE,
5821 Uri_HAS_DOMAIN,S_OK,FALSE,
5822 "http://google.com/",0,S_OK,FALSE
5824 { "http://google.com:120/",0,S_OK,FALSE,
5825 Uri_HAS_AUTHORITY,S_OK,FALSE,
5826 "http://google.com:120/",0,S_OK,FALSE
5828 { "http://google.com/test.com/",0,S_OK,FALSE,
5829 Uri_HAS_EXTENSION,S_OK,FALSE,
5830 "http://google.com/test.com/",0,S_OK,FALSE
5832 { "http://google.com/?test=x",0,S_OK,FALSE,
5833 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5834 "http://google.com/?test=x",0,S_OK,FALSE
5836 /* Can't remove the scheme name. */
5837 { "http://google.com/?test=x",0,S_OK,FALSE,
5838 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5839 "http://google.com/?test=x",0,S_OK,FALSE
5843 typedef struct _uri_combine_str_property {
5844 const char *value;
5845 HRESULT expected;
5846 BOOL todo;
5847 const char *broken_value;
5848 const char *value_ex;
5849 } uri_combine_str_property;
5851 typedef struct _uri_combine_test {
5852 const char *base_uri;
5853 DWORD base_create_flags;
5854 const char *relative_uri;
5855 DWORD relative_create_flags;
5856 DWORD combine_flags;
5857 HRESULT expected;
5858 BOOL todo;
5860 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5861 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5862 } uri_combine_test;
5864 static const uri_combine_test uri_combine_tests[] = {
5865 { "http://google.com/fun/stuff",0,
5866 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5867 0,S_OK,FALSE,
5869 {"http://google.com/not/fun/stuff",S_OK},
5870 {"google.com",S_OK},
5871 {"http://google.com/not/fun/stuff",S_OK},
5872 {"google.com",S_OK},
5873 {"",S_FALSE},
5874 {"",S_FALSE},
5875 {"google.com",S_OK},
5876 {"",S_FALSE},
5877 {"/not/fun/stuff",S_OK},
5878 {"/not/fun/stuff",S_OK},
5879 {"",S_FALSE},
5880 {"http://google.com/not/fun/stuff",S_OK},
5881 {"http",S_OK},
5882 {"",S_FALSE},
5883 {"",S_FALSE}
5886 {Uri_HOST_DNS,S_OK},
5887 {80,S_OK},
5888 {URL_SCHEME_HTTP,S_OK},
5889 {URLZONE_INVALID,E_NOTIMPL}
5892 { "http://google.com/test",0,
5893 "zip://test.com/cool",0,
5894 0,S_OK,FALSE,
5896 {"zip://test.com/cool",S_OK},
5897 {"test.com",S_OK},
5898 {"zip://test.com/cool",S_OK},
5899 {"test.com",S_OK},
5900 {"",S_FALSE},
5901 {"",S_FALSE},
5902 {"test.com",S_OK},
5903 {"",S_FALSE},
5904 {"/cool",S_OK},
5905 {"/cool",S_OK},
5906 {"",S_FALSE},
5907 {"zip://test.com/cool",S_OK},
5908 {"zip",S_OK},
5909 {"",S_FALSE},
5910 {"",S_FALSE}
5913 {Uri_HOST_DNS,S_OK},
5914 {0,S_FALSE},
5915 {URL_SCHEME_UNKNOWN,S_OK},
5916 {URLZONE_INVALID,E_NOTIMPL}
5919 { "http://google.com/use/base/path",0,
5920 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5921 0,S_OK,FALSE,
5923 {"http://google.com/use/base/path?relative",S_OK},
5924 {"google.com",S_OK},
5925 {"http://google.com/use/base/path?relative",S_OK},
5926 {"google.com",S_OK},
5927 {"",S_FALSE},
5928 {"",S_FALSE},
5929 {"google.com",S_OK},
5930 {"",S_FALSE},
5931 {"/use/base/path",S_OK},
5932 {"/use/base/path?relative",S_OK},
5933 {"?relative",S_OK},
5934 {"http://google.com/use/base/path?relative",S_OK},
5935 {"http",S_OK},
5936 {"",S_FALSE},
5937 {"",S_FALSE}
5940 {Uri_HOST_DNS,S_OK},
5941 {80,S_OK},
5942 {URL_SCHEME_HTTP,S_OK},
5943 {URLZONE_INVALID,E_NOTIMPL}
5946 { "http://google.com/path",0,
5947 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5948 0,S_OK,FALSE,
5950 {"http://google.com/testing",S_OK},
5951 {"google.com",S_OK},
5952 {"http://google.com/testing",S_OK},
5953 {"google.com",S_OK},
5954 {"",S_FALSE},
5955 {"",S_FALSE},
5956 {"google.com",S_OK},
5957 {"",S_FALSE},
5958 {"/testing",S_OK},
5959 {"/testing",S_OK},
5960 {"",S_FALSE},
5961 {"http://google.com/testing",S_OK},
5962 {"http",S_OK},
5963 {"",S_FALSE},
5964 {"",S_FALSE}
5967 {Uri_HOST_DNS,S_OK},
5968 {80,S_OK},
5969 {URL_SCHEME_HTTP,S_OK},
5970 {URLZONE_INVALID,E_NOTIMPL}
5973 { "http://google.com/path",0,
5974 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5975 URL_DONT_SIMPLIFY,S_OK,FALSE,
5977 {"http://google.com:80/test/../test/.././testing",S_OK},
5978 {"google.com",S_OK},
5979 {"http://google.com:80/test/../test/.././testing",S_OK},
5980 {"google.com",S_OK},
5981 {"",S_FALSE},
5982 {"",S_FALSE},
5983 {"google.com",S_OK},
5984 {"",S_FALSE},
5985 {"/test/../test/.././testing",S_OK},
5986 {"/test/../test/.././testing",S_OK},
5987 {"",S_FALSE},
5988 {"http://google.com:80/test/../test/.././testing",S_OK},
5989 {"http",S_OK},
5990 {"",S_FALSE},
5991 {"",S_FALSE}
5994 {Uri_HOST_DNS,S_OK},
5995 {80,S_OK},
5996 {URL_SCHEME_HTTP,S_OK},
5997 {URLZONE_INVALID,E_NOTIMPL}
6000 { "http://winehq.org/test/abc",0,
6001 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6002 0,S_OK,FALSE,
6004 {"http://winehq.org/test/testing/test",S_OK},
6005 {"winehq.org",S_OK},
6006 {"http://winehq.org/test/testing/test",S_OK},
6007 {"winehq.org",S_OK},
6008 {"",S_FALSE},
6009 {"",S_FALSE},
6010 {"winehq.org",S_OK},
6011 {"",S_FALSE},
6012 {"/test/testing/test",S_OK},
6013 {"/test/testing/test",S_OK},
6014 {"",S_FALSE},
6015 {"http://winehq.org/test/testing/test",S_OK},
6016 {"http",S_OK},
6017 {"",S_FALSE},
6018 {"",S_FALSE}
6021 {Uri_HOST_DNS,S_OK},
6022 {80,S_OK},
6023 {URL_SCHEME_HTTP,S_OK},
6024 {URLZONE_INVALID,E_NOTIMPL}
6027 { "http://winehq.org/test/abc",0,
6028 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
6029 URL_DONT_SIMPLIFY,S_OK,FALSE,
6031 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6032 /* Default port is hidden in the authority. */
6033 {"winehq.org",S_OK},
6034 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6035 {"winehq.org",S_OK},
6036 {"",S_FALSE},
6037 {"",S_FALSE},
6038 {"winehq.org",S_OK},
6039 {"",S_FALSE},
6040 {"/test/testing/abc/../test",S_OK},
6041 {"/test/testing/abc/../test",S_OK},
6042 {"",S_FALSE},
6043 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
6044 {"http",S_OK},
6045 {"",S_FALSE},
6046 {"",S_FALSE}
6049 {Uri_HOST_DNS,S_OK},
6050 {80,S_OK},
6051 {URL_SCHEME_HTTP,S_OK},
6052 {URLZONE_INVALID,E_NOTIMPL}
6055 { "http://winehq.org/test?query",0,
6056 "testing",Uri_CREATE_ALLOW_RELATIVE,
6057 0,S_OK,FALSE,
6059 {"http://winehq.org/testing",S_OK},
6060 {"winehq.org",S_OK},
6061 {"http://winehq.org/testing",S_OK},
6062 {"winehq.org",S_OK},
6063 {"",S_FALSE},
6064 {"",S_FALSE},
6065 {"winehq.org",S_OK},
6066 {"",S_FALSE},
6067 {"/testing",S_OK},
6068 {"/testing",S_OK},
6069 {"",S_FALSE},
6070 {"http://winehq.org/testing",S_OK},
6071 {"http",S_OK},
6072 {"",S_FALSE},
6073 {"",S_FALSE}
6076 {Uri_HOST_DNS,S_OK},
6077 {80,S_OK},
6078 {URL_SCHEME_HTTP,S_OK},
6079 {URLZONE_INVALID,E_NOTIMPL}
6082 { "http://winehq.org/test#frag",0,
6083 "testing",Uri_CREATE_ALLOW_RELATIVE,
6084 0,S_OK,FALSE,
6086 {"http://winehq.org/testing",S_OK},
6087 {"winehq.org",S_OK},
6088 {"http://winehq.org/testing",S_OK},
6089 {"winehq.org",S_OK},
6090 {"",S_FALSE},
6091 {"",S_FALSE},
6092 {"winehq.org",S_OK},
6093 {"",S_FALSE},
6094 {"/testing",S_OK},
6095 {"/testing",S_OK},
6096 {"",S_FALSE},
6097 {"http://winehq.org/testing",S_OK},
6098 {"http",S_OK},
6099 {"",S_FALSE},
6100 {"",S_FALSE}
6103 {Uri_HOST_DNS,S_OK},
6104 {80,S_OK},
6105 {URL_SCHEME_HTTP,S_OK},
6106 {URLZONE_INVALID,E_NOTIMPL}
6109 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
6110 "test",Uri_CREATE_ALLOW_RELATIVE,
6111 0,S_OK,FALSE,
6113 {"test",S_OK},
6114 {"",S_FALSE},
6115 {"test",S_OK},
6116 {"",S_FALSE},
6117 {"",S_FALSE},
6118 {"",S_FALSE},
6119 {"",S_FALSE},
6120 {"",S_FALSE},
6121 {"test",S_OK},
6122 {"test",S_OK},
6123 {"",S_FALSE},
6124 {"test",S_OK},
6125 {"",S_FALSE},
6126 {"",S_FALSE},
6127 {"",S_FALSE}
6130 {Uri_HOST_UNKNOWN,S_OK},
6131 {0,S_FALSE},
6132 {URL_SCHEME_UNKNOWN,S_OK},
6133 {URLZONE_INVALID,E_NOTIMPL}
6136 { "file:///c:/test/test",0,
6137 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6138 URL_FILE_USE_PATHURL,S_OK,FALSE,
6140 {"file://c:\\testing.mp3",S_OK},
6141 {"",S_FALSE},
6142 {"file://c:\\testing.mp3",S_OK},
6143 {"",S_FALSE},
6144 {".mp3",S_OK},
6145 {"",S_FALSE},
6146 {"",S_FALSE},
6147 {"",S_FALSE},
6148 {"c:\\testing.mp3",S_OK},
6149 {"c:\\testing.mp3",S_OK},
6150 {"",S_FALSE},
6151 {"file://c:\\testing.mp3",S_OK},
6152 {"file",S_OK},
6153 {"",S_FALSE},
6154 {"",S_FALSE}
6157 {Uri_HOST_UNKNOWN,S_OK},
6158 {0,S_FALSE},
6159 {URL_SCHEME_FILE,S_OK},
6160 {URLZONE_INVALID,E_NOTIMPL}
6163 { "file:///c:/test/test",0,
6164 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6165 0,S_OK,FALSE,
6167 {"file:///c:/testing.mp3",S_OK},
6168 {"",S_FALSE},
6169 {"file:///c:/testing.mp3",S_OK},
6170 {"",S_FALSE},
6171 {".mp3",S_OK},
6172 {"",S_FALSE},
6173 {"",S_FALSE},
6174 {"",S_FALSE},
6175 {"/c:/testing.mp3",S_OK},
6176 {"/c:/testing.mp3",S_OK},
6177 {"",S_FALSE},
6178 {"file:///c:/testing.mp3",S_OK},
6179 {"file",S_OK},
6180 {"",S_FALSE},
6181 {"",S_FALSE}
6184 {Uri_HOST_UNKNOWN,S_OK},
6185 {0,S_FALSE},
6186 {URL_SCHEME_FILE,S_OK},
6187 {URLZONE_INVALID,E_NOTIMPL}
6190 { "file://test.com/test/test",0,
6191 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
6192 URL_FILE_USE_PATHURL,S_OK,FALSE,
6194 {"file://\\\\test.com\\testing.mp3",S_OK},
6195 {"test.com",S_OK},
6196 {"file://\\\\test.com\\testing.mp3",S_OK},
6197 {"test.com",S_OK},
6198 {".mp3",S_OK},
6199 {"",S_FALSE},
6200 {"test.com",S_OK},
6201 {"",S_FALSE},
6202 {"\\testing.mp3",S_OK},
6203 {"\\testing.mp3",S_OK},
6204 {"",S_FALSE},
6205 {"file://\\\\test.com\\testing.mp3",S_OK},
6206 {"file",S_OK},
6207 {"",S_FALSE},
6208 {"",S_FALSE}
6211 {Uri_HOST_DNS,S_OK},
6212 {0,S_FALSE},
6213 {URL_SCHEME_FILE,S_OK},
6214 {URLZONE_INVALID,E_NOTIMPL}
6217 /* URL_DONT_SIMPLIFY has no effect. */
6218 { "http://google.com/test",0,
6219 "zip://test.com/cool/../cool/test",0,
6220 URL_DONT_SIMPLIFY,S_OK,FALSE,
6222 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6223 {"test.com",S_OK},
6224 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
6225 {"test.com",S_OK},
6226 {"",S_FALSE},
6227 {"",S_FALSE},
6228 {"test.com",S_OK},
6229 {"",S_FALSE},
6230 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6231 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
6232 {"",S_FALSE},
6233 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6234 * On IE 7 it reduces the path in the Raw URI.
6236 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
6237 {"zip",S_OK},
6238 {"",S_FALSE},
6239 {"",S_FALSE}
6242 {Uri_HOST_DNS,S_OK},
6243 {0,S_FALSE},
6244 {URL_SCHEME_UNKNOWN,S_OK},
6245 {URLZONE_INVALID,E_NOTIMPL}
6248 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6249 * resulting URI is converted into a dos path.
6251 { "http://google.com/test",0,
6252 "file:///c:/test/",0,
6253 URL_FILE_USE_PATHURL,S_OK,FALSE,
6255 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6256 {"",S_FALSE},
6257 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6258 {"",S_FALSE},
6259 {"",S_FALSE},
6260 {"",S_FALSE},
6261 {"",S_FALSE},
6262 {"",S_FALSE},
6263 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6264 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
6265 {"",S_FALSE},
6266 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
6267 {"file",S_OK},
6268 {"",S_FALSE},
6269 {"",S_FALSE}
6272 {Uri_HOST_UNKNOWN,S_OK},
6273 {0,S_FALSE},
6274 {URL_SCHEME_FILE,S_OK},
6275 {URLZONE_INVALID,E_NOTIMPL}
6278 { "http://google.com/test",0,
6279 "http://test.com/test#%30test",0,
6280 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
6282 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6283 {"test.com",S_OK},
6284 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
6285 {"test.com",S_OK},
6286 {"",S_FALSE},
6287 {"#0test",S_OK,FALSE,NULL,"#%30test"},
6288 {"test.com",S_OK},
6289 {"",S_FALSE},
6290 {"/test",S_OK},
6291 {"/test",S_OK},
6292 {"",S_FALSE},
6293 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6294 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
6295 {"http",S_OK},
6296 {"",S_FALSE},
6297 {"",S_FALSE}
6300 {Uri_HOST_DNS,S_OK},
6301 {80,S_OK},
6302 {URL_SCHEME_HTTP,S_OK},
6303 {URLZONE_INVALID,E_NOTIMPL}
6306 /* Windows validates the path component from the relative Uri. */
6307 { "http://google.com/test",0,
6308 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6309 0,E_INVALIDARG,FALSE
6311 /* Windows doesn't validate the query from the relative Uri. */
6312 { "http://google.com/test",0,
6313 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6314 0,S_OK,FALSE,
6316 {"http://google.com/test?Tes%XXt",S_OK},
6317 {"google.com",S_OK},
6318 {"http://google.com/test?Tes%XXt",S_OK},
6319 {"google.com",S_OK},
6320 {"",S_FALSE},
6321 {"",S_FALSE},
6322 {"google.com",S_OK},
6323 {"",S_FALSE},
6324 {"/test",S_OK},
6325 {"/test?Tes%XXt",S_OK},
6326 {"?Tes%XXt",S_OK},
6327 {"http://google.com/test?Tes%XXt",S_OK},
6328 {"http",S_OK},
6329 {"",S_FALSE},
6330 {"",S_FALSE}
6333 {Uri_HOST_DNS,S_OK},
6334 {80,S_OK},
6335 {URL_SCHEME_HTTP,S_OK},
6336 {URLZONE_INVALID,E_NOTIMPL}
6339 /* Windows doesn't validate the fragment from the relative Uri. */
6340 { "http://google.com/test",0,
6341 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6342 0,S_OK,FALSE,
6344 {"http://google.com/test#Tes%XXt",S_OK},
6345 {"google.com",S_OK},
6346 {"http://google.com/test#Tes%XXt",S_OK},
6347 {"google.com",S_OK},
6348 {"",S_FALSE},
6349 {"#Tes%XXt",S_OK},
6350 {"google.com",S_OK},
6351 {"",S_FALSE},
6352 {"/test",S_OK},
6353 {"/test",S_OK},
6354 {"",S_FALSE},
6355 {"http://google.com/test#Tes%XXt",S_OK},
6356 {"http",S_OK},
6357 {"",S_FALSE},
6358 {"",S_FALSE}
6361 {Uri_HOST_DNS,S_OK},
6362 {80,S_OK},
6363 {URL_SCHEME_HTTP,S_OK},
6364 {URLZONE_INVALID,E_NOTIMPL}
6367 /* Creates an IUri which contains an invalid dos path char. */
6368 { "file:///c:/test",0,
6369 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6370 URL_FILE_USE_PATHURL,S_OK,FALSE,
6372 {"file://c:\\test<ing",S_OK},
6373 {"",S_FALSE},
6374 {"file://c:\\test<ing",S_OK},
6375 {"",S_FALSE},
6376 {"",S_FALSE},
6377 {"",S_FALSE},
6378 {"",S_FALSE},
6379 {"",S_FALSE},
6380 {"c:\\test<ing",S_OK},
6381 {"c:\\test<ing",S_OK},
6382 {"",S_FALSE},
6383 {"file://c:\\test<ing",S_OK},
6384 {"file",S_OK},
6385 {"",S_FALSE},
6386 {"",S_FALSE}
6389 {Uri_HOST_UNKNOWN,S_OK},
6390 {0,S_FALSE},
6391 {URL_SCHEME_FILE,S_OK},
6392 {URLZONE_INVALID,E_NOTIMPL}
6395 /* Appends the path after the drive letter (if any). */
6396 { "file:///c:/test",0,
6397 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6398 0,S_OK,FALSE,
6400 {"file:///c:/c:/testing",S_OK},
6401 {"",S_FALSE},
6402 {"file:///c:/c:/testing",S_OK},
6403 {"",S_FALSE},
6404 {"",S_FALSE},
6405 {"",S_FALSE},
6406 {"",S_FALSE},
6407 {"",S_FALSE},
6408 {"/c:/c:/testing",S_OK},
6409 {"/c:/c:/testing",S_OK},
6410 {"",S_FALSE},
6411 {"file:///c:/c:/testing",S_OK},
6412 {"file",S_OK},
6413 {"",S_FALSE},
6414 {"",S_FALSE}
6417 {Uri_HOST_UNKNOWN,S_OK},
6418 {0,S_FALSE},
6419 {URL_SCHEME_FILE,S_OK},
6420 {URLZONE_INVALID,E_NOTIMPL}
6423 /* A '/' is added if the base URI doesn't have a path and the
6424 * relative URI doesn't contain a path (since the base URI is
6425 * hierarchical.
6427 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6428 "?test",Uri_CREATE_ALLOW_RELATIVE,
6429 0,S_OK,FALSE,
6431 {"http://google.com/?test",S_OK},
6432 {"google.com",S_OK},
6433 {"http://google.com/?test",S_OK},
6434 {"google.com",S_OK},
6435 {"",S_FALSE},
6436 {"",S_FALSE},
6437 {"google.com",S_OK},
6438 {"",S_FALSE},
6439 {"/",S_OK},
6440 {"/?test",S_OK},
6441 {"?test",S_OK},
6442 {"http://google.com/?test",S_OK},
6443 {"http",S_OK},
6444 {"",S_FALSE},
6445 {"",S_FALSE}
6448 {Uri_HOST_DNS,S_OK},
6449 {80,S_OK},
6450 {URL_SCHEME_HTTP,S_OK},
6451 {URLZONE_INVALID,E_NOTIMPL}
6454 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6455 "?test",Uri_CREATE_ALLOW_RELATIVE,
6456 0,S_OK,FALSE,
6458 {"zip://google.com/?test",S_OK},
6459 {"google.com",S_OK},
6460 {"zip://google.com/?test",S_OK},
6461 {"google.com",S_OK},
6462 {"",S_FALSE},
6463 {"",S_FALSE},
6464 {"google.com",S_OK},
6465 {"",S_FALSE},
6466 {"/",S_OK},
6467 {"/?test",S_OK},
6468 {"?test",S_OK},
6469 {"zip://google.com/?test",S_OK},
6470 {"zip",S_OK},
6471 {"",S_FALSE},
6472 {"",S_FALSE}
6475 {Uri_HOST_DNS,S_OK},
6476 {0,S_FALSE},
6477 {URL_SCHEME_UNKNOWN,S_OK},
6478 {URLZONE_INVALID,E_NOTIMPL}
6481 /* No path is appended since the base URI is opaque. */
6482 { "zip:?testing",0,
6483 "?test",Uri_CREATE_ALLOW_RELATIVE,
6484 0,S_OK,FALSE,
6486 {"zip:?test",S_OK},
6487 {"",S_FALSE},
6488 {"zip:?test",S_OK},
6489 {"",S_FALSE},
6490 {"",S_FALSE},
6491 {"",S_FALSE},
6492 {"",S_FALSE},
6493 {"",S_FALSE},
6494 {"",S_OK},
6495 {"?test",S_OK},
6496 {"?test",S_OK},
6497 {"zip:?test",S_OK},
6498 {"zip",S_OK},
6499 {"",S_FALSE},
6500 {"",S_FALSE}
6503 {Uri_HOST_UNKNOWN,S_OK},
6504 {0,S_FALSE},
6505 {URL_SCHEME_UNKNOWN,S_OK},
6506 {URLZONE_INVALID,E_NOTIMPL}
6509 { "file:///c:/",0,
6510 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6511 0,S_OK,FALSE,
6513 {"file:///c:/testing/test",S_OK},
6514 {"",S_FALSE},
6515 {"file:///c:/testing/test",S_OK},
6516 {"",S_FALSE},
6517 {"",S_FALSE},
6518 {"",S_FALSE},
6519 {"",S_FALSE},
6520 {"",S_FALSE},
6521 {"/c:/testing/test",S_OK},
6522 {"/c:/testing/test",S_OK},
6523 {"",S_FALSE},
6524 {"file:///c:/testing/test",S_OK},
6525 {"file",S_OK},
6526 {"",S_FALSE},
6527 {"",S_FALSE}
6530 {Uri_HOST_UNKNOWN,S_OK},
6531 {0,S_FALSE},
6532 {URL_SCHEME_FILE,S_OK},
6533 {URLZONE_INVALID,E_NOTIMPL}
6536 { "http://winehq.org/dir/testfile",0,
6537 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6538 0,S_OK,FALSE,
6540 {"http://winehq.org/dir/test?querystring",S_OK},
6541 {"winehq.org",S_OK},
6542 {"http://winehq.org/dir/test?querystring",S_OK},
6543 {"winehq.org",S_OK},
6544 {"",S_FALSE},
6545 {"",S_FALSE},
6546 {"winehq.org",S_OK},
6547 {"",S_FALSE},
6548 {"/dir/test",S_OK},
6549 {"/dir/test?querystring",S_OK},
6550 {"?querystring",S_OK},
6551 {"http://winehq.org/dir/test?querystring",S_OK},
6552 {"http",S_OK},
6553 {"",S_FALSE},
6554 {"",S_FALSE}
6557 {Uri_HOST_DNS,S_OK},
6558 {80,S_OK},
6559 {URL_SCHEME_HTTP,S_OK},
6560 {URLZONE_INVALID,E_NOTIMPL}
6563 { "http://winehq.org/dir/test",0,
6564 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6565 0,S_OK,FALSE,
6567 {"http://winehq.org/dir/test?querystring",S_OK},
6568 {"winehq.org",S_OK},
6569 {"http://winehq.org/dir/test?querystring",S_OK},
6570 {"winehq.org",S_OK},
6571 {"",S_FALSE},
6572 {"",S_FALSE},
6573 {"winehq.org",S_OK},
6574 {"",S_FALSE},
6575 {"/dir/test",S_OK},
6576 {"/dir/test?querystring",S_OK},
6577 {"?querystring",S_OK},
6578 {"http://winehq.org/dir/test?querystring",S_OK},
6579 {"http",S_OK},
6580 {"",S_FALSE},
6581 {"",S_FALSE}
6584 {Uri_HOST_DNS,S_OK},
6585 {80,S_OK},
6586 {URL_SCHEME_HTTP,S_OK},
6587 {URLZONE_INVALID,E_NOTIMPL}
6590 { "http://winehq.org/dir/test?querystring",0,
6591 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6592 0,S_OK,FALSE,
6594 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6595 {"winehq.org",S_OK},
6596 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6597 {"winehq.org",S_OK},
6598 {"",S_FALSE},
6599 {"#hash",S_OK},
6600 {"winehq.org",S_OK},
6601 {"",S_FALSE},
6602 {"/dir/test",S_OK},
6603 {"/dir/test?querystring",S_OK},
6604 {"?querystring",S_OK},
6605 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6606 {"http",S_OK},
6607 {"",S_FALSE},
6608 {"",S_FALSE}
6611 {Uri_HOST_DNS,S_OK},
6612 {80,S_OK},
6613 {URL_SCHEME_HTTP,S_OK},
6614 {URLZONE_INVALID,E_NOTIMPL}
6617 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6618 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6619 0,S_OK,FALSE,
6621 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6622 {"",S_FALSE},
6623 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6624 {"",S_FALSE},
6625 {".txt",S_OK},
6626 {"",S_FALSE},
6627 {"",S_FALSE},
6628 {"",S_FALSE},
6629 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6630 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6631 {"",S_FALSE},
6632 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6633 {"mk",S_OK},
6634 {"",S_FALSE},
6635 {"",S_FALSE}
6638 {Uri_HOST_UNKNOWN,S_OK},
6639 {0,S_FALSE},
6640 {URL_SCHEME_MK,S_OK},
6641 {URLZONE_INVALID,E_NOTIMPL}
6644 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6645 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE,
6646 0,S_OK,FALSE,
6648 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6649 {"",S_FALSE},
6650 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6651 {"",S_FALSE},
6652 {".txt",S_OK},
6653 {"",S_FALSE},
6654 {"",S_FALSE},
6655 {"",S_FALSE},
6656 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6657 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6658 {"",S_FALSE},
6659 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK},
6660 {"mk",S_OK},
6661 {"",S_FALSE},
6662 {"",S_FALSE}
6665 {Uri_HOST_UNKNOWN,S_OK},
6666 {0,S_FALSE},
6667 {URL_SCHEME_MK,S_OK},
6668 {URLZONE_INVALID,E_NOTIMPL}
6671 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6672 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE,
6673 0,S_OK,FALSE,
6675 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6676 {"",S_FALSE},
6677 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6678 {"",S_FALSE},
6679 {".txt",S_OK},
6680 {"",S_FALSE},
6681 {"",S_FALSE},
6682 {"",S_FALSE},
6683 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6684 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6685 {"",S_FALSE},
6686 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK},
6687 {"mk",S_OK},
6688 {"",S_FALSE},
6689 {"",S_FALSE}
6692 {Uri_HOST_UNKNOWN,S_OK},
6693 {0,S_FALSE},
6694 {URL_SCHEME_MK,S_OK},
6695 {URLZONE_INVALID,E_NOTIMPL}
6698 { "http://winehq.org/dir/test?querystring",0,
6699 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE,
6700 0,S_OK,FALSE,
6702 {"http://winehq.com/#hash",S_OK},
6703 {"winehq.com",S_OK},
6704 {"http://winehq.com/#hash",S_OK},
6705 {"winehq.com",S_OK},
6706 {"",S_FALSE},
6707 {"#hash",S_OK},
6708 {"winehq.com",S_OK},
6709 {"",S_FALSE},
6710 {"/",S_OK},
6711 {"/",S_OK},
6712 {"",S_FALSE},
6713 {"http://winehq.com/#hash",S_OK},
6714 {"http",S_OK},
6715 {"",S_FALSE},
6716 {"",S_FALSE}
6719 {Uri_HOST_DNS,S_OK},
6720 {80,S_OK,FALSE,TRUE},
6721 {URL_SCHEME_HTTP,S_OK},
6722 {URLZONE_INVALID,E_NOTIMPL}
6725 { "http://winehq.org/dir/test?querystring",0,
6726 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE,
6727 0,S_OK,FALSE,
6729 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6730 {"winehq.com",S_OK},
6731 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6732 {"winehq.com",S_OK},
6733 {".txt",S_OK},
6734 {"#hash",S_OK},
6735 {"winehq.com",S_OK},
6736 {"",S_FALSE},
6737 {"/dir/file.txt",S_OK},
6738 {"/dir/file.txt?query",S_OK},
6739 {"?query",S_OK},
6740 {"http://winehq.com/dir/file.txt?query#hash",S_OK},
6741 {"http",S_OK},
6742 {"",S_FALSE},
6743 {"",S_FALSE}
6746 {Uri_HOST_DNS,S_OK},
6747 {80,S_OK,FALSE,TRUE},
6748 {URL_SCHEME_HTTP,S_OK},
6749 {URLZONE_INVALID,E_NOTIMPL}
6754 typedef struct _uri_parse_test {
6755 const char *uri;
6756 DWORD uri_flags;
6757 PARSEACTION action;
6758 DWORD flags;
6759 const char *property;
6760 HRESULT expected;
6761 BOOL todo;
6762 } uri_parse_test;
6764 static const uri_parse_test uri_parse_tests[] = {
6765 /* PARSE_CANONICALIZE tests. */
6766 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6767 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6768 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6769 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6770 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6771 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6772 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6773 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6774 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6775 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6776 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6777 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6779 /* PARSE_FRIENDLY tests. */
6780 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6781 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6783 /* PARSE_ROOTDOCUMENT tests. */
6784 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6785 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6786 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6787 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6788 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6789 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6791 /* PARSE_DOCUMENT tests. */
6792 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6793 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6794 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6795 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6796 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6797 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6799 /* PARSE_PATH_FROM_URL tests. */
6800 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6801 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6802 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6803 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6804 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6806 /* PARSE_URL_FROM_PATH tests. */
6807 /* This function almost seems to useless (just returns the absolute uri). */
6808 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6809 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6810 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6811 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6812 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6814 /* PARSE_SCHEMA tests. */
6815 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6816 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6818 /* PARSE_SITE tests. */
6819 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6820 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6821 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6822 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6824 /* PARSE_DOMAIN tests. */
6825 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6826 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6827 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6828 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6830 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6831 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6832 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6833 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6834 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6837 static inline LPWSTR a2w(LPCSTR str) {
6838 LPWSTR ret = NULL;
6840 if(str) {
6841 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6842 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6843 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6846 return ret;
6849 static inline BOOL heap_free(void* mem) {
6850 return HeapFree(GetProcessHeap(), 0, mem);
6853 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6854 LPWSTR strAW = a2w(strA);
6855 DWORD ret = lstrcmpW(strAW, strB);
6856 heap_free(strAW);
6857 return ret;
6860 static inline ULONG get_refcnt(IUri *uri) {
6861 IUri_AddRef(uri);
6862 return IUri_Release(uri);
6865 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6866 DWORD test_index) {
6867 HRESULT hr;
6868 LPWSTR valueW;
6870 valueW = a2w(prop->value);
6871 switch(prop->property) {
6872 case Uri_PROPERTY_FRAGMENT:
6873 hr = IUriBuilder_SetFragment(builder, valueW);
6874 if(prop->todo) {
6875 todo_wine {
6876 ok(hr == prop->expected,
6877 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6878 hr, prop->expected, test_index);
6880 } else {
6881 ok(hr == prop->expected,
6882 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6883 hr, prop->expected, test_index);
6885 break;
6886 case Uri_PROPERTY_HOST:
6887 hr = IUriBuilder_SetHost(builder, valueW);
6888 if(prop->todo) {
6889 todo_wine {
6890 ok(hr == prop->expected,
6891 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6892 hr, prop->expected, test_index);
6894 } else {
6895 ok(hr == prop->expected,
6896 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6897 hr, prop->expected, test_index);
6899 break;
6900 case Uri_PROPERTY_PASSWORD:
6901 hr = IUriBuilder_SetPassword(builder, valueW);
6902 if(prop->todo) {
6903 todo_wine {
6904 ok(hr == prop->expected,
6905 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6906 hr, prop->expected, test_index);
6908 } else {
6909 ok(hr == prop->expected,
6910 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6911 hr, prop->expected, test_index);
6913 break;
6914 case Uri_PROPERTY_PATH:
6915 hr = IUriBuilder_SetPath(builder, valueW);
6916 if(prop->todo) {
6917 todo_wine {
6918 ok(hr == prop->expected,
6919 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6920 hr, prop->expected, test_index);
6922 } else {
6923 ok(hr == prop->expected,
6924 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6925 hr, prop->expected, test_index);
6927 break;
6928 case Uri_PROPERTY_QUERY:
6929 hr = IUriBuilder_SetQuery(builder, valueW);
6930 if(prop->todo) {
6931 todo_wine {
6932 ok(hr == prop->expected,
6933 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6934 hr, prop->expected, test_index);
6936 } else {
6937 ok(hr == prop->expected,
6938 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6939 hr, prop->expected, test_index);
6941 break;
6942 case Uri_PROPERTY_SCHEME_NAME:
6943 hr = IUriBuilder_SetSchemeName(builder, valueW);
6944 if(prop->todo) {
6945 todo_wine {
6946 ok(hr == prop->expected,
6947 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6948 hr, prop->expected, test_index);
6950 } else {
6951 ok(hr == prop->expected,
6952 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6953 hr, prop->expected, test_index);
6955 break;
6956 case Uri_PROPERTY_USER_NAME:
6957 hr = IUriBuilder_SetUserName(builder, valueW);
6958 if(prop->todo) {
6959 todo_wine {
6960 ok(hr == prop->expected,
6961 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6962 hr, prop->expected, test_index);
6964 } else {
6965 ok(hr == prop->expected,
6966 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6967 hr, prop->expected, test_index);
6969 break;
6970 default:
6971 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6974 heap_free(valueW);
6978 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6979 * correctly.
6981 static void test_CreateUri_InvalidFlags(void) {
6982 DWORD i;
6984 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6985 HRESULT hr;
6986 IUri *uri = (void*) 0xdeadbeef;
6988 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6989 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6990 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6991 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6995 static void test_CreateUri_InvalidArgs(void) {
6996 HRESULT hr;
6997 IUri *uri = (void*) 0xdeadbeef;
6999 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
7000 static const WCHAR emptyW[] = {0};
7002 hr = pCreateUri(http_urlW, 0, 0, NULL);
7003 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7005 hr = pCreateUri(NULL, 0, 0, &uri);
7006 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
7007 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7009 uri = (void*) 0xdeadbeef;
7010 hr = pCreateUri(invalidW, 0, 0, &uri);
7011 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7012 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7014 uri = (void*) 0xdeadbeef;
7015 hr = pCreateUri(emptyW, 0, 0, &uri);
7016 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7017 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
7020 static void test_CreateUri_InvalidUri(void) {
7021 DWORD i;
7023 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
7024 invalid_uri test = invalid_uri_tests[i];
7025 IUri *uri = NULL;
7026 LPWSTR uriW;
7027 HRESULT hr;
7029 uriW = a2w(test.uri);
7030 hr = pCreateUri(uriW, test.flags, 0, &uri);
7031 if(test.todo) {
7032 todo_wine {
7033 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7034 hr, E_INVALIDARG, i);
7036 } else {
7037 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7038 hr, E_INVALIDARG, i);
7040 if(uri) IUri_Release(uri);
7042 heap_free(uriW);
7046 static void test_IUri_GetPropertyBSTR(void) {
7047 IUri *uri = NULL;
7048 HRESULT hr;
7049 DWORD i;
7051 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7052 hr = pCreateUri(http_urlW, 0, 0, &uri);
7053 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7054 if(SUCCEEDED(hr)) {
7055 BSTR received = NULL;
7057 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
7058 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7060 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
7061 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
7062 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7063 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7064 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7065 SysFreeString(received);
7067 /* Make sure it handles the ZONE property correctly. */
7068 received = NULL;
7069 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
7070 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
7071 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
7072 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
7073 SysFreeString(received);
7075 if(uri) IUri_Release(uri);
7077 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7078 uri_properties test = uri_tests[i];
7079 LPWSTR uriW;
7080 uri = NULL;
7082 uriW = a2w(test.uri);
7083 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7084 if(test.create_todo) {
7085 todo_wine {
7086 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7087 hr, test.create_expected, i);
7089 } else {
7090 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7091 hr, test.create_expected, i);
7094 if(SUCCEEDED(hr)) {
7095 DWORD j;
7097 /* Checks all the string properties of the uri. */
7098 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7099 BSTR received = NULL;
7100 uri_str_property prop = test.str_props[j];
7102 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
7103 if(prop.todo) {
7104 todo_wine {
7105 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7106 hr, prop.expected, i, j);
7108 todo_wine {
7109 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7110 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7111 prop.value, wine_dbgstr_w(received), i, j);
7113 } else {
7114 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7115 hr, prop.expected, i, j);
7116 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7117 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7118 prop.value, wine_dbgstr_w(received), i, j);
7121 SysFreeString(received);
7125 if(uri) IUri_Release(uri);
7127 heap_free(uriW);
7131 static void test_IUri_GetPropertyDWORD(void) {
7132 IUri *uri = NULL;
7133 HRESULT hr;
7134 DWORD i;
7136 hr = pCreateUri(http_urlW, 0, 0, &uri);
7137 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7138 if(SUCCEEDED(hr)) {
7139 DWORD received = 0xdeadbeef;
7141 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
7142 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7144 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
7145 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7146 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
7148 if(uri) IUri_Release(uri);
7150 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7151 uri_properties test = uri_tests[i];
7152 LPWSTR uriW;
7153 uri = NULL;
7155 uriW = a2w(test.uri);
7156 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7157 if(test.create_todo) {
7158 todo_wine {
7159 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7160 hr, test.create_expected, i);
7162 } else {
7163 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7164 hr, test.create_expected, i);
7167 if(SUCCEEDED(hr)) {
7168 DWORD j;
7170 /* Checks all the DWORD properties of the uri. */
7171 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
7172 DWORD received;
7173 uri_dword_property prop = test.dword_props[j];
7175 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
7176 if(prop.todo) {
7177 todo_wine {
7178 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7179 hr, prop.expected, i, j);
7181 todo_wine {
7182 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7183 prop.value, received, i, j);
7185 } else {
7186 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7187 hr, prop.expected, i, j);
7188 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7189 prop.value, received, i, j);
7194 if(uri) IUri_Release(uri);
7196 heap_free(uriW);
7200 /* Tests all the 'Get*' property functions which deal with strings. */
7201 static void test_IUri_GetStrProperties(void) {
7202 IUri *uri = NULL;
7203 HRESULT hr;
7204 DWORD i;
7206 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7207 hr = pCreateUri(http_urlW, 0, 0, &uri);
7208 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7209 if(SUCCEEDED(hr)) {
7210 hr = IUri_GetAbsoluteUri(uri, NULL);
7211 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7213 hr = IUri_GetAuthority(uri, NULL);
7214 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7216 hr = IUri_GetDisplayUri(uri, NULL);
7217 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7219 hr = IUri_GetDomain(uri, NULL);
7220 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7222 hr = IUri_GetExtension(uri, NULL);
7223 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7225 hr = IUri_GetFragment(uri, NULL);
7226 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7228 hr = IUri_GetHost(uri, NULL);
7229 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7231 hr = IUri_GetPassword(uri, NULL);
7232 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7234 hr = IUri_GetPath(uri, NULL);
7235 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7237 hr = IUri_GetPathAndQuery(uri, NULL);
7238 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7240 hr = IUri_GetQuery(uri, NULL);
7241 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7243 hr = IUri_GetRawUri(uri, NULL);
7244 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7246 hr = IUri_GetSchemeName(uri, NULL);
7247 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7249 hr = IUri_GetUserInfo(uri, NULL);
7250 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7252 hr = IUri_GetUserName(uri, NULL);
7253 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7255 if(uri) IUri_Release(uri);
7257 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7258 uri_properties test = uri_tests[i];
7259 LPWSTR uriW;
7260 uri = NULL;
7262 uriW = a2w(test.uri);
7263 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7264 if(test.create_todo) {
7265 todo_wine {
7266 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7267 hr, test.create_expected, i);
7269 } else {
7270 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7271 hr, test.create_expected, i);
7274 if(SUCCEEDED(hr)) {
7275 uri_str_property prop;
7276 BSTR received = NULL;
7278 /* GetAbsoluteUri() tests. */
7279 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
7280 hr = IUri_GetAbsoluteUri(uri, &received);
7281 if(prop.todo) {
7282 todo_wine {
7283 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7284 hr, prop.expected, i);
7286 todo_wine {
7287 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7288 "Error: Expected %s but got %s on uri_tests[%d].\n",
7289 prop.value, wine_dbgstr_w(received), i);
7291 } else {
7292 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7293 hr, prop.expected, i);
7294 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7295 "Error: Expected %s but got %s on uri_tests[%d].\n",
7296 prop.value, wine_dbgstr_w(received), i);
7298 SysFreeString(received);
7299 received = NULL;
7301 /* GetAuthority() tests. */
7302 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
7303 hr = IUri_GetAuthority(uri, &received);
7304 if(prop.todo) {
7305 todo_wine {
7306 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7307 hr, prop.expected, i);
7309 todo_wine {
7310 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7311 prop.value, wine_dbgstr_w(received), i);
7313 } else {
7314 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7315 hr, prop.expected, i);
7316 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7317 prop.value, wine_dbgstr_w(received), i);
7319 SysFreeString(received);
7320 received = NULL;
7322 /* GetDisplayUri() tests. */
7323 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
7324 hr = IUri_GetDisplayUri(uri, &received);
7325 if(prop.todo) {
7326 todo_wine {
7327 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7328 hr, prop.expected, i);
7330 todo_wine {
7331 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7332 "Error: Expected %s but got %s on uri_test[%d].\n",
7333 prop.value, wine_dbgstr_w(received), i);
7335 } else {
7336 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7337 hr, prop.expected, i);
7338 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
7339 "Error: Expected %s but got %s on uri_tests[%d].\n",
7340 prop.value, wine_dbgstr_w(received), i);
7342 SysFreeString(received);
7343 received = NULL;
7345 /* GetDomain() tests. */
7346 prop = test.str_props[Uri_PROPERTY_DOMAIN];
7347 hr = IUri_GetDomain(uri, &received);
7348 if(prop.todo) {
7349 todo_wine {
7350 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7351 hr, prop.expected, i);
7353 todo_wine {
7354 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7355 prop.value, wine_dbgstr_w(received), i);
7357 } else {
7358 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7359 hr, prop.expected, i);
7360 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7361 prop.value, wine_dbgstr_w(received), i);
7363 SysFreeString(received);
7364 received = NULL;
7366 /* GetExtension() tests. */
7367 prop = test.str_props[Uri_PROPERTY_EXTENSION];
7368 hr = IUri_GetExtension(uri, &received);
7369 if(prop.todo) {
7370 todo_wine {
7371 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7372 hr, prop.expected, i);
7374 todo_wine {
7375 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7376 prop.value, wine_dbgstr_w(received), i);
7378 } else {
7379 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7380 hr, prop.expected, i);
7381 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7382 prop.value, wine_dbgstr_w(received), i);
7384 SysFreeString(received);
7385 received = NULL;
7387 /* GetFragment() tests. */
7388 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
7389 hr = IUri_GetFragment(uri, &received);
7390 if(prop.todo) {
7391 todo_wine {
7392 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7393 hr, prop.expected, i);
7395 todo_wine {
7396 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7397 prop.value, wine_dbgstr_w(received), i);
7399 } else {
7400 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7401 hr, prop.expected, i);
7402 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7403 prop.value, wine_dbgstr_w(received), i);
7405 SysFreeString(received);
7406 received = NULL;
7408 /* GetHost() tests. */
7409 prop = test.str_props[Uri_PROPERTY_HOST];
7410 hr = IUri_GetHost(uri, &received);
7411 if(prop.todo) {
7412 todo_wine {
7413 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7414 hr, prop.expected, i);
7416 todo_wine {
7417 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7418 prop.value, wine_dbgstr_w(received), i);
7420 } else {
7421 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7422 hr, prop.expected, i);
7423 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7424 prop.value, wine_dbgstr_w(received), i);
7426 SysFreeString(received);
7427 received = NULL;
7429 /* GetPassword() tests. */
7430 prop = test.str_props[Uri_PROPERTY_PASSWORD];
7431 hr = IUri_GetPassword(uri, &received);
7432 if(prop.todo) {
7433 todo_wine {
7434 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7435 hr, prop.expected, i);
7437 todo_wine {
7438 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7439 prop.value, wine_dbgstr_w(received), i);
7441 } else {
7442 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7443 hr, prop.expected, i);
7444 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7445 prop.value, wine_dbgstr_w(received), i);
7447 SysFreeString(received);
7448 received = NULL;
7450 /* GetPath() tests. */
7451 prop = test.str_props[Uri_PROPERTY_PATH];
7452 hr = IUri_GetPath(uri, &received);
7453 if(prop.todo) {
7454 todo_wine {
7455 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7456 hr, prop.expected, i);
7458 todo_wine {
7459 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7460 prop.value, wine_dbgstr_w(received), i);
7462 } else {
7463 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7464 hr, prop.expected, i);
7465 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7466 prop.value, wine_dbgstr_w(received), i);
7468 SysFreeString(received);
7469 received = NULL;
7471 /* GetPathAndQuery() tests. */
7472 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7473 hr = IUri_GetPathAndQuery(uri, &received);
7474 if(prop.todo) {
7475 todo_wine {
7476 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7477 hr, prop.expected, i);
7479 todo_wine {
7480 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7481 prop.value, wine_dbgstr_w(received), i);
7483 } else {
7484 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7485 hr, prop.expected, i);
7486 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7487 prop.value, wine_dbgstr_w(received), i);
7489 SysFreeString(received);
7490 received = NULL;
7492 /* GetQuery() tests. */
7493 prop = test.str_props[Uri_PROPERTY_QUERY];
7494 hr = IUri_GetQuery(uri, &received);
7495 if(prop.todo) {
7496 todo_wine {
7497 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7498 hr, prop.expected, i);
7500 todo_wine {
7501 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7502 prop.value, wine_dbgstr_w(received), i);
7504 } else {
7505 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7506 hr, prop.expected, i);
7507 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7508 prop.value, wine_dbgstr_w(received), i);
7510 SysFreeString(received);
7511 received = NULL;
7513 /* GetRawUri() tests. */
7514 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7515 hr = IUri_GetRawUri(uri, &received);
7516 if(prop.todo) {
7517 todo_wine {
7518 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7519 hr, prop.expected, i);
7521 todo_wine {
7522 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7523 prop.value, wine_dbgstr_w(received), i);
7525 } else {
7526 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7527 hr, prop.expected, i);
7528 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7529 prop.value, wine_dbgstr_w(received), i);
7531 SysFreeString(received);
7532 received = NULL;
7534 /* GetSchemeName() tests. */
7535 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7536 hr = IUri_GetSchemeName(uri, &received);
7537 if(prop.todo) {
7538 todo_wine {
7539 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7540 hr, prop.expected, i);
7542 todo_wine {
7543 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7544 prop.value, wine_dbgstr_w(received), i);
7546 } else {
7547 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7548 hr, prop.expected, i);
7549 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7550 prop.value, wine_dbgstr_w(received), i);
7552 SysFreeString(received);
7553 received = NULL;
7555 /* GetUserInfo() tests. */
7556 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7557 hr = IUri_GetUserInfo(uri, &received);
7558 if(prop.todo) {
7559 todo_wine {
7560 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7561 hr, prop.expected, i);
7563 todo_wine {
7564 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7565 prop.value, wine_dbgstr_w(received), i);
7567 } else {
7568 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7569 hr, prop.expected, i);
7570 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7571 prop.value, wine_dbgstr_w(received), i);
7573 SysFreeString(received);
7574 received = NULL;
7576 /* GetUserName() tests. */
7577 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7578 hr = IUri_GetUserName(uri, &received);
7579 if(prop.todo) {
7580 todo_wine {
7581 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7582 hr, prop.expected, i);
7584 todo_wine {
7585 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7586 prop.value, wine_dbgstr_w(received), i);
7588 } else {
7589 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7590 hr, prop.expected, i);
7591 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7592 prop.value, wine_dbgstr_w(received), i);
7594 SysFreeString(received);
7597 if(uri) IUri_Release(uri);
7599 heap_free(uriW);
7603 static void test_IUri_GetDwordProperties(void) {
7604 IUri *uri = NULL;
7605 HRESULT hr;
7606 DWORD i;
7608 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7609 hr = pCreateUri(http_urlW, 0, 0, &uri);
7610 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7611 if(SUCCEEDED(hr)) {
7612 hr = IUri_GetHostType(uri, NULL);
7613 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7615 hr = IUri_GetPort(uri, NULL);
7616 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7618 hr = IUri_GetScheme(uri, NULL);
7619 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7621 hr = IUri_GetZone(uri, NULL);
7622 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7624 if(uri) IUri_Release(uri);
7626 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7627 uri_properties test = uri_tests[i];
7628 LPWSTR uriW;
7629 uri = NULL;
7631 uriW = a2w(test.uri);
7632 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7633 if(test.create_todo) {
7634 todo_wine {
7635 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7636 hr, test.create_expected, i);
7638 } else {
7639 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7640 hr, test.create_expected, i);
7643 if(SUCCEEDED(hr)) {
7644 uri_dword_property prop;
7645 DWORD received;
7647 /* Assign an insane value so tests don't accidentally pass when
7648 * they shouldn't!
7650 received = -9999999;
7652 /* GetHostType() tests. */
7653 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7654 hr = IUri_GetHostType(uri, &received);
7655 if(prop.todo) {
7656 todo_wine {
7657 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7658 hr, prop.expected, i);
7660 todo_wine {
7661 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7663 } else {
7664 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7665 hr, prop.expected, i);
7666 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7668 received = -9999999;
7670 /* GetPort() tests. */
7671 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7672 hr = IUri_GetPort(uri, &received);
7673 if(prop.todo) {
7674 todo_wine {
7675 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7676 hr, prop.expected, i);
7678 todo_wine {
7679 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7681 } else {
7682 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7683 hr, prop.expected, i);
7684 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7686 received = -9999999;
7688 /* GetScheme() tests. */
7689 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7690 hr = IUri_GetScheme(uri, &received);
7691 if(prop.todo) {
7692 todo_wine {
7693 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7694 hr, prop.expected, i);
7696 todo_wine {
7697 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7699 } else {
7700 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7701 hr, prop.expected, i);
7702 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7704 received = -9999999;
7706 /* GetZone() tests. */
7707 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7708 hr = IUri_GetZone(uri, &received);
7709 if(prop.todo) {
7710 todo_wine {
7711 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7712 hr, prop.expected, i);
7714 todo_wine {
7715 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7717 } else {
7718 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7719 hr, prop.expected, i);
7720 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7724 if(uri) IUri_Release(uri);
7726 heap_free(uriW);
7730 static void test_IUri_GetPropertyLength(void) {
7731 IUri *uri = NULL;
7732 HRESULT hr;
7733 DWORD i;
7735 /* Make sure it handles invalid args correctly. */
7736 hr = pCreateUri(http_urlW, 0, 0, &uri);
7737 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7738 if(SUCCEEDED(hr)) {
7739 DWORD received = 0xdeadbeef;
7741 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7742 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7744 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7745 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7746 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7748 if(uri) IUri_Release(uri);
7750 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7751 uri_properties test = uri_tests[i];
7752 LPWSTR uriW;
7753 uri = NULL;
7755 uriW = a2w(test.uri);
7756 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7757 if(test.create_todo) {
7758 todo_wine {
7759 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7760 hr, test.create_expected, i);
7762 } else {
7763 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7764 hr, test.create_expected, i);
7767 if(SUCCEEDED(hr)) {
7768 DWORD j;
7770 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7771 DWORD expectedLen, brokenLen, receivedLen;
7772 uri_str_property prop = test.str_props[j];
7774 expectedLen = lstrlen(prop.value);
7775 brokenLen = lstrlen(prop.broken_value);
7777 /* This won't be necessary once GetPropertyLength is implemented. */
7778 receivedLen = -1;
7780 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7781 if(prop.todo) {
7782 todo_wine {
7783 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7784 hr, prop.expected, i, j);
7786 todo_wine {
7787 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7788 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7789 expectedLen, receivedLen, i, j);
7791 } else {
7792 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7793 hr, prop.expected, i, j);
7794 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7795 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7796 expectedLen, receivedLen, i, j);
7801 if(uri) IUri_Release(uri);
7803 heap_free(uriW);
7807 static DWORD compute_expected_props(uri_properties *test)
7809 DWORD ret = 0, i;
7811 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7812 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7813 ret |= 1<<i;
7816 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7817 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7818 ret |= 1<<i;
7821 return ret;
7824 static void test_IUri_GetProperties(void) {
7825 IUri *uri = NULL;
7826 HRESULT hr;
7827 DWORD i;
7829 hr = pCreateUri(http_urlW, 0, 0, &uri);
7830 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7831 if(SUCCEEDED(hr)) {
7832 hr = IUri_GetProperties(uri, NULL);
7833 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7835 if(uri) IUri_Release(uri);
7837 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7838 uri_properties test = uri_tests[i];
7839 LPWSTR uriW;
7840 uri = NULL;
7842 uriW = a2w(test.uri);
7843 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7844 if(test.create_todo) {
7845 todo_wine {
7846 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7848 } else {
7849 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7852 if(SUCCEEDED(hr)) {
7853 DWORD received = 0, expected_props;
7854 DWORD j;
7856 hr = IUri_GetProperties(uri, &received);
7857 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7859 expected_props = compute_expected_props(&test);
7861 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7862 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7863 if(expected_props & (1 << j))
7864 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7865 else
7866 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7870 if(uri) IUri_Release(uri);
7872 heap_free(uriW);
7876 static void test_IUri_HasProperty(void) {
7877 IUri *uri = NULL;
7878 HRESULT hr;
7879 DWORD i;
7881 hr = pCreateUri(http_urlW, 0, 0, &uri);
7882 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7883 if(SUCCEEDED(hr)) {
7884 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7885 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7887 if(uri) IUri_Release(uri);
7889 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7890 uri_properties test = uri_tests[i];
7891 LPWSTR uriW;
7892 uri = NULL;
7894 uriW = a2w(test.uri);
7896 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7897 if(test.create_todo) {
7898 todo_wine {
7899 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7901 } else {
7902 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7905 if(SUCCEEDED(hr)) {
7906 DWORD expected_props, j;
7908 expected_props = compute_expected_props(&test);
7910 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7911 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7912 BOOL received = -1;
7914 hr = IUri_HasProperty(uri, j, &received);
7915 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7916 hr, S_OK, j, i);
7918 if(expected_props & (1 << j)) {
7919 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7920 } else {
7921 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7926 if(uri) IUri_Release(uri);
7928 heap_free(uriW);
7932 static void test_IUri_IsEqual(void) {
7933 IUri *uriA, *uriB;
7934 BOOL equal;
7935 HRESULT hres;
7936 DWORD i;
7938 uriA = uriB = NULL;
7940 /* Make sure IsEqual handles invalid args correctly. */
7941 hres = pCreateUri(http_urlW, 0, 0, &uriA);
7942 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7943 hres = pCreateUri(http_urlW, 0, 0, &uriB);
7944 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7946 equal = -1;
7947 hres = IUri_IsEqual(uriA, NULL, &equal);
7948 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, S_OK);
7949 ok(!equal, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7951 hres = IUri_IsEqual(uriA, uriB, NULL);
7952 ok(hres == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres, E_POINTER);
7954 IUri_Release(uriA);
7955 IUri_Release(uriB);
7957 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7958 uri_equality test = equality_tests[i];
7959 LPWSTR uriA_W, uriB_W;
7961 uriA = uriB = NULL;
7963 uriA_W = a2w(test.a);
7964 uriB_W = a2w(test.b);
7966 hres = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7967 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres, S_OK, i);
7969 hres = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7970 ok(hres == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres, S_OK, i);
7972 equal = -1;
7973 hres = IUri_IsEqual(uriA, uriB, &equal);
7974 if(test.todo) todo_wine {
7975 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7976 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7977 } else {
7978 ok(hres == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres, S_OK, i);
7979 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7981 if(uriA) IUri_Release(uriA);
7982 if(uriB) IUri_Release(uriB);
7984 heap_free(uriA_W);
7985 heap_free(uriB_W);
7989 static void test_CreateUriWithFragment_InvalidArgs(void) {
7990 HRESULT hr;
7991 IUri *uri = (void*) 0xdeadbeef;
7992 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7994 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7995 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7996 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7998 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7999 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8001 /* Original URI can't already contain a fragment component. */
8002 uri = (void*) 0xdeadbeef;
8003 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
8004 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
8005 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8008 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8009 static void test_CreateUriWithFragment_InvalidFlags(void) {
8010 DWORD i;
8012 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
8013 HRESULT hr;
8014 IUri *uri = (void*) 0xdeadbeef;
8016 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
8017 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8018 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
8019 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8023 static void test_CreateUriWithFragment(void) {
8024 DWORD i;
8026 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
8027 HRESULT hr;
8028 IUri *uri = NULL;
8029 LPWSTR uriW, fragW;
8030 uri_with_fragment test = uri_fragment_tests[i];
8032 uriW = a2w(test.uri);
8033 fragW = a2w(test.fragment);
8035 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
8036 if(test.expected_todo) {
8037 todo_wine {
8038 ok(hr == test.create_expected,
8039 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8040 hr, test.create_expected, i);
8042 } else
8043 ok(hr == test.create_expected,
8044 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8045 hr, test.create_expected, i);
8047 if(SUCCEEDED(hr)) {
8048 BSTR received = NULL;
8050 hr = IUri_GetAbsoluteUri(uri, &received);
8051 if(test.expected_todo) {
8052 todo_wine {
8053 ok(hr == S_OK,
8054 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8055 hr, S_OK, i);
8057 todo_wine {
8058 ok(!strcmp_aw(test.expected_uri, received),
8059 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8060 test.expected_uri, wine_dbgstr_w(received), i);
8062 } else {
8063 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8064 hr, S_OK, i);
8065 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8066 test.expected_uri, wine_dbgstr_w(received), i);
8069 SysFreeString(received);
8072 if(uri) IUri_Release(uri);
8073 heap_free(uriW);
8074 heap_free(fragW);
8078 static void test_CreateIUriBuilder(void) {
8079 HRESULT hr;
8080 IUriBuilder *builder = NULL;
8081 IUri *uri;
8083 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
8084 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8085 hr, E_POINTER);
8087 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8088 hr = pCreateUri(http_urlW, 0, 0, &uri);
8089 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8090 if(SUCCEEDED(hr)) {
8091 ULONG cur_count, orig_count;
8093 orig_count = get_refcnt(uri);
8094 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
8095 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8096 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
8098 cur_count = get_refcnt(uri);
8099 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
8101 if(builder) IUriBuilder_Release(builder);
8102 cur_count = get_refcnt(uri);
8103 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
8105 if(uri) IUri_Release(uri);
8108 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
8109 DWORD test_index) {
8110 HRESULT hr;
8111 IUri *uri = NULL;
8113 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
8114 if(test->uri_todo) {
8115 todo_wine {
8116 ok(hr == test->uri_hres,
8117 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8118 hr, test->uri_hres, test_index);
8120 } else {
8121 ok(hr == test->uri_hres,
8122 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8123 hr, test->uri_hres, test_index);
8126 if(SUCCEEDED(hr)) {
8127 DWORD i;
8129 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8130 uri_builder_str_property prop = test->expected_str_props[i];
8131 BSTR received = NULL;
8133 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8134 if(prop.todo) {
8135 todo_wine {
8136 ok(hr == prop.result,
8137 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8138 hr, prop.result, test_index, i);
8140 } else {
8141 ok(hr == prop.result,
8142 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8143 hr, prop.result, test_index, i);
8145 if(SUCCEEDED(hr)) {
8146 if(prop.todo) {
8147 todo_wine {
8148 ok(!strcmp_aw(prop.expected, received),
8149 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8150 prop.expected, wine_dbgstr_w(received), test_index, i);
8152 } else {
8153 ok(!strcmp_aw(prop.expected, received),
8154 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8155 prop.expected, wine_dbgstr_w(received), test_index, i);
8158 SysFreeString(received);
8161 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8162 uri_builder_dword_property prop = test->expected_dword_props[i];
8163 DWORD received = -2;
8165 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8166 if(prop.todo) {
8167 todo_wine {
8168 ok(hr == prop.result,
8169 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8170 hr, prop.result, test_index, i);
8172 } else {
8173 ok(hr == prop.result,
8174 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8175 hr, prop.result, test_index, i);
8177 if(SUCCEEDED(hr)) {
8178 if(prop.todo) {
8179 todo_wine {
8180 ok(received == prop.expected,
8181 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8182 prop.expected, received, test_index, i);
8184 } else {
8185 ok(received == prop.expected,
8186 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8187 prop.expected, received, test_index, i);
8192 if(uri) IUri_Release(uri);
8195 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
8196 DWORD test_index) {
8197 HRESULT hr;
8198 IUri *uri = NULL;
8200 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
8201 if(test->uri_simple_todo) {
8202 todo_wine {
8203 ok(hr == test->uri_simple_hres,
8204 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8205 hr, test->uri_simple_hres, test_index);
8207 } else {
8208 ok(hr == test->uri_simple_hres,
8209 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8210 hr, test->uri_simple_hres, test_index);
8213 if(SUCCEEDED(hr)) {
8214 DWORD i;
8216 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8217 uri_builder_str_property prop = test->expected_str_props[i];
8218 BSTR received = NULL;
8220 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8221 if(prop.todo) {
8222 todo_wine {
8223 ok(hr == prop.result,
8224 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8225 hr, prop.result, test_index, i);
8227 } else {
8228 ok(hr == prop.result,
8229 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8230 hr, prop.result, test_index, i);
8232 if(SUCCEEDED(hr)) {
8233 if(prop.todo) {
8234 todo_wine {
8235 ok(!strcmp_aw(prop.expected, received),
8236 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8237 prop.expected, wine_dbgstr_w(received), test_index, i);
8239 } else {
8240 ok(!strcmp_aw(prop.expected, received),
8241 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8242 prop.expected, wine_dbgstr_w(received), test_index, i);
8245 SysFreeString(received);
8248 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8249 uri_builder_dword_property prop = test->expected_dword_props[i];
8250 DWORD received = -2;
8252 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8253 if(prop.todo) {
8254 todo_wine {
8255 ok(hr == prop.result,
8256 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8257 hr, prop.result, test_index, i);
8259 } else {
8260 ok(hr == prop.result,
8261 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8262 hr, prop.result, test_index, i);
8264 if(SUCCEEDED(hr)) {
8265 if(prop.todo) {
8266 todo_wine {
8267 ok(received == prop.expected,
8268 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8269 prop.expected, received, test_index, i);
8271 } else {
8272 ok(received == prop.expected,
8273 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8274 prop.expected, received, test_index, i);
8279 if(uri) IUri_Release(uri);
8282 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
8283 DWORD test_index) {
8284 HRESULT hr;
8285 IUri *uri = NULL;
8287 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
8288 test->uri_with_encode_flags, 0, &uri);
8289 if(test->uri_with_todo) {
8290 todo_wine {
8291 ok(hr == test->uri_with_hres,
8292 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8293 hr, test->uri_with_hres, test_index);
8295 } else {
8296 ok(hr == test->uri_with_hres,
8297 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8298 hr, test->uri_with_hres, test_index);
8301 if(SUCCEEDED(hr)) {
8302 DWORD i;
8304 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
8305 uri_builder_str_property prop = test->expected_str_props[i];
8306 BSTR received = NULL;
8308 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
8309 if(prop.todo) {
8310 todo_wine {
8311 ok(hr == prop.result,
8312 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8313 hr, prop.result, test_index, i);
8315 } else {
8316 ok(hr == prop.result,
8317 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8318 hr, prop.result, test_index, i);
8320 if(SUCCEEDED(hr)) {
8321 if(prop.todo) {
8322 todo_wine {
8323 ok(!strcmp_aw(prop.expected, received),
8324 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8325 prop.expected, wine_dbgstr_w(received), test_index, i);
8327 } else {
8328 ok(!strcmp_aw(prop.expected, received),
8329 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8330 prop.expected, wine_dbgstr_w(received), test_index, i);
8333 SysFreeString(received);
8336 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
8337 uri_builder_dword_property prop = test->expected_dword_props[i];
8338 DWORD received = -2;
8340 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
8341 if(prop.todo) {
8342 todo_wine {
8343 ok(hr == prop.result,
8344 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8345 hr, prop.result, test_index, i);
8347 } else {
8348 ok(hr == prop.result,
8349 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8350 hr, prop.result, test_index, i);
8352 if(SUCCEEDED(hr)) {
8353 if(prop.todo) {
8354 todo_wine {
8355 ok(received == prop.expected,
8356 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8357 prop.expected, received, test_index, i);
8359 } else {
8360 ok(received == prop.expected,
8361 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8362 prop.expected, received, test_index, i);
8367 if(uri) IUri_Release(uri);
8370 static void test_IUriBuilder_CreateInvalidArgs(void) {
8371 IUriBuilder *builder;
8372 HRESULT hr;
8374 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8375 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8376 if(SUCCEEDED(hr)) {
8377 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
8379 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8380 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
8381 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
8383 uri = (void*) 0xdeadbeef;
8384 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8385 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
8386 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
8388 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
8389 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8390 hr, E_POINTER);
8392 uri = (void*) 0xdeadbeef;
8393 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8394 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8395 hr, E_NOTIMPL);
8396 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
8398 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
8399 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8400 hr, E_POINTER);
8402 uri = (void*) 0xdeadbeef;
8403 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8404 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8405 hr, E_NOTIMPL);
8406 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8408 hr = pCreateUri(http_urlW, 0, 0, &test);
8409 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8410 if(SUCCEEDED(hr)) {
8411 hr = IUriBuilder_SetIUri(builder, test);
8412 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8414 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8415 uri = NULL;
8416 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8417 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8418 ok(uri != NULL, "Error: The uri was NULL.\n");
8419 if(uri) IUri_Release(uri);
8421 uri = NULL;
8422 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8423 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8424 hr, S_OK);
8425 ok(uri != NULL, "Error: uri was NULL.\n");
8426 if(uri) IUri_Release(uri);
8428 uri = NULL;
8429 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8430 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8431 hr, S_OK);
8432 ok(uri != NULL, "Error: uri was NULL.\n");
8433 if(uri) IUri_Release(uri);
8435 hr = IUriBuilder_SetFragment(builder, NULL);
8436 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8438 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8439 uri = (void*) 0xdeadbeef;
8440 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8441 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8442 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8444 uri = (void*) 0xdeadbeef;
8445 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8446 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8447 hr, S_OK);
8448 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8450 uri = (void*) 0xdeadbeef;
8451 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8452 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8453 hr, E_NOTIMPL);
8454 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8456 if(test) IUri_Release(test);
8458 if(builder) IUriBuilder_Release(builder);
8461 /* Tests invalid args to the "Get*" functions. */
8462 static void test_IUriBuilder_GetInvalidArgs(void) {
8463 IUriBuilder *builder = NULL;
8464 HRESULT hr;
8466 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8467 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8468 if(SUCCEEDED(hr)) {
8469 LPCWSTR received = (void*) 0xdeadbeef;
8470 DWORD len = -1, port = -1;
8471 BOOL set = -1;
8473 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8474 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8475 hr, E_POINTER);
8476 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8477 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8478 hr, E_POINTER);
8479 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8480 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8481 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8482 hr, E_POINTER);
8483 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8485 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8486 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8487 hr, E_POINTER);
8488 received = (void*) 0xdeadbeef;
8489 hr = IUriBuilder_GetHost(builder, NULL, &received);
8490 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8491 hr, E_POINTER);
8492 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8493 len = -1;
8494 hr = IUriBuilder_GetHost(builder, &len, NULL);
8495 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8496 hr, E_POINTER);
8497 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8499 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8500 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8501 hr, E_POINTER);
8502 received = (void*) 0xdeadbeef;
8503 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8504 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8505 hr, E_POINTER);
8506 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8507 len = -1;
8508 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8509 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8510 hr, E_POINTER);
8511 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8513 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8514 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8515 hr, E_POINTER);
8516 received = (void*) 0xdeadbeef;
8517 hr = IUriBuilder_GetPath(builder, NULL, &received);
8518 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8519 hr, E_POINTER);
8520 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8521 len = -1;
8522 hr = IUriBuilder_GetPath(builder, &len, NULL);
8523 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8524 hr, E_POINTER);
8525 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8527 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8528 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8529 hr, E_POINTER);
8530 hr = IUriBuilder_GetPort(builder, NULL, &port);
8531 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8532 hr, E_POINTER);
8533 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8534 hr = IUriBuilder_GetPort(builder, &set, NULL);
8535 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8536 hr, E_POINTER);
8537 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8539 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8540 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8541 hr, E_POINTER);
8542 received = (void*) 0xdeadbeef;
8543 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8544 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8545 hr, E_POINTER);
8546 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8547 len = -1;
8548 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8549 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8550 hr, E_POINTER);
8551 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8553 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8554 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8555 hr, E_POINTER);
8556 received = (void*) 0xdeadbeef;
8557 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8558 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8559 hr, E_POINTER);
8560 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8561 len = -1;
8562 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8563 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8564 hr, E_POINTER);
8565 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8567 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8568 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8569 hr, E_POINTER);
8570 received = (void*) 0xdeadbeef;
8571 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8572 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8573 hr, E_POINTER);
8574 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8575 len = -1;
8576 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8577 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8578 hr, E_POINTER);
8579 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8581 if(builder) IUriBuilder_Release(builder);
8584 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8585 DWORD test_index) {
8586 HRESULT hr;
8587 DWORD i;
8588 LPCWSTR received = NULL;
8589 DWORD len = -1;
8590 const uri_builder_property *prop = NULL;
8592 /* Check if the property was set earlier. */
8593 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8594 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8595 prop = &(test->properties[i]);
8598 if(prop) {
8599 /* Use expected_value unless it's NULL, then use value. */
8600 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8601 hr = IUriBuilder_GetFragment(builder, &len, &received);
8602 if(prop->todo) {
8603 todo_wine {
8604 ok(hr == (expected ? S_OK : S_FALSE),
8605 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8606 hr, (expected ? S_OK : S_FALSE), test_index);
8608 if(SUCCEEDED(hr)) {
8609 todo_wine {
8610 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8611 expected, wine_dbgstr_w(received), test_index);
8613 todo_wine {
8614 ok(lstrlen(expected) == len,
8615 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8616 lstrlen(expected), len, test_index);
8619 } else {
8620 ok(hr == (expected ? S_OK : S_FALSE),
8621 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8622 hr, (expected ? S_OK : S_FALSE), test_index);
8623 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8624 expected, wine_dbgstr_w(received), test_index);
8625 ok(lstrlen(expected) == len,
8626 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8627 lstrlen(expected), len, test_index);
8629 } else {
8630 /* The property wasn't set earlier, so it should return whatever
8631 * the base IUri contains (if anything).
8633 IUri *uri = NULL;
8634 hr = IUriBuilder_GetIUri(builder, &uri);
8635 ok(hr == S_OK,
8636 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8637 hr, S_OK, test_index);
8638 if(SUCCEEDED(hr)) {
8639 if(!uri) {
8640 received = (void*) 0xdeadbeef;
8641 len = -1;
8643 hr = IUriBuilder_GetFragment(builder, &len, &received);
8644 ok(hr == S_FALSE,
8645 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8646 hr, S_FALSE, test_index);
8647 if(SUCCEEDED(hr)) {
8648 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8649 len, test_index);
8650 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8651 received, test_index);
8653 } else {
8654 BOOL has_prop = FALSE;
8655 BSTR expected = NULL;
8657 hr = IUri_GetFragment(uri, &expected);
8658 ok(SUCCEEDED(hr),
8659 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8660 hr, test_index);
8661 has_prop = hr == S_OK;
8663 hr = IUriBuilder_GetFragment(builder, &len, &received);
8664 if(has_prop) {
8665 ok(hr == S_OK,
8666 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8667 hr, S_OK, test_index);
8668 if(SUCCEEDED(hr)) {
8669 ok(!lstrcmpW(expected, received),
8670 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8671 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8672 ok(lstrlenW(expected) == len,
8673 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8674 lstrlenW(expected), len, test_index);
8676 } else {
8677 ok(hr == S_FALSE,
8678 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8679 hr, S_FALSE, test_index);
8680 if(SUCCEEDED(hr)) {
8681 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8682 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8683 len, test_index);
8686 SysFreeString(expected);
8689 if(uri) IUri_Release(uri);
8693 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8694 DWORD test_index) {
8695 HRESULT hr;
8696 DWORD i;
8697 LPCWSTR received = NULL;
8698 DWORD len = -1;
8699 const uri_builder_property *prop = NULL;
8701 /* Check if the property was set earlier. */
8702 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8703 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8704 prop = &(test->properties[i]);
8707 if(prop) {
8708 /* Use expected_value unless it's NULL, then use value. */
8709 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8710 hr = IUriBuilder_GetHost(builder, &len, &received);
8711 if(prop->todo) {
8712 todo_wine {
8713 ok(hr == (expected ? S_OK : S_FALSE),
8714 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8715 hr, (expected ? S_OK : S_FALSE), test_index);
8717 if(SUCCEEDED(hr)) {
8718 todo_wine {
8719 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8720 expected, wine_dbgstr_w(received), test_index);
8722 todo_wine {
8723 ok(lstrlen(expected) == len,
8724 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8725 lstrlen(expected), len, test_index);
8728 } else {
8729 ok(hr == (expected ? S_OK : S_FALSE),
8730 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8731 hr, (expected ? S_OK : S_FALSE), test_index);
8732 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8733 expected, wine_dbgstr_w(received), test_index);
8734 ok(lstrlen(expected) == len,
8735 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8736 lstrlen(expected), len, test_index);
8738 } else {
8739 /* The property wasn't set earlier, so it should return whatever
8740 * the base IUri contains (if anything).
8742 IUri *uri = NULL;
8743 hr = IUriBuilder_GetIUri(builder, &uri);
8744 ok(hr == S_OK,
8745 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8746 hr, S_OK, test_index);
8747 if(SUCCEEDED(hr)) {
8748 if(!uri) {
8749 received = (void*) 0xdeadbeef;
8750 len = -1;
8752 hr = IUriBuilder_GetHost(builder, &len, &received);
8753 ok(hr == S_FALSE,
8754 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8755 hr, S_FALSE, test_index);
8756 if(SUCCEEDED(hr)) {
8757 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8758 len, test_index);
8759 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8760 received, test_index);
8762 } else {
8763 BOOL has_prop = FALSE;
8764 BSTR expected = NULL;
8766 hr = IUri_GetHost(uri, &expected);
8767 ok(SUCCEEDED(hr),
8768 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8769 hr, test_index);
8770 has_prop = hr == S_OK;
8772 hr = IUriBuilder_GetHost(builder, &len, &received);
8773 if(has_prop) {
8774 ok(hr == S_OK,
8775 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8776 hr, S_OK, test_index);
8777 if(SUCCEEDED(hr)) {
8778 ok(!lstrcmpW(expected, received),
8779 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8780 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8781 ok(lstrlenW(expected) == len,
8782 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8783 lstrlenW(expected), len, test_index);
8785 } else {
8786 ok(hr == S_FALSE,
8787 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8788 hr, S_FALSE, test_index);
8789 if(SUCCEEDED(hr)) {
8790 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8791 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8792 len, test_index);
8795 SysFreeString(expected);
8798 if(uri) IUri_Release(uri);
8802 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8803 DWORD test_index) {
8804 HRESULT hr;
8805 DWORD i;
8806 LPCWSTR received = NULL;
8807 DWORD len = -1;
8808 const uri_builder_property *prop = NULL;
8810 /* Check if the property was set earlier. */
8811 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8812 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8813 prop = &(test->properties[i]);
8816 if(prop) {
8817 /* Use expected_value unless it's NULL, then use value. */
8818 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8819 hr = IUriBuilder_GetPassword(builder, &len, &received);
8820 if(prop->todo) {
8821 todo_wine {
8822 ok(hr == (expected ? S_OK : S_FALSE),
8823 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8824 hr, (expected ? S_OK : S_FALSE), test_index);
8826 if(SUCCEEDED(hr)) {
8827 todo_wine {
8828 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8829 expected, wine_dbgstr_w(received), test_index);
8831 todo_wine {
8832 ok(lstrlen(expected) == len,
8833 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8834 lstrlen(expected), len, test_index);
8837 } else {
8838 ok(hr == (expected ? S_OK : S_FALSE),
8839 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8840 hr, (expected ? S_OK : S_FALSE), test_index);
8841 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8842 expected, wine_dbgstr_w(received), test_index);
8843 ok(lstrlen(expected) == len,
8844 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8845 lstrlen(expected), len, test_index);
8847 } else {
8848 /* The property wasn't set earlier, so it should return whatever
8849 * the base IUri contains (if anything).
8851 IUri *uri = NULL;
8852 hr = IUriBuilder_GetIUri(builder, &uri);
8853 ok(hr == S_OK,
8854 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8855 hr, S_OK, test_index);
8856 if(SUCCEEDED(hr)) {
8857 if(!uri) {
8858 received = (void*) 0xdeadbeef;
8859 len = -1;
8861 hr = IUriBuilder_GetPassword(builder, &len, &received);
8862 ok(hr == S_FALSE,
8863 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8864 hr, S_FALSE, test_index);
8865 if(SUCCEEDED(hr)) {
8866 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8867 len, test_index);
8868 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8869 received, test_index);
8871 } else {
8872 BOOL has_prop = FALSE;
8873 BSTR expected = NULL;
8875 hr = IUri_GetPassword(uri, &expected);
8876 ok(SUCCEEDED(hr),
8877 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8878 hr, test_index);
8879 has_prop = hr == S_OK;
8881 hr = IUriBuilder_GetPassword(builder, &len, &received);
8882 if(has_prop) {
8883 ok(hr == S_OK,
8884 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8885 hr, S_OK, test_index);
8886 if(SUCCEEDED(hr)) {
8887 ok(!lstrcmpW(expected, received),
8888 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8889 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8890 ok(lstrlenW(expected) == len,
8891 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8892 lstrlenW(expected), len, test_index);
8894 } else {
8895 ok(hr == S_FALSE,
8896 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8897 hr, S_FALSE, test_index);
8898 if(SUCCEEDED(hr)) {
8899 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8900 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8901 len, test_index);
8904 SysFreeString(expected);
8907 if(uri) IUri_Release(uri);
8911 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8912 DWORD test_index) {
8913 HRESULT hr;
8914 DWORD i;
8915 LPCWSTR received = NULL;
8916 DWORD len = -1;
8917 const uri_builder_property *prop = NULL;
8919 /* Check if the property was set earlier. */
8920 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8921 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8922 prop = &(test->properties[i]);
8925 if(prop) {
8926 /* Use expected_value unless it's NULL, then use value. */
8927 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8928 hr = IUriBuilder_GetPath(builder, &len, &received);
8929 if(prop->todo) {
8930 todo_wine {
8931 ok(hr == (expected ? S_OK : S_FALSE),
8932 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8933 hr, (expected ? S_OK : S_FALSE), test_index);
8935 if(SUCCEEDED(hr)) {
8936 todo_wine {
8937 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8938 expected, wine_dbgstr_w(received), test_index);
8940 todo_wine {
8941 ok(lstrlen(expected) == len,
8942 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8943 lstrlen(expected), len, test_index);
8946 } else {
8947 ok(hr == (expected ? S_OK : S_FALSE),
8948 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8949 hr, (expected ? S_OK : S_FALSE), test_index);
8950 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8951 expected, wine_dbgstr_w(received), test_index);
8952 ok(lstrlen(expected) == len,
8953 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8954 lstrlen(expected), len, test_index);
8956 } else {
8957 /* The property wasn't set earlier, so it should return whatever
8958 * the base IUri contains (if anything).
8960 IUri *uri = NULL;
8961 hr = IUriBuilder_GetIUri(builder, &uri);
8962 ok(hr == S_OK,
8963 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8964 hr, S_OK, test_index);
8965 if(SUCCEEDED(hr)) {
8966 if(!uri) {
8967 received = (void*) 0xdeadbeef;
8968 len = -1;
8970 hr = IUriBuilder_GetPath(builder, &len, &received);
8971 ok(hr == S_FALSE,
8972 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8973 hr, S_FALSE, test_index);
8974 if(SUCCEEDED(hr)) {
8975 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8976 len, test_index);
8977 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8978 received, test_index);
8980 } else {
8981 BOOL has_prop = FALSE;
8982 BSTR expected = NULL;
8984 hr = IUri_GetPath(uri, &expected);
8985 ok(SUCCEEDED(hr),
8986 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8987 hr, test_index);
8988 has_prop = hr == S_OK;
8990 hr = IUriBuilder_GetPath(builder, &len, &received);
8991 if(has_prop) {
8992 ok(hr == S_OK,
8993 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8994 hr, S_OK, test_index);
8995 if(SUCCEEDED(hr)) {
8996 ok(!lstrcmpW(expected, received),
8997 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8998 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8999 ok(lstrlenW(expected) == len,
9000 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9001 lstrlenW(expected), len, test_index);
9003 } else {
9004 ok(hr == S_FALSE,
9005 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9006 hr, S_FALSE, test_index);
9007 if(SUCCEEDED(hr)) {
9008 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9009 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9010 len, test_index);
9013 SysFreeString(expected);
9016 if(uri) IUri_Release(uri);
9020 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
9021 DWORD test_index) {
9022 HRESULT hr;
9023 BOOL has_port = FALSE;
9024 DWORD received = -1;
9026 if(test->port_prop.change) {
9027 DWORD expected = test->port_prop.value;
9029 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9030 if(test->port_prop.todo) {
9031 todo_wine {
9032 ok(hr == S_OK,
9033 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9034 hr, S_OK, test_index);
9036 if(SUCCEEDED(hr)) {
9037 todo_wine {
9038 ok(has_port == test->port_prop.set,
9039 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9040 test->port_prop.set, has_port, test_index);
9042 todo_wine {
9043 ok(received == expected,
9044 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9045 expected, received, test_index);
9048 } else {
9049 ok(hr == S_OK,
9050 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9051 hr, S_OK, test_index);
9052 ok(has_port == test->port_prop.set,
9053 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9054 test->port_prop.set, has_port, test_index);
9055 ok(received == test->port_prop.value,
9056 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9057 test->port_prop.value, received, test_index);
9059 } else {
9060 IUri *uri = NULL;
9062 hr = IUriBuilder_GetIUri(builder, &uri);
9063 ok(hr == S_OK,
9064 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9065 hr, S_OK, test_index);
9066 if(SUCCEEDED(hr)) {
9067 if(!uri) {
9068 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9069 ok(hr == S_OK,
9070 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9071 hr, S_OK, test_index);
9072 if(SUCCEEDED(hr)) {
9073 ok(has_port == FALSE,
9074 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9075 has_port, test_index);
9076 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9077 received, test_index);
9079 } else {
9080 DWORD expected;
9082 hr = IUri_GetPort(uri, &expected);
9083 ok(SUCCEEDED(hr),
9084 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9085 hr, test_index);
9087 hr = IUriBuilder_GetPort(builder, &has_port, &received);
9088 ok(hr == S_OK,
9089 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9090 hr, S_OK, test_index);
9091 if(SUCCEEDED(hr)) {
9092 ok(!has_port,
9093 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9094 test_index);
9095 ok(received == expected,
9096 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9097 expected, received, test_index);
9101 if(uri) IUri_Release(uri);
9105 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
9106 DWORD test_index) {
9107 HRESULT hr;
9108 DWORD i;
9109 LPCWSTR received = NULL;
9110 DWORD len = -1;
9111 const uri_builder_property *prop = NULL;
9113 /* Check if the property was set earlier. */
9114 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9115 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
9116 prop = &(test->properties[i]);
9119 if(prop) {
9120 /* Use expected_value unless it's NULL, then use value. */
9121 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9122 hr = IUriBuilder_GetQuery(builder, &len, &received);
9123 if(prop->todo) {
9124 todo_wine {
9125 ok(hr == (expected ? S_OK : S_FALSE),
9126 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9127 hr, (expected ? S_OK : S_FALSE), test_index);
9129 if(SUCCEEDED(hr)) {
9130 todo_wine {
9131 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9132 expected, wine_dbgstr_w(received), test_index);
9134 todo_wine {
9135 ok(lstrlen(expected) == len,
9136 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9137 lstrlen(expected), len, test_index);
9140 } else {
9141 ok(hr == (expected ? S_OK : S_FALSE),
9142 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9143 hr, (expected ? S_OK : S_FALSE), test_index);
9144 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9145 expected, wine_dbgstr_w(received), test_index);
9146 ok(lstrlen(expected) == len,
9147 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9148 lstrlen(expected), len, test_index);
9150 } else {
9151 /* The property wasn't set earlier, so it should return whatever
9152 * the base IUri contains (if anything).
9154 IUri *uri = NULL;
9155 hr = IUriBuilder_GetIUri(builder, &uri);
9156 ok(hr == S_OK,
9157 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9158 hr, S_OK, test_index);
9159 if(SUCCEEDED(hr)) {
9160 if(!uri) {
9161 received = (void*) 0xdeadbeef;
9162 len = -1;
9164 hr = IUriBuilder_GetQuery(builder, &len, &received);
9165 ok(hr == S_FALSE,
9166 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9167 hr, S_FALSE, test_index);
9168 if(SUCCEEDED(hr)) {
9169 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9170 len, test_index);
9171 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9172 received, test_index);
9174 } else {
9175 BOOL has_prop = FALSE;
9176 BSTR expected = NULL;
9178 hr = IUri_GetQuery(uri, &expected);
9179 ok(SUCCEEDED(hr),
9180 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9181 hr, test_index);
9182 has_prop = hr == S_OK;
9184 hr = IUriBuilder_GetQuery(builder, &len, &received);
9185 if(has_prop) {
9186 ok(hr == S_OK,
9187 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9188 hr, S_OK, test_index);
9189 if(SUCCEEDED(hr)) {
9190 ok(!lstrcmpW(expected, received),
9191 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9192 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9193 ok(lstrlenW(expected) == len,
9194 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9195 lstrlenW(expected), len, test_index);
9197 } else {
9198 ok(hr == S_FALSE,
9199 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9200 hr, S_FALSE, test_index);
9201 if(SUCCEEDED(hr)) {
9202 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9203 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9204 len, test_index);
9207 SysFreeString(expected);
9210 if(uri) IUri_Release(uri);
9214 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
9215 DWORD test_index) {
9216 HRESULT hr;
9217 DWORD i;
9218 LPCWSTR received = NULL;
9219 DWORD len = -1;
9220 const uri_builder_property *prop = NULL;
9222 /* Check if the property was set earlier. */
9223 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9224 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
9225 prop = &(test->properties[i]);
9228 if(prop) {
9229 /* Use expected_value unless it's NULL, then use value. */
9230 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9231 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9232 if(prop->todo) {
9233 todo_wine {
9234 ok(hr == (expected ? S_OK : S_FALSE),
9235 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9236 hr, (expected ? S_OK : S_FALSE), test_index);
9238 if(SUCCEEDED(hr)) {
9239 todo_wine {
9240 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9241 expected, wine_dbgstr_w(received), test_index);
9243 todo_wine {
9244 ok(lstrlen(expected) == len,
9245 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9246 lstrlen(expected), len, test_index);
9249 } else {
9250 ok(hr == (expected ? S_OK : S_FALSE),
9251 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9252 hr, (expected ? S_OK : S_FALSE), test_index);
9253 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9254 expected, wine_dbgstr_w(received), test_index);
9255 ok(lstrlen(expected) == len,
9256 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9257 lstrlen(expected), len, test_index);
9259 } else {
9260 /* The property wasn't set earlier, so it should return whatever
9261 * the base IUri contains (if anything).
9263 IUri *uri = NULL;
9264 hr = IUriBuilder_GetIUri(builder, &uri);
9265 ok(hr == S_OK,
9266 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9267 hr, S_OK, test_index);
9268 if(SUCCEEDED(hr)) {
9269 if(!uri) {
9270 received = (void*) 0xdeadbeef;
9271 len = -1;
9273 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9274 ok(hr == S_FALSE,
9275 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9276 hr, S_FALSE, test_index);
9277 if(SUCCEEDED(hr)) {
9278 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9279 len, test_index);
9280 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9281 received, test_index);
9283 } else {
9284 BOOL has_prop = FALSE;
9285 BSTR expected = NULL;
9287 hr = IUri_GetSchemeName(uri, &expected);
9288 ok(SUCCEEDED(hr),
9289 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9290 hr, test_index);
9291 has_prop = hr == S_OK;
9293 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
9294 if(has_prop) {
9295 ok(hr == S_OK,
9296 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9297 hr, S_OK, test_index);
9298 if(SUCCEEDED(hr)) {
9299 ok(!lstrcmpW(expected, received),
9300 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9301 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9302 ok(lstrlenW(expected) == len,
9303 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9304 lstrlenW(expected), len, test_index);
9306 } else {
9307 ok(hr == S_FALSE,
9308 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9309 hr, S_FALSE, test_index);
9310 if(SUCCEEDED(hr)) {
9311 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9312 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9313 len, test_index);
9316 SysFreeString(expected);
9319 if(uri) IUri_Release(uri);
9323 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
9324 DWORD test_index) {
9325 HRESULT hr;
9326 DWORD i;
9327 LPCWSTR received = NULL;
9328 DWORD len = -1;
9329 const uri_builder_property *prop = NULL;
9331 /* Check if the property was set earlier. */
9332 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
9333 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
9334 prop = &(test->properties[i]);
9337 if(prop && prop->value && *prop->value) {
9338 /* Use expected_value unless it's NULL, then use value. */
9339 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
9340 hr = IUriBuilder_GetUserName(builder, &len, &received);
9341 if(prop->todo) {
9342 todo_wine {
9343 ok(hr == (expected ? S_OK : S_FALSE),
9344 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9345 hr, (expected ? S_OK : S_FALSE), test_index);
9347 if(SUCCEEDED(hr)) {
9348 todo_wine {
9349 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9350 expected, wine_dbgstr_w(received), test_index);
9352 todo_wine {
9353 ok(lstrlen(expected) == len,
9354 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9355 lstrlen(expected), len, test_index);
9358 } else {
9359 ok(hr == (expected ? S_OK : S_FALSE),
9360 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9361 hr, (expected ? S_OK : S_FALSE), test_index);
9362 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9363 expected, wine_dbgstr_w(received), test_index);
9364 ok(lstrlen(expected) == len,
9365 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9366 lstrlen(expected), len, test_index);
9368 } else {
9369 /* The property wasn't set earlier, so it should return whatever
9370 * the base IUri contains (if anything).
9372 IUri *uri = NULL;
9373 hr = IUriBuilder_GetIUri(builder, &uri);
9374 ok(hr == S_OK,
9375 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9376 hr, S_OK, test_index);
9377 if(SUCCEEDED(hr)) {
9378 if(!uri) {
9379 received = (void*) 0xdeadbeef;
9380 len = -1;
9382 hr = IUriBuilder_GetUserName(builder, &len, &received);
9383 ok(hr == S_FALSE,
9384 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9385 hr, S_FALSE, test_index);
9386 if(SUCCEEDED(hr)) {
9387 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9388 len, test_index);
9389 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9390 received, test_index);
9392 } else {
9393 BSTR expected = NULL;
9394 BOOL has_prop = FALSE;
9396 hr = IUri_GetUserName(uri, &expected);
9397 ok(SUCCEEDED(hr),
9398 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9399 hr, test_index);
9400 has_prop = hr == S_OK;
9402 hr = IUriBuilder_GetUserName(builder, &len, &received);
9403 if(has_prop) {
9404 ok(hr == S_OK,
9405 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9406 hr, S_OK, test_index);
9407 if(SUCCEEDED(hr)) {
9408 ok(!lstrcmpW(expected, received),
9409 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9410 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
9411 ok(lstrlenW(expected) == len,
9412 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9413 lstrlenW(expected), len, test_index);
9415 } else {
9416 ok(hr == S_FALSE,
9417 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9418 hr, S_FALSE, test_index);
9419 if(SUCCEEDED(hr)) {
9420 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9421 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9422 len, test_index);
9425 SysFreeString(expected);
9428 if(uri) IUri_Release(uri);
9432 /* Tests IUriBuilder functions. */
9433 static void test_IUriBuilder(void) {
9434 HRESULT hr;
9435 IUriBuilder *builder;
9436 DWORD i;
9438 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9439 IUri *uri = NULL;
9440 uri_builder_test test = uri_builder_tests[i];
9441 LPWSTR uriW = NULL;
9443 if(test.uri) {
9444 uriW = a2w(test.uri);
9445 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9446 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9447 hr, S_OK, i);
9448 if(FAILED(hr)) continue;
9450 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9451 if(test.create_builder_todo) {
9452 todo_wine {
9453 ok(hr == test.create_builder_expected,
9454 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9455 hr, test.create_builder_expected, i);
9457 } else {
9458 ok(hr == test.create_builder_expected,
9459 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9460 hr, test.create_builder_expected, i);
9462 if(SUCCEEDED(hr)) {
9463 DWORD j;
9464 BOOL modified = FALSE, received = FALSE;
9466 /* Perform all the string property changes. */
9467 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9468 uri_builder_property prop = test.properties[j];
9469 if(prop.change) {
9470 change_property(builder, &prop, i);
9471 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9472 prop.property != Uri_PROPERTY_HOST)
9473 modified = TRUE;
9474 else if(prop.value && *prop.value)
9475 modified = TRUE;
9476 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9477 /* Host name property can't be NULL, but it can be empty. */
9478 modified = TRUE;
9482 if(test.port_prop.change) {
9483 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9484 modified = TRUE;
9485 if(test.port_prop.todo) {
9486 todo_wine {
9487 ok(hr == test.port_prop.expected,
9488 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9489 hr, test.port_prop.expected, i);
9491 } else {
9492 ok(hr == test.port_prop.expected,
9493 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9494 hr, test.port_prop.expected, i);
9498 hr = IUriBuilder_HasBeenModified(builder, &received);
9499 ok(hr == S_OK,
9500 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9501 hr, S_OK, i);
9502 if(SUCCEEDED(hr))
9503 ok(received == modified,
9504 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9505 modified, received, i);
9507 /* Test the "Get*" functions. */
9508 test_IUriBuilder_GetFragment(builder, &test, i);
9509 test_IUriBuilder_GetHost(builder, &test, i);
9510 test_IUriBuilder_GetPassword(builder, &test, i);
9511 test_IUriBuilder_GetPath(builder, &test, i);
9512 test_IUriBuilder_GetPort(builder, &test, i);
9513 test_IUriBuilder_GetQuery(builder, &test, i);
9514 test_IUriBuilder_GetSchemeName(builder, &test, i);
9515 test_IUriBuilder_GetUserName(builder, &test, i);
9517 test_IUriBuilder_CreateUri(builder, &test, i);
9518 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9519 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9521 if(builder) IUriBuilder_Release(builder);
9522 if(uri) IUri_Release(uri);
9523 heap_free(uriW);
9527 static void test_IUriBuilder_HasBeenModified(void) {
9528 HRESULT hr;
9529 IUriBuilder *builder = NULL;
9531 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9532 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9533 if(SUCCEEDED(hr)) {
9534 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9535 IUri *uri = NULL;
9536 BOOL received;
9538 hr = IUriBuilder_HasBeenModified(builder, NULL);
9539 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9540 hr, E_POINTER);
9542 hr = IUriBuilder_SetHost(builder, hostW);
9543 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9544 hr, S_OK);
9546 hr = IUriBuilder_HasBeenModified(builder, &received);
9547 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9548 hr, S_OK);
9549 if(SUCCEEDED(hr))
9550 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9552 hr = pCreateUri(http_urlW, 0, 0, &uri);
9553 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9554 if(SUCCEEDED(hr)) {
9555 LPCWSTR prop;
9556 DWORD len = -1;
9558 hr = IUriBuilder_SetIUri(builder, uri);
9559 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9560 hr, S_OK);
9562 hr = IUriBuilder_HasBeenModified(builder, &received);
9563 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9564 hr, S_OK);
9565 if(SUCCEEDED(hr))
9566 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9568 /* Test what happens with you call SetIUri with the same IUri again. */
9569 hr = IUriBuilder_SetHost(builder, hostW);
9570 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9572 hr = IUriBuilder_HasBeenModified(builder, &received);
9573 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9574 hr, S_OK);
9575 if(SUCCEEDED(hr))
9576 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9578 hr = IUriBuilder_SetIUri(builder, uri);
9579 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9581 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9582 * reset any of the changes that were made to the IUriBuilder.
9584 hr = IUriBuilder_HasBeenModified(builder, &received);
9585 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9586 if(SUCCEEDED(hr))
9587 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9589 hr = IUriBuilder_GetHost(builder, &len, &prop);
9590 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9591 if(SUCCEEDED(hr)) {
9592 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9593 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9594 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9595 lstrlenW(hostW), len);
9598 hr = IUriBuilder_SetIUri(builder, NULL);
9599 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9601 hr = IUriBuilder_SetHost(builder, hostW);
9602 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9603 hr = IUriBuilder_HasBeenModified(builder, &received);
9604 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9605 hr, S_OK);
9606 if(SUCCEEDED(hr))
9607 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9609 hr = IUriBuilder_SetIUri(builder, NULL);
9610 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9612 hr = IUriBuilder_HasBeenModified(builder, &received);
9613 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9614 hr, S_OK);
9615 if(SUCCEEDED(hr))
9616 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9618 hr = IUriBuilder_GetHost(builder, &len, &prop);
9619 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9620 if(SUCCEEDED(hr)) {
9621 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9622 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9623 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9624 lstrlenW(hostW), len);
9627 if(uri) IUri_Release(uri);
9629 if(builder) IUriBuilder_Release(builder);
9632 /* Test IUriBuilder {Get,Set}IUri functions. */
9633 static void test_IUriBuilder_IUriProperty(void) {
9634 IUriBuilder *builder = NULL;
9635 HRESULT hr;
9637 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9638 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9639 if(SUCCEEDED(hr)) {
9640 IUri *uri = NULL;
9642 hr = IUriBuilder_GetIUri(builder, NULL);
9643 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9644 hr, E_POINTER);
9646 hr = pCreateUri(http_urlW, 0, 0, &uri);
9647 if(SUCCEEDED(hr)) {
9648 IUri *test = NULL;
9649 ULONG cur_count, orig_count;
9651 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9652 orig_count = get_refcnt(uri);
9653 hr = IUriBuilder_SetIUri(builder, uri);
9654 cur_count = get_refcnt(uri);
9655 if(SUCCEEDED(hr))
9656 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9657 orig_count+1, cur_count);
9659 hr = IUriBuilder_SetIUri(builder, NULL);
9660 cur_count = get_refcnt(uri);
9661 if(SUCCEEDED(hr))
9662 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9663 orig_count, cur_count);
9665 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9666 hr = IUriBuilder_SetIUri(builder, uri);
9667 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9668 orig_count = get_refcnt(uri);
9670 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9671 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9672 if(SUCCEEDED(hr)) {
9673 cur_count = get_refcnt(uri);
9674 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9675 orig_count+1, cur_count);
9676 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9677 uri, test);
9679 if(test) IUri_Release(test);
9681 test = NULL;
9682 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9683 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9684 if(SUCCEEDED(hr)) {
9685 cur_count = get_refcnt(uri);
9686 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9687 orig_count+1, cur_count);
9688 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9690 if(test) IUri_Release(test);
9692 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9693 * the base IUri.
9695 test = NULL;
9696 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9697 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9698 if(SUCCEEDED(hr))
9699 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9701 if(test) IUri_Release(test);
9703 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9704 * explicitly set (because it's a default flags).
9706 test = NULL;
9707 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9708 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9709 if(SUCCEEDED(hr)) {
9710 cur_count = get_refcnt(uri);
9711 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9712 orig_count+1, cur_count);
9713 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9715 if(test) IUri_Release(test);
9717 test = NULL;
9718 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9719 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9720 if(SUCCEEDED(hr)) {
9721 cur_count = get_refcnt(uri);
9722 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9723 orig_count+1, cur_count);
9724 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9726 if(test) IUri_Release(test);
9728 test = NULL;
9729 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9730 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9731 hr, S_OK);
9732 if(SUCCEEDED(hr)) {
9733 cur_count = get_refcnt(uri);
9734 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9735 orig_count+1, cur_count);
9736 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9738 if(test) IUri_Release(test);
9740 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9741 * the base IUri.
9743 test = NULL;
9744 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9745 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9746 if(SUCCEEDED(hr))
9747 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9749 if(test) IUri_Release(test);
9751 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9752 * explicitly set (because it's a default flags).
9754 test = NULL;
9755 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9756 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9757 if(SUCCEEDED(hr)) {
9758 cur_count = get_refcnt(uri);
9759 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9760 orig_count+1, cur_count);
9761 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9763 if(test) IUri_Release(test);
9765 if(uri) IUri_Release(uri);
9767 if(builder) IUriBuilder_Release(builder);
9770 static void test_IUriBuilder_RemoveProperties(void) {
9771 IUriBuilder *builder = NULL;
9772 HRESULT hr;
9773 DWORD i;
9775 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9776 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9777 if(SUCCEEDED(hr)) {
9778 /* Properties that can't be removed. */
9779 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9780 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9782 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9783 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9784 if((i << 1) & invalid) {
9785 ok(hr == E_INVALIDARG,
9786 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9787 hr, E_INVALIDARG, i);
9788 } else {
9789 ok(hr == S_OK,
9790 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9791 hr, S_OK, i);
9795 /* Also doesn't accept anything that's outside the range of the
9796 * Uri_HAS flags.
9798 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9799 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9800 hr, E_INVALIDARG);
9802 if(builder) IUriBuilder_Release(builder);
9804 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9805 uri_builder_remove_test test = uri_builder_remove_tests[i];
9806 IUri *uri = NULL;
9807 LPWSTR uriW;
9809 uriW = a2w(test.uri);
9810 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9811 if(SUCCEEDED(hr)) {
9812 builder = NULL;
9814 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9815 if(test.create_builder_todo) {
9816 todo_wine {
9817 ok(hr == test.create_builder_expected,
9818 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9819 hr, test.create_builder_expected, i);
9821 } else {
9822 ok(hr == test.create_builder_expected,
9823 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9824 hr, test.create_builder_expected, i);
9826 if(SUCCEEDED(hr)) {
9827 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9828 if(test.remove_todo) {
9829 todo_wine {
9830 ok(hr == test.remove_expected,
9831 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9832 hr, test.remove_expected, i);
9834 } else {
9835 ok(hr == test.remove_expected,
9836 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9837 hr, test.remove_expected, i);
9839 if(SUCCEEDED(hr)) {
9840 IUri *result = NULL;
9842 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9843 if(test.expected_todo) {
9844 todo_wine {
9845 ok(hr == test.expected_hres,
9846 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9847 hr, test.expected_hres, i);
9849 } else {
9850 ok(hr == test.expected_hres,
9851 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9852 hr, test.expected_hres, i);
9854 if(SUCCEEDED(hr)) {
9855 BSTR received = NULL;
9857 hr = IUri_GetAbsoluteUri(result, &received);
9858 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9859 ok(!strcmp_aw(test.expected_uri, received),
9860 "Error: Expected %s but got %s instead on test %d.\n",
9861 test.expected_uri, wine_dbgstr_w(received), i);
9862 SysFreeString(received);
9864 if(result) IUri_Release(result);
9867 if(builder) IUriBuilder_Release(builder);
9869 if(uri) IUri_Release(uri);
9870 heap_free(uriW);
9874 static void test_IUriBuilder_Misc(void) {
9875 HRESULT hr;
9876 IUri *uri;
9878 hr = pCreateUri(http_urlW, 0, 0, &uri);
9879 if(SUCCEEDED(hr)) {
9880 IUriBuilder *builder;
9882 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9883 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9884 if(SUCCEEDED(hr)) {
9885 BOOL has = -1;
9886 DWORD port = -1;
9888 hr = IUriBuilder_GetPort(builder, &has, &port);
9889 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9890 if(SUCCEEDED(hr)) {
9891 /* 'has' will be set to FALSE, even though uri had a port. */
9892 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9893 /* Still sets 'port' to 80. */
9894 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9897 if(builder) IUriBuilder_Release(builder);
9899 if(uri) IUri_Release(uri);
9902 static void test_IUriBuilderFactory(void) {
9903 HRESULT hr;
9904 IUri *uri;
9905 IUriBuilderFactory *factory;
9906 IUriBuilder *builder;
9908 hr = pCreateUri(http_urlW, 0, 0, &uri);
9909 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9910 if(SUCCEEDED(hr)) {
9911 factory = NULL;
9912 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9913 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9914 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9916 if(SUCCEEDED(hr)) {
9917 builder = (void*) 0xdeadbeef;
9918 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9919 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9920 hr, E_INVALIDARG);
9921 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9923 builder = (void*) 0xdeadbeef;
9924 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9925 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9926 hr, E_INVALIDARG);
9927 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9929 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9930 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9931 hr, E_POINTER);
9933 builder = NULL;
9934 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9935 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9936 hr, S_OK);
9937 if(SUCCEEDED(hr)) {
9938 IUri *tmp = (void*) 0xdeadbeef;
9939 LPCWSTR result;
9940 DWORD result_len;
9942 hr = IUriBuilder_GetIUri(builder, &tmp);
9943 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9944 hr, S_OK);
9945 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9947 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9948 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9949 hr, S_FALSE);
9951 if(builder) IUriBuilder_Release(builder);
9953 builder = (void*) 0xdeadbeef;
9954 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9955 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9956 hr, E_INVALIDARG);
9957 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9959 builder = (void*) 0xdeadbeef;
9960 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9961 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9962 hr, E_INVALIDARG);
9963 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9965 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9966 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9967 hr, E_POINTER);
9969 builder = NULL;
9970 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9971 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9972 hr, S_OK);
9973 if(SUCCEEDED(hr)) {
9974 IUri *tmp = NULL;
9976 hr = IUriBuilder_GetIUri(builder, &tmp);
9977 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9978 hr, S_OK);
9979 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9980 if(uri) IUri_Release(uri);
9982 if(builder) IUriBuilder_Release(builder);
9984 if(factory) IUriBuilderFactory_Release(factory);
9986 if(uri) IUri_Release(uri);
9989 static void test_CoInternetCombineIUri(void) {
9990 HRESULT hr;
9991 IUri *base, *relative, *result;
9992 DWORD i;
9994 base = NULL;
9995 hr = pCreateUri(http_urlW, 0, 0, &base);
9996 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9997 if(SUCCEEDED(hr)) {
9998 result = (void*) 0xdeadbeef;
9999 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
10000 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10001 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10004 relative = NULL;
10005 hr = pCreateUri(http_urlW, 0, 0, &relative);
10006 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
10007 if(SUCCEEDED(hr)) {
10008 result = (void*) 0xdeadbeef;
10009 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
10010 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10011 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
10014 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
10015 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
10017 if(base) IUri_Release(base);
10018 if(relative) IUri_Release(relative);
10020 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10021 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10023 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10024 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10025 if(SUCCEEDED(hr)) {
10026 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10028 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
10029 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
10030 if(SUCCEEDED(hr)) {
10031 result = NULL;
10033 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
10034 if(uri_combine_tests[i].todo) {
10035 todo_wine {
10036 ok(hr == uri_combine_tests[i].expected,
10037 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10038 hr, uri_combine_tests[i].expected, i);
10040 } else {
10041 ok(hr == uri_combine_tests[i].expected,
10042 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10043 hr, uri_combine_tests[i]. expected, i);
10045 if(SUCCEEDED(hr)) {
10046 DWORD j;
10048 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10049 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10050 BSTR received;
10052 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10053 if(prop.todo) {
10054 todo_wine {
10055 ok(hr == prop.expected,
10056 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10057 hr, prop.expected, i, j);
10059 todo_wine {
10060 ok(!strcmp_aw(prop.value, received) ||
10061 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10062 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10063 prop.value, wine_dbgstr_w(received), i, j);
10065 } else {
10066 ok(hr == prop.expected,
10067 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10068 hr, prop.expected, i, j);
10069 ok(!strcmp_aw(prop.value, received) ||
10070 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10071 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10072 prop.value, wine_dbgstr_w(received), i, j);
10074 SysFreeString(received);
10077 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10078 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10079 DWORD received;
10081 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10082 if(prop.todo) {
10083 todo_wine {
10084 ok(hr == prop.expected,
10085 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10086 hr, prop.expected, i, j);
10088 todo_wine {
10089 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10090 prop.value, received, i, j);
10092 } else {
10093 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10094 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10095 hr, prop.expected, i, j);
10096 if(!prop.broken_combine_hres || hr != S_FALSE)
10097 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10098 prop.value, received, i, j);
10102 if(result) IUri_Release(result);
10104 if(relative) IUri_Release(relative);
10105 heap_free(relativeW);
10107 if(base) IUri_Release(base);
10108 heap_free(baseW);
10112 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
10113 REFIID riid, void **ppv)
10115 ok(0, "unexpected call\n");
10116 return E_NOINTERFACE;
10119 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
10121 return 2;
10124 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
10126 return 1;
10129 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
10130 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
10131 DWORD *pcchResult, DWORD dwReserved)
10133 CHECK_EXPECT(ParseUrl);
10134 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
10135 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
10136 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
10137 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
10138 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
10140 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
10141 *pcchResult = lstrlenW(parse_resultW);
10143 return S_OK;
10146 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
10147 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
10148 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
10150 CHECK_EXPECT(CombineUrl);
10151 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
10152 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
10153 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
10154 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
10155 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
10156 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
10157 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
10159 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
10160 *pcchResult = lstrlenW(combine_resultW);
10162 return S_OK;
10165 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
10166 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
10168 ok(0, "unexpected call\n");
10169 return E_NOTIMPL;
10172 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
10173 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
10174 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
10176 ok(0, "unexpected call\n");
10177 return E_NOTIMPL;
10180 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
10181 InternetProtocolInfo_QueryInterface,
10182 InternetProtocolInfo_AddRef,
10183 InternetProtocolInfo_Release,
10184 InternetProtocolInfo_ParseUrl,
10185 InternetProtocolInfo_CombineUrl,
10186 InternetProtocolInfo_CompareUrl,
10187 InternetProtocolInfo_QueryInfo
10190 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
10192 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
10194 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
10195 *ppv = &protocol_info;
10196 return S_OK;
10199 ok(0, "unexpected call\n");
10200 return E_NOINTERFACE;
10203 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
10205 return 2;
10208 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
10210 return 1;
10213 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
10214 REFIID riid, void **ppv)
10216 ok(0, "unexpected call\n");
10217 return E_NOTIMPL;
10220 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
10222 ok(0, "unexpected call\n");
10223 return S_OK;
10226 static const IClassFactoryVtbl ClassFactoryVtbl = {
10227 ClassFactory_QueryInterface,
10228 ClassFactory_AddRef,
10229 ClassFactory_Release,
10230 ClassFactory_CreateInstance,
10231 ClassFactory_LockServer
10234 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
10236 static void register_protocols(void)
10238 IInternetSession *session;
10239 HRESULT hres;
10241 hres = pCoInternetGetSession(0, &session, 0);
10242 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
10243 if(FAILED(hres))
10244 return;
10246 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
10247 winetestW, 0, NULL, 0);
10248 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
10250 IInternetSession_Release(session);
10253 static void unregister_protocols(void) {
10254 IInternetSession *session;
10255 HRESULT hr;
10257 hr = pCoInternetGetSession(0, &session, 0);
10258 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
10259 if(FAILED(hr))
10260 return;
10262 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
10263 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
10265 IInternetSession_Release(session);
10268 static void test_CoInternetCombineIUri_Pluggable(void) {
10269 HRESULT hr;
10270 IUri *base = NULL;
10272 hr = pCreateUri(combine_baseW, 0, 0, &base);
10273 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10274 if(SUCCEEDED(hr)) {
10275 IUri *relative = NULL;
10277 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
10278 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10279 if(SUCCEEDED(hr)) {
10280 IUri *result = NULL;
10282 SET_EXPECT(CombineUrl);
10284 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10285 &result, 0);
10286 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10288 CHECK_CALLED(CombineUrl);
10290 if(SUCCEEDED(hr)) {
10291 BSTR received = NULL;
10292 hr = IUri_GetAbsoluteUri(result, &received);
10293 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10294 if(SUCCEEDED(hr)) {
10295 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10296 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10298 SysFreeString(received);
10300 if(result) IUri_Release(result);
10302 if(relative) IUri_Release(relative);
10304 if(base) IUri_Release(base);
10307 static void test_CoInternetCombineUrlEx(void) {
10308 HRESULT hr;
10309 IUri *base, *result;
10310 DWORD i;
10312 base = NULL;
10313 hr = pCreateUri(http_urlW, 0, 0, &base);
10314 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10315 if(SUCCEEDED(hr)) {
10316 result = (void*) 0xdeadbeef;
10317 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
10318 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10319 hr, E_UNEXPECTED);
10320 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
10323 result = (void*) 0xdeadbeef;
10324 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
10325 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10326 hr, E_INVALIDARG);
10327 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10329 result = (void*) 0xdeadbeef;
10330 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
10331 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10332 hr, E_UNEXPECTED);
10333 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
10335 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
10336 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10337 hr, E_POINTER);
10338 if(base) IUri_Release(base);
10340 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
10341 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
10343 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
10344 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
10345 if(SUCCEEDED(hr)) {
10346 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
10348 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
10349 &result, 0);
10350 if(uri_combine_tests[i].todo) {
10351 todo_wine {
10352 ok(hr == uri_combine_tests[i].expected,
10353 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10354 hr, uri_combine_tests[i].expected, i);
10356 } else {
10357 ok(hr == uri_combine_tests[i].expected,
10358 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10359 hr, uri_combine_tests[i]. expected, i);
10361 if(SUCCEEDED(hr)) {
10362 DWORD j;
10364 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
10365 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
10366 BSTR received;
10367 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
10369 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
10370 if(prop.todo) {
10371 todo_wine {
10372 ok(hr == prop.expected,
10373 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10374 hr, prop.expected, i, j);
10376 todo_wine {
10377 ok(!strcmp_aw(value, received) ||
10378 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10379 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10380 value, wine_dbgstr_w(received), i, j);
10382 } else {
10383 ok(hr == prop.expected,
10384 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10385 hr, prop.expected, i, j);
10386 ok(!strcmp_aw(value, received) ||
10387 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
10388 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10389 value, wine_dbgstr_w(received), i, j);
10391 SysFreeString(received);
10394 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
10395 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
10396 DWORD received;
10398 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
10399 if(prop.todo) {
10400 todo_wine {
10401 ok(hr == prop.expected,
10402 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10403 hr, prop.expected, i, j);
10405 todo_wine {
10406 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10407 prop.value, received, i, j);
10409 } else {
10410 ok(hr == prop.expected || broken(prop.broken_combine_hres && hr == S_FALSE),
10411 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10412 hr, prop.expected, i, j);
10413 if(!prop.broken_combine_hres || hr != S_FALSE)
10414 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10415 prop.value, received, i, j);
10419 if(result) IUri_Release(result);
10420 heap_free(relativeW);
10422 if(base) IUri_Release(base);
10423 heap_free(baseW);
10427 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10428 HRESULT hr;
10429 IUri *base = NULL;
10431 hr = pCreateUri(combine_baseW, 0, 0, &base);
10432 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10433 if(SUCCEEDED(hr)) {
10434 IUri *result = NULL;
10436 SET_EXPECT(CombineUrl);
10438 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10439 &result, 0);
10440 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10442 CHECK_CALLED(CombineUrl);
10444 if(SUCCEEDED(hr)) {
10445 BSTR received = NULL;
10446 hr = IUri_GetAbsoluteUri(result, &received);
10447 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10448 if(SUCCEEDED(hr)) {
10449 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10450 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10452 SysFreeString(received);
10454 if(result) IUri_Release(result);
10456 if(base) IUri_Release(base);
10459 static void test_CoInternetParseIUri_InvalidArgs(void) {
10460 HRESULT hr;
10461 IUri *uri = NULL;
10462 WCHAR tmp[3];
10463 DWORD result = -1;
10465 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10466 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10467 hr, E_INVALIDARG);
10468 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10470 hr = pCreateUri(http_urlW, 0, 0, &uri);
10471 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10472 if(SUCCEEDED(hr)) {
10473 DWORD expected_len;
10475 result = -1;
10476 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10477 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10478 hr, E_INVALIDARG);
10479 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10481 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10482 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10483 hr, E_POINTER);
10485 result = -1;
10486 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10487 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10488 hr, E_FAIL);
10489 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10491 result = -1;
10492 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10493 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10494 hr, E_FAIL);
10495 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10497 result = -1;
10498 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10499 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10500 hr, E_FAIL);
10501 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10503 result = -1;
10504 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10505 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10506 hr, E_FAIL);
10507 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10509 expected_len = lstrlenW(http_urlW);
10510 result = -1;
10511 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10512 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10513 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10514 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10515 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10516 expected_len, result);
10518 if(uri) IUri_Release(uri);
10521 static void test_CoInternetParseIUri(void) {
10522 DWORD i;
10524 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10525 HRESULT hr;
10526 IUri *uri;
10527 LPWSTR uriW;
10528 uri_parse_test test = uri_parse_tests[i];
10530 uriW = a2w(test.uri);
10531 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10532 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10533 if(SUCCEEDED(hr)) {
10534 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10535 DWORD result_len = -1;
10537 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10538 if(test.todo) {
10539 todo_wine {
10540 ok(hr == test.expected,
10541 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10542 hr, test.expected, i);
10544 } else {
10545 ok(hr == test.expected,
10546 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10547 hr, test.expected, i);
10549 if(SUCCEEDED(hr)) {
10550 DWORD len = lstrlenA(test.property);
10551 ok(!strcmp_aw(test.property, result),
10552 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10553 test.property, wine_dbgstr_w(result), i);
10554 ok(len == result_len,
10555 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10556 len, result_len, i);
10557 } else {
10558 ok(!result_len,
10559 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10560 result_len, i);
10563 if(uri) IUri_Release(uri);
10564 heap_free(uriW);
10568 static void test_CoInternetParseIUri_Pluggable(void) {
10569 HRESULT hr;
10570 IUri *uri = NULL;
10572 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10573 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10574 if(SUCCEEDED(hr)) {
10575 WCHAR result[200];
10576 DWORD result_len;
10578 SET_EXPECT(ParseUrl);
10580 parse_action = PARSE_CANONICALIZE;
10581 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10583 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10584 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10586 CHECK_CALLED(ParseUrl);
10588 if(SUCCEEDED(hr)) {
10589 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10590 lstrlenW(parse_resultW), result_len);
10591 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10592 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10595 if(uri) IUri_Release(uri);
10598 typedef struct {
10599 const char *url;
10600 DWORD uri_flags;
10601 const char *base_url;
10602 DWORD base_uri_flags;
10603 const char *legacy_url;
10604 const char *uniform_url;
10605 const char *no_canon_url;
10606 const char *uri_url;
10607 } create_urlmon_test_t;
10609 static const create_urlmon_test_t create_urlmon_tests[] = {
10611 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10612 NULL,0,
10613 "http://www.winehq.org/",
10614 "http://www.winehq.org/",
10615 "http://www.winehq.org",
10616 "http://www.winehq.org"
10619 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10620 NULL,0,
10621 "file://c:\\dir\\file.txt",
10622 "file:///c:/dir/file.txt",
10623 "file:///c:/dir/file.txt",
10624 "file:///c:/dir/file.txt"
10627 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10628 NULL,0,
10629 "file://c:\\dir\\file.txt",
10630 "file:///c:/dir/file.txt",
10631 "file:///c:/dir/file.txt",
10632 "file://c:\\dir\\file.txt"
10635 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10636 "http://www.winehq.org",0,
10637 "http://www.winehq.org/data",
10638 "http://www.winehq.org/data",
10639 "http://www.winehq.org:80/data",
10642 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10643 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10644 "file://c:\\dir\\file.txt",
10645 "file:///c:/dir/file.txt",
10646 "file:///c:/dir/file.txt",
10649 "",Uri_CREATE_ALLOW_RELATIVE,
10650 NULL,0,
10657 "test",Uri_CREATE_ALLOW_RELATIVE,
10658 NULL,0,
10659 "test",
10660 "test",
10661 "test",
10662 "test"
10665 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10666 NULL,0,
10667 "file://c:\\dir\\file.txt",
10668 "file:///c:/dir/file.txt",
10669 "file:///c:/dir/file.txt",
10670 "file:///c:/dir/file.txt",
10674 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10675 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10677 WCHAR *display_name;
10678 HRESULT hres;
10680 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10681 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10682 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10683 wine_dbgstr_w(display_name), exurl);
10685 CoTaskMemFree(display_name);
10688 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10689 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10691 IUriContainer *uri_container;
10692 IUri *uri;
10693 BSTR display_uri;
10694 HRESULT hres;
10696 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10697 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10699 uri = NULL;
10700 hres = IUriContainer_GetIUri(uri_container, &uri);
10701 IUriContainer_Release(uri_container);
10702 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10703 ok(uri != NULL, "uri == NULL\n");
10705 hres = IUri_GetDisplayUri(uri, &display_uri);
10706 IUri_Release(uri);
10707 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10708 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10709 wine_dbgstr_w(display_uri), exurl);
10710 SysFreeString(display_uri);
10713 static void test_CreateURLMoniker(void)
10715 const create_urlmon_test_t *test;
10716 IMoniker *mon, *base_mon;
10717 WCHAR *url, *base_url;
10718 IUri *uri, *base_uri;
10719 HRESULT hres;
10721 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10722 url = a2w(test->url);
10723 base_url = a2w(test->base_url);
10725 if(base_url) {
10726 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10727 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10729 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10730 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10731 }else {
10732 base_uri = NULL;
10733 base_mon = NULL;
10736 hres = CreateURLMoniker(base_mon, url, &mon);
10737 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10738 test_urlmon_display_name(mon, test->legacy_url);
10739 test_display_uri(mon, test->legacy_url);
10740 IMoniker_Release(mon);
10742 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10743 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10744 test_urlmon_display_name(mon, test->legacy_url);
10745 test_display_uri(mon, test->legacy_url);
10746 IMoniker_Release(mon);
10748 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10749 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10750 test_urlmon_display_name(mon, test->uniform_url);
10751 test_display_uri(mon, test->uniform_url);
10752 IMoniker_Release(mon);
10754 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10755 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10756 test_urlmon_display_name(mon, test->no_canon_url);
10757 test_display_uri(mon, test->no_canon_url);
10758 IMoniker_Release(mon);
10760 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10761 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10763 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10764 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10765 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10766 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10767 IMoniker_Release(mon);
10769 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10770 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10771 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10772 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10773 IMoniker_Release(mon);
10775 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10776 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10777 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10778 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10779 IMoniker_Release(mon);
10781 IUri_Release(uri);
10782 heap_free(url);
10783 heap_free(base_url);
10784 if(base_uri)
10785 IUri_Release(base_uri);
10786 if(base_mon)
10787 IMoniker_Release(base_mon);
10791 static int add_default_flags(DWORD flags) {
10792 if(!(flags & Uri_CREATE_NO_CANONICALIZE))
10793 flags |= Uri_CREATE_CANONICALIZE;
10794 if(!(flags & Uri_CREATE_NO_DECODE_EXTRA_INFO))
10795 flags |= Uri_CREATE_DECODE_EXTRA_INFO;
10796 if(!(flags & Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES))
10797 flags |= Uri_CREATE_CRACK_UNKNOWN_SCHEMES;
10798 if(!(flags & Uri_CREATE_NO_PRE_PROCESS_HTML_URI))
10799 flags |= Uri_CREATE_PRE_PROCESS_HTML_URI;
10800 if(!(flags & Uri_CREATE_IE_SETTINGS))
10801 flags |= Uri_CREATE_NO_IE_SETTINGS;
10803 return flags;
10806 static void test_IPersistStream(void)
10808 int i, props_order[Uri_PROPERTY_DWORD_LAST+1] = { 0 };
10810 props_order[Uri_PROPERTY_RAW_URI] = 1;
10811 props_order[Uri_PROPERTY_FRAGMENT] = 2;
10812 props_order[Uri_PROPERTY_HOST] = 3;
10813 props_order[Uri_PROPERTY_PASSWORD] = 4;
10814 props_order[Uri_PROPERTY_PATH] = 5;
10815 props_order[Uri_PROPERTY_PORT] = 6;
10816 props_order[Uri_PROPERTY_QUERY] = 7;
10817 props_order[Uri_PROPERTY_SCHEME_NAME] = 8;
10818 props_order[Uri_PROPERTY_USER_NAME] = 9;
10820 for(i=0; i<sizeof(uri_tests)/sizeof(*uri_tests); i++) {
10821 const uri_properties *test = uri_tests+i;
10822 LPWSTR uriW;
10823 IUri *uri;
10824 IPersistStream *persist_stream;
10825 IStream *stream;
10826 IMarshal *marshal;
10827 DWORD props, props_no, dw_data[6];
10828 WCHAR str_data[1024];
10829 ULARGE_INTEGER size, max_size;
10830 LARGE_INTEGER no_off;
10831 CLSID curi;
10832 BSTR raw_uri;
10833 HRESULT hr;
10835 if(test->create_todo || test->create_expected!=S_OK)
10836 continue;
10838 uriW = a2w(test->uri);
10839 hr = pCreateUri(uriW, test->create_flags, 0, &uri);
10840 ok(hr == S_OK, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i, hr);
10842 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10843 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10845 hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
10846 ok(hr == S_OK, "CreateStreamOnHGlobal failed 0x%08x.\n", hr);
10847 hr = IPersistStream_IsDirty(persist_stream);
10848 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10849 hr = IPersistStream_Save(persist_stream, stream, FALSE);
10850 ok(hr == S_OK, "%d) Save failed 0x%08x, expected S_OK.\n", i, hr);
10851 hr = IPersistStream_IsDirty(persist_stream);
10852 ok(hr == S_FALSE, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i, hr);
10853 no_off.QuadPart = 0;
10854 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
10855 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10856 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10857 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10858 hr = IPersistStream_GetSizeMax(persist_stream, &max_size);
10859 ok(hr == S_OK, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i, hr);
10860 ok(U(size).LowPart+2 == U(max_size).LowPart,
10861 "%d) Written data size is %d, max_size %d.\n",
10862 i, U(size).LowPart, U(max_size).LowPart);
10864 hr = IStream_Read(stream, (void*)dw_data, sizeof(DWORD), NULL);
10865 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10866 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
10867 i, dw_data[0]-2, U(size).LowPart);
10868 hr = IStream_Read(stream, (void*)dw_data, 6*sizeof(DWORD), NULL);
10869 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10870 ok(dw_data[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[0]);
10871 ok(dw_data[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[1]);
10872 ok(dw_data[2] == add_default_flags(test->create_flags),
10873 "%d) Incorrect value %x, expected %x (creation flags).\n",
10874 i, dw_data[2], add_default_flags(test->create_flags));
10875 ok(dw_data[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[3]);
10876 ok(dw_data[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[4]);
10877 ok(dw_data[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i, dw_data[5]);
10879 props_no = 0;
10880 for(props=0; props<=Uri_PROPERTY_DWORD_LAST; props++) {
10881 if(!props_order[props])
10882 continue;
10884 if(props <= Uri_PROPERTY_STRING_LAST) {
10885 if(test->str_props[props].expected == S_OK)
10886 props_no++;
10887 } else {
10888 if(test->dword_props[props-Uri_PROPERTY_DWORD_START].expected == S_OK)
10889 props_no++;
10892 if(test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTP
10893 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_FTP
10894 && test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value != URL_SCHEME_HTTPS)
10895 props_no = 1;
10897 hr = IStream_Read(stream, (void*)&props, sizeof(DWORD), NULL);
10898 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10899 ok(props == props_no, "%d) Properties no is %d, expected %d.\n", i, props, props_no);
10901 dw_data[2] = 0;
10902 dw_data[3] = -1;
10903 while(props) {
10904 hr = IStream_Read(stream, (void*)dw_data, 2*sizeof(DWORD), NULL);
10905 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10906 props--;
10907 ok(dw_data[2]<props_order[dw_data[0]],
10908 "%d) Incorrect properties order (%d, %d)\n",
10909 i, dw_data[0], dw_data[3]);
10910 dw_data[2] = props_order[dw_data[0]];
10911 dw_data[3] = dw_data[0];
10913 if(dw_data[0]<=Uri_PROPERTY_STRING_LAST) {
10914 const uri_str_property *prop = test->str_props+dw_data[0];
10915 hr = IStream_Read(stream, (void*)str_data, dw_data[1], NULL);
10916 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10917 ok(!strcmp_aw(prop->value, str_data) || broken(prop->broken_value && !strcmp_aw(prop->broken_value, str_data)),
10918 "%d) Expected %s but got %s (%d).\n", i, prop->value, wine_dbgstr_w(str_data), dw_data[0]);
10919 } else if(dw_data[0]>=Uri_PROPERTY_DWORD_START && dw_data[0]<=Uri_PROPERTY_DWORD_LAST) {
10920 const uri_dword_property *prop = test->dword_props+dw_data[0]-Uri_PROPERTY_DWORD_START;
10921 ok(dw_data[1] == sizeof(DWORD), "%d) Size of dword property is %d (%d)\n", i, dw_data[1], dw_data[0]);
10922 hr = IStream_Read(stream, (void*)&dw_data[1], sizeof(DWORD), NULL);
10923 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10924 ok(prop->value == dw_data[1], "%d) Expected %d but got %d (%d).\n", i, prop->value, dw_data[1], dw_data[0]);
10925 } else {
10926 ok(FALSE, "%d) Incorrect property type (%d)\n", i, dw_data[0]);
10927 break;
10930 ok(props == 0, "%d) No all properties were processed %d. Next property type: %d\n",
10931 i, props, dw_data[0]);
10933 IPersistStream_Release(persist_stream);
10934 IUri_Release(uri);
10936 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10937 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10938 hr = IPersistStream_GetClassID(persist_stream, &curi);
10939 ok(hr == S_OK, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i, hr);
10940 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetClassID returned incorrect CLSID.\n", i);
10941 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
10942 &IID_IUri, (void**)&uri);
10943 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
10944 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&persist_stream);
10945 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
10946 hr = IPersistStream_Load(persist_stream, stream);
10947 ok(hr == S_OK, "%d) Load failed 0x%08x, expected S_OK.\n", i, hr);
10948 hr = IUri_GetRawUri(uri, &raw_uri);
10949 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
10950 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
10951 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
10952 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
10953 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
10954 wine_dbgstr_w(raw_uri));
10955 SysFreeString(raw_uri);
10957 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
10958 ok(hr == S_OK, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i, hr);
10959 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10960 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10961 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10962 MSHCTX_DIFFERENTMACHINE, NULL, MSHLFLAGS_NORMAL);
10963 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10964 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10965 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL);
10966 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10967 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10968 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
10969 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10970 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10971 MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLEWEAK);
10972 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10973 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10974 MSHCTX_LOCAL, NULL, MSHLFLAGS_NOPING);
10975 ok(hr == E_INVALIDARG, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10976 hr = IMarshal_MarshalInterface(marshal, stream, &IID_IUri, (void*)uri,
10977 MSHCTX_LOCAL, NULL, MSHLFLAGS_NORMAL);
10978 ok(hr == S_OK, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
10979 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
10980 MSHCTX_CROSSCTX, NULL, MSHLFLAGS_NORMAL, &curi);
10981 ok(hr == E_INVALIDARG, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i, hr);
10982 hr = IMarshal_GetUnmarshalClass(marshal, &IID_IUri, (void*)uri,
10983 MSHCTX_INPROC, NULL, MSHLFLAGS_NORMAL, &curi);
10984 ok(hr == S_OK, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i, hr);
10985 ok(IsEqualCLSID(&curi, &CLSID_CUri), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i);
10987 hr = IStream_Seek(stream, no_off, STREAM_SEEK_CUR, &size);
10988 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10989 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
10990 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
10991 hr = IStream_Read(stream, (void*)dw_data, 3*sizeof(DWORD), NULL);
10992 ok(hr == S_OK, "%d) Read failed 0x%08x, expected S_OK.\n", i, hr);
10993 ok(dw_data[0]-2 == U(size).LowPart, "%d) Structure size is %d, expected %d\n",
10994 i, dw_data[0]-2, U(size).LowPart);
10995 ok(dw_data[1] == MSHCTX_LOCAL, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
10996 i, dw_data[1]);
10997 ok(dw_data[2] == dw_data[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10998 i, dw_data[2], dw_data[0]-8);
10999 if(!test->str_props[Uri_PROPERTY_PATH].value[0] &&
11000 (test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTP
11001 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_FTP
11002 || test->dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START].value == URL_SCHEME_HTTPS))
11003 U(max_size).LowPart += 3*sizeof(DWORD);
11004 ok(dw_data[2] == U(max_size).LowPart, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11005 i, dw_data[2], U(max_size).LowPart);
11006 IMarshal_Release(marshal);
11007 IUri_Release(uri);
11009 hr = IStream_Seek(stream, no_off, STREAM_SEEK_SET, NULL);
11010 ok(hr == S_OK, "%d) Seek failed 0x%08x, expected S_OK.\n", i, hr);
11011 hr = CoCreateInstance(&curi, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11012 &IID_IUri, (void**)&uri);
11013 ok(hr == S_OK, "%d) Error creating uninitialized Uri: 0x%08x.\n", i, hr);
11014 hr = IUri_QueryInterface(uri, &IID_IMarshal, (void**)&marshal);
11015 ok(hr == S_OK, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i, hr);
11016 hr = IMarshal_UnmarshalInterface(marshal, stream, &IID_IUri, (void**)&uri);
11017 ok(hr == S_OK, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i, hr);
11018 hr = IUri_GetRawUri(uri, &raw_uri);
11019 ok(hr == S_OK, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i, hr);
11020 ok(!strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].value, raw_uri)
11021 || broken(test->str_props[Uri_PROPERTY_RAW_URI].broken_value
11022 && !strcmp_aw(test->str_props[Uri_PROPERTY_RAW_URI].broken_value, raw_uri)),
11023 "%d) Expected %s but got %s.\n", i, test->str_props[Uri_PROPERTY_RAW_URI].value,
11024 wine_dbgstr_w(raw_uri));
11025 SysFreeString(raw_uri);
11027 IMarshal_Release(marshal);
11028 IStream_Release(stream);
11029 IPersistStream_Release(persist_stream);
11030 IUri_Release(uri);
11031 heap_free(uriW);
11035 static void test_UninitializedUri(void)
11037 IUri *uri;
11038 IUriBuilderFactory *ubf;
11039 IPersistStream *ps;
11040 IUriBuilder *ub;
11041 BSTR bstr;
11042 DWORD dword;
11043 BOOL eq;
11044 ULARGE_INTEGER ui;
11045 HRESULT hr;
11047 hr = CoCreateInstance(&CLSID_CUri, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
11048 &IID_IUri, (void**)&uri);
11049 if(FAILED(hr)) {
11050 win_skip("Skipping uninitialized Uri tests.\n");
11051 return;
11054 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&ubf);
11055 ok(hr == S_OK, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr);
11056 hr = IUri_QueryInterface(uri, &IID_IPersistStream, (void**)&ps);
11057 ok(hr == S_OK, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr);
11059 hr = IUri_GetAbsoluteUri(uri, NULL);
11060 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11061 hr = IUri_GetAbsoluteUri(uri, &bstr);
11062 ok(hr == E_UNEXPECTED, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr);
11063 hr = IUri_GetAuthority(uri, &bstr);
11064 ok(hr == E_UNEXPECTED, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr);
11065 hr = IUri_GetDisplayUri(uri, &bstr);
11066 ok(hr == E_UNEXPECTED, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr);
11067 hr = IUri_GetDomain(uri, &bstr);
11068 ok(hr == E_UNEXPECTED, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr);
11069 hr = IUri_GetExtension(uri, &bstr);
11070 ok(hr == E_UNEXPECTED, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr);
11071 hr = IUri_GetFragment(uri, &bstr);
11072 ok(hr == E_UNEXPECTED, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr);
11073 hr = IUri_GetHost(uri, &bstr);
11074 ok(hr == E_UNEXPECTED, "GetHost returned %x, expected E_UNEXPECTED.\n", hr);
11075 hr = IUri_GetHostType(uri, &dword);
11076 ok(hr == E_UNEXPECTED, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr);
11077 hr = IUri_GetPassword(uri, &bstr);
11078 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11079 hr = IUri_GetPassword(uri, &bstr);
11080 ok(hr == E_UNEXPECTED, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr);
11081 hr = IUri_GetPathAndQuery(uri, &bstr);
11082 ok(hr == E_UNEXPECTED, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr);
11083 hr = IUri_GetPort(uri, &dword);
11084 ok(hr == E_UNEXPECTED, "GetPort returned %x, expected E_UNEXPECTED.\n", hr);
11085 hr = IUri_GetProperties(uri, &dword);
11086 ok(hr == E_UNEXPECTED, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr);
11087 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, &bstr, 0);
11088 ok(hr == E_UNEXPECTED, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr);
11089 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_PORT, &dword, 0);
11090 ok(hr == E_UNEXPECTED, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr);
11091 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_RAW_URI, &dword, 0);
11092 ok(hr == E_UNEXPECTED, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr);
11093 hr = IUri_GetQuery(uri, &bstr);
11094 ok(hr == E_UNEXPECTED, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr);
11095 hr = IUri_GetRawUri(uri, &bstr);
11096 ok(hr == E_UNEXPECTED, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr);
11097 hr = IUri_GetScheme(uri, &dword);
11098 ok(hr == E_UNEXPECTED, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr);
11099 hr = IUri_GetSchemeName(uri, &bstr);
11100 ok(hr == E_UNEXPECTED, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr);
11101 hr = IUri_GetUserInfo(uri, &bstr);
11102 ok(hr == E_UNEXPECTED, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr);
11103 hr = IUri_GetUserName(uri, &bstr);
11104 ok(hr == E_UNEXPECTED, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr);
11105 hr = IUri_GetZone(uri, &dword);
11106 ok(hr == E_UNEXPECTED, "GetZone returned %x, expected E_UNEXPECTED.\n", hr);
11107 hr = IUri_IsEqual(uri, uri, &eq);
11108 ok(hr == E_UNEXPECTED, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr);
11110 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(ubf, 0, 0, &ub);
11111 ok(hr == E_UNEXPECTED, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr);
11112 hr = IUriBuilderFactory_CreateIUriBuilder(ubf, 0, 0, &ub);
11113 ok(hr == S_OK, "CreateIUriBuilder returned %x, expected S_OK.\n", hr);
11114 IUriBuilder_Release(ub);
11116 hr = IPersistStream_GetSizeMax(ps, &ui);
11117 ok(hr == S_OK, "GetSizeMax returned %x, expected S_OK.\n", hr);
11118 ok(ui.u.LowPart == 34, "ui.LowPart = %d, expected 34.\n", ui.u.LowPart);
11119 hr = IPersistStream_IsDirty(ps);
11120 ok(hr == S_FALSE, "IsDirty returned %x, expected S_FALSE.\n", hr);
11122 IPersistStream_Release(ps);
11123 IUriBuilderFactory_Release(ubf);
11124 IUri_Release(uri);
11127 START_TEST(uri) {
11128 HMODULE hurlmon;
11130 hurlmon = GetModuleHandle("urlmon.dll");
11131 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
11132 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
11133 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
11134 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
11135 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
11136 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
11137 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
11138 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
11139 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
11141 if(!pCreateUri) {
11142 win_skip("CreateUri is not present, skipping tests.\n");
11143 return;
11146 trace("test CreateUri invalid flags...\n");
11147 test_CreateUri_InvalidFlags();
11149 trace("test CreateUri invalid args...\n");
11150 test_CreateUri_InvalidArgs();
11152 trace("test CreateUri invalid URIs...\n");
11153 test_CreateUri_InvalidUri();
11155 trace("test IUri_GetPropertyBSTR...\n");
11156 test_IUri_GetPropertyBSTR();
11158 trace("test IUri_GetPropertyDWORD...\n");
11159 test_IUri_GetPropertyDWORD();
11161 trace("test IUri_GetStrProperties...\n");
11162 test_IUri_GetStrProperties();
11164 trace("test IUri_GetDwordProperties...\n");
11165 test_IUri_GetDwordProperties();
11167 trace("test IUri_GetPropertyLength...\n");
11168 test_IUri_GetPropertyLength();
11170 trace("test IUri_GetProperties...\n");
11171 test_IUri_GetProperties();
11173 trace("test IUri_HasProperty...\n");
11174 test_IUri_HasProperty();
11176 trace("test IUri_IsEqual...\n");
11177 test_IUri_IsEqual();
11179 trace("test CreateUriWithFragment invalid args...\n");
11180 test_CreateUriWithFragment_InvalidArgs();
11182 trace("test CreateUriWithFragment invalid flags...\n");
11183 test_CreateUriWithFragment_InvalidFlags();
11185 trace("test CreateUriWithFragment...\n");
11186 test_CreateUriWithFragment();
11188 trace("test CreateIUriBuilder...\n");
11189 test_CreateIUriBuilder();
11191 trace("test IUriBuilder_CreateInvalidArgs...\n");
11192 test_IUriBuilder_CreateInvalidArgs();
11194 trace("test IUriBuilder...\n");
11195 test_IUriBuilder();
11197 trace("test IUriBuilder_GetInvalidArgs...\n");
11198 test_IUriBuilder_GetInvalidArgs();
11200 trace("test IUriBuilder_HasBeenModified...\n");
11201 test_IUriBuilder_HasBeenModified();
11203 trace("test IUriBuilder_IUriProperty...\n");
11204 test_IUriBuilder_IUriProperty();
11206 trace("test IUriBuilder_RemoveProperties...\n");
11207 test_IUriBuilder_RemoveProperties();
11209 trace("test IUriBuilder miscellaneous...\n");
11210 test_IUriBuilder_Misc();
11212 trace("test IUriBuilderFactory...\n");
11213 test_IUriBuilderFactory();
11215 trace("test CoInternetCombineIUri...\n");
11216 test_CoInternetCombineIUri();
11218 trace("test CoInternetCombineUrlEx...\n");
11219 test_CoInternetCombineUrlEx();
11221 trace("test CoInternetParseIUri Invalid Args...\n");
11222 test_CoInternetParseIUri_InvalidArgs();
11224 trace("test CoInternetParseIUri...\n");
11225 test_CoInternetParseIUri();
11227 register_protocols();
11229 trace("test CoInternetCombineIUri pluggable...\n");
11230 test_CoInternetCombineIUri_Pluggable();
11232 trace("test CoInternetCombineUrlEx Pluggable...\n");
11233 test_CoInternetCombineUrlEx_Pluggable();
11235 trace("test CoInternetParseIUri pluggable...\n");
11236 test_CoInternetParseIUri_Pluggable();
11238 trace("test CreateURLMoniker...\n");
11239 test_CreateURLMoniker();
11241 CoInitialize(NULL);
11243 trace("test IPersistStream...\n");
11244 test_IPersistStream();
11246 trace("test uninitialized Uri...\n");
11247 test_UninitializedUri();
11249 CoUninitialize();
11250 unregister_protocols();