urlmon: Store URI host len in parse_ipv4address before further parsing.
[wine/wine-gecko.git] / dlls / urlmon / tests / uri.c
blob2fe67c221ec8e49235a21e8889ebd2dcf8185300
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
28 #include "windef.h"
29 #include "winbase.h"
30 #include "urlmon.h"
31 #include "shlwapi.h"
32 #include "wininet.h"
33 #include "strsafe.h"
35 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
36 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
37 #define URI_BUILDER_STR_PROPERTY_COUNT 7
39 #define DEFINE_EXPECT(func) \
40 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
42 #define SET_EXPECT(func) \
43 expect_ ## func = TRUE
45 #define CHECK_EXPECT(func) \
46 do { \
47 ok(expect_ ##func, "unexpected call " #func "\n"); \
48 expect_ ## func = FALSE; \
49 called_ ## func = TRUE; \
50 }while(0)
52 #define CHECK_EXPECT2(func) \
53 do { \
54 ok(expect_ ##func, "unexpected call " #func "\n"); \
55 called_ ## func = TRUE; \
56 }while(0)
58 #define CHECK_CALLED(func) \
59 do { \
60 ok(called_ ## func, "expected " #func "\n"); \
61 expect_ ## func = called_ ## func = FALSE; \
62 }while(0)
64 DEFINE_EXPECT(CombineUrl);
65 DEFINE_EXPECT(ParseUrl);
67 static HRESULT (WINAPI *pCreateUri)(LPCWSTR, DWORD, DWORD_PTR, IUri**);
68 static HRESULT (WINAPI *pCreateUriWithFragment)(LPCWSTR, LPCWSTR, DWORD, DWORD_PTR, IUri**);
69 static HRESULT (WINAPI *pCreateIUriBuilder)(IUri*, DWORD, DWORD_PTR, IUriBuilder**);
70 static HRESULT (WINAPI *pCoInternetCombineIUri)(IUri*,IUri*,DWORD,IUri**,DWORD_PTR);
71 static HRESULT (WINAPI *pCoInternetGetSession)(DWORD,IInternetSession**,DWORD);
72 static HRESULT (WINAPI *pCoInternetCombineUrlEx)(IUri*,LPCWSTR,DWORD,IUri**,DWORD_PTR);
73 static HRESULT (WINAPI *pCoInternetParseIUri)(IUri*,PARSEACTION,DWORD,LPWSTR,DWORD,DWORD*,DWORD_PTR);
74 static HRESULT (WINAPI *pCreateURLMonikerEx)(IMoniker*,LPCWSTR,IMoniker**,DWORD);
75 static HRESULT (WINAPI *pCreateURLMonikerEx2)(IMoniker*,IUri*,IMoniker**,DWORD);
77 static const WCHAR http_urlW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
78 '.','o','r','g','/',0};
79 static const WCHAR http_url_fragW[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
80 '.','o','r','g','/','#','F','r','a','g',0};
82 static const WCHAR combine_baseW[] = {'w','i','n','e','t','e','s','t',':','?','t',
83 'e','s','t','i','n','g',0};
84 static const WCHAR combine_relativeW[] = {'?','t','e','s','t',0};
85 static const WCHAR combine_resultW[] = {'z','i','p',':','t','e','s','t',0};
87 static const WCHAR winetestW[] = {'w','i','n','e','t','e','s','t',0};
89 static const WCHAR parse_urlW[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
90 static const WCHAR parse_resultW[] = {'z','i','p',':','t','e','s','t',0};
92 static PARSEACTION parse_action;
93 static DWORD parse_flags;
95 typedef struct _uri_create_flag_test {
96 DWORD flags;
97 HRESULT expected;
98 } uri_create_flag_test;
100 static const uri_create_flag_test invalid_flag_tests[] = {
101 /* Set of invalid flag combinations to test for. */
102 {Uri_CREATE_DECODE_EXTRA_INFO | Uri_CREATE_NO_DECODE_EXTRA_INFO, E_INVALIDARG},
103 {Uri_CREATE_CANONICALIZE | Uri_CREATE_NO_CANONICALIZE, E_INVALIDARG},
104 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES | Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, E_INVALIDARG},
105 {Uri_CREATE_PRE_PROCESS_HTML_URI | Uri_CREATE_NO_PRE_PROCESS_HTML_URI, E_INVALIDARG},
106 {Uri_CREATE_IE_SETTINGS | Uri_CREATE_NO_IE_SETTINGS, E_INVALIDARG}
109 typedef struct _uri_str_property {
110 const char* value;
111 HRESULT expected;
112 BOOL todo;
113 const char* broken_value;
114 } uri_str_property;
116 typedef struct _uri_dword_property {
117 DWORD value;
118 HRESULT expected;
119 BOOL todo;
120 } uri_dword_property;
122 typedef struct _uri_properties {
123 const char* uri;
124 DWORD create_flags;
125 HRESULT create_expected;
126 BOOL create_todo;
128 uri_str_property str_props[URI_STR_PROPERTY_COUNT];
129 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
130 } uri_properties;
132 static const uri_properties uri_tests[] = {
133 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK, FALSE,
135 {"http://www.winehq.org/",S_OK,FALSE}, /* ABSOLUTE_URI */
136 {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */
137 {"http://www.winehq.org/",S_OK,FALSE}, /* DISPLAY_URI */
138 {"winehq.org",S_OK,FALSE}, /* DOMAIN */
139 {"",S_FALSE,FALSE}, /* EXTENSION */
140 {"",S_FALSE,FALSE}, /* FRAGMENT */
141 {"www.winehq.org",S_OK,FALSE}, /* HOST */
142 {"",S_FALSE,FALSE}, /* PASSWORD */
143 {"/",S_OK,FALSE}, /* PATH */
144 {"/",S_OK,FALSE}, /* PATH_AND_QUERY */
145 {"",S_FALSE,FALSE}, /* QUERY */
146 {"http://www.winehq.org/tests/../tests/../..",S_OK,FALSE}, /* RAW_URI */
147 {"http",S_OK,FALSE}, /* SCHEME_NAME */
148 {"",S_FALSE,FALSE}, /* USER_INFO */
149 {"",S_FALSE,FALSE} /* USER_NAME */
152 {Uri_HOST_DNS,S_OK,FALSE}, /* HOST_TYPE */
153 {80,S_OK,FALSE}, /* PORT */
154 {URL_SCHEME_HTTP,S_OK,FALSE}, /* SCHEME */
155 {URLZONE_INVALID,E_NOTIMPL,FALSE} /* ZONE */
158 { "http://winehq.org/tests/.././tests", 0, S_OK, FALSE,
160 {"http://winehq.org/tests",S_OK,FALSE},
161 {"winehq.org",S_OK,FALSE},
162 {"http://winehq.org/tests",S_OK,FALSE},
163 {"winehq.org",S_OK,FALSE},
164 {"",S_FALSE,FALSE},
165 {"",S_FALSE,FALSE},
166 {"winehq.org",S_OK,FALSE},
167 {"",S_FALSE,FALSE},
168 {"/tests",S_OK,FALSE},
169 {"/tests",S_OK,FALSE},
170 {"",S_FALSE,FALSE},
171 {"http://winehq.org/tests/.././tests",S_OK,FALSE},
172 {"http",S_OK,FALSE},
173 {"",S_FALSE,FALSE},
174 {"",S_FALSE,FALSE}
177 {Uri_HOST_DNS,S_OK,FALSE},
178 {80,S_OK,FALSE},
179 {URL_SCHEME_HTTP,S_OK,FALSE},
180 {URLZONE_INVALID,E_NOTIMPL,FALSE}
183 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK, FALSE,
185 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
186 {"www.winehq.org",S_OK,FALSE},
187 {"http://www.winehq.org/?query=x&return=y",S_OK,FALSE},
188 {"winehq.org",S_OK,FALSE},
189 {"",S_FALSE,FALSE},
190 {"",S_FALSE,FALSE},
191 {"www.winehq.org",S_OK,FALSE},
192 {"",S_FALSE,FALSE},
193 {"/",S_OK,FALSE},
194 {"/?query=x&return=y",S_OK,FALSE},
195 {"?query=x&return=y",S_OK,FALSE},
196 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK,FALSE},
197 {"http",S_OK,FALSE},
198 {"",S_FALSE,FALSE},
199 {"",S_FALSE,FALSE}
202 {Uri_HOST_DNS,S_OK,FALSE},
203 {80,S_OK,FALSE},
204 {URL_SCHEME_HTTP,S_OK,FALSE},
205 {URLZONE_INVALID,E_NOTIMPL,FALSE},
208 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK, FALSE,
210 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
211 {"usEr%3Ainfo@example.com",S_OK,FALSE},
212 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
213 {"example.com",S_OK,FALSE},
214 {"",S_FALSE,FALSE},
215 {"",S_FALSE,FALSE},
216 {"example.com",S_OK,FALSE},
217 {"",S_FALSE,FALSE},
218 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
219 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,FALSE},
220 {"",S_FALSE,FALSE},
221 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK,FALSE},
222 {"http",S_OK,FALSE},
223 {"usEr%3Ainfo",S_OK,FALSE},
224 {"usEr%3Ainfo",S_OK,FALSE}
227 {Uri_HOST_DNS,S_OK,FALSE},
228 {80,S_OK,FALSE},
229 {URL_SCHEME_HTTP,S_OK,FALSE},
230 {URLZONE_INVALID,E_NOTIMPL,FALSE},
233 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK, FALSE,
235 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
236 {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE},
237 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,FALSE},
238 {"winehq.org",S_OK,FALSE},
239 {".txt",S_OK,FALSE},
240 {"",S_FALSE,FALSE},
241 {"ftp.winehq.org",S_OK,FALSE},
242 {"wine",S_OK,FALSE},
243 {"/dir/foo%20bar.txt",S_OK,FALSE},
244 {"/dir/foo%20bar.txt",S_OK,FALSE},
245 {"",S_FALSE,FALSE},
246 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK,FALSE},
247 {"ftp",S_OK,FALSE},
248 {"winepass:wine",S_OK,FALSE},
249 {"winepass",S_OK,FALSE}
252 {Uri_HOST_DNS,S_OK,FALSE},
253 {9999,S_OK,FALSE},
254 {URL_SCHEME_FTP,S_OK,FALSE},
255 {URLZONE_INVALID,E_NOTIMPL,FALSE}
258 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK, FALSE,
260 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
261 {"",S_FALSE,FALSE},
262 {"file:///c:/tests/foo%2520bar.mp3",S_OK,FALSE},
263 {"",S_FALSE,FALSE},
264 {".mp3",S_OK,FALSE},
265 {"",S_FALSE,FALSE},
266 {"",S_FALSE,FALSE},
267 {"",S_FALSE,FALSE},
268 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
269 {"/c:/tests/foo%2520bar.mp3",S_OK,FALSE},
270 {"",S_FALSE,FALSE},
271 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK,FALSE},
272 {"file",S_OK,FALSE},
273 {"",S_FALSE,FALSE},
274 {"",S_FALSE,FALSE}
277 {Uri_HOST_UNKNOWN,S_OK,FALSE},
278 {0,S_FALSE,FALSE},
279 {URL_SCHEME_FILE,S_OK,FALSE},
280 {URLZONE_INVALID,E_NOTIMPL,FALSE}
283 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK, FALSE,
285 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
286 {"",S_FALSE,FALSE},
287 {"file:///tests/test%20file.README.txt",S_OK,FALSE},
288 {"",S_FALSE,FALSE},
289 {".txt",S_OK,FALSE},
290 {"",S_FALSE,FALSE},
291 {"",S_FALSE,FALSE},
292 {"",S_FALSE,FALSE},
293 {"/tests/test%20file.README.txt",S_OK,FALSE},
294 {"/tests/test%20file.README.txt",S_OK,FALSE},
295 {"",S_FALSE,FALSE},
296 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK,FALSE},
297 {"file",S_OK,FALSE},
298 {"",S_FALSE,FALSE},
299 {"",S_FALSE,FALSE}
302 {Uri_HOST_UNKNOWN,S_OK,FALSE},
303 {0,S_FALSE,FALSE},
304 {URL_SCHEME_FILE,S_OK,FALSE},
305 {URLZONE_INVALID,E_NOTIMPL,FALSE}
308 { "urn:nothing:should:happen here", 0, S_OK, FALSE,
310 {"urn:nothing:should:happen here",S_OK,FALSE},
311 {"",S_FALSE,FALSE},
312 {"urn:nothing:should:happen here",S_OK,FALSE},
313 {"",S_FALSE,FALSE},
314 {"",S_FALSE,FALSE},
315 {"",S_FALSE,FALSE},
316 {"",S_FALSE,FALSE},
317 {"",S_FALSE,FALSE},
318 {"nothing:should:happen here",S_OK,FALSE},
319 {"nothing:should:happen here",S_OK,FALSE},
320 {"",S_FALSE,FALSE},
321 {"urn:nothing:should:happen here",S_OK,FALSE},
322 {"urn",S_OK,FALSE},
323 {"",S_FALSE,FALSE},
324 {"",S_FALSE,FALSE}
327 {Uri_HOST_UNKNOWN,S_OK,FALSE},
328 {0,S_FALSE,FALSE},
329 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
333 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK, FALSE,
335 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
336 {"127.0.0.1",S_OK,FALSE},
337 {"http://127.0.0.1/test%20dir/test.txt",S_OK,FALSE},
338 {"",S_FALSE,FALSE},
339 {".txt",S_OK,FALSE},
340 {"",S_FALSE,FALSE},
341 {"127.0.0.1",S_OK,FALSE},
342 {"",S_FALSE,FALSE},
343 {"/test%20dir/test.txt",S_OK,FALSE},
344 {"/test%20dir/test.txt",S_OK,FALSE},
345 {"",S_FALSE,FALSE},
346 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK,FALSE},
347 {"http",S_OK,FALSE},
348 {"",S_FALSE,FALSE},
349 {"",S_FALSE,FALSE}
352 {Uri_HOST_IPV4,S_OK,FALSE},
353 {80,S_OK,FALSE},
354 {URL_SCHEME_HTTP,S_OK,FALSE},
355 {URLZONE_INVALID,E_NOTIMPL,FALSE}
358 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK, FALSE,
360 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
361 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE},
362 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,FALSE},
363 {"",S_FALSE,FALSE},
364 {"",S_FALSE,FALSE},
365 {"",S_FALSE,FALSE},
366 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE},
367 {"",S_FALSE,FALSE},
368 {"/",S_OK,FALSE},
369 {"/",S_OK,FALSE},
370 {"",S_FALSE,FALSE},
371 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK,FALSE},
372 {"http",S_OK,FALSE},
373 {"",S_FALSE,FALSE},
374 {"",S_FALSE,FALSE}
377 {Uri_HOST_IPV6,S_OK,FALSE},
378 {80,S_OK,FALSE},
379 {URL_SCHEME_HTTP,S_OK,FALSE},
380 {URLZONE_INVALID,E_NOTIMPL,FALSE}
383 { "ftp://[::13.1.68.3]", 0, S_OK, FALSE,
385 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
386 {"[::13.1.68.3]",S_OK,FALSE},
387 {"ftp://[::13.1.68.3]/",S_OK,FALSE},
388 {"",S_FALSE,FALSE},
389 {"",S_FALSE,FALSE},
390 {"",S_FALSE,FALSE},
391 {"::13.1.68.3",S_OK,FALSE},
392 {"",S_FALSE,FALSE},
393 {"/",S_OK,FALSE},
394 {"/",S_OK,FALSE},
395 {"",S_FALSE,FALSE},
396 {"ftp://[::13.1.68.3]",S_OK,FALSE},
397 {"ftp",S_OK,FALSE},
398 {"",S_FALSE,FALSE},
399 {"",S_FALSE,FALSE}
402 {Uri_HOST_IPV6,S_OK,FALSE},
403 {21,S_OK,FALSE},
404 {URL_SCHEME_FTP,S_OK,FALSE},
405 {URLZONE_INVALID,E_NOTIMPL,FALSE}
408 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK, FALSE,
410 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
411 {"[fedc:ba98::3210]",S_OK,FALSE},
412 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
413 {"",S_FALSE,FALSE},
414 {"",S_FALSE,FALSE},
415 {"",S_FALSE,FALSE},
416 {"fedc:ba98::3210",S_OK,FALSE},
417 {"",S_FALSE,FALSE},
418 {"/",S_OK,FALSE},
419 {"/",S_OK,FALSE},
420 {"",S_FALSE,FALSE},
421 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK,FALSE},
422 {"http",S_OK,FALSE},
423 {"",S_FALSE,FALSE},
424 {"",S_FALSE,FALSE},
427 {Uri_HOST_IPV6,S_OK,FALSE},
428 {80,S_OK,FALSE},
429 {URL_SCHEME_HTTP,S_OK,FALSE},
430 {URLZONE_INVALID,E_NOTIMPL,FALSE}
433 { "1234://www.winehq.org", 0, S_OK, FALSE,
435 {"1234://www.winehq.org/",S_OK,FALSE},
436 {"www.winehq.org",S_OK,FALSE},
437 {"1234://www.winehq.org/",S_OK,FALSE},
438 {"winehq.org",S_OK,FALSE},
439 {"",S_FALSE,FALSE},
440 {"",S_FALSE,FALSE},
441 {"www.winehq.org",S_OK,FALSE},
442 {"",S_FALSE,FALSE},
443 {"/",S_OK,FALSE},
444 {"/",S_OK,FALSE},
445 {"",S_FALSE,FALSE},
446 {"1234://www.winehq.org",S_OK,FALSE},
447 {"1234",S_OK,FALSE},
448 {"",S_FALSE,FALSE},
449 {"",S_FALSE,FALSE}
452 {Uri_HOST_DNS,S_OK,FALSE},
453 {0,S_FALSE,FALSE},
454 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
455 {URLZONE_INVALID,E_NOTIMPL,FALSE}
458 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
459 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
461 {"file:///C:/test/test.mp3",S_OK,FALSE},
462 {"",S_FALSE,FALSE},
463 {"file:///C:/test/test.mp3",S_OK,FALSE},
464 {"",S_FALSE,FALSE},
465 {".mp3",S_OK,FALSE},
466 {"",S_FALSE,FALSE},
467 {"",S_FALSE,FALSE},
468 {"",S_FALSE,FALSE},
469 {"/C:/test/test.mp3",S_OK,FALSE},
470 {"/C:/test/test.mp3",S_OK,FALSE},
471 {"",S_FALSE,FALSE},
472 {"C:/test/test.mp3",S_OK,FALSE},
473 {"file",S_OK,FALSE},
474 {"",S_FALSE,FALSE},
475 {"",S_FALSE,FALSE}
478 {Uri_HOST_UNKNOWN,S_OK,FALSE},
479 {0,S_FALSE,FALSE},
480 {URL_SCHEME_FILE,S_OK,FALSE},
481 {URLZONE_INVALID,E_NOTIMPL,FALSE}
484 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
485 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, S_OK, FALSE,
487 {"file://server/test.mp3",S_OK,FALSE},
488 {"server",S_OK,FALSE},
489 {"file://server/test.mp3",S_OK,FALSE},
490 {"",S_FALSE,FALSE},
491 {".mp3",S_OK,FALSE},
492 {"",S_FALSE,FALSE},
493 {"server",S_OK,FALSE},
494 {"",S_FALSE,FALSE},
495 {"/test.mp3",S_OK,FALSE},
496 {"/test.mp3",S_OK,FALSE},
497 {"",S_FALSE,FALSE},
498 {"\\\\Server/test.mp3",S_OK,FALSE},
499 {"file",S_OK,FALSE},
500 {"",S_FALSE,FALSE},
501 {"",S_FALSE,FALSE}
504 {Uri_HOST_DNS,S_OK,FALSE},
505 {0,S_FALSE,FALSE},
506 {URL_SCHEME_FILE,S_OK,FALSE},
507 {URLZONE_INVALID,E_NOTIMPL,FALSE}
510 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
512 {"*:www.winehq.org/test",S_OK,FALSE},
513 {"www.winehq.org",S_OK,FALSE},
514 {"*:www.winehq.org/test",S_OK,FALSE},
515 {"winehq.org",S_OK,FALSE},
516 {"",S_FALSE,FALSE},
517 {"",S_FALSE,FALSE},
518 {"www.winehq.org",S_OK,FALSE},
519 {"",S_FALSE,FALSE},
520 {"/test",S_OK,FALSE},
521 {"/test",S_OK,FALSE},
522 {"",S_FALSE,FALSE},
523 {"www.winehq.org/test",S_OK,FALSE},
524 {"*",S_OK,FALSE},
525 {"",S_FALSE,FALSE},
526 {"",S_FALSE,FALSE}
529 {Uri_HOST_DNS,S_OK,FALSE},
530 {0,S_FALSE,FALSE},
531 {URL_SCHEME_WILDCARD,S_OK,FALSE},
532 {URLZONE_INVALID,E_NOTIMPL,FALSE}
535 /* Valid since the '*' is the only character in the scheme name. */
536 { "*:www.winehq.org/test", 0, S_OK, FALSE,
538 {"*:www.winehq.org/test",S_OK,FALSE},
539 {"www.winehq.org",S_OK,FALSE},
540 {"*:www.winehq.org/test",S_OK,FALSE},
541 {"winehq.org",S_OK,FALSE},
542 {"",S_FALSE,FALSE},
543 {"",S_FALSE,FALSE},
544 {"www.winehq.org",S_OK,FALSE},
545 {"",S_FALSE,FALSE},
546 {"/test",S_OK,FALSE},
547 {"/test",S_OK,FALSE},
548 {"",S_FALSE,FALSE},
549 {"*:www.winehq.org/test",S_OK,FALSE},
550 {"*",S_OK,FALSE},
551 {"",S_FALSE,FALSE},
552 {"",S_FALSE,FALSE}
555 {Uri_HOST_DNS,S_OK,FALSE},
556 {0,S_FALSE,FALSE},
557 {URL_SCHEME_WILDCARD,S_OK,FALSE},
558 {URLZONE_INVALID,E_NOTIMPL,FALSE}
561 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
563 {"/../some dir/test.ext",S_OK,FALSE},
564 {"",S_FALSE,FALSE},
565 {"/../some dir/test.ext",S_OK,FALSE},
566 {"",S_FALSE,FALSE},
567 {".ext",S_OK,FALSE},
568 {"",S_FALSE,FALSE},
569 {"",S_FALSE,FALSE},
570 {"",S_FALSE,FALSE},
571 {"/../some dir/test.ext",S_OK,FALSE},
572 {"/../some dir/test.ext",S_OK,FALSE},
573 {"",S_FALSE,FALSE},
574 {"/../some dir/test.ext",S_OK,FALSE},
575 {"",S_FALSE,FALSE},
576 {"",S_FALSE,FALSE},
577 {"",S_FALSE,FALSE}
580 {Uri_HOST_UNKNOWN,S_OK,FALSE},
581 {0,S_FALSE,FALSE},
582 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
583 {URLZONE_INVALID,E_NOTIMPL,FALSE}
586 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, S_OK, FALSE,
588 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
589 {"",S_OK,FALSE},
590 {"*://implicit/wildcard/uri%20scheme",S_OK,FALSE},
591 {"",S_FALSE,FALSE},
592 {"",S_FALSE,FALSE},
593 {"",S_FALSE,FALSE},
594 {"",S_OK,FALSE},
595 {"",S_FALSE,FALSE},
596 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
597 {"//implicit/wildcard/uri%20scheme",S_OK,FALSE},
598 {"",S_FALSE,FALSE},
599 {"//implicit/wildcard/uri scheme",S_OK,FALSE},
600 {"*",S_OK,FALSE},
601 {"",S_FALSE,FALSE},
602 {"",S_FALSE,FALSE},
605 {Uri_HOST_UNKNOWN,S_OK,FALSE},
606 {0,S_FALSE,FALSE},
607 {URL_SCHEME_WILDCARD,S_OK,FALSE},
608 {URLZONE_INVALID,E_NOTIMPL,FALSE}
611 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
612 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES, S_OK, FALSE,
614 {"zip:/.//google.com",S_OK,FALSE},
615 {"",S_FALSE,FALSE},
616 {"zip:/.//google.com",S_OK,FALSE},
617 {"",S_FALSE,FALSE},
618 {".com",S_OK,FALSE},
619 {"",S_FALSE,FALSE},
620 {"",S_FALSE,FALSE},
621 {"",S_FALSE,FALSE},
622 {"/.//google.com",S_OK,FALSE},
623 {"/.//google.com",S_OK,FALSE},
624 {"",S_FALSE,FALSE},
625 {"zip://google.com",S_OK,FALSE},
626 {"zip",S_OK,FALSE},
627 {"",S_FALSE,FALSE},
628 {"",S_FALSE,FALSE}
631 {Uri_HOST_UNKNOWN,S_OK,FALSE},
632 {0,S_FALSE,FALSE},
633 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
634 {URLZONE_INVALID,E_NOTIMPL,FALSE}
637 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
638 { "ftp://user:pass:word@winehq.org/", 0, S_OK, FALSE,
640 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
641 {"user:pass:word@winehq.org",S_OK,FALSE},
642 {"ftp://winehq.org/",S_OK,FALSE},
643 {"winehq.org",S_OK,FALSE},
644 {"",S_FALSE,FALSE},
645 {"",S_FALSE,FALSE},
646 {"winehq.org",S_OK,FALSE},
647 {"pass:word",S_OK,FALSE},
648 {"/",S_OK,FALSE},
649 {"/",S_OK,FALSE},
650 {"",S_FALSE,FALSE},
651 {"ftp://user:pass:word@winehq.org/",S_OK,FALSE},
652 {"ftp",S_OK,FALSE},
653 {"user:pass:word",S_OK,FALSE},
654 {"user",S_OK,FALSE}
657 {Uri_HOST_DNS,S_OK,FALSE},
658 {21,S_OK,FALSE},
659 {URL_SCHEME_FTP,S_OK,FALSE},
660 {URLZONE_INVALID,E_NOTIMPL,FALSE}
663 /* Make sure % encoded unreserved characters are decoded. */
664 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK, FALSE,
666 {"ftp://wINe:PASS@ftp.google.com/",S_OK,FALSE},
667 {"wINe:PASS@ftp.google.com",S_OK,FALSE},
668 {"ftp://ftp.google.com/",S_OK,FALSE},
669 {"google.com",S_OK,FALSE},
670 {"",S_FALSE,FALSE},
671 {"",S_FALSE,FALSE},
672 {"ftp.google.com",S_OK,FALSE},
673 {"PASS",S_OK,FALSE},
674 {"/",S_OK,FALSE},
675 {"/",S_OK,FALSE},
676 {"",S_FALSE,FALSE},
677 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK,FALSE},
678 {"ftp",S_OK,FALSE},
679 {"wINe:PASS",S_OK,FALSE},
680 {"wINe",S_OK,FALSE}
683 {Uri_HOST_DNS,S_OK,FALSE},
684 {21,S_OK,FALSE},
685 {URL_SCHEME_FTP,S_OK,FALSE},
686 {URLZONE_INVALID,E_NOTIMPL,FALSE}
689 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
690 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK, FALSE,
692 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
693 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE},
694 {"ftp://ftp.google.com/",S_OK,FALSE},
695 {"google.com",S_OK,FALSE},
696 {"",S_FALSE,FALSE},
697 {"",S_FALSE,FALSE},
698 {"ftp.google.com",S_OK,FALSE},
699 {"PA%7B%7D",S_OK,FALSE},
700 {"/",S_OK,FALSE},
701 {"/",S_OK,FALSE},
702 {"",S_FALSE,FALSE},
703 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK,FALSE},
704 {"ftp",S_OK,FALSE},
705 {"w%5D%5Be:PA%7B%7D",S_OK,FALSE},
706 {"w%5D%5Be",S_OK,FALSE}
709 {Uri_HOST_DNS,S_OK,FALSE},
710 {21,S_OK,FALSE},
711 {URL_SCHEME_FTP,S_OK,FALSE},
712 {URLZONE_INVALID,E_NOTIMPL,FALSE}
715 /* You're allowed to have an empty password portion in the userinfo section. */
716 { "ftp://empty:@ftp.google.com/", 0, S_OK, FALSE,
718 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
719 {"empty:@ftp.google.com",S_OK,FALSE},
720 {"ftp://ftp.google.com/",S_OK,FALSE},
721 {"google.com",S_OK,FALSE},
722 {"",S_FALSE,FALSE},
723 {"",S_FALSE,FALSE},
724 {"ftp.google.com",S_OK,FALSE},
725 {"",S_OK,FALSE},
726 {"/",S_OK,FALSE},
727 {"/",S_OK,FALSE},
728 {"",S_FALSE,FALSE},
729 {"ftp://empty:@ftp.google.com/",S_OK,FALSE},
730 {"ftp",S_OK,FALSE},
731 {"empty:",S_OK,FALSE},
732 {"empty",S_OK,FALSE}
735 {Uri_HOST_DNS,S_OK,FALSE},
736 {21,S_OK,FALSE},
737 {URL_SCHEME_FTP,S_OK,FALSE},
738 {URLZONE_INVALID,E_NOTIMPL,FALSE}
741 /* Make sure forbidden characters in "userinfo" get encoded. */
742 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK, FALSE,
744 {"ftp://%22%20%22weird@ftp.google.com/",S_OK,FALSE},
745 {"%22%20%22weird@ftp.google.com",S_OK,FALSE},
746 {"ftp://ftp.google.com/",S_OK,FALSE},
747 {"google.com",S_OK,FALSE},
748 {"",S_FALSE,FALSE},
749 {"",S_FALSE,FALSE},
750 {"ftp.google.com",S_OK,FALSE},
751 {"",S_FALSE,FALSE},
752 {"/",S_OK,FALSE},
753 {"/",S_OK,FALSE},
754 {"",S_FALSE,FALSE},
755 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
756 {"ftp",S_OK,FALSE},
757 {"%22%20%22weird",S_OK,FALSE},
758 {"%22%20%22weird",S_OK,FALSE}
761 {Uri_HOST_DNS,S_OK,FALSE},
762 {21,S_OK,FALSE},
763 {URL_SCHEME_FTP,S_OK,FALSE},
764 {URLZONE_INVALID,E_NOTIMPL,FALSE}
767 /* Make sure the forbidden characters don't get percent encoded. */
768 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
770 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
771 {"\" \"weird@ftp.google.com",S_OK,FALSE},
772 {"ftp://ftp.google.com/",S_OK,FALSE},
773 {"google.com",S_OK,FALSE},
774 {"",S_FALSE,FALSE},
775 {"",S_FALSE,FALSE},
776 {"ftp.google.com",S_OK,FALSE},
777 {"",S_FALSE,FALSE},
778 {"/",S_OK,FALSE},
779 {"/",S_OK,FALSE},
780 {"",S_FALSE,FALSE},
781 {"ftp://\" \"weird@ftp.google.com/",S_OK,FALSE},
782 {"ftp",S_OK,FALSE},
783 {"\" \"weird",S_OK,FALSE},
784 {"\" \"weird",S_OK,FALSE}
787 {Uri_HOST_DNS,S_OK,FALSE},
788 {21,S_OK,FALSE},
789 {URL_SCHEME_FTP,S_OK,FALSE},
790 {URLZONE_INVALID,E_NOTIMPL,FALSE}
793 /* Make sure already percent encoded characters don't get unencoded. */
794 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
796 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
797 {"\"%20\"weird@ftp.google.com",S_OK,FALSE},
798 {"ftp://ftp.google.com/\"%20\"weird",S_OK,FALSE},
799 {"google.com",S_OK,FALSE},
800 {"",S_FALSE,FALSE},
801 {"",S_FALSE,FALSE},
802 {"ftp.google.com",S_OK,FALSE},
803 {"",S_FALSE,FALSE},
804 {"/\"%20\"weird",S_OK,FALSE},
805 {"/\"%20\"weird",S_OK,FALSE},
806 {"",S_FALSE,FALSE},
807 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK,FALSE},
808 {"ftp",S_OK,FALSE},
809 {"\"%20\"weird",S_OK,FALSE},
810 {"\"%20\"weird",S_OK,FALSE}
813 {Uri_HOST_DNS,S_OK,FALSE},
814 {21,S_OK,FALSE},
815 {URL_SCHEME_FTP,S_OK,FALSE},
816 {URLZONE_INVALID,E_NOTIMPL,FALSE}
819 /* Allowed to have invalid % encoded because its an unknown scheme type. */
820 { "zip://%xy:word@winehq.org/", 0, S_OK, FALSE,
822 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
823 {"%xy:word@winehq.org",S_OK,FALSE},
824 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
825 {"winehq.org",S_OK,FALSE},
826 {"",S_FALSE,FALSE},
827 {"",S_FALSE,FALSE},
828 {"winehq.org",S_OK,FALSE},
829 {"word",S_OK,FALSE},
830 {"/",S_OK,FALSE},
831 {"/",S_OK,FALSE},
832 {"",S_FALSE,FALSE},
833 {"zip://%xy:word@winehq.org/",S_OK,FALSE},
834 {"zip",S_OK,FALSE},
835 {"%xy:word",S_OK,FALSE},
836 {"%xy",S_OK,FALSE}
839 {Uri_HOST_DNS,S_OK,FALSE},
840 {0,S_FALSE,FALSE},
841 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
842 {URLZONE_INVALID,E_NOTIMPL,FALSE}
845 /* Unreserved, percent encoded characters aren't decoded in the userinfo becuase the scheme
846 * isn't known.
848 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK, FALSE,
850 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
851 {"%2E:%52%53ord@winehq.org",S_OK,FALSE},
852 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
853 {"winehq.org",S_OK,FALSE},
854 {"",S_FALSE,FALSE},
855 {"",S_FALSE,FALSE},
856 {"winehq.org",S_OK,FALSE},
857 {"%52%53ord",S_OK,FALSE},
858 {"/",S_OK,FALSE},
859 {"/",S_OK,FALSE},
860 {"",S_FALSE,FALSE},
861 {"zip://%2E:%52%53ord@winehq.org/",S_OK,FALSE},
862 {"zip",S_OK,FALSE},
863 {"%2E:%52%53ord",S_OK,FALSE},
864 {"%2E",S_OK,FALSE}
867 {Uri_HOST_DNS,S_OK,FALSE},
868 {0,S_FALSE,FALSE},
869 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
870 {URLZONE_INVALID,E_NOTIMPL,FALSE}
873 { "ftp://[](),'test':word@winehq.org/", 0, S_OK, FALSE,
875 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
876 {"[](),'test':word@winehq.org",S_OK,FALSE},
877 {"ftp://winehq.org/",S_OK,FALSE},
878 {"winehq.org",S_OK,FALSE},
879 {"",S_FALSE,FALSE},
880 {"",S_FALSE,FALSE},
881 {"winehq.org",S_OK,FALSE},
882 {"word",S_OK,FALSE},
883 {"/",S_OK,FALSE},
884 {"/",S_OK,FALSE},
885 {"",S_FALSE,FALSE},
886 {"ftp://[](),'test':word@winehq.org/",S_OK,FALSE},
887 {"ftp",S_OK,FALSE},
888 {"[](),'test':word",S_OK,FALSE},
889 {"[](),'test'",S_OK,FALSE}
892 {Uri_HOST_DNS,S_OK,FALSE},
893 {21,S_OK,FALSE},
894 {URL_SCHEME_FTP,S_OK,FALSE},
895 {URLZONE_INVALID,E_NOTIMPL,FALSE}
898 { "ftp://test?:word@winehq.org/", 0, S_OK, FALSE,
900 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
901 {"test",S_OK,FALSE},
902 {"ftp://test/?:word@winehq.org/",S_OK,FALSE},
903 {"",S_FALSE,FALSE},
904 {"",S_FALSE,FALSE},
905 {"",S_FALSE,FALSE},
906 {"test",S_OK,FALSE},
907 {"",S_FALSE,FALSE},
908 {"/",S_OK,FALSE},
909 {"/?:word@winehq.org/",S_OK,FALSE},
910 {"?:word@winehq.org/",S_OK,FALSE},
911 {"ftp://test?:word@winehq.org/",S_OK,FALSE},
912 {"ftp",S_OK,FALSE},
913 {"",S_FALSE,FALSE},
914 {"",S_FALSE,FALSE}
917 {Uri_HOST_DNS,S_OK,FALSE},
918 {21,S_OK,FALSE},
919 {URL_SCHEME_FTP,S_OK,FALSE},
920 {URLZONE_INVALID,E_NOTIMPL,FALSE}
923 { "ftp://test#:word@winehq.org/", 0, S_OK, FALSE,
925 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
926 {"test",S_OK,FALSE},
927 {"ftp://test/#:word@winehq.org/",S_OK,FALSE},
928 {"",S_FALSE,FALSE},
929 {"",S_FALSE,FALSE},
930 {"#:word@winehq.org/",S_OK,FALSE},
931 {"test",S_OK,FALSE},
932 {"",S_FALSE,FALSE},
933 {"/",S_OK,FALSE},
934 {"/",S_OK,FALSE},
935 {"",S_FALSE,FALSE},
936 {"ftp://test#:word@winehq.org/",S_OK,FALSE},
937 {"ftp",S_OK,FALSE},
938 {"",S_FALSE,FALSE},
939 {"",S_FALSE,FALSE}
942 {Uri_HOST_DNS,S_OK,FALSE},
943 {21,S_OK,FALSE},
944 {URL_SCHEME_FTP,S_OK,FALSE},
945 {URLZONE_INVALID,E_NOTIMPL,FALSE}
948 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
949 { "zip://test\\:word@winehq.org/", 0, S_OK, FALSE,
951 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
952 {"test\\:word@winehq.org",S_OK,FALSE},
953 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
954 {"winehq.org",S_OK,FALSE},
955 {"",S_FALSE,FALSE},
956 {"",S_FALSE,FALSE},
957 {"winehq.org",S_OK,FALSE},
958 {"word",S_OK,FALSE},
959 {"/",S_OK,FALSE},
960 {"/",S_OK,FALSE},
961 {"",S_FALSE,FALSE},
962 {"zip://test\\:word@winehq.org/",S_OK,FALSE},
963 {"zip",S_OK,FALSE},
964 {"test\\:word",S_OK,FALSE},
965 {"test\\",S_OK,FALSE}
968 {Uri_HOST_DNS,S_OK,FALSE},
969 {0,S_FALSE,FALSE},
970 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
971 {URLZONE_INVALID,E_NOTIMPL,FALSE}
974 /* It normalizes IPv4 addresses correctly. */
975 { "http://127.000.000.100/", 0, S_OK, FALSE,
977 {"http://127.0.0.100/",S_OK,FALSE},
978 {"127.0.0.100",S_OK,FALSE},
979 {"http://127.0.0.100/",S_OK,FALSE},
980 {"",S_FALSE,FALSE},
981 {"",S_FALSE,FALSE},
982 {"",S_FALSE,FALSE},
983 {"127.0.0.100",S_OK,FALSE},
984 {"",S_FALSE,FALSE},
985 {"/",S_OK,FALSE},
986 {"/",S_OK,FALSE},
987 {"",S_FALSE,FALSE},
988 {"http://127.000.000.100/",S_OK,FALSE},
989 {"http",S_OK,FALSE},
990 {"",S_FALSE,FALSE},
991 {"",S_FALSE,FALSE}
994 {Uri_HOST_IPV4,S_OK,FALSE},
995 {80,S_OK,FALSE},
996 {URL_SCHEME_HTTP,S_OK,FALSE},
997 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1000 { "http://127.0.0.1:8000", 0, S_OK, FALSE,
1002 {"http://127.0.0.1:8000/",S_OK},
1003 {"127.0.0.1:8000",S_OK},
1004 {"http://127.0.0.1:8000/",S_OK},
1005 {"",S_FALSE},
1006 {"",S_FALSE},
1007 {"",S_FALSE},
1008 {"127.0.0.1",S_OK},
1009 {"",S_FALSE},
1010 {"/",S_OK},
1011 {"/",S_OK},
1012 {"",S_FALSE},
1013 {"http://127.0.0.1:8000",S_OK},
1014 {"http",S_OK},
1015 {"",S_FALSE},
1016 {"",S_FALSE}
1019 {Uri_HOST_IPV4,S_OK,FALSE},
1020 {8000,S_OK,FALSE},
1021 {URL_SCHEME_HTTP,S_OK,FALSE},
1022 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1025 /* Make sure it normalizes partial IPv4 addresses correctly. */
1026 { "http://127.0/", 0, S_OK, FALSE,
1028 {"http://127.0.0.0/",S_OK,FALSE},
1029 {"127.0.0.0",S_OK,FALSE},
1030 {"http://127.0.0.0/",S_OK,FALSE},
1031 {"",S_FALSE,FALSE},
1032 {"",S_FALSE,FALSE},
1033 {"",S_FALSE,FALSE},
1034 {"127.0.0.0",S_OK,FALSE},
1035 {"",S_FALSE,FALSE},
1036 {"/",S_OK,FALSE},
1037 {"/",S_OK,FALSE},
1038 {"",S_FALSE,FALSE},
1039 {"http://127.0/",S_OK,FALSE},
1040 {"http",S_OK,FALSE},
1041 {"",S_FALSE,FALSE},
1042 {"",S_FALSE,FALSE}
1045 {Uri_HOST_IPV4,S_OK,FALSE},
1046 {80,S_OK,FALSE},
1047 {URL_SCHEME_HTTP,S_OK,FALSE},
1048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1051 /* Make sure it converts implicit IPv4's correctly. */
1052 { "http://123456/", 0, S_OK, FALSE,
1054 {"http://0.1.226.64/",S_OK,FALSE},
1055 {"0.1.226.64",S_OK,FALSE},
1056 {"http://0.1.226.64/",S_OK,FALSE},
1057 {"",S_FALSE,FALSE},
1058 {"",S_FALSE,FALSE},
1059 {"",S_FALSE,FALSE},
1060 {"0.1.226.64",S_OK,FALSE},
1061 {"",S_FALSE,FALSE},
1062 {"/",S_OK,FALSE},
1063 {"/",S_OK,FALSE},
1064 {"",S_FALSE,FALSE},
1065 {"http://123456/",S_OK,FALSE},
1066 {"http",S_OK,FALSE},
1067 {"",S_FALSE,FALSE},
1068 {"",S_FALSE,FALSE}
1071 {Uri_HOST_IPV4,S_OK,FALSE},
1072 {80,S_OK,FALSE},
1073 {URL_SCHEME_HTTP,S_OK,FALSE},
1074 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1077 /* UINT_MAX */
1078 { "http://4294967295/", 0, S_OK, FALSE,
1080 {"http://255.255.255.255/",S_OK,FALSE},
1081 {"255.255.255.255",S_OK,FALSE},
1082 {"http://255.255.255.255/",S_OK,FALSE},
1083 {"",S_FALSE,FALSE},
1084 {"",S_FALSE,FALSE},
1085 {"",S_FALSE,FALSE},
1086 {"255.255.255.255",S_OK,FALSE},
1087 {"",S_FALSE,FALSE},
1088 {"/",S_OK,FALSE},
1089 {"/",S_OK,FALSE},
1090 {"",S_FALSE,FALSE},
1091 {"http://4294967295/",S_OK,FALSE},
1092 {"http",S_OK,FALSE},
1093 {"",S_FALSE,FALSE},
1094 {"",S_FALSE,FALSE}
1097 {Uri_HOST_IPV4,S_OK,FALSE},
1098 {80,S_OK,FALSE},
1099 {URL_SCHEME_HTTP,S_OK,FALSE},
1100 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1103 /* UINT_MAX+1 */
1104 { "http://4294967296/", 0, S_OK, FALSE,
1106 {"http://4294967296/",S_OK,FALSE},
1107 {"4294967296",S_OK,FALSE},
1108 {"http://4294967296/",S_OK,FALSE},
1109 {"",S_FALSE,FALSE},
1110 {"",S_FALSE,FALSE},
1111 {"",S_FALSE,FALSE},
1112 {"4294967296",S_OK,FALSE},
1113 {"",S_FALSE,FALSE},
1114 {"/",S_OK,FALSE},
1115 {"/",S_OK,FALSE},
1116 {"",S_FALSE,FALSE},
1117 {"http://4294967296/",S_OK,FALSE},
1118 {"http",S_OK,FALSE},
1119 {"",S_FALSE,FALSE},
1120 {"",S_FALSE,FALSE}
1123 {Uri_HOST_DNS,S_OK,FALSE},
1124 {80,S_OK,FALSE},
1125 {URL_SCHEME_HTTP,S_OK,FALSE},
1126 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1129 /* Window's doesn't normalize IP address for unknown schemes. */
1130 { "1234://4294967295/", 0, S_OK, FALSE,
1132 {"1234://4294967295/",S_OK,FALSE},
1133 {"4294967295",S_OK,FALSE},
1134 {"1234://4294967295/",S_OK,FALSE},
1135 {"",S_FALSE,FALSE},
1136 {"",S_FALSE,FALSE},
1137 {"",S_FALSE,FALSE},
1138 {"4294967295",S_OK,FALSE},
1139 {"",S_FALSE,FALSE},
1140 {"/",S_OK,FALSE},
1141 {"/",S_OK,FALSE},
1142 {"",S_FALSE,FALSE},
1143 {"1234://4294967295/",S_OK,FALSE},
1144 {"1234",S_OK,FALSE},
1145 {"",S_FALSE,FALSE},
1146 {"",S_FALSE,FALSE}
1149 {Uri_HOST_IPV4,S_OK,FALSE},
1150 {0,S_FALSE,FALSE},
1151 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1152 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1155 /* Window's doesn't normalize IP address for unknown schemes. */
1156 { "1234://127.001/", 0, S_OK, FALSE,
1158 {"1234://127.001/",S_OK,FALSE},
1159 {"127.001",S_OK,FALSE},
1160 {"1234://127.001/",S_OK,FALSE},
1161 {"",S_FALSE,FALSE},
1162 {"",S_FALSE,FALSE},
1163 {"",S_FALSE,FALSE},
1164 {"127.001",S_OK,FALSE},
1165 {"",S_FALSE,FALSE},
1166 {"/",S_OK,FALSE},
1167 {"/",S_OK,FALSE},
1168 {"",S_FALSE,FALSE},
1169 {"1234://127.001/",S_OK,FALSE},
1170 {"1234",S_OK,FALSE},
1171 {"",S_FALSE,FALSE},
1172 {"",S_FALSE,FALSE}
1175 {Uri_HOST_IPV4,S_OK,FALSE},
1176 {0,S_FALSE,FALSE},
1177 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1178 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1181 { "http://[FEDC:BA98::3210]", 0, S_OK, FALSE,
1183 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1184 {"[fedc:ba98::3210]",S_OK,FALSE},
1185 {"http://[fedc:ba98::3210]/",S_OK,FALSE},
1186 {"",S_FALSE,FALSE},
1187 {"",S_FALSE,FALSE},
1188 {"",S_FALSE,FALSE},
1189 {"fedc:ba98::3210",S_OK,FALSE},
1190 {"",S_FALSE,FALSE},
1191 {"/",S_OK,FALSE},
1192 {"/",S_OK,FALSE},
1193 {"",S_FALSE,FALSE},
1194 {"http://[FEDC:BA98::3210]",S_OK,FALSE},
1195 {"http",S_OK,FALSE},
1196 {"",S_FALSE,FALSE},
1197 {"",S_FALSE,FALSE},
1200 {Uri_HOST_IPV6,S_OK,FALSE},
1201 {80,S_OK,FALSE},
1202 {URL_SCHEME_HTTP,S_OK,FALSE},
1203 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1206 { "http://[::]", 0, S_OK, FALSE,
1208 {"http://[::]/",S_OK,FALSE},
1209 {"[::]",S_OK,FALSE},
1210 {"http://[::]/",S_OK,FALSE},
1211 {"",S_FALSE,FALSE},
1212 {"",S_FALSE,FALSE},
1213 {"",S_FALSE,FALSE},
1214 {"::",S_OK,FALSE},
1215 {"",S_FALSE,FALSE},
1216 {"/",S_OK,FALSE},
1217 {"/",S_OK,FALSE},
1218 {"",S_FALSE,FALSE},
1219 {"http://[::]",S_OK,FALSE},
1220 {"http",S_OK,FALSE},
1221 {"",S_FALSE,FALSE},
1222 {"",S_FALSE,FALSE},
1225 {Uri_HOST_IPV6,S_OK,FALSE},
1226 {80,S_OK,FALSE},
1227 {URL_SCHEME_HTTP,S_OK,FALSE},
1228 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1231 { "http://[FEDC:BA98::]", 0, S_OK, FALSE,
1233 {"http://[fedc:ba98::]/",S_OK,FALSE},
1234 {"[fedc:ba98::]",S_OK,FALSE},
1235 {"http://[fedc:ba98::]/",S_OK,FALSE},
1236 {"",S_FALSE,FALSE},
1237 {"",S_FALSE,FALSE},
1238 {"",S_FALSE,FALSE},
1239 {"fedc:ba98::",S_OK,FALSE},
1240 {"",S_FALSE,FALSE},
1241 {"/",S_OK,FALSE},
1242 {"/",S_OK,FALSE},
1243 {"",S_FALSE,FALSE},
1244 {"http://[FEDC:BA98::]",S_OK,FALSE},
1245 {"http",S_OK,FALSE},
1246 {"",S_FALSE,FALSE},
1247 {"",S_FALSE,FALSE},
1250 {Uri_HOST_IPV6,S_OK,FALSE},
1251 {80,S_OK,FALSE},
1252 {URL_SCHEME_HTTP,S_OK,FALSE},
1253 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1256 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1257 { "http://[1::3:4:5:6:7:8]", 0, S_OK, FALSE,
1259 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1260 {"[1:0:3:4:5:6:7:8]",S_OK,FALSE},
1261 {"http://[1:0:3:4:5:6:7:8]/",S_OK,FALSE},
1262 {"",S_FALSE,FALSE},
1263 {"",S_FALSE,FALSE},
1264 {"",S_FALSE,FALSE},
1265 {"1:0:3:4:5:6:7:8",S_OK,FALSE},
1266 {"",S_FALSE,FALSE},
1267 {"/",S_OK,FALSE},
1268 {"/",S_OK,FALSE},
1269 {"",S_FALSE,FALSE},
1270 {"http://[1::3:4:5:6:7:8]",S_OK,FALSE},
1271 {"http",S_OK,FALSE},
1272 {"",S_FALSE,FALSE},
1273 {"",S_FALSE,FALSE},
1276 {Uri_HOST_IPV6,S_OK,FALSE},
1277 {80,S_OK,FALSE},
1278 {URL_SCHEME_HTTP,S_OK,FALSE},
1279 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1282 { "http://[v2.34]/", 0, S_OK, FALSE,
1284 {"http://[v2.34]/",S_OK,FALSE},
1285 {"[v2.34]",S_OK,FALSE},
1286 {"http://[v2.34]/",S_OK,FALSE},
1287 {"",S_FALSE,FALSE},
1288 {"",S_FALSE,FALSE},
1289 {"",S_FALSE,FALSE},
1290 {"[v2.34]",S_OK,FALSE},
1291 {"",S_FALSE,FALSE},
1292 {"/",S_OK,FALSE},
1293 {"/",S_OK,FALSE},
1294 {"",S_FALSE,FALSE},
1295 {"http://[v2.34]/",S_OK,FALSE},
1296 {"http",S_OK,FALSE},
1297 {"",S_FALSE,FALSE},
1298 {"",S_FALSE,FALSE}
1301 {Uri_HOST_UNKNOWN,S_OK,FALSE},
1302 {80,S_OK,FALSE},
1303 {URL_SCHEME_HTTP,S_OK,FALSE},
1304 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1307 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1308 { "http://[xyz:12345.com/test", 0, S_OK, FALSE,
1310 {"http://[xyz:12345.com/test",S_OK,FALSE},
1311 {"[xyz:12345.com",S_OK,FALSE},
1312 {"http://[xyz:12345.com/test",S_OK,FALSE},
1313 {"[xyz:12345.com",S_OK,FALSE},
1314 {"",S_FALSE,FALSE},
1315 {"",S_FALSE,FALSE},
1316 {"[xyz:12345.com",S_OK,FALSE},
1317 {"",S_FALSE,FALSE},
1318 {"/test",S_OK,FALSE},
1319 {"/test",S_OK,FALSE},
1320 {"",S_FALSE,FALSE},
1321 {"http://[xyz:12345.com/test",S_OK,FALSE},
1322 {"http",S_OK,FALSE},
1323 {"",S_FALSE,FALSE},
1324 {"",S_FALSE,FALSE}
1327 {Uri_HOST_DNS,S_OK,FALSE},
1328 {80,S_OK,FALSE},
1329 {URL_SCHEME_HTTP,S_OK,FALSE},
1330 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1333 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1334 * of the host name (respectively).
1336 { "ftp://www.[works].com/", 0, S_OK, FALSE,
1338 {"ftp://www.[works].com/",S_OK,FALSE},
1339 {"www.[works].com",S_OK,FALSE},
1340 {"ftp://www.[works].com/",S_OK,FALSE},
1341 {"[works].com",S_OK,FALSE},
1342 {"",S_FALSE,FALSE},
1343 {"",S_FALSE,FALSE},
1344 {"www.[works].com",S_OK,FALSE},
1345 {"",S_FALSE,FALSE},
1346 {"/",S_OK,FALSE},
1347 {"/",S_OK,FALSE},
1348 {"",S_FALSE,FALSE},
1349 {"ftp://www.[works].com/",S_OK,FALSE},
1350 {"ftp",S_OK,FALSE},
1351 {"",S_FALSE,FALSE},
1352 {"",S_FALSE,FALSE}
1355 {Uri_HOST_DNS,S_OK,FALSE},
1356 {21,S_OK,FALSE},
1357 {URL_SCHEME_FTP,S_OK,FALSE},
1358 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1361 /* Considers ':' a delimiter since it appears after the ']'. */
1362 { "http://www.google.com]:12345/", 0, S_OK, FALSE,
1364 {"http://www.google.com]:12345/",S_OK,FALSE},
1365 {"www.google.com]:12345",S_OK,FALSE},
1366 {"http://www.google.com]:12345/",S_OK,FALSE},
1367 {"google.com]",S_OK,FALSE},
1368 {"",S_FALSE,FALSE},
1369 {"",S_FALSE,FALSE},
1370 {"www.google.com]",S_OK,FALSE},
1371 {"",S_FALSE,FALSE},
1372 {"/",S_OK,FALSE},
1373 {"/",S_OK,FALSE},
1374 {"",S_FALSE,FALSE},
1375 {"http://www.google.com]:12345/",S_OK,FALSE},
1376 {"http",S_OK,FALSE},
1377 {"",S_FALSE,FALSE},
1378 {"",S_FALSE,FALSE}
1381 {Uri_HOST_DNS,S_OK,FALSE},
1382 {12345,S_OK,FALSE},
1383 {URL_SCHEME_HTTP,S_OK,FALSE},
1384 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1387 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1388 { "zip://w%XXw%GEw.google.com/", 0, S_OK, FALSE,
1390 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1391 {"w%XXw%GEw.google.com",S_OK,FALSE},
1392 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1393 {"google.com",S_OK,FALSE},
1394 {"",S_FALSE,FALSE},
1395 {"",S_FALSE,FALSE},
1396 {"w%XXw%GEw.google.com",S_OK,FALSE},
1397 {"",S_FALSE,FALSE},
1398 {"/",S_OK,FALSE},
1399 {"/",S_OK,FALSE},
1400 {"",S_FALSE,FALSE},
1401 {"zip://w%XXw%GEw.google.com/",S_OK,FALSE},
1402 {"zip",S_OK,FALSE},
1403 {"",S_FALSE,FALSE},
1404 {"",S_FALSE,FALSE}
1407 {Uri_HOST_DNS,S_OK,FALSE},
1408 {0,S_FALSE,FALSE},
1409 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1410 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1413 /* Unknown scheme types hostname doesn't get lower cased. */
1414 { "zip://GOOGLE.com/", 0, S_OK, FALSE,
1416 {"zip://GOOGLE.com/",S_OK,FALSE},
1417 {"GOOGLE.com",S_OK,FALSE},
1418 {"zip://GOOGLE.com/",S_OK,FALSE},
1419 {"GOOGLE.com",S_OK,FALSE},
1420 {"",S_FALSE,FALSE},
1421 {"",S_FALSE,FALSE},
1422 {"GOOGLE.com",S_OK,FALSE},
1423 {"",S_FALSE,FALSE},
1424 {"/",S_OK,FALSE},
1425 {"/",S_OK,FALSE},
1426 {"",S_FALSE,FALSE},
1427 {"zip://GOOGLE.com/",S_OK,FALSE},
1428 {"zip",S_OK,FALSE},
1429 {"",S_FALSE,FALSE},
1430 {"",S_FALSE,FALSE}
1433 {Uri_HOST_DNS,S_OK,FALSE},
1434 {0,S_FALSE,FALSE},
1435 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1436 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1439 /* Hostname get's lower cased for known scheme types. */
1440 { "http://WWW.GOOGLE.com/", 0, S_OK, FALSE,
1442 {"http://www.google.com/",S_OK,FALSE},
1443 {"www.google.com",S_OK,FALSE},
1444 {"http://www.google.com/",S_OK,FALSE},
1445 {"google.com",S_OK,FALSE},
1446 {"",S_FALSE,FALSE},
1447 {"",S_FALSE,FALSE},
1448 {"www.google.com",S_OK,FALSE},
1449 {"",S_FALSE,FALSE},
1450 {"/",S_OK,FALSE},
1451 {"/",S_OK,FALSE},
1452 {"",S_FALSE,FALSE},
1453 {"http://WWW.GOOGLE.com/",S_OK,FALSE},
1454 {"http",S_OK,FALSE},
1455 {"",S_FALSE,FALSE},
1456 {"",S_FALSE,FALSE}
1459 {Uri_HOST_DNS,S_OK,FALSE},
1460 {80,S_OK,FALSE},
1461 {URL_SCHEME_HTTP,S_OK,FALSE},
1462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1465 /* Characters that get % encoded in the hostname also have their percent
1466 * encoded forms lower cased.
1468 { "http://www.%7Cgoogle|.com/", 0, S_OK, FALSE,
1470 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1471 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1472 {"http://www.%7cgoogle%7c.com/",S_OK,FALSE},
1473 {"%7cgoogle%7c.com",S_OK,FALSE},
1474 {"",S_FALSE,FALSE},
1475 {"",S_FALSE,FALSE},
1476 {"www.%7cgoogle%7c.com",S_OK,FALSE},
1477 {"",S_FALSE,FALSE},
1478 {"/",S_OK,FALSE},
1479 {"/",S_OK,FALSE},
1480 {"",S_FALSE,FALSE},
1481 {"http://www.%7Cgoogle|.com/",S_OK,FALSE},
1482 {"http",S_OK,FALSE},
1483 {"",S_FALSE,FALSE},
1484 {"",S_FALSE,FALSE}
1487 {Uri_HOST_DNS,S_OK,FALSE},
1488 {80,S_OK,FALSE},
1489 {URL_SCHEME_HTTP,S_OK,FALSE},
1490 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1493 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1494 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK, FALSE,
1496 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1497 {"[1:2:3:4:5:6::]",S_OK,FALSE},
1498 {"http://[1:2:3:4:5:6::]/",S_OK,FALSE},
1499 {"",S_FALSE,FALSE},
1500 {"",S_FALSE,FALSE},
1501 {"",S_FALSE,FALSE},
1502 {"1:2:3:4:5:6::",S_OK,FALSE},
1503 {"",S_FALSE,FALSE},
1504 {"/",S_OK,FALSE},
1505 {"/",S_OK,FALSE},
1506 {"",S_FALSE,FALSE},
1507 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK,FALSE},
1508 {"http",S_OK,FALSE},
1509 {"",S_FALSE,FALSE},
1510 {"",S_FALSE,FALSE},
1513 {Uri_HOST_IPV6,S_OK,FALSE},
1514 {80,S_OK,FALSE},
1515 {URL_SCHEME_HTTP,S_OK,FALSE},
1516 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1519 /* IPv4 addresses get normalized. */
1520 { "http://[::001.002.003.000]", 0, S_OK, FALSE,
1522 {"http://[::1.2.3.0]/",S_OK,FALSE},
1523 {"[::1.2.3.0]",S_OK,FALSE},
1524 {"http://[::1.2.3.0]/",S_OK,FALSE},
1525 {"",S_FALSE,FALSE},
1526 {"",S_FALSE,FALSE},
1527 {"",S_FALSE,FALSE},
1528 {"::1.2.3.0",S_OK,FALSE},
1529 {"",S_FALSE,FALSE},
1530 {"/",S_OK,FALSE},
1531 {"/",S_OK,FALSE},
1532 {"",S_FALSE,FALSE},
1533 {"http://[::001.002.003.000]",S_OK,FALSE},
1534 {"http",S_OK,FALSE},
1535 {"",S_FALSE,FALSE},
1536 {"",S_FALSE,FALSE},
1539 {Uri_HOST_IPV6,S_OK,FALSE},
1540 {80,S_OK,FALSE},
1541 {URL_SCHEME_HTTP,S_OK,FALSE},
1542 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1545 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1546 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK, FALSE,
1548 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1549 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1550 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,FALSE},
1551 {"",S_FALSE,FALSE},
1552 {"",S_FALSE,FALSE},
1553 {"",S_FALSE,FALSE},
1554 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE},
1555 {"",S_FALSE,FALSE},
1556 {"/",S_OK,FALSE},
1557 {"/",S_OK,FALSE},
1558 {"",S_FALSE,FALSE},
1559 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE},
1560 {"zip",S_OK,FALSE},
1561 {"",S_FALSE,FALSE},
1562 {"",S_FALSE,FALSE},
1565 {Uri_HOST_IPV6,S_OK,FALSE},
1566 {0,S_FALSE,FALSE},
1567 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1568 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1571 /* IPv4 address is converted into 2 h16 components. */
1572 { "http://[ffff::192.222.111.32]", 0, S_OK, FALSE,
1574 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1575 {"[ffff::c0de:6f20]",S_OK,FALSE},
1576 {"http://[ffff::c0de:6f20]/",S_OK,FALSE},
1577 {"",S_FALSE,FALSE},
1578 {"",S_FALSE,FALSE},
1579 {"",S_FALSE,FALSE},
1580 {"ffff::c0de:6f20",S_OK,FALSE},
1581 {"",S_FALSE,FALSE},
1582 {"/",S_OK,FALSE},
1583 {"/",S_OK,FALSE},
1584 {"",S_FALSE,FALSE},
1585 {"http://[ffff::192.222.111.32]",S_OK,FALSE},
1586 {"http",S_OK,FALSE},
1587 {"",S_FALSE,FALSE},
1588 {"",S_FALSE,FALSE},
1591 {Uri_HOST_IPV6,S_OK,FALSE},
1592 {80,S_OK,FALSE},
1593 {URL_SCHEME_HTTP,S_OK,FALSE},
1594 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1597 /* Max value for a port. */
1598 { "http://google.com:65535", 0, S_OK, FALSE,
1600 {"http://google.com:65535/",S_OK,FALSE},
1601 {"google.com:65535",S_OK,FALSE},
1602 {"http://google.com:65535/",S_OK,FALSE},
1603 {"google.com",S_OK,FALSE},
1604 {"",S_FALSE,FALSE},
1605 {"",S_FALSE,FALSE},
1606 {"google.com",S_OK,FALSE},
1607 {"",S_FALSE,FALSE},
1608 {"/",S_OK,FALSE},
1609 {"/",S_OK,FALSE},
1610 {"",S_FALSE,FALSE},
1611 {"http://google.com:65535",S_OK,FALSE},
1612 {"http",S_OK,FALSE},
1613 {"",S_FALSE,FALSE},
1614 {"",S_FALSE,FALSE}
1617 {Uri_HOST_DNS,S_OK,FALSE},
1618 {65535,S_OK,FALSE},
1619 {URL_SCHEME_HTTP,S_OK,FALSE},
1620 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1623 { "zip://google.com:65536", 0, S_OK, FALSE,
1625 {"zip://google.com:65536/",S_OK,FALSE},
1626 {"google.com:65536",S_OK,FALSE},
1627 {"zip://google.com:65536/",S_OK,FALSE},
1628 {"google.com:65536",S_OK,FALSE},
1629 {"",S_FALSE,FALSE},
1630 {"",S_FALSE,FALSE},
1631 {"google.com:65536",S_OK,FALSE},
1632 {"",S_FALSE,FALSE},
1633 {"/",S_OK,FALSE},
1634 {"/",S_OK,FALSE},
1635 {"",S_FALSE,FALSE},
1636 {"zip://google.com:65536",S_OK,FALSE},
1637 {"zip",S_OK,FALSE},
1638 {"",S_FALSE,FALSE},
1639 {"",S_FALSE,FALSE}
1642 {Uri_HOST_DNS,S_OK,FALSE},
1643 {0,S_FALSE,FALSE},
1644 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1645 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1648 { "zip://google.com:65536:25", 0, S_OK, FALSE,
1650 {"zip://google.com:65536:25/",S_OK,FALSE},
1651 {"google.com:65536:25",S_OK,FALSE},
1652 {"zip://google.com:65536:25/",S_OK,FALSE},
1653 {"google.com:65536:25",S_OK,FALSE},
1654 {"",S_FALSE,FALSE},
1655 {"",S_FALSE,FALSE},
1656 {"google.com:65536:25",S_OK,FALSE},
1657 {"",S_FALSE,FALSE},
1658 {"/",S_OK,FALSE},
1659 {"/",S_OK,FALSE},
1660 {"",S_FALSE,FALSE},
1661 {"zip://google.com:65536:25",S_OK,FALSE},
1662 {"zip",S_OK,FALSE},
1663 {"",S_FALSE,FALSE},
1664 {"",S_FALSE,FALSE}
1667 {Uri_HOST_DNS,S_OK,FALSE},
1668 {0,S_FALSE,FALSE},
1669 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1670 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1673 { "zip://[::ffff]:abcd", 0, S_OK, FALSE,
1675 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1676 {"[::ffff]:abcd",S_OK,FALSE},
1677 {"zip://[::ffff]:abcd/",S_OK,FALSE},
1678 {"",S_FALSE,FALSE},
1679 {"",S_FALSE,FALSE},
1680 {"",S_FALSE,FALSE},
1681 {"[::ffff]:abcd",S_OK,FALSE},
1682 {"",S_FALSE,FALSE},
1683 {"/",S_OK,FALSE},
1684 {"/",S_OK,FALSE},
1685 {"",S_FALSE,FALSE},
1686 {"zip://[::ffff]:abcd",S_OK,FALSE},
1687 {"zip",S_OK,FALSE},
1688 {"",S_FALSE,FALSE},
1689 {"",S_FALSE,FALSE}
1692 {Uri_HOST_DNS,S_OK,FALSE},
1693 {0,S_FALSE,FALSE},
1694 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1695 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1698 { "zip://127.0.0.1:abcd", 0, S_OK, FALSE,
1700 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1701 {"127.0.0.1:abcd",S_OK,FALSE},
1702 {"zip://127.0.0.1:abcd/",S_OK,FALSE},
1703 {"0.1:abcd",S_OK,FALSE},
1704 {"",S_FALSE,FALSE},
1705 {"",S_FALSE,FALSE},
1706 {"127.0.0.1:abcd",S_OK,FALSE},
1707 {"",S_FALSE,FALSE},
1708 {"/",S_OK,FALSE},
1709 {"/",S_OK,FALSE},
1710 {"",S_FALSE,FALSE},
1711 {"zip://127.0.0.1:abcd",S_OK,FALSE},
1712 {"zip",S_OK,FALSE},
1713 {"",S_FALSE,FALSE},
1714 {"",S_FALSE,FALSE}
1717 {Uri_HOST_DNS,S_OK,FALSE},
1718 {0,S_FALSE,FALSE},
1719 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
1720 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1723 /* Port is just copied over. */
1724 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1726 {"http://google.com:00035",S_OK,FALSE},
1727 {"google.com:00035",S_OK,FALSE},
1728 {"http://google.com:00035",S_OK,FALSE,"http://google.com:35"},
1729 {"google.com",S_OK,FALSE},
1730 {"",S_FALSE,FALSE},
1731 {"",S_FALSE,FALSE},
1732 {"google.com",S_OK,FALSE},
1733 {"",S_FALSE,FALSE},
1734 {"",S_FALSE,FALSE},
1735 {"",S_FALSE,FALSE},
1736 {"",S_FALSE,FALSE},
1737 {"http://google.com:00035",S_OK,FALSE},
1738 {"http",S_OK,FALSE},
1739 {"",S_FALSE,FALSE},
1740 {"",S_FALSE,FALSE}
1743 {Uri_HOST_DNS,S_OK,FALSE},
1744 {35,S_OK,FALSE},
1745 {URL_SCHEME_HTTP,S_OK,FALSE},
1746 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1749 /* Default port is copied over. */
1750 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
1752 {"http://google.com:80",S_OK,FALSE},
1753 {"google.com:80",S_OK,FALSE},
1754 {"http://google.com:80",S_OK,FALSE},
1755 {"google.com",S_OK,FALSE},
1756 {"",S_FALSE,FALSE},
1757 {"",S_FALSE,FALSE},
1758 {"google.com",S_OK,FALSE},
1759 {"",S_FALSE,FALSE},
1760 {"",S_FALSE,FALSE},
1761 {"",S_FALSE,FALSE},
1762 {"",S_FALSE,FALSE},
1763 {"http://google.com:80",S_OK,FALSE},
1764 {"http",S_OK,FALSE},
1765 {"",S_FALSE,FALSE},
1766 {"",S_FALSE,FALSE}
1769 {Uri_HOST_DNS,S_OK,FALSE},
1770 {80,S_OK,FALSE},
1771 {URL_SCHEME_HTTP,S_OK,FALSE},
1772 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1775 { "http://google.com.uk", 0, S_OK, FALSE,
1777 {"http://google.com.uk/",S_OK,FALSE},
1778 {"google.com.uk",S_OK,FALSE},
1779 {"http://google.com.uk/",S_OK,FALSE},
1780 {"google.com.uk",S_OK,FALSE},
1781 {"",S_FALSE,FALSE},
1782 {"",S_FALSE,FALSE},
1783 {"google.com.uk",S_OK,FALSE},
1784 {"",S_FALSE,FALSE},
1785 {"/",S_OK,FALSE},
1786 {"/",S_OK,FALSE},
1787 {"",S_FALSE,FALSE},
1788 {"http://google.com.uk",S_OK,FALSE},
1789 {"http",S_OK,FALSE},
1790 {"",S_FALSE,FALSE},
1791 {"",S_FALSE,FALSE}
1794 {Uri_HOST_DNS,S_OK,FALSE},
1795 {80,S_OK,FALSE},
1796 {URL_SCHEME_HTTP,S_OK,FALSE},
1797 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1800 { "http://google.com.com", 0, S_OK, FALSE,
1802 {"http://google.com.com/",S_OK,FALSE},
1803 {"google.com.com",S_OK,FALSE},
1804 {"http://google.com.com/",S_OK,FALSE},
1805 {"com.com",S_OK,FALSE},
1806 {"",S_FALSE,FALSE},
1807 {"",S_FALSE,FALSE},
1808 {"google.com.com",S_OK,FALSE},
1809 {"",S_FALSE,FALSE},
1810 {"/",S_OK,FALSE},
1811 {"/",S_OK,FALSE},
1812 {"",S_FALSE,FALSE},
1813 {"http://google.com.com",S_OK,FALSE},
1814 {"http",S_OK,FALSE},
1815 {"",S_FALSE,FALSE},
1816 {"",S_FALSE,FALSE}
1819 {Uri_HOST_DNS,S_OK,FALSE},
1820 {80,S_OK,FALSE},
1821 {URL_SCHEME_HTTP,S_OK,FALSE},
1822 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1825 { "http://google.uk.1", 0, S_OK, FALSE,
1827 {"http://google.uk.1/",S_OK,FALSE},
1828 {"google.uk.1",S_OK,FALSE},
1829 {"http://google.uk.1/",S_OK,FALSE},
1830 {"google.uk.1",S_OK,FALSE},
1831 {"",S_FALSE,FALSE},
1832 {"",S_FALSE,FALSE},
1833 {"google.uk.1",S_OK,FALSE},
1834 {"",S_FALSE,FALSE},
1835 {"/",S_OK,FALSE},
1836 {"/",S_OK,FALSE},
1837 {"",S_FALSE,FALSE},
1838 {"http://google.uk.1",S_OK,FALSE},
1839 {"http",S_OK,FALSE},
1840 {"",S_FALSE,FALSE},
1841 {"",S_FALSE,FALSE}
1844 {Uri_HOST_DNS,S_OK,FALSE},
1845 {80,S_OK,FALSE},
1846 {URL_SCHEME_HTTP,S_OK,FALSE},
1847 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1850 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1851 { "http://google.foo.uk", 0, S_OK, FALSE,
1853 {"http://google.foo.uk/",S_OK,FALSE},
1854 {"google.foo.uk",S_OK,FALSE},
1855 {"http://google.foo.uk/",S_OK,FALSE},
1856 {"foo.uk",S_OK,FALSE},
1857 {"",S_FALSE,FALSE},
1858 {"",S_FALSE,FALSE},
1859 {"google.foo.uk",S_OK,FALSE},
1860 {"",S_FALSE,FALSE},
1861 {"/",S_OK,FALSE},
1862 {"/",S_OK,FALSE},
1863 {"",S_FALSE,FALSE},
1864 {"http://google.foo.uk",S_OK,FALSE},
1865 {"http",S_OK,FALSE},
1866 {"",S_FALSE,FALSE},
1867 {"",S_FALSE,FALSE}
1870 {Uri_HOST_DNS,S_OK,FALSE},
1871 {80,S_OK,FALSE},
1872 {URL_SCHEME_HTTP,S_OK,FALSE},
1873 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1876 { "http://.com", 0, S_OK, FALSE,
1878 {"http://.com/",S_OK,FALSE},
1879 {".com",S_OK,FALSE},
1880 {"http://.com/",S_OK,FALSE},
1881 {".com",S_OK,FALSE},
1882 {"",S_FALSE,FALSE},
1883 {"",S_FALSE,FALSE},
1884 {".com",S_OK,FALSE},
1885 {"",S_FALSE,FALSE},
1886 {"/",S_OK,FALSE},
1887 {"/",S_OK,FALSE},
1888 {"",S_FALSE,FALSE},
1889 {"http://.com",S_OK,FALSE},
1890 {"http",S_OK,FALSE},
1891 {"",S_FALSE,FALSE},
1892 {"",S_FALSE,FALSE}
1895 {Uri_HOST_DNS,S_OK,FALSE},
1896 {80,S_OK,FALSE},
1897 {URL_SCHEME_HTTP,S_OK,FALSE},
1898 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1901 { "http://.uk", 0, S_OK, FALSE,
1903 {"http://.uk/",S_OK,FALSE},
1904 {".uk",S_OK,FALSE},
1905 {"http://.uk/",S_OK,FALSE},
1906 {"",S_FALSE,FALSE},
1907 {"",S_FALSE,FALSE},
1908 {"",S_FALSE,FALSE},
1909 {".uk",S_OK,FALSE},
1910 {"",S_FALSE,FALSE},
1911 {"/",S_OK,FALSE},
1912 {"/",S_OK,FALSE},
1913 {"",S_FALSE,FALSE},
1914 {"http://.uk",S_OK,FALSE},
1915 {"http",S_OK,FALSE},
1916 {"",S_FALSE,FALSE},
1917 {"",S_FALSE,FALSE}
1920 {Uri_HOST_DNS,S_OK,FALSE},
1921 {80,S_OK,FALSE},
1922 {URL_SCHEME_HTTP,S_OK,FALSE},
1923 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1926 { "http://www.co.google.com.[]", 0, S_OK, FALSE,
1928 {"http://www.co.google.com.[]/",S_OK,FALSE},
1929 {"www.co.google.com.[]",S_OK,FALSE},
1930 {"http://www.co.google.com.[]/",S_OK,FALSE},
1931 {"google.com.[]",S_OK,FALSE},
1932 {"",S_FALSE,FALSE},
1933 {"",S_FALSE,FALSE},
1934 {"www.co.google.com.[]",S_OK,FALSE},
1935 {"",S_FALSE,FALSE},
1936 {"/",S_OK,FALSE},
1937 {"/",S_OK,FALSE},
1938 {"",S_FALSE,FALSE},
1939 {"http://www.co.google.com.[]",S_OK,FALSE},
1940 {"http",S_OK,FALSE},
1941 {"",S_FALSE,FALSE},
1942 {"",S_FALSE,FALSE}
1945 {Uri_HOST_DNS,S_OK,FALSE},
1946 {80,S_OK,FALSE},
1947 {URL_SCHEME_HTTP,S_OK,FALSE},
1948 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1951 { "http://co.uk", 0, S_OK, FALSE,
1953 {"http://co.uk/",S_OK,FALSE},
1954 {"co.uk",S_OK,FALSE},
1955 {"http://co.uk/",S_OK,FALSE},
1956 {"",S_FALSE,FALSE},
1957 {"",S_FALSE,FALSE},
1958 {"",S_FALSE,FALSE},
1959 {"co.uk",S_OK,FALSE},
1960 {"",S_FALSE,FALSE},
1961 {"/",S_OK,FALSE},
1962 {"/",S_OK,FALSE},
1963 {"",S_FALSE,FALSE},
1964 {"http://co.uk",S_OK,FALSE},
1965 {"http",S_OK,FALSE},
1966 {"",S_FALSE,FALSE},
1967 {"",S_FALSE,FALSE}
1970 {Uri_HOST_DNS,S_OK,FALSE},
1971 {80,S_OK,FALSE},
1972 {URL_SCHEME_HTTP,S_OK,FALSE},
1973 {URLZONE_INVALID,E_NOTIMPL,FALSE}
1976 { "http://www.co.google.us.test", 0, S_OK, FALSE,
1978 {"http://www.co.google.us.test/",S_OK,FALSE},
1979 {"www.co.google.us.test",S_OK,FALSE},
1980 {"http://www.co.google.us.test/",S_OK,FALSE},
1981 {"us.test",S_OK,FALSE},
1982 {"",S_FALSE,FALSE},
1983 {"",S_FALSE,FALSE},
1984 {"www.co.google.us.test",S_OK,FALSE},
1985 {"",S_FALSE,FALSE},
1986 {"/",S_OK,FALSE},
1987 {"/",S_OK,FALSE},
1988 {"",S_FALSE,FALSE},
1989 {"http://www.co.google.us.test",S_OK,FALSE},
1990 {"http",S_OK,FALSE},
1991 {"",S_FALSE,FALSE},
1992 {"",S_FALSE,FALSE}
1995 {Uri_HOST_DNS,S_OK,FALSE},
1996 {80,S_OK,FALSE},
1997 {URL_SCHEME_HTTP,S_OK,FALSE},
1998 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2001 { "http://gov.uk", 0, S_OK, FALSE,
2003 {"http://gov.uk/",S_OK,FALSE},
2004 {"gov.uk",S_OK,FALSE},
2005 {"http://gov.uk/",S_OK,FALSE},
2006 {"",S_FALSE,FALSE},
2007 {"",S_FALSE,FALSE},
2008 {"",S_FALSE,FALSE},
2009 {"gov.uk",S_OK,FALSE},
2010 {"",S_FALSE,FALSE},
2011 {"/",S_OK,FALSE},
2012 {"/",S_OK,FALSE},
2013 {"",S_FALSE,FALSE},
2014 {"http://gov.uk",S_OK,FALSE},
2015 {"http",S_OK,FALSE},
2016 {"",S_FALSE,FALSE},
2017 {"",S_FALSE,FALSE}
2020 {Uri_HOST_DNS,S_OK,FALSE},
2021 {80,S_OK,FALSE},
2022 {URL_SCHEME_HTTP,S_OK,FALSE},
2023 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2026 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2028 {"zip://www.google.com\\test",S_OK,FALSE},
2029 {"www.google.com\\test",S_OK,FALSE},
2030 {"zip://www.google.com\\test",S_OK,FALSE},
2031 {"google.com\\test",S_OK,FALSE},
2032 {"",S_FALSE,FALSE},
2033 {"",S_FALSE,FALSE},
2034 {"www.google.com\\test",S_OK,FALSE},
2035 {"",S_FALSE,FALSE},
2036 {"",S_FALSE,FALSE},
2037 {"",S_FALSE,FALSE},
2038 {"",S_FALSE,FALSE},
2039 {"zip://www.google.com\\test",S_OK,FALSE},
2040 {"zip",S_OK,FALSE},
2041 {"",S_FALSE,FALSE},
2042 {"",S_FALSE,FALSE}
2045 {Uri_HOST_DNS,S_OK,FALSE},
2046 {0,S_FALSE,FALSE},
2047 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2048 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2051 { "urn:excepts:bad:%XY:encoded", 0, S_OK, FALSE,
2053 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2054 {"",S_FALSE,FALSE},
2055 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2056 {"",S_FALSE,FALSE},
2057 {"",S_FALSE,FALSE},
2058 {"",S_FALSE,FALSE},
2059 {"",S_FALSE,FALSE},
2060 {"",S_FALSE,FALSE},
2061 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2062 {"excepts:bad:%XY:encoded",S_OK,FALSE},
2063 {"",S_FALSE,FALSE},
2064 {"urn:excepts:bad:%XY:encoded",S_OK,FALSE},
2065 {"urn",S_OK,FALSE},
2066 {"",S_FALSE,FALSE},
2067 {"",S_FALSE,FALSE}
2070 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2071 {0,S_FALSE,FALSE},
2072 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2073 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2076 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2077 * are decoded and all '%' are encoded.
2079 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK, FALSE,
2081 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2082 {"",S_FALSE,FALSE},
2083 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2084 {"",S_FALSE,FALSE},
2085 {".mp3",S_OK,FALSE},
2086 {"",S_FALSE,FALSE},
2087 {"",S_FALSE,FALSE},
2088 {"",S_FALSE,FALSE},
2089 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2090 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK,FALSE},
2091 {"",S_FALSE,FALSE},
2092 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK,FALSE},
2093 {"file",S_OK,FALSE},
2094 {"",S_FALSE,FALSE},
2095 {"",S_FALSE,FALSE}
2098 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2099 {0,S_FALSE,FALSE},
2100 {URL_SCHEME_FILE,S_OK,FALSE},
2101 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2104 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2105 * is decoded and only %'s in front of invalid hex digits are encoded.
2107 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK, FALSE,
2109 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2110 {"",S_FALSE,FALSE},
2111 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2112 {"",S_FALSE,FALSE},
2113 {".mp3",S_OK,FALSE},
2114 {"",S_FALSE,FALSE},
2115 {"",S_FALSE,FALSE},
2116 {"",S_FALSE,FALSE},
2117 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2118 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK,FALSE},
2119 {"",S_FALSE,FALSE},
2120 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK,FALSE},
2121 {"file",S_OK,FALSE},
2122 {"",S_FALSE,FALSE},
2123 {"",S_FALSE,FALSE}
2126 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2127 {0,S_FALSE,FALSE},
2128 {URL_SCHEME_FILE,S_OK,FALSE},
2129 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2132 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2133 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK, FALSE,
2135 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2136 {"[::1.2.3.0]",S_OK,FALSE},
2137 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,FALSE},
2138 {"",S_FALSE,FALSE},
2139 {"",S_FALSE,FALSE},
2140 {"",S_FALSE,FALSE},
2141 {"::1.2.3.0",S_OK,FALSE},
2142 {"",S_FALSE,FALSE},
2143 {"/%3F%23.T/test",S_OK,FALSE},
2144 {"/%3F%23.T/test",S_OK,FALSE},
2145 {"",S_FALSE,FALSE},
2146 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK,FALSE},
2147 {"http",S_OK,FALSE},
2148 {"",S_FALSE,FALSE},
2149 {"",S_FALSE,FALSE},
2152 {Uri_HOST_IPV6,S_OK,FALSE},
2153 {80,S_OK,FALSE},
2154 {URL_SCHEME_HTTP,S_OK,FALSE},
2155 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2158 /* Forbidden characters are always encoded for file URIs. */
2159 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2161 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2162 {"",S_FALSE,FALSE},
2163 {"file:///C:/%22test%22/test.mp3",S_OK,FALSE},
2164 {"",S_FALSE,FALSE},
2165 {".mp3",S_OK,FALSE},
2166 {"",S_FALSE,FALSE},
2167 {"",S_FALSE,FALSE},
2168 {"",S_FALSE,FALSE},
2169 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2170 {"/C:/%22test%22/test.mp3",S_OK,FALSE},
2171 {"",S_FALSE,FALSE},
2172 {"file:///C:/\"test\"/test.mp3",S_OK,FALSE},
2173 {"file",S_OK,FALSE},
2174 {"",S_FALSE,FALSE},
2175 {"",S_FALSE,FALSE}
2178 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2179 {0,S_FALSE,FALSE},
2180 {URL_SCHEME_FILE,S_OK,FALSE},
2181 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2184 /* Forbidden characters are never encoded for unknown scheme types. */
2185 { "1234://4294967295/<|>\" test<|>", 0, S_OK, FALSE,
2187 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2188 {"4294967295",S_OK,FALSE},
2189 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2190 {"",S_FALSE,FALSE},
2191 {"",S_FALSE,FALSE},
2192 {"",S_FALSE,FALSE},
2193 {"4294967295",S_OK,FALSE},
2194 {"",S_FALSE,FALSE},
2195 {"/<|>\" test<|>",S_OK,FALSE},
2196 {"/<|>\" test<|>",S_OK,FALSE},
2197 {"",S_FALSE,FALSE},
2198 {"1234://4294967295/<|>\" test<|>",S_OK,FALSE},
2199 {"1234",S_OK,FALSE},
2200 {"",S_FALSE,FALSE},
2201 {"",S_FALSE,FALSE}
2204 {Uri_HOST_IPV4,S_OK,FALSE},
2205 {0,S_FALSE,FALSE},
2206 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2207 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2210 /* Make sure forbidden characters are percent encoded. */
2211 { "http://gov.uk/<|> test<|>", 0, S_OK, FALSE,
2213 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2214 {"gov.uk",S_OK,FALSE},
2215 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2216 {"",S_FALSE,FALSE},
2217 {"",S_FALSE,FALSE},
2218 {"",S_FALSE,FALSE},
2219 {"gov.uk",S_OK,FALSE},
2220 {"",S_FALSE,FALSE},
2221 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2222 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK,FALSE},
2223 {"",S_FALSE,FALSE},
2224 {"http://gov.uk/<|> test<|>",S_OK,FALSE},
2225 {"http",S_OK,FALSE},
2226 {"",S_FALSE,FALSE},
2227 {"",S_FALSE,FALSE}
2230 {Uri_HOST_DNS,S_OK,FALSE},
2231 {80,S_OK,FALSE},
2232 {URL_SCHEME_HTTP,S_OK,FALSE},
2233 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2236 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK, FALSE,
2238 {"http://gov.uk/",S_OK,FALSE},
2239 {"gov.uk",S_OK,FALSE},
2240 {"http://gov.uk/",S_OK,FALSE},
2241 {"",S_FALSE,FALSE},
2242 {"",S_FALSE,FALSE},
2243 {"",S_FALSE,FALSE},
2244 {"gov.uk",S_OK,FALSE},
2245 {"",S_FALSE,FALSE},
2246 {"/",S_OK,FALSE},
2247 {"/",S_OK,FALSE},
2248 {"",S_FALSE,FALSE},
2249 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK,FALSE},
2250 {"http",S_OK,FALSE},
2251 {"",S_FALSE,FALSE},
2252 {"",S_FALSE,FALSE}
2255 {Uri_HOST_DNS,S_OK,FALSE},
2256 {80,S_OK,FALSE},
2257 {URL_SCHEME_HTTP,S_OK,FALSE},
2258 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2261 { "http://gov.uk/test/test2/../../..", 0, S_OK, FALSE,
2263 {"http://gov.uk/",S_OK,FALSE},
2264 {"gov.uk",S_OK,FALSE},
2265 {"http://gov.uk/",S_OK,FALSE},
2266 {"",S_FALSE,FALSE},
2267 {"",S_FALSE,FALSE},
2268 {"",S_FALSE,FALSE},
2269 {"gov.uk",S_OK,FALSE},
2270 {"",S_FALSE,FALSE},
2271 {"/",S_OK,FALSE},
2272 {"/",S_OK,FALSE},
2273 {"",S_FALSE,FALSE},
2274 {"http://gov.uk/test/test2/../../..",S_OK,FALSE},
2275 {"http",S_OK,FALSE},
2276 {"",S_FALSE,FALSE},
2277 {"",S_FALSE,FALSE}
2280 {Uri_HOST_DNS,S_OK,FALSE},
2281 {80,S_OK,FALSE},
2282 {URL_SCHEME_HTTP,S_OK,FALSE},
2283 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2286 { "http://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2288 {"http://gov.uk/",S_OK,FALSE},
2289 {"gov.uk",S_OK,FALSE},
2290 {"http://gov.uk/",S_OK,FALSE},
2291 {"",S_FALSE,FALSE},
2292 {"",S_FALSE,FALSE},
2293 {"",S_FALSE,FALSE},
2294 {"gov.uk",S_OK,FALSE},
2295 {"",S_FALSE,FALSE},
2296 {"/",S_OK,FALSE},
2297 {"/",S_OK,FALSE},
2298 {"",S_FALSE,FALSE},
2299 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2300 {"http",S_OK,FALSE},
2301 {"",S_FALSE,FALSE},
2302 {"",S_FALSE,FALSE}
2305 {Uri_HOST_DNS,S_OK,FALSE},
2306 {80,S_OK,FALSE},
2307 {URL_SCHEME_HTTP,S_OK,FALSE},
2308 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2311 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK, FALSE,
2313 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2314 {"",S_FALSE,FALSE},
2315 {"file:///c:/foo%2520bar.mp3",S_OK,FALSE},
2316 {"",S_FALSE,FALSE},
2317 {".mp3",S_OK,FALSE},
2318 {"",S_FALSE,FALSE},
2319 {"",S_FALSE,FALSE},
2320 {"",S_FALSE,FALSE},
2321 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2322 {"/c:/foo%2520bar.mp3",S_OK,FALSE},
2323 {"",S_FALSE,FALSE},
2324 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK,FALSE},
2325 {"file",S_OK,FALSE},
2326 {"",S_FALSE,FALSE},
2327 {"",S_FALSE,FALSE}
2330 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2331 {0,S_FALSE,FALSE},
2332 {URL_SCHEME_FILE,S_OK,FALSE},
2333 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2336 /* Dot removal happens for unknown scheme types. */
2337 { "zip://gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2339 {"zip://gov.uk/",S_OK,FALSE},
2340 {"gov.uk",S_OK,FALSE},
2341 {"zip://gov.uk/",S_OK,FALSE},
2342 {"",S_FALSE,FALSE},
2343 {"",S_FALSE,FALSE},
2344 {"",S_FALSE,FALSE},
2345 {"gov.uk",S_OK,FALSE},
2346 {"",S_FALSE,FALSE},
2347 {"/",S_OK,FALSE},
2348 {"/",S_OK,FALSE},
2349 {"",S_FALSE,FALSE},
2350 {"zip://gov.uk/test/test2/../../.",S_OK,FALSE},
2351 {"zip",S_OK,FALSE},
2352 {"",S_FALSE,FALSE},
2353 {"",S_FALSE,FALSE}
2356 {Uri_HOST_DNS,S_OK,FALSE},
2357 {0,S_FALSE,FALSE},
2358 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2359 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2362 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2363 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2365 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2366 {"gov.uk",S_OK,FALSE},
2367 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2368 {"",S_FALSE,FALSE},
2369 {".",S_OK,FALSE},
2370 {"",S_FALSE,FALSE},
2371 {"gov.uk",S_OK,FALSE},
2372 {"",S_FALSE,FALSE},
2373 {"/test/test2/../../.",S_OK,FALSE},
2374 {"/test/test2/../../.",S_OK,FALSE},
2375 {"",S_FALSE,FALSE},
2376 {"http://gov.uk/test/test2/../../.",S_OK,FALSE},
2377 {"http",S_OK,FALSE},
2378 {"",S_FALSE,FALSE},
2379 {"",S_FALSE,FALSE}
2382 {Uri_HOST_DNS,S_OK,FALSE},
2383 {80,S_OK,FALSE},
2384 {URL_SCHEME_HTTP,S_OK,FALSE},
2385 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2388 /* Dot removal doesn't happen for wildcard scheme types. */
2389 { "*:gov.uk/test/test2/../../.", 0, S_OK, FALSE,
2391 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2392 {"gov.uk",S_OK,FALSE},
2393 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2394 {"",S_FALSE,FALSE},
2395 {".",S_OK,FALSE},
2396 {"",S_FALSE,FALSE},
2397 {"gov.uk",S_OK,FALSE},
2398 {"",S_FALSE,FALSE},
2399 {"/test/test2/../../.",S_OK,FALSE},
2400 {"/test/test2/../../.",S_OK,FALSE},
2401 {"",S_FALSE,FALSE},
2402 {"*:gov.uk/test/test2/../../.",S_OK,FALSE},
2403 {"*",S_OK,FALSE},
2404 {"",S_FALSE,FALSE},
2405 {"",S_FALSE,FALSE}
2408 {Uri_HOST_DNS,S_OK,FALSE},
2409 {0,S_FALSE,FALSE},
2410 {URL_SCHEME_WILDCARD,S_OK,FALSE},
2411 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2414 /* Forbidden characters are encoded for opaque known scheme types. */
2415 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK, FALSE,
2417 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2418 {"",S_FALSE,FALSE},
2419 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2420 {"",S_FALSE,FALSE},
2421 {".com%22",S_OK,FALSE},
2422 {"",S_FALSE,FALSE},
2423 {"",S_FALSE,FALSE},
2424 {"",S_FALSE,FALSE},
2425 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2426 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK,FALSE},
2427 {"",S_FALSE,FALSE},
2428 {"mailto:\"acco<|>unt@example.com\"",S_OK,FALSE},
2429 {"mailto",S_OK,FALSE},
2430 {"",S_FALSE,FALSE},
2431 {"",S_FALSE,FALSE}
2434 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2435 {0,S_FALSE,FALSE},
2436 {URL_SCHEME_MAILTO,S_OK,FALSE},
2437 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2440 { "news:test.tes<|>t.com", 0, S_OK, FALSE,
2442 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2443 {"",S_FALSE,FALSE},
2444 {"news:test.tes%3C%7C%3Et.com",S_OK,FALSE},
2445 {"",S_FALSE,FALSE},
2446 {".com",S_OK,FALSE},
2447 {"",S_FALSE,FALSE},
2448 {"",S_FALSE,FALSE},
2449 {"",S_FALSE,FALSE},
2450 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2451 {"test.tes%3C%7C%3Et.com",S_OK,FALSE},
2452 {"",S_FALSE,FALSE},
2453 {"news:test.tes<|>t.com",S_OK,FALSE},
2454 {"news",S_OK,FALSE},
2455 {"",S_FALSE,FALSE},
2456 {"",S_FALSE,FALSE}
2459 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2460 {0,S_FALSE,FALSE},
2461 {URL_SCHEME_NEWS,S_OK,FALSE},
2462 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2465 /* Don't encode forbidden characters. */
2466 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2468 {"news:test.tes<|>t.com",S_OK,FALSE},
2469 {"",S_FALSE,FALSE},
2470 {"news:test.tes<|>t.com",S_OK,FALSE},
2471 {"",S_FALSE,FALSE},
2472 {".com",S_OK,FALSE},
2473 {"",S_FALSE,FALSE},
2474 {"",S_FALSE,FALSE},
2475 {"",S_FALSE,FALSE},
2476 {"test.tes<|>t.com",S_OK,FALSE},
2477 {"test.tes<|>t.com",S_OK,FALSE},
2478 {"",S_FALSE,FALSE},
2479 {"news:test.tes<|>t.com",S_OK,FALSE},
2480 {"news",S_OK,FALSE},
2481 {"",S_FALSE,FALSE},
2482 {"",S_FALSE,FALSE}
2485 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2486 {0,S_FALSE,FALSE},
2487 {URL_SCHEME_NEWS,S_OK,FALSE},
2488 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2491 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2492 { "urn:test.tes<|>t.com", 0, S_OK, FALSE,
2494 {"urn:test.tes<|>t.com",S_OK,FALSE},
2495 {"",S_FALSE,FALSE},
2496 {"urn:test.tes<|>t.com",S_OK,FALSE},
2497 {"",S_FALSE,FALSE},
2498 {".com",S_OK,FALSE},
2499 {"",S_FALSE,FALSE},
2500 {"",S_FALSE,FALSE},
2501 {"",S_FALSE,FALSE},
2502 {"test.tes<|>t.com",S_OK,FALSE},
2503 {"test.tes<|>t.com",S_OK,FALSE},
2504 {"",S_FALSE,FALSE},
2505 {"urn:test.tes<|>t.com",S_OK,FALSE},
2506 {"urn",S_OK,FALSE},
2507 {"",S_FALSE,FALSE},
2508 {"",S_FALSE,FALSE}
2511 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2512 {0,S_FALSE,FALSE},
2513 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2514 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2517 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2518 { "news:test.%74%65%73%74.com", 0, S_OK, FALSE,
2520 {"news:test.test.com",S_OK,FALSE},
2521 {"",S_FALSE,FALSE},
2522 {"news:test.test.com",S_OK,FALSE},
2523 {"",S_FALSE,FALSE},
2524 {".com",S_OK,FALSE},
2525 {"",S_FALSE,FALSE},
2526 {"",S_FALSE,FALSE},
2527 {"",S_FALSE,FALSE},
2528 {"test.test.com",S_OK,FALSE},
2529 {"test.test.com",S_OK,FALSE},
2530 {"",S_FALSE,FALSE},
2531 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2532 {"news",S_OK,FALSE},
2533 {"",S_FALSE,FALSE},
2534 {"",S_FALSE,FALSE}
2537 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2538 {0,S_FALSE,FALSE},
2539 {URL_SCHEME_NEWS,S_OK,FALSE},
2540 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2543 /* Percent encoded characters are still decoded for known scheme types. */
2544 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2546 {"news:test.test.com",S_OK,FALSE},
2547 {"",S_FALSE,FALSE},
2548 {"news:test.test.com",S_OK,FALSE},
2549 {"",S_FALSE,FALSE},
2550 {".com",S_OK,FALSE},
2551 {"",S_FALSE,FALSE},
2552 {"",S_FALSE,FALSE},
2553 {"",S_FALSE,FALSE},
2554 {"test.test.com",S_OK,FALSE},
2555 {"test.test.com",S_OK,FALSE},
2556 {"",S_FALSE,FALSE},
2557 {"news:test.%74%65%73%74.com",S_OK,FALSE},
2558 {"news",S_OK,FALSE},
2559 {"",S_FALSE,FALSE},
2560 {"",S_FALSE,FALSE}
2563 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2564 {0,S_FALSE,FALSE},
2565 {URL_SCHEME_NEWS,S_OK,FALSE},
2566 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2569 /* Percent encoded characters aren't decoded for unknown scheme types. */
2570 { "urn:test.%74%65%73%74.com", 0, S_OK, FALSE,
2572 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2573 {"",S_FALSE,FALSE},
2574 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2575 {"",S_FALSE,FALSE},
2576 {".com",S_OK,FALSE},
2577 {"",S_FALSE,FALSE},
2578 {"",S_FALSE,FALSE},
2579 {"",S_FALSE,FALSE},
2580 {"test.%74%65%73%74.com",S_OK,FALSE},
2581 {"test.%74%65%73%74.com",S_OK,FALSE},
2582 {"",S_FALSE,FALSE},
2583 {"urn:test.%74%65%73%74.com",S_OK,FALSE},
2584 {"urn",S_OK,FALSE},
2585 {"",S_FALSE,FALSE},
2586 {"",S_FALSE,FALSE}
2589 {Uri_HOST_UNKNOWN,S_OK,FALSE},
2590 {0,S_FALSE,FALSE},
2591 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2592 {URLZONE_INVALID,E_NOTIMPL,FALSE}
2595 /* Unknown scheme types can have invalid % encoded data in query string. */
2596 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK, FALSE,
2598 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2599 {"www.winehq.org",S_OK,FALSE},
2600 {"zip://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2601 {"winehq.org",S_OK,FALSE},
2602 {"",S_FALSE,FALSE},
2603 {"",S_FALSE,FALSE},
2604 {"www.winehq.org",S_OK,FALSE},
2605 {"",S_FALSE,FALSE},
2606 {"/",S_OK,FALSE},
2607 {"/?query=%xx&return=y",S_OK,FALSE},
2608 {"?query=%xx&return=y",S_OK,FALSE},
2609 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2610 {"zip",S_OK,FALSE},
2611 {"",S_FALSE,FALSE},
2612 {"",S_FALSE,FALSE}
2615 {Uri_HOST_DNS,S_OK,FALSE},
2616 {0,S_FALSE,FALSE},
2617 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2618 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2621 /* Known scheme types can have invalid % encoded data with the right flags. */
2622 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2624 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2625 {"www.winehq.org",S_OK,FALSE},
2626 {"http://www.winehq.org/?query=%xx&return=y",S_OK,FALSE},
2627 {"winehq.org",S_OK,FALSE},
2628 {"",S_FALSE,FALSE},
2629 {"",S_FALSE,FALSE},
2630 {"www.winehq.org",S_OK,FALSE},
2631 {"",S_FALSE,FALSE},
2632 {"/",S_OK,FALSE},
2633 {"/?query=%xx&return=y",S_OK,FALSE},
2634 {"?query=%xx&return=y",S_OK,FALSE},
2635 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK,FALSE},
2636 {"http",S_OK,FALSE},
2637 {"",S_FALSE,FALSE},
2638 {"",S_FALSE,FALSE}
2641 {Uri_HOST_DNS,S_OK,FALSE},
2642 {80,S_OK,FALSE},
2643 {URL_SCHEME_HTTP,S_OK,FALSE},
2644 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2647 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2648 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2650 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2651 {"www.winehq.org",S_OK,FALSE},
2652 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2653 {"winehq.org",S_OK,FALSE},
2654 {"",S_FALSE,FALSE},
2655 {"",S_FALSE,FALSE},
2656 {"www.winehq.org",S_OK,FALSE},
2657 {"",S_FALSE,FALSE},
2658 {"/",S_OK,FALSE},
2659 {"/?query=<|>&return=y",S_OK,FALSE},
2660 {"?query=<|>&return=y",S_OK,FALSE},
2661 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2662 {"http",S_OK,FALSE},
2663 {"",S_FALSE,FALSE},
2664 {"",S_FALSE,FALSE}
2667 {Uri_HOST_DNS,S_OK,FALSE},
2668 {80,S_OK,FALSE},
2669 {URL_SCHEME_HTTP,S_OK,FALSE},
2670 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2673 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2674 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2676 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2677 {"www.winehq.org",S_OK,FALSE},
2678 {"http://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2679 {"winehq.org",S_OK,FALSE},
2680 {"",S_FALSE,FALSE},
2681 {"",S_FALSE,FALSE},
2682 {"www.winehq.org",S_OK,FALSE},
2683 {"",S_FALSE,FALSE},
2684 {"/",S_OK,FALSE},
2685 {"/?query=<|>&return=y",S_OK,FALSE},
2686 {"?query=<|>&return=y",S_OK,FALSE},
2687 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2688 {"http",S_OK,FALSE},
2689 {"",S_FALSE,FALSE},
2690 {"",S_FALSE,FALSE}
2693 {Uri_HOST_DNS,S_OK,FALSE},
2694 {80,S_OK,FALSE},
2695 {URL_SCHEME_HTTP,S_OK,FALSE},
2696 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2699 /* Forbidden characters are encoded for known scheme types. */
2700 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2702 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2703 {"www.winehq.org",S_OK,FALSE},
2704 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2705 {"winehq.org",S_OK,FALSE},
2706 {"",S_FALSE,FALSE},
2707 {"",S_FALSE,FALSE},
2708 {"www.winehq.org",S_OK,FALSE},
2709 {"",S_FALSE,FALSE},
2710 {"/",S_OK,FALSE},
2711 {"/?query=%3C%7C%3E&return=y",S_OK,FALSE},
2712 {"?query=%3C%7C%3E&return=y",S_OK,FALSE},
2713 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2714 {"http",S_OK,FALSE},
2715 {"",S_FALSE,FALSE},
2716 {"",S_FALSE,FALSE}
2719 {Uri_HOST_DNS,S_OK,FALSE},
2720 {80,S_OK,FALSE},
2721 {URL_SCHEME_HTTP,S_OK,FALSE},
2722 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2725 /* Forbidden characters are not encoded for unknown scheme types. */
2726 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK, FALSE,
2728 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2729 {"www.winehq.org",S_OK,FALSE},
2730 {"zip://www.winehq.org/?query=<|>&return=y",S_OK,FALSE},
2731 {"winehq.org",S_OK,FALSE},
2732 {"",S_FALSE,FALSE},
2733 {"",S_FALSE,FALSE},
2734 {"www.winehq.org",S_OK,FALSE},
2735 {"",S_FALSE,FALSE},
2736 {"/",S_OK,FALSE},
2737 {"/?query=<|>&return=y",S_OK,FALSE},
2738 {"?query=<|>&return=y",S_OK,FALSE},
2739 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK,FALSE},
2740 {"zip",S_OK,FALSE},
2741 {"",S_FALSE,FALSE},
2742 {"",S_FALSE,FALSE}
2745 {Uri_HOST_DNS,S_OK,FALSE},
2746 {0,S_FALSE,FALSE},
2747 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2748 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2751 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2752 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2754 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2755 {"www.winehq.org",S_OK,FALSE},
2756 {"http://www.winehq.org/?query=01&return=y",S_OK,FALSE},
2757 {"winehq.org",S_OK,FALSE},
2758 {"",S_FALSE,FALSE},
2759 {"",S_FALSE,FALSE},
2760 {"www.winehq.org",S_OK,FALSE},
2761 {"",S_FALSE,FALSE},
2762 {"/",S_OK,FALSE},
2763 {"/?query=01&return=y",S_OK,FALSE},
2764 {"?query=01&return=y",S_OK,FALSE},
2765 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2766 {"http",S_OK,FALSE},
2767 {"",S_FALSE,FALSE},
2768 {"",S_FALSE,FALSE}
2771 {Uri_HOST_DNS,S_OK,FALSE},
2772 {80,S_OK,FALSE},
2773 {URL_SCHEME_HTTP,S_OK,FALSE},
2774 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2777 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2778 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK, FALSE,
2780 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2781 {"www.winehq.org",S_OK,FALSE},
2782 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2783 {"winehq.org",S_OK,FALSE},
2784 {"",S_FALSE,FALSE},
2785 {"",S_FALSE,FALSE},
2786 {"www.winehq.org",S_OK,FALSE},
2787 {"",S_FALSE,FALSE},
2788 {"/",S_OK,FALSE},
2789 {"/?query=%30%31&return=y",S_OK,FALSE},
2790 {"?query=%30%31&return=y",S_OK,FALSE},
2791 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2792 {"zip",S_OK,FALSE},
2793 {"",S_FALSE,FALSE},
2794 {"",S_FALSE,FALSE}
2797 {Uri_HOST_DNS,S_OK,FALSE},
2798 {0,S_FALSE,FALSE},
2799 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2800 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2803 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2804 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2806 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2807 {"www.winehq.org",S_OK,FALSE},
2808 {"http://www.winehq.org/?query=%30%31&return=y",S_OK,FALSE},
2809 {"winehq.org",S_OK,FALSE},
2810 {"",S_FALSE,FALSE},
2811 {"",S_FALSE,FALSE},
2812 {"www.winehq.org",S_OK,FALSE},
2813 {"",S_FALSE,FALSE},
2814 {"/",S_OK,FALSE},
2815 {"/?query=%30%31&return=y",S_OK,FALSE},
2816 {"?query=%30%31&return=y",S_OK,FALSE},
2817 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK,FALSE},
2818 {"http",S_OK,FALSE},
2819 {"",S_FALSE,FALSE},
2820 {"",S_FALSE,FALSE}
2823 {Uri_HOST_DNS,S_OK,FALSE},
2824 {80,S_OK,FALSE},
2825 {URL_SCHEME_HTTP,S_OK,FALSE},
2826 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2829 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
2831 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2832 {"www.winehq.org",S_OK,FALSE},
2833 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2834 {"winehq.org",S_OK,FALSE},
2835 {"",S_FALSE,FALSE},
2836 {"",S_FALSE,FALSE},
2837 {"www.winehq.org",S_OK,FALSE},
2838 {"",S_FALSE,FALSE},
2839 {"",S_FALSE,FALSE},
2840 {"?query=12&return=y",S_OK,FALSE},
2841 {"?query=12&return=y",S_OK,FALSE},
2842 {"http://www.winehq.org?query=12&return=y",S_OK,FALSE},
2843 {"http",S_OK,FALSE},
2844 {"",S_FALSE,FALSE},
2845 {"",S_FALSE,FALSE}
2848 {Uri_HOST_DNS,S_OK,FALSE},
2849 {80,S_OK,FALSE},
2850 {URL_SCHEME_HTTP,S_OK,FALSE},
2851 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2854 /* Unknown scheme types can have invalid % encoded data in fragments. */
2855 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK, FALSE,
2857 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2858 {"www.winehq.org",S_OK,FALSE},
2859 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2860 {"winehq.org",S_OK,FALSE},
2861 {"",S_FALSE,FALSE},
2862 {"#Te%xx",S_OK,FALSE},
2863 {"www.winehq.org",S_OK,FALSE},
2864 {"",S_FALSE,FALSE},
2865 {"/tests/",S_OK,FALSE},
2866 {"/tests/",S_OK,FALSE},
2867 {"",S_FALSE,FALSE},
2868 {"zip://www.winehq.org/tests/#Te%xx",S_OK,FALSE},
2869 {"zip",S_OK,FALSE},
2870 {"",S_FALSE,FALSE},
2871 {"",S_FALSE,FALSE}
2874 {Uri_HOST_DNS,S_OK,FALSE},
2875 {0,S_FALSE,FALSE},
2876 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2877 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2880 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2881 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2883 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2884 {"www.winehq.org",S_OK,FALSE},
2885 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2886 {"winehq.org",S_OK,FALSE},
2887 {"",S_FALSE,FALSE},
2888 {"#Te<|>",S_OK,FALSE},
2889 {"www.winehq.org",S_OK,FALSE},
2890 {"",S_FALSE,FALSE},
2891 {"/tests/",S_OK,FALSE},
2892 {"/tests/",S_OK,FALSE},
2893 {"",S_FALSE,FALSE},
2894 {"zip://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2895 {"zip",S_OK,FALSE},
2896 {"",S_FALSE,FALSE},
2897 {"",S_FALSE,FALSE}
2900 {Uri_HOST_DNS,S_OK,FALSE},
2901 {0,S_FALSE,FALSE},
2902 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
2903 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2906 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2907 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK, FALSE,
2909 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2910 {"www.winehq.org",S_OK,FALSE},
2911 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK,FALSE},
2912 {"winehq.org",S_OK,FALSE},
2913 {"",S_FALSE,FALSE},
2914 {"#Te%3C%7C%3E",S_OK,FALSE},
2915 {"www.winehq.org",S_OK,FALSE},
2916 {"",S_FALSE,FALSE},
2917 {"/tests/",S_OK,FALSE},
2918 {"/tests/",S_OK,FALSE},
2919 {"",S_FALSE,FALSE},
2920 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2921 {"http",S_OK,FALSE},
2922 {"",S_FALSE,FALSE},
2923 {"",S_FALSE,FALSE}
2926 {Uri_HOST_DNS,S_OK,FALSE},
2927 {80,S_OK,FALSE},
2928 {URL_SCHEME_HTTP,S_OK,FALSE},
2929 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2932 /* Forbidden characters aren't encoded in the fragment with this flag. */
2933 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
2935 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2936 {"www.winehq.org",S_OK,FALSE},
2937 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2938 {"winehq.org",S_OK,FALSE},
2939 {"",S_FALSE,FALSE},
2940 {"#Te<|>",S_OK,FALSE},
2941 {"www.winehq.org",S_OK,FALSE},
2942 {"",S_FALSE,FALSE},
2943 {"/tests/",S_OK,FALSE},
2944 {"/tests/",S_OK,FALSE},
2945 {"",S_FALSE,FALSE},
2946 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2947 {"http",S_OK,FALSE},
2948 {"",S_FALSE,FALSE},
2949 {"",S_FALSE,FALSE}
2952 {Uri_HOST_DNS,S_OK,FALSE},
2953 {80,S_OK,FALSE},
2954 {URL_SCHEME_HTTP,S_OK,FALSE},
2955 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2958 /* Forbidden characters aren't encoded in the fragment with this flag. */
2959 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS, S_OK, FALSE,
2961 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2962 {"www.winehq.org",S_OK,FALSE},
2963 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2964 {"winehq.org",S_OK,FALSE},
2965 {"",S_FALSE,FALSE},
2966 {"#Te<|>",S_OK,FALSE},
2967 {"www.winehq.org",S_OK,FALSE},
2968 {"",S_FALSE,FALSE},
2969 {"/tests/",S_OK,FALSE},
2970 {"/tests/",S_OK,FALSE},
2971 {"",S_FALSE,FALSE},
2972 {"http://www.winehq.org/tests/#Te<|>",S_OK,FALSE},
2973 {"http",S_OK,FALSE},
2974 {"",S_FALSE,FALSE},
2975 {"",S_FALSE,FALSE}
2978 {Uri_HOST_DNS,S_OK,FALSE},
2979 {80,S_OK,FALSE},
2980 {URL_SCHEME_HTTP,S_OK,FALSE},
2981 {URLZONE_INVALID,E_NOTIMPL,FALSE},
2984 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
2985 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
2987 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2988 {"www.winehq.org",S_OK,FALSE},
2989 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2990 {"winehq.org",S_OK,FALSE},
2991 {"",S_FALSE,FALSE},
2992 {"#Te%30%31%32",S_OK,FALSE},
2993 {"www.winehq.org",S_OK,FALSE},
2994 {"",S_FALSE,FALSE},
2995 {"/tests/",S_OK,FALSE},
2996 {"/tests/",S_OK,FALSE},
2997 {"",S_FALSE,FALSE},
2998 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
2999 {"zip",S_OK,FALSE},
3000 {"",S_FALSE,FALSE},
3001 {"",S_FALSE,FALSE}
3004 {Uri_HOST_DNS,S_OK,FALSE},
3005 {0,S_FALSE,FALSE},
3006 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3007 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3010 /* Percent encoded, unreserved characters are decoded for known schemes. */
3011 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK, FALSE,
3013 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3014 {"www.winehq.org",S_OK,FALSE},
3015 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3016 {"winehq.org",S_OK,FALSE},
3017 {"",S_FALSE,FALSE},
3018 {"#Te012",S_OK,FALSE},
3019 {"www.winehq.org",S_OK,FALSE},
3020 {"",S_FALSE,FALSE},
3021 {"/tests/",S_OK,FALSE},
3022 {"/tests/",S_OK,FALSE},
3023 {"",S_FALSE,FALSE},
3024 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3025 {"http",S_OK,FALSE},
3026 {"",S_FALSE,FALSE},
3027 {"",S_FALSE,FALSE}
3030 {Uri_HOST_DNS,S_OK,FALSE},
3031 {80,S_OK,FALSE},
3032 {URL_SCHEME_HTTP,S_OK,FALSE},
3033 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3036 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3037 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3039 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3040 {"www.winehq.org",S_OK,FALSE},
3041 {"http://www.winehq.org/tests/#Te012",S_OK,FALSE},
3042 {"winehq.org",S_OK,FALSE},
3043 {"",S_FALSE,FALSE},
3044 {"#Te012",S_OK,FALSE},
3045 {"www.winehq.org",S_OK,FALSE},
3046 {"",S_FALSE,FALSE},
3047 {"/tests/",S_OK,FALSE},
3048 {"/tests/",S_OK,FALSE},
3049 {"",S_FALSE,FALSE},
3050 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3051 {"http",S_OK,FALSE},
3052 {"",S_FALSE,FALSE},
3053 {"",S_FALSE,FALSE}
3056 {Uri_HOST_DNS,S_OK,FALSE},
3057 {80,S_OK,FALSE},
3058 {URL_SCHEME_HTTP,S_OK,FALSE},
3059 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3062 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3063 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO, S_OK, FALSE,
3065 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3066 {"www.winehq.org",S_OK,FALSE},
3067 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3068 {"winehq.org",S_OK,FALSE},
3069 {"",S_FALSE,FALSE},
3070 {"#Te%30%31%32",S_OK,FALSE},
3071 {"www.winehq.org",S_OK,FALSE},
3072 {"",S_FALSE,FALSE},
3073 {"/tests/",S_OK,FALSE},
3074 {"/tests/",S_OK,FALSE},
3075 {"",S_FALSE,FALSE},
3076 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK,FALSE},
3077 {"http",S_OK,FALSE},
3078 {"",S_FALSE,FALSE},
3079 {"",S_FALSE,FALSE}
3082 {Uri_HOST_DNS,S_OK,FALSE},
3083 {80,S_OK,FALSE},
3084 {URL_SCHEME_HTTP,S_OK,FALSE},
3085 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3088 /* Leading/Trailing whitespace is removed. */
3089 { " http://google.com/ ", 0, S_OK, FALSE,
3091 {"http://google.com/",S_OK,FALSE},
3092 {"google.com",S_OK,FALSE},
3093 {"http://google.com/",S_OK,FALSE},
3094 {"google.com",S_OK,FALSE},
3095 {"",S_FALSE,FALSE},
3096 {"",S_FALSE,FALSE},
3097 {"google.com",S_OK,FALSE},
3098 {"",S_FALSE,FALSE},
3099 {"/",S_OK,FALSE},
3100 {"/",S_OK,FALSE},
3101 {"",S_FALSE,FALSE},
3102 {"http://google.com/",S_OK,FALSE},
3103 {"http",S_OK,FALSE},
3104 {"",S_FALSE,FALSE},
3105 {"",S_FALSE,FALSE}
3108 {Uri_HOST_DNS,S_OK,FALSE},
3109 {80,S_OK,FALSE},
3110 {URL_SCHEME_HTTP,S_OK,FALSE},
3111 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3114 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK, FALSE,
3116 {"http://google.com/",S_OK,FALSE},
3117 {"google.com",S_OK,FALSE},
3118 {"http://google.com/",S_OK,FALSE},
3119 {"google.com",S_OK,FALSE},
3120 {"",S_FALSE,FALSE},
3121 {"",S_FALSE,FALSE},
3122 {"google.com",S_OK,FALSE},
3123 {"",S_FALSE,FALSE},
3124 {"/",S_OK,FALSE},
3125 {"/",S_OK,FALSE},
3126 {"",S_FALSE,FALSE},
3127 {"http://google.com/",S_OK,FALSE},
3128 {"http",S_OK,FALSE},
3129 {"",S_FALSE,FALSE},
3130 {"",S_FALSE,FALSE}
3133 {Uri_HOST_DNS,S_OK,FALSE},
3134 {80,S_OK,FALSE},
3135 {URL_SCHEME_HTTP,S_OK,FALSE},
3136 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3139 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3141 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3142 {"g%0aoogle.co%0dm",S_OK,FALSE},
3143 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK,FALSE},
3144 {"g%0aoogle.co%0dm",S_OK,FALSE},
3145 {"",S_FALSE,FALSE},
3146 {"",S_FALSE,FALSE},
3147 {"g%0aoogle.co%0dm",S_OK,FALSE},
3148 {"",S_FALSE,FALSE},
3149 {"/%0A%0A%0A",S_OK,FALSE},
3150 {"/%0A%0A%0A",S_OK,FALSE},
3151 {"",S_FALSE,FALSE},
3152 {"http://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3153 {"http",S_OK,FALSE},
3154 {"",S_FALSE,FALSE},
3155 {"",S_FALSE,FALSE}
3158 {Uri_HOST_DNS,S_OK,FALSE},
3159 {80,S_OK,FALSE},
3160 {URL_SCHEME_HTTP,S_OK,FALSE},
3161 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3164 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI, S_OK, FALSE,
3166 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3167 {"g\noogle.co\rm",S_OK,FALSE},
3168 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3169 {"g\noogle.co\rm",S_OK,FALSE},
3170 {"",S_FALSE,FALSE},
3171 {"",S_FALSE,FALSE},
3172 {"g\noogle.co\rm",S_OK,FALSE},
3173 {"",S_FALSE,FALSE},
3174 {"/\n\n\n",S_OK,FALSE},
3175 {"/\n\n\n",S_OK,FALSE},
3176 {"",S_FALSE,FALSE},
3177 {"zip://g\noogle.co\rm/\n\n\n",S_OK,FALSE},
3178 {"zip",S_OK,FALSE},
3179 {"",S_FALSE,FALSE},
3180 {"",S_FALSE,FALSE}
3183 {Uri_HOST_DNS,S_OK,FALSE},
3184 {0,S_FALSE,FALSE},
3185 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3186 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3189 /* Since file URLs are usually hierarchical, it returns an empty string
3190 * for the absolute URI property since it was declared as an opaque URI.
3192 { "file:index.html", 0, S_OK, FALSE,
3194 {"",S_FALSE,FALSE},
3195 {"",S_FALSE,FALSE},
3196 {"file:index.html",S_OK,FALSE},
3197 {"",S_FALSE,FALSE},
3198 {".html",S_OK,FALSE},
3199 {"",S_FALSE,FALSE},
3200 {"",S_FALSE,FALSE},
3201 {"",S_FALSE,FALSE},
3202 {"index.html",S_OK,FALSE},
3203 {"index.html",S_OK,FALSE},
3204 {"",S_FALSE,FALSE},
3205 {"file:index.html",S_OK,FALSE},
3206 {"file",S_OK,FALSE},
3207 {"",S_FALSE,FALSE},
3208 {"",S_FALSE,FALSE}
3211 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3212 {0,S_FALSE,FALSE},
3213 {URL_SCHEME_FILE,S_OK,FALSE},
3214 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3217 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3218 { "http:test.com/index.html", 0, S_OK, FALSE,
3220 {"",S_FALSE,FALSE},
3221 {"",S_FALSE,FALSE},
3222 {"http:test.com/index.html",S_OK,FALSE},
3223 {"",S_FALSE,FALSE},
3224 {".html",S_OK,FALSE},
3225 {"",S_FALSE,FALSE},
3226 {"",S_FALSE,FALSE},
3227 {"",S_FALSE,FALSE},
3228 {"test.com/index.html",S_OK,FALSE},
3229 {"test.com/index.html",S_OK,FALSE},
3230 {"",S_FALSE,FALSE},
3231 {"http:test.com/index.html",S_OK,FALSE},
3232 {"http",S_OK,FALSE},
3233 {"",S_FALSE,FALSE},
3234 {"",S_FALSE,FALSE}
3237 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3238 {80,S_OK,FALSE},
3239 {URL_SCHEME_HTTP,S_OK,FALSE},
3240 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3243 { "ftp:test.com/index.html", 0, S_OK, FALSE,
3245 {"",S_FALSE,FALSE},
3246 {"",S_FALSE,FALSE},
3247 {"ftp:test.com/index.html",S_OK,FALSE},
3248 {"",S_FALSE,FALSE},
3249 {".html",S_OK,FALSE},
3250 {"",S_FALSE,FALSE},
3251 {"",S_FALSE,FALSE},
3252 {"",S_FALSE,FALSE},
3253 {"test.com/index.html",S_OK,FALSE},
3254 {"test.com/index.html",S_OK,FALSE},
3255 {"",S_FALSE,FALSE},
3256 {"ftp:test.com/index.html",S_OK,FALSE},
3257 {"ftp",S_OK,FALSE},
3258 {"",S_FALSE,FALSE},
3259 {"",S_FALSE,FALSE}
3262 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3263 {21,S_OK,FALSE},
3264 {URL_SCHEME_FTP,S_OK,FALSE},
3265 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3268 { "file://C|/test.mp3", 0, S_OK, FALSE,
3270 {"file:///C:/test.mp3",S_OK,FALSE},
3271 {"",S_FALSE,FALSE},
3272 {"file:///C:/test.mp3",S_OK,FALSE},
3273 {"",S_FALSE,FALSE},
3274 {".mp3",S_OK,FALSE},
3275 {"",S_FALSE,FALSE},
3276 {"",S_FALSE,FALSE},
3277 {"",S_FALSE,FALSE},
3278 {"/C:/test.mp3",S_OK,FALSE},
3279 {"/C:/test.mp3",S_OK,FALSE},
3280 {"",S_FALSE,FALSE},
3281 {"file://C|/test.mp3",S_OK,FALSE},
3282 {"file",S_OK,FALSE},
3283 {"",S_FALSE,FALSE},
3284 {"",S_FALSE,FALSE}
3287 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3288 {0,S_FALSE,FALSE},
3289 {URL_SCHEME_FILE,S_OK,FALSE},
3290 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3293 { "file:///C|/test.mp3", 0, S_OK, FALSE,
3295 {"file:///C:/test.mp3",S_OK,FALSE},
3296 {"",S_FALSE,FALSE},
3297 {"file:///C:/test.mp3",S_OK,FALSE},
3298 {"",S_FALSE,FALSE},
3299 {".mp3",S_OK,FALSE},
3300 {"",S_FALSE,FALSE},
3301 {"",S_FALSE,FALSE},
3302 {"",S_FALSE,FALSE},
3303 {"/C:/test.mp3",S_OK,FALSE},
3304 {"/C:/test.mp3",S_OK,FALSE},
3305 {"",S_FALSE,FALSE},
3306 {"file:///C|/test.mp3",S_OK,FALSE},
3307 {"file",S_OK,FALSE},
3308 {"",S_FALSE,FALSE},
3309 {"",S_FALSE,FALSE}
3312 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3313 {0,S_FALSE,FALSE},
3314 {URL_SCHEME_FILE,S_OK,FALSE},
3315 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3318 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3319 * to '\\'.
3321 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3323 {"file://c:\\dir\\index.html",S_OK,FALSE},
3324 {"",S_FALSE,FALSE},
3325 {"file://c:\\dir\\index.html",S_OK,FALSE},
3326 {"",S_FALSE,FALSE},
3327 {".html",S_OK,FALSE},
3328 {"",S_FALSE,FALSE},
3329 {"",S_FALSE,FALSE},
3330 {"",S_FALSE,FALSE},
3331 {"c:\\dir\\index.html",S_OK,FALSE},
3332 {"c:\\dir\\index.html",S_OK,FALSE},
3333 {"",S_FALSE,FALSE},
3334 {"file://c:/dir/index.html",S_OK,FALSE},
3335 {"file",S_OK,FALSE},
3336 {"",S_FALSE,FALSE},
3337 {"",S_FALSE,FALSE}
3340 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3341 {0,S_FALSE,FALSE},
3342 {URL_SCHEME_FILE,S_OK,FALSE},
3343 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3346 /* Extra '/' after "file://" is removed. */
3347 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3349 {"file://c:\\dir\\index.html",S_OK,FALSE},
3350 {"",S_FALSE,FALSE},
3351 {"file://c:\\dir\\index.html",S_OK,FALSE},
3352 {"",S_FALSE,FALSE},
3353 {".html",S_OK,FALSE},
3354 {"",S_FALSE,FALSE},
3355 {"",S_FALSE,FALSE},
3356 {"",S_FALSE,FALSE},
3357 {"c:\\dir\\index.html",S_OK,FALSE},
3358 {"c:\\dir\\index.html",S_OK,FALSE},
3359 {"",S_FALSE,FALSE},
3360 {"file:///c:/dir/index.html",S_OK,FALSE},
3361 {"file",S_OK,FALSE},
3362 {"",S_FALSE,FALSE},
3363 {"",S_FALSE,FALSE}
3366 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3367 {0,S_FALSE,FALSE},
3368 {URL_SCHEME_FILE,S_OK,FALSE},
3369 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3372 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3373 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3375 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3376 {"",S_FALSE,FALSE},
3377 {"file://c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3378 {"",S_FALSE,FALSE},
3379 {".html",S_OK,FALSE},
3380 {"",S_FALSE,FALSE},
3381 {"",S_FALSE,FALSE},
3382 {"",S_FALSE,FALSE},
3383 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3384 {"c:\\dir\\%a _name\\file*.html",S_OK,FALSE},
3385 {"",S_FALSE,FALSE},
3386 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK,FALSE},
3387 {"file",S_OK,FALSE},
3388 {"",S_FALSE,FALSE},
3389 {"",S_FALSE,FALSE}
3392 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3393 {0,S_FALSE,FALSE},
3394 {URL_SCHEME_FILE,S_OK,FALSE},
3395 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3398 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3400 {"file://c:\\dir\\index.html",S_OK,FALSE},
3401 {"",S_FALSE,FALSE},
3402 {"file://c:\\dir\\index.html",S_OK,FALSE},
3403 {"",S_FALSE,FALSE},
3404 {".html",S_OK,FALSE},
3405 {"",S_FALSE,FALSE},
3406 {"",S_FALSE,FALSE},
3407 {"",S_FALSE,FALSE},
3408 {"c:\\dir\\index.html",S_OK,FALSE},
3409 {"c:\\dir\\index.html",S_OK,FALSE},
3410 {"",S_FALSE,FALSE},
3411 {"file://c|/dir\\index.html",S_OK,FALSE},
3412 {"file",S_OK,FALSE},
3413 {"",S_FALSE,FALSE},
3414 {"",S_FALSE,FALSE}
3417 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3418 {0,S_FALSE,FALSE},
3419 {URL_SCHEME_FILE,S_OK,FALSE},
3420 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3423 /* The backslashes after the scheme name are converted to forward slashes. */
3424 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3426 {"file://c:\\dir\\index.html",S_OK,FALSE},
3427 {"",S_FALSE,FALSE},
3428 {"file://c:\\dir\\index.html",S_OK,FALSE},
3429 {"",S_FALSE,FALSE},
3430 {".html",S_OK,FALSE},
3431 {"",S_FALSE,FALSE},
3432 {"",S_FALSE,FALSE},
3433 {"",S_FALSE,FALSE},
3434 {"c:\\dir\\index.html",S_OK,FALSE},
3435 {"c:\\dir\\index.html",S_OK,FALSE},
3436 {"",S_FALSE,FALSE},
3437 {"file:\\\\c:\\dir\\index.html",S_OK,FALSE},
3438 {"file",S_OK,FALSE},
3439 {"",S_FALSE,FALSE},
3440 {"",S_FALSE,FALSE}
3443 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3444 {0,S_FALSE,FALSE},
3445 {URL_SCHEME_FILE,S_OK,FALSE},
3446 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3449 { "file:\\\\c:/dir/index.html", 0, S_OK, FALSE,
3451 {"file:///c:/dir/index.html",S_OK,FALSE},
3452 {"",S_FALSE,FALSE},
3453 {"file:///c:/dir/index.html",S_OK,FALSE},
3454 {"",S_FALSE,FALSE},
3455 {".html",S_OK,FALSE},
3456 {"",S_FALSE,FALSE},
3457 {"",S_FALSE,FALSE},
3458 {"",S_FALSE,FALSE},
3459 {"/c:/dir/index.html",S_OK,FALSE},
3460 {"/c:/dir/index.html",S_OK,FALSE},
3461 {"",S_FALSE,FALSE},
3462 {"file:\\\\c:/dir/index.html",S_OK,FALSE},
3463 {"file",S_OK,FALSE},
3464 {"",S_FALSE,FALSE},
3465 {"",S_FALSE,FALSE}
3468 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3469 {0,S_FALSE,FALSE},
3470 {URL_SCHEME_FILE,S_OK,FALSE},
3471 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3474 { "http:\\\\google.com", 0, S_OK, FALSE,
3476 {"http://google.com/",S_OK,FALSE},
3477 {"google.com",S_OK,FALSE},
3478 {"http://google.com/",S_OK,FALSE},
3479 {"google.com",S_OK,FALSE},
3480 {"",S_FALSE,FALSE},
3481 {"",S_FALSE,FALSE},
3482 {"google.com",S_OK,FALSE},
3483 {"",S_FALSE,FALSE},
3484 {"/",S_OK,FALSE},
3485 {"/",S_OK,FALSE},
3486 {"",S_FALSE,FALSE},
3487 {"http:\\\\google.com",S_OK,FALSE},
3488 {"http",S_OK,FALSE},
3489 {"",S_FALSE,FALSE},
3490 {"",S_FALSE,FALSE}
3493 {Uri_HOST_DNS,S_OK,FALSE},
3494 {80,S_OK,FALSE},
3495 {URL_SCHEME_HTTP,S_OK,FALSE},
3496 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3499 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3500 { "zip:\\\\google.com", 0, S_OK, FALSE,
3502 {"zip:\\\\google.com",S_OK,FALSE},
3503 {"",S_FALSE,FALSE},
3504 {"zip:\\\\google.com",S_OK,FALSE},
3505 {"",S_FALSE,FALSE},
3506 {".com",S_OK,FALSE},
3507 {"",S_FALSE,FALSE},
3508 {"",S_FALSE,FALSE},
3509 {"",S_FALSE,FALSE},
3510 {"\\\\google.com",S_OK,FALSE},
3511 {"\\\\google.com",S_OK,FALSE},
3512 {"",S_FALSE,FALSE},
3513 {"zip:\\\\google.com",S_OK,FALSE},
3514 {"zip",S_OK,FALSE},
3515 {"",S_FALSE,FALSE},
3516 {"",S_FALSE,FALSE}
3519 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3520 {0,S_FALSE,FALSE},
3521 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3522 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3525 /* Dot segments aren't removed. */
3526 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3528 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3529 {"",S_FALSE,FALSE},
3530 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3531 {"",S_FALSE,FALSE},
3532 {".html",S_OK,FALSE},
3533 {"",S_FALSE,FALSE},
3534 {"",S_FALSE,FALSE},
3535 {"",S_FALSE,FALSE},
3536 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3537 {"c:\\dir\\..\\..\\.\\index.html",S_OK,FALSE},
3538 {"",S_FALSE,FALSE},
3539 {"file://c:\\dir\\../..\\./index.html",S_OK,FALSE},
3540 {"file",S_OK,FALSE},
3541 {"",S_FALSE,FALSE},
3542 {"",S_FALSE,FALSE}
3545 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3546 {0,S_FALSE,FALSE},
3547 {URL_SCHEME_FILE,S_OK,FALSE},
3548 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3551 /* Forbidden characters aren't percent encoded. */
3552 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3554 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3555 {"",S_FALSE,FALSE},
3556 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3557 {"",S_FALSE,FALSE},
3558 {".html",S_OK,FALSE},
3559 {"",S_FALSE,FALSE},
3560 {"",S_FALSE,FALSE},
3561 {"",S_FALSE,FALSE},
3562 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3563 {"c:\\dir\\i^|ndex.html",S_OK,FALSE},
3564 {"",S_FALSE,FALSE},
3565 {"file://c:\\dir\\i^|ndex.html",S_OK,FALSE},
3566 {"file",S_OK,FALSE},
3567 {"",S_FALSE,FALSE},
3568 {"",S_FALSE,FALSE}
3571 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3572 {0,S_FALSE,FALSE},
3573 {URL_SCHEME_FILE,S_OK,FALSE},
3574 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3577 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3578 { "file:c:\\dir\\../..\\index.html", 0, S_OK, FALSE,
3580 {"",S_FALSE,FALSE},
3581 {"",S_FALSE,FALSE},
3582 {"file:c:/dir/../../index.html",S_OK,FALSE},
3583 {"",S_FALSE,FALSE},
3584 {".html",S_OK,FALSE},
3585 {"",S_FALSE,FALSE},
3586 {"",S_FALSE,FALSE},
3587 {"",S_FALSE,FALSE},
3588 {"c:/dir/../../index.html",S_OK,FALSE},
3589 {"c:/dir/../../index.html",S_OK,FALSE},
3590 {"",S_FALSE,FALSE},
3591 {"file:c:\\dir\\../..\\index.html",S_OK,FALSE},
3592 {"file",S_OK,FALSE},
3593 {"",S_FALSE,FALSE},
3594 {"",S_FALSE,FALSE}
3597 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3598 {0,S_FALSE,FALSE},
3599 {URL_SCHEME_FILE,S_OK,FALSE},
3600 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3603 /* '/' are still converted to '\' even though it's an opaque URI. */
3604 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3606 {"",S_FALSE,FALSE},
3607 {"",S_FALSE,FALSE},
3608 {"file:c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3609 {"",S_FALSE,FALSE},
3610 {".html",S_OK,FALSE},
3611 {"",S_FALSE,FALSE},
3612 {"",S_FALSE,FALSE},
3613 {"",S_FALSE,FALSE},
3614 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3615 {"c:\\dir\\..\\..\\index.html",S_OK,FALSE},
3616 {"",S_FALSE,FALSE},
3617 {"file:c:/dir\\../..\\index.html",S_OK,FALSE},
3618 {"file",S_OK,FALSE},
3619 {"",S_FALSE,FALSE},
3620 {"",S_FALSE,FALSE}
3623 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3624 {0,S_FALSE,FALSE},
3625 {URL_SCHEME_FILE,S_OK,FALSE},
3626 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3629 /* Forbidden characters aren't percent encoded. */
3630 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3632 {"",S_FALSE,FALSE},
3633 {"",S_FALSE,FALSE},
3634 {"file:c:\\in^|dex.html",S_OK,FALSE},
3635 {"",S_FALSE,FALSE},
3636 {".html",S_OK,FALSE},
3637 {"",S_FALSE,FALSE},
3638 {"",S_FALSE,FALSE},
3639 {"",S_FALSE,FALSE},
3640 {"c:\\in^|dex.html",S_OK,FALSE},
3641 {"c:\\in^|dex.html",S_OK,FALSE},
3642 {"",S_FALSE,FALSE},
3643 {"file:c:\\in^|dex.html",S_OK,FALSE},
3644 {"file",S_OK,FALSE},
3645 {"",S_FALSE,FALSE},
3646 {"",S_FALSE,FALSE}
3649 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3650 {0,S_FALSE,FALSE},
3651 {URL_SCHEME_FILE,S_OK,FALSE},
3652 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3655 /* Doesn't have a UserName since the ':' appears at the beginning of the
3656 * userinfo section.
3658 { "http://:password@gov.uk", 0, S_OK, FALSE,
3660 {"http://:password@gov.uk/",S_OK,FALSE},
3661 {":password@gov.uk",S_OK,FALSE},
3662 {"http://gov.uk/",S_OK,FALSE},
3663 {"",S_FALSE,FALSE},
3664 {"",S_FALSE,FALSE},
3665 {"",S_FALSE,FALSE},
3666 {"gov.uk",S_OK,FALSE},
3667 {"password",S_OK,FALSE},
3668 {"/",S_OK,FALSE},
3669 {"/",S_OK,FALSE},
3670 {"",S_FALSE,FALSE},
3671 {"http://:password@gov.uk",S_OK,FALSE},
3672 {"http",S_OK,FALSE},
3673 {":password",S_OK,FALSE},
3674 {"",S_FALSE,FALSE}
3677 {Uri_HOST_DNS,S_OK,FALSE},
3678 {80,S_OK,FALSE},
3679 {URL_SCHEME_HTTP,S_OK,FALSE},
3680 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3683 /* Has a UserName since the userinfo section doesn't contain a password. */
3684 { "http://@gov.uk", 0, S_OK, FALSE,
3686 {"http://gov.uk/",S_OK,FALSE,"http://@gov.uk/"},
3687 {"@gov.uk",S_OK,FALSE},
3688 {"http://gov.uk/",S_OK,FALSE},
3689 {"",S_FALSE,FALSE},
3690 {"",S_FALSE,FALSE},
3691 {"",S_FALSE,FALSE},
3692 {"gov.uk",S_OK,FALSE},
3693 {"",S_FALSE,FALSE},
3694 {"/",S_OK,FALSE},
3695 {"/",S_OK,FALSE},
3696 {"",S_FALSE,FALSE},
3697 {"http://@gov.uk",S_OK,FALSE},
3698 {"http",S_OK,FALSE},
3699 {"",S_OK,FALSE},
3700 {"",S_OK,FALSE}
3703 {Uri_HOST_DNS,S_OK,FALSE},
3704 {80,S_OK,FALSE},
3705 {URL_SCHEME_HTTP,S_OK,FALSE},
3706 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3709 /* ":@" not included in the absolute URI. */
3710 { "http://:@gov.uk", 0, S_OK, FALSE,
3712 {"http://gov.uk/",S_OK,FALSE,"http://:@gov.uk/"},
3713 {":@gov.uk",S_OK,FALSE},
3714 {"http://gov.uk/",S_OK,FALSE},
3715 {"",S_FALSE,FALSE},
3716 {"",S_FALSE,FALSE},
3717 {"",S_FALSE,FALSE},
3718 {"gov.uk",S_OK,FALSE},
3719 {"",S_OK,FALSE},
3720 {"/",S_OK,FALSE},
3721 {"/",S_OK,FALSE},
3722 {"",S_FALSE,FALSE},
3723 {"http://:@gov.uk",S_OK,FALSE},
3724 {"http",S_OK,FALSE},
3725 {":",S_OK,FALSE},
3726 {"",S_FALSE,FALSE}
3729 {Uri_HOST_DNS,S_OK,FALSE},
3730 {80,S_OK,FALSE},
3731 {URL_SCHEME_HTTP,S_OK,FALSE},
3732 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3735 /* '@' is included because it's an unknown scheme type. */
3736 { "zip://@gov.uk", 0, S_OK, FALSE,
3738 {"zip://@gov.uk/",S_OK,FALSE},
3739 {"@gov.uk",S_OK,FALSE},
3740 {"zip://@gov.uk/",S_OK,FALSE},
3741 {"",S_FALSE,FALSE},
3742 {"",S_FALSE,FALSE},
3743 {"",S_FALSE,FALSE},
3744 {"gov.uk",S_OK,FALSE},
3745 {"",S_FALSE,FALSE},
3746 {"/",S_OK,FALSE},
3747 {"/",S_OK,FALSE},
3748 {"",S_FALSE,FALSE},
3749 {"zip://@gov.uk",S_OK,FALSE},
3750 {"zip",S_OK,FALSE},
3751 {"",S_OK,FALSE},
3752 {"",S_OK,FALSE}
3755 {Uri_HOST_DNS,S_OK,FALSE},
3756 {0,S_FALSE,FALSE},
3757 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3758 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3761 /* ":@" are included because it's an unknown scheme type. */
3762 { "zip://:@gov.uk", 0, S_OK, FALSE,
3764 {"zip://:@gov.uk/",S_OK,FALSE},
3765 {":@gov.uk",S_OK,FALSE},
3766 {"zip://:@gov.uk/",S_OK,FALSE},
3767 {"",S_FALSE,FALSE},
3768 {"",S_FALSE,FALSE},
3769 {"",S_FALSE,FALSE},
3770 {"gov.uk",S_OK,FALSE},
3771 {"",S_OK,FALSE},
3772 {"/",S_OK,FALSE},
3773 {"/",S_OK,FALSE},
3774 {"",S_FALSE,FALSE},
3775 {"zip://:@gov.uk",S_OK,FALSE},
3776 {"zip",S_OK,FALSE},
3777 {":",S_OK,FALSE},
3778 {"",S_FALSE,FALSE}
3781 {Uri_HOST_DNS,S_OK,FALSE},
3782 {0,S_FALSE,FALSE},
3783 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
3784 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3787 { "about:blank", 0, S_OK, FALSE,
3789 {"about:blank",S_OK,FALSE},
3790 {"",S_FALSE,FALSE},
3791 {"about:blank",S_OK,FALSE},
3792 {"",S_FALSE,FALSE},
3793 {"",S_FALSE,FALSE},
3794 {"",S_FALSE,FALSE},
3795 {"",S_FALSE,FALSE},
3796 {"",S_FALSE,FALSE},
3797 {"blank",S_OK,FALSE},
3798 {"blank",S_OK,FALSE},
3799 {"",S_FALSE,FALSE},
3800 {"about:blank",S_OK,FALSE},
3801 {"about",S_OK,FALSE},
3802 {"",S_FALSE,FALSE},
3803 {"",S_FALSE,FALSE}
3806 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3807 {0,S_FALSE,FALSE},
3808 {URL_SCHEME_ABOUT,S_OK,FALSE},
3809 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3812 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK,FALSE,
3814 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3815 {"",S_FALSE,FALSE},
3816 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3817 {"",S_FALSE,FALSE},
3818 {".htm",S_OK,FALSE},
3819 {"",S_FALSE,FALSE},
3820 {"",S_FALSE,FALSE},
3821 {"",S_FALSE,FALSE},
3822 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3823 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3824 {"",S_FALSE,FALSE},
3825 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK,FALSE},
3826 {"mk",S_OK,FALSE},
3827 {"",S_FALSE,FALSE},
3828 {"",S_FALSE,FALSE}
3831 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3832 {0,S_FALSE,FALSE},
3833 {URL_SCHEME_MK,S_OK,FALSE},
3834 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3837 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK,FALSE,
3839 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3840 {"",S_FALSE,FALSE},
3841 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3842 {"",S_FALSE,FALSE},
3843 {".htm",S_OK,FALSE},
3844 {"",S_FALSE,FALSE},
3845 {"",S_FALSE,FALSE},
3846 {"",S_FALSE,FALSE},
3847 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3848 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3849 {"",S_FALSE,FALSE},
3850 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK,FALSE},
3851 {"mk",S_OK,FALSE},
3852 {"",S_FALSE,FALSE},
3853 {"",S_FALSE,FALSE}
3856 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3857 {0,S_FALSE,FALSE},
3858 {URL_SCHEME_MK,S_OK,FALSE},
3859 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3862 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3863 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH, S_OK, FALSE,
3865 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3866 {"server",S_OK,FALSE},
3867 {"file://\\\\server\\dir\\index.html",S_OK,FALSE},
3868 {"",S_FALSE,FALSE},
3869 {".html",S_OK,FALSE},
3870 {"",S_FALSE,FALSE},
3871 {"server",S_OK,FALSE},
3872 {"",S_FALSE,FALSE},
3873 {"\\dir\\index.html",S_OK,FALSE},
3874 {"\\dir\\index.html",S_OK,FALSE},
3875 {"",S_FALSE,FALSE},
3876 {"file://server/dir/index.html",S_OK,FALSE},
3877 {"file",S_OK,FALSE},
3878 {"",S_FALSE,FALSE},
3879 {"",S_FALSE,FALSE}
3882 {Uri_HOST_DNS,S_OK,FALSE},
3883 {0,S_FALSE,FALSE},
3884 {URL_SCHEME_FILE,S_OK,FALSE},
3885 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3888 /* When CreateUri generates an IUri, it still displays the default port in the
3889 * authority.
3891 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
3893 {"http://google.com:80/",S_OK,FALSE},
3894 {"google.com:80",S_OK,FALSE},
3895 {"http://google.com:80/",S_OK,FALSE},
3896 {"google.com",S_OK,FALSE},
3897 {"",S_FALSE,FALSE},
3898 {"",S_FALSE,FALSE},
3899 {"google.com",S_OK,FALSE},
3900 {"",S_FALSE,FALSE},
3901 {"/",S_OK,FALSE},
3902 {"/",S_OK,FALSE},
3903 {"",S_FALSE,FALSE},
3904 {"http://google.com:80/",S_OK,FALSE},
3905 {"http",S_OK,FALSE},
3906 {"",S_FALSE,FALSE},
3907 {"",S_FALSE,FALSE}
3910 {Uri_HOST_DNS,S_OK,FALSE},
3911 {80,S_OK,FALSE},
3912 {URL_SCHEME_HTTP,S_OK,FALSE},
3913 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3916 /* For res URIs the host is everything up until the first '/'. */
3917 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK, FALSE,
3919 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3920 {"C:\\dir\\file.exe",S_OK,FALSE},
3921 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3922 {"",S_FALSE,FALSE},
3923 {".html",S_OK,FALSE},
3924 {"",S_FALSE,FALSE},
3925 {"C:\\dir\\file.exe",S_OK,FALSE},
3926 {"",S_FALSE,FALSE},
3927 {"/DATA/test.html",S_OK,FALSE},
3928 {"/DATA/test.html",S_OK,FALSE},
3929 {"",S_FALSE,FALSE},
3930 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK,FALSE},
3931 {"res",S_OK,FALSE},
3932 {"",S_FALSE,FALSE},
3933 {"",S_FALSE,FALSE}
3936 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3937 {0,S_FALSE,FALSE},
3938 {URL_SCHEME_RES,S_OK,FALSE},
3939 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3942 /* Res URI can contain a '|' in the host name. */
3943 { "res://c:\\di|r\\file.exe/test", 0, S_OK, FALSE,
3945 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3946 {"c:\\di|r\\file.exe",S_OK,FALSE},
3947 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3948 {"",S_FALSE,FALSE},
3949 {"",S_FALSE,FALSE},
3950 {"",S_FALSE,FALSE},
3951 {"c:\\di|r\\file.exe",S_OK,FALSE},
3952 {"",S_FALSE,FALSE},
3953 {"/test",S_OK,FALSE},
3954 {"/test",S_OK,FALSE},
3955 {"",S_FALSE,FALSE},
3956 {"res://c:\\di|r\\file.exe/test",S_OK,FALSE},
3957 {"res",S_OK,FALSE},
3958 {"",S_FALSE,FALSE},
3959 {"",S_FALSE,FALSE}
3962 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3963 {0,S_FALSE,FALSE},
3964 {URL_SCHEME_RES,S_OK,FALSE},
3965 {URLZONE_INVALID,E_NOTIMPL,FALSE},
3968 /* Res URIs can have invalid percent encoded values. */
3969 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK, FALSE,
3971 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3972 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3973 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3974 {"",S_FALSE,FALSE},
3975 {"",S_FALSE,FALSE},
3976 {"",S_FALSE,FALSE},
3977 {"c:\\dir%xx\\file.exe",S_OK,FALSE},
3978 {"",S_FALSE,FALSE},
3979 {"/test",S_OK,FALSE},
3980 {"/test",S_OK,FALSE},
3981 {"",S_FALSE,FALSE},
3982 {"res://c:\\dir%xx\\file.exe/test",S_OK,FALSE},
3983 {"res",S_OK,FALSE},
3984 {"",S_FALSE,FALSE},
3985 {"",S_FALSE,FALSE}
3988 {Uri_HOST_UNKNOWN,S_OK,FALSE},
3989 {0,S_FALSE,FALSE},
3990 {URL_SCHEME_RES,S_OK,FALSE},
3991 {URLZONE_INVALID,E_NOTIMPL,FALSE}
3994 /* Res doesn't get forbidden characters percent encoded in it's path. */
3995 { "res://c:\\test/tes<|>t", 0, S_OK, FALSE,
3997 {"res://c:\\test/tes<|>t",S_OK,FALSE},
3998 {"c:\\test",S_OK,FALSE},
3999 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4000 {"",S_FALSE,FALSE},
4001 {"",S_FALSE,FALSE},
4002 {"",S_FALSE,FALSE},
4003 {"c:\\test",S_OK,FALSE},
4004 {"",S_FALSE,FALSE},
4005 {"/tes<|>t",S_OK,FALSE},
4006 {"/tes<|>t",S_OK,FALSE},
4007 {"",S_FALSE,FALSE},
4008 {"res://c:\\test/tes<|>t",S_OK,FALSE},
4009 {"res",S_OK,FALSE},
4010 {"",S_FALSE,FALSE},
4011 {"",S_FALSE,FALSE}
4014 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4015 {0,S_FALSE,FALSE},
4016 {URL_SCHEME_RES,S_OK,FALSE},
4017 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4020 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4022 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4023 {"",S_FALSE,FALSE},
4024 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4025 {"",S_FALSE,FALSE},
4026 {".jpg",S_OK,FALSE},
4027 {"",S_FALSE,FALSE},
4028 {"",S_FALSE,FALSE},
4029 {"",S_FALSE,FALSE},
4030 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4031 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK,FALSE},
4032 {"",S_FALSE,FALSE},
4033 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4034 {"mk",S_OK,FALSE},
4035 {"",S_FALSE,FALSE},
4036 {"",S_FALSE,FALSE}
4039 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4040 {0,S_FALSE,FALSE},
4041 {URL_SCHEME_MK,S_OK,FALSE},
4042 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4045 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE, S_OK, FALSE,
4047 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4048 {"",S_FALSE,FALSE},
4049 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4050 {"",S_FALSE,FALSE},
4051 {".jpg",S_OK,FALSE},
4052 {"",S_FALSE,FALSE},
4053 {"",S_FALSE,FALSE},
4054 {"",S_FALSE,FALSE},
4055 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4056 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4057 {"",S_FALSE,FALSE},
4058 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4059 {"mk",S_OK,FALSE},
4060 {"",S_FALSE,FALSE},
4061 {"",S_FALSE,FALSE}
4064 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4065 {0,S_FALSE,FALSE},
4066 {URL_SCHEME_MK,S_OK,FALSE},
4067 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4070 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK, FALSE,
4072 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4073 {"",S_FALSE,FALSE},
4074 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4075 {"",S_FALSE,FALSE},
4076 {".jpg",S_OK,FALSE},
4077 {"",S_FALSE,FALSE},
4078 {"",S_FALSE,FALSE},
4079 {"",S_FALSE,FALSE},
4080 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4081 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4082 {"",S_FALSE,FALSE},
4083 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK,FALSE},
4084 {"xx",S_OK,FALSE},
4085 {"",S_FALSE,FALSE},
4086 {"",S_FALSE,FALSE}
4089 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4090 {0,S_FALSE,FALSE},
4091 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4092 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4095 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4097 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4098 {"",S_FALSE,FALSE},
4099 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4100 {"",S_FALSE,FALSE},
4101 {".jpg",S_OK,FALSE},
4102 {"",S_FALSE,FALSE},
4103 {"",S_FALSE,FALSE},
4104 {"",S_FALSE,FALSE},
4105 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4106 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4107 {"",S_FALSE,FALSE},
4108 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4109 {"mk",S_OK,FALSE},
4110 {"",S_FALSE,FALSE},
4111 {"",S_FALSE,FALSE}
4114 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4115 {0,S_FALSE,FALSE},
4116 {URL_SCHEME_MK,S_OK,FALSE},
4117 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4120 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK, FALSE,
4122 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4123 {"",S_FALSE,FALSE},
4124 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4125 {"",S_FALSE,FALSE},
4126 {".jpg",S_OK,FALSE},
4127 {"",S_FALSE,FALSE},
4128 {"",S_FALSE,FALSE},
4129 {"",S_FALSE,FALSE},
4130 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4131 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK,FALSE},
4132 {"",S_FALSE,FALSE},
4133 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK,FALSE},
4134 {"mk",S_OK,FALSE},
4135 {"",S_FALSE,FALSE},
4136 {"",S_FALSE,FALSE}
4139 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4140 {0,S_FALSE,FALSE},
4141 {URL_SCHEME_MK,S_OK,FALSE},
4142 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4145 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK, FALSE,
4147 {"mk:images/xxx.jpg",S_OK,FALSE},
4148 {"",S_FALSE,FALSE},
4149 {"mk:images/xxx.jpg",S_OK,FALSE},
4150 {"",S_FALSE,FALSE},
4151 {".jpg",S_OK,FALSE},
4152 {"",S_FALSE,FALSE},
4153 {"",S_FALSE,FALSE},
4154 {"",S_FALSE,FALSE},
4155 {"images/xxx.jpg",S_OK,FALSE},
4156 {"images/xxx.jpg",S_OK,FALSE},
4157 {"",S_FALSE,FALSE},
4158 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK,FALSE},
4159 {"mk",S_OK,FALSE},
4160 {"",S_FALSE,FALSE},
4161 {"",S_FALSE,FALSE}
4164 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4165 {0,S_FALSE,FALSE},
4166 {URL_SCHEME_MK,S_OK,FALSE},
4167 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4170 { "", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4172 {"",S_OK,FALSE},
4173 {"",S_FALSE,FALSE},
4174 {"",S_OK,FALSE},
4175 {"",S_FALSE,FALSE},
4176 {"",S_FALSE,FALSE},
4177 {"",S_FALSE,FALSE},
4178 {"",S_FALSE,FALSE},
4179 {"",S_FALSE,FALSE},
4180 {"",S_OK,FALSE},
4181 {"",S_OK,FALSE},
4182 {"",S_FALSE,FALSE},
4183 {"",S_OK,FALSE},
4184 {"",S_FALSE,FALSE},
4185 {"",S_FALSE,FALSE},
4186 {"",S_FALSE,FALSE}
4189 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4190 {0,S_FALSE,FALSE},
4191 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4192 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4195 { " \t ", Uri_CREATE_ALLOW_RELATIVE, S_OK, FALSE,
4197 {"",S_OK,FALSE},
4198 {"",S_FALSE,FALSE},
4199 {"",S_OK,FALSE},
4200 {"",S_FALSE,FALSE},
4201 {"",S_FALSE,FALSE},
4202 {"",S_FALSE,FALSE},
4203 {"",S_FALSE,FALSE},
4204 {"",S_FALSE,FALSE},
4205 {"",S_OK,FALSE},
4206 {"",S_OK,FALSE},
4207 {"",S_FALSE,FALSE},
4208 {"",S_OK,FALSE},
4209 {"",S_FALSE,FALSE},
4210 {"",S_FALSE,FALSE},
4211 {"",S_FALSE,FALSE}
4214 {Uri_HOST_UNKNOWN,S_OK,FALSE},
4215 {0,S_FALSE,FALSE},
4216 {URL_SCHEME_UNKNOWN,S_OK,FALSE},
4217 {URLZONE_INVALID,E_NOTIMPL,FALSE}
4220 { "javascript:void", 0, S_OK, FALSE,
4222 {"javascript:void",S_OK},
4223 {"",S_FALSE},
4224 {"javascript:void",S_OK},
4225 {"",S_FALSE},
4226 {"",S_FALSE},
4227 {"",S_FALSE},
4228 {"",S_FALSE},
4229 {"",S_FALSE},
4230 {"void",S_OK},
4231 {"void",S_OK},
4232 {"",S_FALSE},
4233 {"javascript:void",S_OK},
4234 {"javascript",S_OK},
4235 {"",S_FALSE},
4236 {"",S_FALSE}
4239 {Uri_HOST_UNKNOWN,S_OK},
4240 {0,S_FALSE},
4241 {URL_SCHEME_JAVASCRIPT,S_OK},
4242 {URLZONE_INVALID,E_NOTIMPL}
4245 { "javascript://undefined", 0, S_OK, FALSE,
4247 {"javascript://undefined",S_OK},
4248 {"",S_FALSE},
4249 {"javascript://undefined",S_OK},
4250 {"",S_FALSE},
4251 {"",S_FALSE},
4252 {"",S_FALSE},
4253 {"",S_FALSE},
4254 {"",S_FALSE},
4255 {"//undefined",S_OK},
4256 {"//undefined",S_OK},
4257 {"",S_FALSE},
4258 {"javascript://undefined",S_OK},
4259 {"javascript",S_OK},
4260 {"",S_FALSE},
4261 {"",S_FALSE}
4264 {Uri_HOST_UNKNOWN,S_OK},
4265 {0,S_FALSE},
4266 {URL_SCHEME_JAVASCRIPT,S_OK},
4267 {URLZONE_INVALID,E_NOTIMPL}
4270 { "JavaSCript:escape('/\\?#?')", 0, S_OK, FALSE,
4272 {"javascript:escape('/\\?#?')",S_OK},
4273 {"",S_FALSE},
4274 {"javascript:escape('/\\?#?')",S_OK},
4275 {"",S_FALSE},
4276 {"",S_FALSE},
4277 {"",S_FALSE},
4278 {"",S_FALSE},
4279 {"",S_FALSE},
4280 {"escape('/\\?#?')",S_OK},
4281 {"escape('/\\?#?')",S_OK},
4282 {"",S_FALSE},
4283 {"JavaSCript:escape('/\\?#?')",S_OK},
4284 {"javascript",S_OK},
4285 {"",S_FALSE},
4286 {"",S_FALSE}
4289 {Uri_HOST_UNKNOWN,S_OK},
4290 {0,S_FALSE},
4291 {URL_SCHEME_JAVASCRIPT,S_OK},
4292 {URLZONE_INVALID,E_NOTIMPL}
4297 typedef struct _invalid_uri {
4298 const char* uri;
4299 DWORD flags;
4300 BOOL todo;
4301 } invalid_uri;
4303 static const invalid_uri invalid_uri_tests[] = {
4304 /* Has to have a scheme name. */
4305 {"://www.winehq.org",0,FALSE},
4306 /* Window's doesn't like URI's which are implicitly file paths without the
4307 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4309 {"C:/test/test.mp3",0,FALSE},
4310 {"\\\\Server/test/test.mp3",0,FALSE},
4311 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME,FALSE},
4312 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE,FALSE},
4313 /* Invalid schemes. */
4314 {"*abcd://not.valid.com",0,FALSE},
4315 {"*a*b*c*d://not.valid.com",0,FALSE},
4316 /* Not allowed to have invalid % encoded data. */
4317 {"ftp://google.co%XX/",0,FALSE},
4318 /* To many h16 components. */
4319 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE},
4320 /* Not enough room for IPv4 address. */
4321 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE},
4322 /* Not enough h16 components. */
4323 {"http://[1:2:3:4]",0,FALSE},
4324 /* Not enough components including IPv4. */
4325 {"http://[1:192.0.1.0]",0,FALSE},
4326 /* Not allowed to have partial IPv4 in IPv6. */
4327 {"http://[::192.0]",0,FALSE},
4328 /* Can't have elision of 1 h16 at beginning of address. */
4329 {"http://[::2:3:4:5:6:7:8]",0,FALSE},
4330 /* Can't have elision of 1 h16 at end of address. */
4331 {"http://[1:2:3:4:5:6:7::]",0,FALSE},
4332 /* Expects a valid IP Literal. */
4333 {"ftp://[not.valid.uri]/",0,FALSE},
4334 /* Expects valid port for a known scheme type. */
4335 {"ftp://www.winehq.org:123fgh",0,FALSE},
4336 /* Port exceeds USHORT_MAX for known scheme type. */
4337 {"ftp://www.winehq.org:65536",0,FALSE},
4338 /* Invalid port with IPv4 address. */
4339 {"http://www.winehq.org:1abcd",0,FALSE},
4340 /* Invalid port with IPv6 address. */
4341 {"http://[::ffff]:32xy",0,FALSE},
4342 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4343 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE,FALSE},
4344 /* Not allowed to have invalid % encoded data in opaque URI path. */
4345 {"news:test%XX",0,FALSE},
4346 {"mailto:wine@winehq%G8.com",0,FALSE},
4347 /* Known scheme types can't have invalid % encoded data in query string. */
4348 {"http://google.com/?query=te%xx",0,FALSE},
4349 /* Invalid % encoded data in fragment of know scheme type. */
4350 {"ftp://google.com/#Test%xx",0,FALSE},
4351 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4352 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI,FALSE},
4353 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4354 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4355 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4356 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4357 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4358 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH,FALSE},
4359 /* res URIs aren't allowed to have forbidden dos path characters in the
4360 * hostname.
4362 {"res://c:\\te<st\\test/test",0,FALSE},
4363 {"res://c:\\te>st\\test/test",0,FALSE},
4364 {"res://c:\\te\"st\\test/test",0,FALSE},
4365 {"res://c:\\test/te%xxst",0,FALSE}
4368 typedef struct _uri_equality {
4369 const char* a;
4370 DWORD create_flags_a;
4371 BOOL create_todo_a;
4372 const char* b;
4373 DWORD create_flags_b;
4374 BOOL create_todo_b;
4375 BOOL equal;
4376 BOOL todo;
4377 } uri_equality;
4379 static const uri_equality equality_tests[] = {
4381 "HTTP://www.winehq.org/test dir/./",0,FALSE,
4382 "http://www.winehq.org/test dir/../test dir/",0,FALSE,
4383 TRUE, FALSE
4386 /* http://www.winehq.org/test%20dir */
4387 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,FALSE,
4388 "http://www.winehq.org/test dir",0,FALSE,
4389 TRUE, FALSE
4392 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,FALSE,
4393 "file:///c:/test.mp3",0,FALSE,
4394 TRUE, FALSE
4397 "ftp://ftp.winehq.org/",0,FALSE,
4398 "ftp://ftp.winehq.org",0,FALSE,
4399 TRUE, FALSE
4402 "ftp://ftp.winehq.org/test/test2/../../testB/",0,FALSE,
4403 "ftp://ftp.winehq.org/t%45stB/",0,FALSE,
4404 FALSE, FALSE
4407 "http://google.com/TEST",0,FALSE,
4408 "http://google.com/test",0,FALSE,
4409 FALSE, FALSE
4412 "http://GOOGLE.com/",0,FALSE,
4413 "http://google.com/",0,FALSE,
4414 TRUE, FALSE
4416 /* Performs case insensitive compare of host names (for known scheme types). */
4418 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4419 "ftp://google.com/",0,FALSE,
4420 TRUE, FALSE
4423 "zip://GOOGLE.com/",0,FALSE,
4424 "zip://google.com/",0,FALSE,
4425 FALSE, FALSE
4428 "file:///c:/TEST/TeST/",0,FALSE,
4429 "file:///c:/test/test/",0,FALSE,
4430 TRUE, FALSE
4433 "file:///server/TEST",0,FALSE,
4434 "file:///SERVER/TEST",0,FALSE,
4435 TRUE, FALSE
4438 "http://google.com",Uri_CREATE_NO_CANONICALIZE,FALSE,
4439 "http://google.com/",0,FALSE,
4440 TRUE, FALSE
4443 "ftp://google.com:21/",0,FALSE,
4444 "ftp://google.com/",0,FALSE,
4445 TRUE, FALSE
4448 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE,FALSE,
4449 "http://google.com/",0,FALSE,
4450 TRUE, FALSE
4453 "http://google.com:70/",0,FALSE,
4454 "http://google.com:71/",0,FALSE,
4455 FALSE, FALSE
4459 typedef struct _uri_with_fragment {
4460 const char* uri;
4461 const char* fragment;
4462 DWORD create_flags;
4463 HRESULT create_expected;
4464 BOOL create_todo;
4466 const char* expected_uri;
4467 BOOL expected_todo;
4468 } uri_with_fragment;
4470 static const uri_with_fragment uri_fragment_tests[] = {
4472 "http://google.com/","#fragment",0,S_OK,FALSE,
4473 "http://google.com/#fragment",FALSE
4476 "http://google.com/","fragment",0,S_OK,FALSE,
4477 "http://google.com/#fragment",FALSE
4480 "zip://test.com/","?test",0,S_OK,FALSE,
4481 "zip://test.com/#?test",FALSE
4483 /* The fragment can be empty. */
4485 "ftp://ftp.google.com/","",0,S_OK,FALSE,
4486 "ftp://ftp.google.com/#",FALSE
4490 typedef struct _uri_builder_property {
4491 BOOL change;
4492 const char *value;
4493 const char *expected_value;
4494 Uri_PROPERTY property;
4495 HRESULT expected;
4496 BOOL todo;
4497 } uri_builder_property;
4499 typedef struct _uri_builder_port {
4500 BOOL change;
4501 BOOL set;
4502 DWORD value;
4503 HRESULT expected;
4504 BOOL todo;
4505 } uri_builder_port;
4507 typedef struct _uri_builder_str_property {
4508 const char* expected;
4509 HRESULT result;
4510 BOOL todo;
4511 } uri_builder_str_property;
4513 typedef struct _uri_builder_dword_property {
4514 DWORD expected;
4515 HRESULT result;
4516 BOOL todo;
4517 } uri_builder_dword_property;
4519 typedef struct _uri_builder_test {
4520 const char *uri;
4521 DWORD create_flags;
4522 HRESULT create_builder_expected;
4523 BOOL create_builder_todo;
4525 uri_builder_property properties[URI_BUILDER_STR_PROPERTY_COUNT];
4527 uri_builder_port port_prop;
4529 DWORD uri_flags;
4530 HRESULT uri_hres;
4531 BOOL uri_todo;
4533 DWORD uri_simple_encode_flags;
4534 HRESULT uri_simple_hres;
4535 BOOL uri_simple_todo;
4537 DWORD uri_with_flags;
4538 DWORD uri_with_builder_flags;
4539 DWORD uri_with_encode_flags;
4540 HRESULT uri_with_hres;
4541 BOOL uri_with_todo;
4543 uri_builder_str_property expected_str_props[URI_STR_PROPERTY_COUNT];
4544 uri_builder_dword_property expected_dword_props[URI_DWORD_PROPERTY_COUNT];
4545 } uri_builder_test;
4547 static const uri_builder_test uri_builder_tests[] = {
4548 { "http://google.com/",0,S_OK,FALSE,
4550 {TRUE,"#fragment",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4551 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE},
4552 {TRUE,"?query=x",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE},
4553 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
4555 {FALSE},
4556 0,S_OK,FALSE,
4557 0,S_OK,FALSE,
4558 0,0,0,S_OK,FALSE,
4560 {"http://username:password@google.com/?query=x#fragment",S_OK},
4561 {"username:password@google.com",S_OK},
4562 {"http://google.com/?query=x#fragment",S_OK},
4563 {"google.com",S_OK},
4564 {"",S_FALSE},
4565 {"#fragment",S_OK},
4566 {"google.com",S_OK},
4567 {"password",S_OK},
4568 {"/",S_OK},
4569 {"/?query=x",S_OK},
4570 {"?query=x",S_OK},
4571 {"http://username:password@google.com/?query=x#fragment",S_OK},
4572 {"http",S_OK},
4573 {"username:password",S_OK},
4574 {"username",S_OK}
4577 {Uri_HOST_DNS,S_OK},
4578 {80,S_OK},
4579 {URL_SCHEME_HTTP,S_OK},
4580 {URLZONE_INVALID,E_NOTIMPL}
4583 { "http://google.com/",0,S_OK,FALSE,
4585 {TRUE,"test",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
4587 {TRUE,TRUE,120,S_OK,FALSE},
4588 0,S_OK,FALSE,
4589 0,S_OK,FALSE,
4590 0,0,0,S_OK,FALSE,
4592 {"test://google.com:120/",S_OK},
4593 {"google.com:120",S_OK},
4594 {"test://google.com:120/",S_OK},
4595 {"google.com",S_OK},
4596 {"",S_FALSE},
4597 {"",S_FALSE},
4598 {"google.com",S_OK},
4599 {"",S_FALSE},
4600 {"/",S_OK},
4601 {"/",S_OK},
4602 {"",S_FALSE},
4603 {"test://google.com:120/",S_OK},
4604 {"test",S_OK},
4605 {"",S_FALSE},
4606 {"",S_FALSE}
4609 {Uri_HOST_DNS,S_OK},
4610 {120,S_OK},
4611 {URL_SCHEME_UNKNOWN,S_OK},
4612 {URLZONE_INVALID,E_NOTIMPL}
4615 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4617 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
4618 {TRUE,"::192.2.3.4",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
4619 {TRUE,NULL,NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
4621 {FALSE},
4622 0,S_OK,FALSE,
4623 0,S_OK,FALSE,
4624 0,0,0,S_OK,FALSE,
4626 {"http://[::192.2.3.4]/",S_OK},
4627 {"[::192.2.3.4]",S_OK},
4628 {"http://[::192.2.3.4]/",S_OK},
4629 {"",S_FALSE},
4630 {"",S_FALSE},
4631 {"",S_FALSE},
4632 {"::192.2.3.4",S_OK},
4633 {"",S_FALSE},
4634 {"/",S_OK},
4635 {"/",S_OK},
4636 {"",S_FALSE},
4637 {"http://[::192.2.3.4]/",S_OK},
4638 {"http",S_OK},
4639 {"",S_FALSE},
4640 {"",S_FALSE}
4643 {Uri_HOST_IPV6,S_OK},
4644 {80,S_OK},
4645 {URL_SCHEME_HTTP,S_OK},
4646 {URLZONE_INVALID,E_NOTIMPL}
4649 { "http://google.com/",0,S_OK,FALSE,
4651 {TRUE,"Frag","#Frag",Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
4653 {FALSE},
4654 0,S_OK,FALSE,
4655 0,S_OK,FALSE,
4656 0,0,0,S_OK,FALSE,
4658 {"http://google.com/#Frag",S_OK},
4659 {"google.com",S_OK},
4660 {"http://google.com/#Frag",S_OK},
4661 {"google.com",S_OK},
4662 {"",S_FALSE},
4663 {"#Frag",S_OK},
4664 {"google.com",S_OK},
4665 {"",S_FALSE},
4666 {"/",S_OK},
4667 {"/",S_OK},
4668 {"",S_FALSE},
4669 {"http://google.com/#Frag",S_OK},
4670 {"http",S_OK},
4671 {"",S_FALSE},
4672 {"",S_FALSE}
4675 {Uri_HOST_DNS,S_OK},
4676 {80,S_OK},
4677 {URL_SCHEME_HTTP,S_OK},
4678 {URLZONE_INVALID,E_NOTIMPL}
4681 { "http://google.com/",0,S_OK,FALSE,
4683 {TRUE,"","#",Uri_PROPERTY_FRAGMENT,S_OK,FALSE},
4685 {FALSE},
4686 0,S_OK,FALSE,
4687 0,S_OK,FALSE,
4688 0,0,0,S_OK,FALSE,
4690 {"http://google.com/#",S_OK},
4691 {"google.com",S_OK},
4692 {"http://google.com/#",S_OK},
4693 {"google.com",S_OK},
4694 {"",S_FALSE},
4695 {"#",S_OK},
4696 {"google.com",S_OK},
4697 {"",S_FALSE},
4698 {"/",S_OK},
4699 {"/",S_OK},
4700 {"",S_FALSE},
4701 {"http://google.com/#",S_OK},
4702 {"http",S_OK},
4703 {"",S_FALSE},
4704 {"",S_FALSE}
4707 {Uri_HOST_DNS,S_OK},
4708 {80,S_OK},
4709 {URL_SCHEME_HTTP,S_OK},
4710 {URLZONE_INVALID,E_NOTIMPL}
4713 { "http://google.com/",0,S_OK,FALSE,
4715 {TRUE,":password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4717 {FALSE},
4718 0,S_OK,FALSE,
4719 0,S_OK,FALSE,
4720 0,0,0,S_OK,FALSE,
4722 {"http://::password@google.com/",S_OK},
4723 {"::password@google.com",S_OK},
4724 {"http://google.com/",S_OK},
4725 {"google.com",S_OK},
4726 {"",S_FALSE},
4727 {"",S_FALSE},
4728 {"google.com",S_OK},
4729 {":password",S_OK},
4730 {"/",S_OK},
4731 {"/",S_OK},
4732 {"",S_FALSE},
4733 {"http://::password@google.com/",S_OK},
4734 {"http",S_OK},
4735 {"::password",S_OK},
4736 {"",S_FALSE}
4739 {Uri_HOST_DNS,S_OK},
4740 {80,S_OK},
4741 {URL_SCHEME_HTTP,S_OK},
4742 {URLZONE_INVALID,E_NOTIMPL}
4745 { "test/test",Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4747 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
4749 {FALSE},
4750 Uri_CREATE_ALLOW_RELATIVE,S_OK,FALSE,
4751 0,S_OK,FALSE,
4752 Uri_CREATE_ALLOW_RELATIVE,0,0,S_OK,FALSE,
4754 {":password@test/test",S_OK},
4755 {":password@",S_OK},
4756 {":password@test/test",S_OK},
4757 {"",S_FALSE},
4758 {"",S_FALSE},
4759 {"",S_FALSE},
4760 {"",S_FALSE},
4761 {"password",S_OK},
4762 {"test/test",S_OK},
4763 {"test/test",S_OK},
4764 {"",S_FALSE},
4765 {":password@test/test",S_OK},
4766 {"",S_FALSE},
4767 {":password",S_OK},
4768 {"",S_FALSE}
4771 {Uri_HOST_UNKNOWN,S_OK},
4772 {0,S_FALSE},
4773 {URL_SCHEME_UNKNOWN,S_OK},
4774 {URLZONE_INVALID,E_NOTIMPL}
4777 { "http://google.com/",0,S_OK,FALSE,
4779 {TRUE,"test/test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4781 {FALSE},
4782 0,S_OK,FALSE,
4783 0,S_OK,FALSE,
4784 0,0,0,S_OK,FALSE,
4786 {"http://google.com/test/test",S_OK},
4787 {"google.com",S_OK},
4788 {"http://google.com/test/test",S_OK},
4789 {"google.com",S_OK},
4790 {"",S_FALSE},
4791 {"",S_FALSE},
4792 {"google.com",S_OK},
4793 {"",S_FALSE},
4794 {"/test/test",S_OK},
4795 {"/test/test",S_OK},
4796 {"",S_FALSE},
4797 {"http://google.com/test/test",S_OK},
4798 {"http",S_OK},
4799 {"",S_FALSE},
4800 {"",S_FALSE}
4803 {Uri_HOST_DNS,S_OK},
4804 {80,S_OK},
4805 {URL_SCHEME_HTTP,S_OK},
4806 {URLZONE_INVALID,E_NOTIMPL}
4809 { "zip:testing/test",0,S_OK,FALSE,
4811 {TRUE,"test",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
4813 {FALSE},
4814 0,S_OK,FALSE,
4815 0,S_OK,FALSE,
4816 0,0,0,S_OK,FALSE,
4818 {"zip:test",S_OK},
4819 {"",S_FALSE},
4820 {"zip:test",S_OK},
4821 {"",S_FALSE},
4822 {"",S_FALSE},
4823 {"",S_FALSE},
4824 {"",S_FALSE},
4825 {"",S_FALSE},
4826 {"test",S_OK},
4827 {"test",S_OK},
4828 {"",S_FALSE},
4829 {"zip:test",S_OK},
4830 {"zip",S_OK},
4831 {"",S_FALSE},
4832 {"",S_FALSE}
4835 {Uri_HOST_UNKNOWN,S_OK},
4836 {0,S_FALSE},
4837 {URL_SCHEME_UNKNOWN,S_OK},
4838 {URLZONE_INVALID,E_NOTIMPL}
4841 { "http://google.com/",0,S_OK,FALSE,
4843 {FALSE},
4845 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
4846 {TRUE,FALSE,555,S_OK,FALSE},
4847 0,S_OK,FALSE,
4848 0,S_OK,FALSE,
4849 0,0,0,S_OK,FALSE,
4851 {"http://google.com/",S_OK},
4852 {"google.com",S_OK},
4853 {"http://google.com/",S_OK},
4854 {"google.com",S_OK},
4855 {"",S_FALSE},
4856 {"",S_FALSE},
4857 {"google.com",S_OK},
4858 {"",S_FALSE},
4859 {"/",S_OK},
4860 {"/",S_OK},
4861 {"",S_FALSE},
4862 {"http://google.com/",S_OK},
4863 {"http",S_OK},
4864 {"",S_FALSE},
4865 {"",S_FALSE}
4868 {Uri_HOST_DNS,S_OK},
4869 /* Still returns 80, even though earlier the port was disabled. */
4870 {80,S_OK},
4871 {URL_SCHEME_HTTP,S_OK},
4872 {URLZONE_INVALID,E_NOTIMPL}
4875 { "http://google.com/",0,S_OK,FALSE,
4877 {FALSE},
4879 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
4880 * you'll get 122345 instead.
4882 {TRUE,122345,222,S_OK,FALSE},
4883 0,S_OK,FALSE,
4884 0,S_OK,FALSE,
4885 0,0,0,S_OK,FALSE,
4887 {"http://google.com:222/",S_OK},
4888 {"google.com:222",S_OK},
4889 {"http://google.com:222/",S_OK},
4890 {"google.com",S_OK},
4891 {"",S_FALSE},
4892 {"",S_FALSE},
4893 {"google.com",S_OK},
4894 {"",S_FALSE},
4895 {"/",S_OK},
4896 {"/",S_OK},
4897 {"",S_FALSE},
4898 {"http://google.com:222/",S_OK},
4899 {"http",S_OK},
4900 {"",S_FALSE},
4901 {"",S_FALSE}
4904 {Uri_HOST_DNS,S_OK},
4905 {222,S_OK},
4906 {URL_SCHEME_HTTP,S_OK},
4907 {URLZONE_INVALID,E_NOTIMPL}
4910 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
4911 { "http://google.com/",0,S_OK,FALSE,
4913 {FALSE},
4915 {TRUE,TRUE,999999,S_OK,FALSE},
4916 0,S_OK,FALSE,
4917 0,S_OK,FALSE,
4918 0,0,0,S_OK,FALSE,
4920 {"http://google.com:999999/",S_OK},
4921 {"google.com:999999",S_OK},
4922 {"http://google.com:999999/",S_OK},
4923 {"google.com",S_OK},
4924 {"",S_FALSE},
4925 {"",S_FALSE},
4926 {"google.com",S_OK},
4927 {"",S_FALSE},
4928 {"/",S_OK},
4929 {"/",S_OK},
4930 {"",S_FALSE},
4931 {"http://google.com:999999/",S_OK},
4932 {"http",S_OK},
4933 {"",S_FALSE},
4934 {"",S_FALSE}
4937 {Uri_HOST_DNS,S_OK},
4938 {999999,S_OK},
4939 {URL_SCHEME_HTTP,S_OK},
4940 {URLZONE_INVALID,E_NOTIMPL}
4943 { "http://google.com/",0,S_OK,FALSE,
4945 {TRUE,"test","?test",Uri_PROPERTY_QUERY,S_OK,FALSE},
4948 {FALSE},
4949 0,S_OK,FALSE,
4950 0,S_OK,FALSE,
4951 0,0,0,S_OK,FALSE,
4953 {"http://google.com/?test",S_OK},
4954 {"google.com",S_OK},
4955 {"http://google.com/?test",S_OK},
4956 {"google.com",S_OK},
4957 {"",S_FALSE},
4958 {"",S_FALSE},
4959 {"google.com",S_OK},
4960 {"",S_FALSE},
4961 {"/",S_OK},
4962 {"/?test",S_OK},
4963 {"?test",S_OK},
4964 {"http://google.com/?test",S_OK},
4965 {"http",S_OK},
4966 {"",S_FALSE},
4967 {"",S_FALSE}
4970 {Uri_HOST_DNS,S_OK},
4971 {80,S_OK},
4972 {URL_SCHEME_HTTP,S_OK},
4973 {URLZONE_INVALID,E_NOTIMPL}
4976 { "http://:password@google.com/",0,S_OK,FALSE,
4978 {FALSE},
4980 {FALSE},
4981 0,S_OK,FALSE,
4982 0,S_OK,FALSE,
4983 0,0,0,S_OK,FALSE,
4985 {"http://:password@google.com/",S_OK},
4986 {":password@google.com",S_OK},
4987 {"http://google.com/",S_OK},
4988 {"google.com",S_OK},
4989 {"",S_FALSE},
4990 {"",S_FALSE},
4991 {"google.com",S_OK},
4992 {"password",S_OK},
4993 {"/",S_OK},
4994 {"/",S_OK},
4995 {"",S_FALSE},
4996 {"http://:password@google.com/",S_OK},
4997 {"http",S_OK},
4998 {":password",S_OK},
4999 {"",S_FALSE}
5002 {Uri_HOST_DNS,S_OK},
5003 {80,S_OK},
5004 {URL_SCHEME_HTTP,S_OK},
5005 {URLZONE_INVALID,E_NOTIMPL}
5008 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5009 { NULL,0,S_OK,FALSE,
5011 {TRUE,"http",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE},
5012 {TRUE,"google.com",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5014 {FALSE},
5015 0,S_OK,FALSE,
5016 0,S_OK,FALSE,
5017 0,0,0,S_OK,FALSE,
5019 {"http://google.com/",S_OK},
5020 {"google.com",S_OK},
5021 {"http://google.com/",S_OK},
5022 {"google.com",S_OK},
5023 {"",S_FALSE},
5024 {"",S_FALSE},
5025 {"google.com",S_OK},
5026 {"",S_FALSE},
5027 {"/",S_OK},
5028 {"/",S_OK},
5029 {"",S_FALSE},
5030 {"http://google.com/",S_OK},
5031 {"http",S_OK},
5032 {"",S_FALSE},
5033 {"",S_FALSE}
5036 {Uri_HOST_DNS,S_OK},
5037 {80,S_OK},
5038 {URL_SCHEME_HTTP,S_OK},
5039 {URLZONE_INVALID,E_NOTIMPL}
5042 /* Can't set the scheme name to NULL. */
5043 { "zip://google.com/",0,S_OK,FALSE,
5045 {TRUE,NULL,"zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5047 {FALSE},
5048 0,S_OK,FALSE,
5049 0,S_OK,FALSE,
5050 0,0,0,S_OK,FALSE,
5052 {"zip://google.com/",S_OK},
5053 {"google.com",S_OK},
5054 {"zip://google.com/",S_OK},
5055 {"google.com",S_OK},
5056 {"",S_FALSE},
5057 {"",S_FALSE},
5058 {"google.com",S_OK},
5059 {"",S_FALSE},
5060 {"/",S_OK},
5061 {"/",S_OK},
5062 {"",S_FALSE},
5063 {"zip://google.com/",S_OK},
5064 {"zip",S_OK},
5065 {"",S_FALSE},
5066 {"",S_FALSE}
5069 {Uri_HOST_DNS,S_OK},
5070 {0,S_FALSE},
5071 {URL_SCHEME_UNKNOWN,S_OK},
5072 {URLZONE_INVALID,E_NOTIMPL}
5075 /* Can't set the scheme name to an empty string. */
5076 { "zip://google.com/",0,S_OK,FALSE,
5078 {TRUE,"","zip",Uri_PROPERTY_SCHEME_NAME,E_INVALIDARG,FALSE}
5080 {FALSE},
5081 0,S_OK,FALSE,
5082 0,S_OK,FALSE,
5083 0,0,0,S_OK,FALSE,
5085 {"zip://google.com/",S_OK},
5086 {"google.com",S_OK},
5087 {"zip://google.com/",S_OK},
5088 {"google.com",S_OK},
5089 {"",S_FALSE},
5090 {"",S_FALSE},
5091 {"google.com",S_OK},
5092 {"",S_FALSE},
5093 {"/",S_OK},
5094 {"/",S_OK},
5095 {"",S_FALSE},
5096 {"zip://google.com/",S_OK},
5097 {"zip",S_OK},
5098 {"",S_FALSE},
5099 {"",S_FALSE}
5102 {Uri_HOST_DNS,S_OK},
5103 {0,S_FALSE},
5104 {URL_SCHEME_UNKNOWN,S_OK},
5105 {URLZONE_INVALID,E_NOTIMPL}
5108 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5109 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5111 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE,S_OK,FALSE,
5112 {{FALSE}},
5113 {FALSE},
5114 -1,S_OK,FALSE,
5115 0,S_OK,FALSE,
5116 0,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5118 {"http://google.com/../../",S_OK},
5119 {"google.com",S_OK},
5120 {"http://google.com/../../",S_OK},
5121 {"google.com",S_OK},
5122 {"",S_FALSE},
5123 {"",S_FALSE},
5124 {"google.com",S_OK},
5125 {"",S_FALSE},
5126 {"/../../",S_OK},
5127 {"/../../",S_OK},
5128 {"",S_FALSE},
5129 {"http://google.com/../../",S_OK},
5130 {"http",S_OK},
5131 {"",S_FALSE},
5132 {"",S_FALSE}
5135 {Uri_HOST_DNS,S_OK},
5136 {80,S_OK},
5137 {URL_SCHEME_HTTP,S_OK},
5138 {URLZONE_INVALID,E_NOTIMPL}
5141 { "http://google.com/",0,S_OK,FALSE,
5143 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5145 {FALSE},
5146 -1,S_OK,FALSE,
5147 0,S_OK,FALSE,
5148 Uri_CREATE_NO_DECODE_EXTRA_INFO,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5150 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5151 {"google.com",S_OK},
5152 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5153 {"google.com",S_OK},
5154 {"",S_FALSE},
5155 {"#Fr%3C%7C%3Eg",S_OK},
5156 {"google.com",S_OK},
5157 {"",S_FALSE},
5158 {"/",S_OK},
5159 {"/",S_OK},
5160 {"",S_FALSE},
5161 {"http://google.com/#Fr<|>g",S_OK},
5162 {"http",S_OK},
5163 {"",S_FALSE},
5164 {"",S_FALSE}
5167 {Uri_HOST_DNS,S_OK},
5168 {80,S_OK},
5169 {URL_SCHEME_HTTP,S_OK},
5170 {URLZONE_INVALID,E_NOTIMPL}
5173 { "http://google.com/",0,S_OK,FALSE,
5175 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5177 {FALSE},
5178 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,E_INVALIDARG,FALSE,
5179 0,S_OK,FALSE,
5180 Uri_CREATE_CANONICALIZE|Uri_CREATE_NO_CANONICALIZE,UriBuilder_USE_ORIGINAL_FLAGS,0,S_OK,FALSE,
5182 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5183 {"google.com",S_OK},
5184 {"http://google.com/#Fr%3C%7C%3Eg",S_OK},
5185 {"google.com",S_OK},
5186 {"",S_FALSE},
5187 {"#Fr%3C%7C%3Eg",S_OK},
5188 {"google.com",S_OK},
5189 {"",S_FALSE},
5190 {"/",S_OK},
5191 {"/",S_OK},
5192 {"",S_FALSE},
5193 {"http://google.com/#Fr<|>g",S_OK},
5194 {"http",S_OK},
5195 {"",S_FALSE},
5196 {"",S_FALSE}
5199 {Uri_HOST_DNS,S_OK},
5200 {80,S_OK},
5201 {URL_SCHEME_HTTP,S_OK},
5202 {URLZONE_INVALID,E_NOTIMPL}
5205 { NULL,0,S_OK,FALSE,
5207 {TRUE,"/test/test/",NULL,Uri_PROPERTY_PATH,S_OK,FALSE},
5208 {TRUE,"#Fr<|>g",NULL,Uri_PROPERTY_FRAGMENT,S_OK,FALSE}
5210 {FALSE},
5211 0,INET_E_INVALID_URL,FALSE,
5212 0,INET_E_INVALID_URL,FALSE,
5213 0,0,0,INET_E_INVALID_URL,FALSE
5215 { "http://google.com/",0,S_OK,FALSE,
5217 {TRUE,"ht%xxtp",NULL,Uri_PROPERTY_SCHEME_NAME,S_OK,FALSE}
5219 {FALSE},
5220 0,INET_E_INVALID_URL,FALSE,
5221 0,INET_E_INVALID_URL,FALSE,
5222 0,0,0,INET_E_INVALID_URL,FALSE
5224 /* File scheme's can't have a username set. */
5225 { "file://google.com/",0,S_OK,FALSE,
5227 {TRUE,"username",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5229 {FALSE},
5230 0,INET_E_INVALID_URL,FALSE,
5231 0,INET_E_INVALID_URL,FALSE,
5232 0,0,0,INET_E_INVALID_URL,FALSE
5234 /* File schemes can't have a password set. */
5235 { "file://google.com/",0,S_OK,FALSE,
5237 {TRUE,"password",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5239 {FALSE},
5240 0,INET_E_INVALID_URL,FALSE,
5241 0,INET_E_INVALID_URL,FALSE,
5242 0,0,0,INET_E_INVALID_URL,FALSE
5244 /* UserName can't contain any character that is a delimeter for another
5245 * component that appears after it in a normal URI.
5247 { "http://google.com/",0,S_OK,FALSE,
5249 {TRUE,"user:pass",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5251 {FALSE},
5252 0,INET_E_INVALID_URL,FALSE,
5253 0,INET_E_INVALID_URL,FALSE,
5254 0,0,0,INET_E_INVALID_URL,FALSE
5256 { "http://google.com/",0,S_OK,FALSE,
5258 {TRUE,"user@google.com",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5260 {FALSE},
5261 0,INET_E_INVALID_URL,FALSE,
5262 0,INET_E_INVALID_URL,FALSE,
5263 0,0,0,INET_E_INVALID_URL,FALSE
5265 { "http://google.com/",0,S_OK,FALSE,
5267 {TRUE,"user/path",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5269 {FALSE},
5270 0,INET_E_INVALID_URL,FALSE,
5271 0,INET_E_INVALID_URL,FALSE,
5272 0,0,0,INET_E_INVALID_URL,FALSE
5274 { "http://google.com/",0,S_OK,FALSE,
5276 {TRUE,"user?Query",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5278 {FALSE},
5279 0,INET_E_INVALID_URL,FALSE,
5280 0,INET_E_INVALID_URL,FALSE,
5281 0,0,0,INET_E_INVALID_URL,FALSE
5283 { "http://google.com/",0,S_OK,FALSE,
5285 {TRUE,"user#Frag",NULL,Uri_PROPERTY_USER_NAME,S_OK,FALSE}
5287 {FALSE},
5288 0,INET_E_INVALID_URL,FALSE,
5289 0,INET_E_INVALID_URL,FALSE,
5290 0,0,0,INET_E_INVALID_URL,FALSE
5292 { "http://google.com/",0,S_OK,FALSE,
5294 {TRUE,"pass@google.com",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5296 {FALSE},
5297 0,INET_E_INVALID_URL,FALSE,
5298 0,INET_E_INVALID_URL,FALSE,
5299 0,0,0,INET_E_INVALID_URL,FALSE
5301 { "http://google.com/",0,S_OK,FALSE,
5303 {TRUE,"pass/path",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5305 {FALSE},
5306 0,INET_E_INVALID_URL,FALSE,
5307 0,INET_E_INVALID_URL,FALSE,
5308 0,0,0,INET_E_INVALID_URL,FALSE
5310 { "http://google.com/",0,S_OK,FALSE,
5312 {TRUE,"pass?query",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5314 {FALSE},
5315 0,INET_E_INVALID_URL,FALSE,
5316 0,INET_E_INVALID_URL,FALSE,
5317 0,0,0,INET_E_INVALID_URL,FALSE
5319 { "http://google.com/",0,S_OK,FALSE,
5321 {TRUE,"pass#frag",NULL,Uri_PROPERTY_PASSWORD,S_OK,FALSE}
5323 {FALSE},
5324 0,INET_E_INVALID_URL,FALSE,
5325 0,INET_E_INVALID_URL,FALSE,
5326 0,0,0,INET_E_INVALID_URL,FALSE
5328 { "http://google.com/",0,S_OK,FALSE,
5330 {TRUE,"winehq.org/test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5332 {FALSE},
5333 0,INET_E_INVALID_URL,FALSE,
5334 0,INET_E_INVALID_URL,FALSE,
5335 0,0,0,INET_E_INVALID_URL,FALSE
5337 { "http://google.com/",0,S_OK,FALSE,
5339 {TRUE,"winehq.org?test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5341 {FALSE},
5342 0,INET_E_INVALID_URL,FALSE,
5343 0,INET_E_INVALID_URL,FALSE,
5344 0,0,0,INET_E_INVALID_URL,FALSE
5346 { "http://google.com/",0,S_OK,FALSE,
5348 {TRUE,"winehq.org#test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5350 {FALSE},
5351 0,INET_E_INVALID_URL,FALSE,
5352 0,INET_E_INVALID_URL,FALSE,
5353 0,0,0,INET_E_INVALID_URL,FALSE
5355 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5356 { "http://google.com/",0,S_OK,FALSE,
5358 {TRUE,"winehq.org:test",NULL,Uri_PROPERTY_HOST,S_OK,FALSE},
5360 {FALSE},
5361 0,S_OK,FALSE,
5362 0,S_OK,FALSE,
5363 0,0,0,S_OK,FALSE,
5365 {"http://winehq.org:test/",S_OK},
5366 {"winehq.org:test",S_OK},
5367 {"http://winehq.org:test/",S_OK},
5368 {"winehq.org:test",S_OK},
5369 {"",S_FALSE},
5370 {"",S_FALSE},
5371 {"winehq.org:test",S_OK},
5372 {"",S_FALSE},
5373 {"/",S_OK},
5374 {"/",S_OK},
5375 {"",S_FALSE},
5376 {"http://winehq.org:test/",S_OK},
5377 {"http",S_OK},
5378 {"",S_FALSE},
5379 {"",S_FALSE}
5382 {Uri_HOST_DNS,S_OK},
5383 {80,S_OK},
5384 {URL_SCHEME_HTTP,S_OK},
5385 {URLZONE_INVALID,E_NOTIMPL}
5388 /* Can't set the host name to NULL. */
5389 { "http://google.com/",0,S_OK,FALSE,
5391 {TRUE,NULL,"google.com",Uri_PROPERTY_HOST,E_INVALIDARG,FALSE}
5393 {FALSE},
5394 0,S_OK,FALSE,
5395 0,S_OK,FALSE,
5396 0,0,0,S_OK,FALSE,
5398 {"http://google.com/",S_OK},
5399 {"google.com",S_OK},
5400 {"http://google.com/",S_OK},
5401 {"google.com",S_OK},
5402 {"",S_FALSE},
5403 {"",S_FALSE},
5404 {"google.com",S_OK},
5405 {"",S_FALSE},
5406 {"/",S_OK},
5407 {"/",S_OK},
5408 {"",S_FALSE},
5409 {"http://google.com/",S_OK},
5410 {"http",S_OK},
5411 {"",S_FALSE},
5412 {"",S_FALSE}
5415 {Uri_HOST_DNS,S_OK},
5416 {80,S_OK},
5417 {URL_SCHEME_HTTP,S_OK},
5418 {URLZONE_INVALID,E_NOTIMPL}
5421 /* Can set the host name to an empty string. */
5422 { "http://google.com/",0,S_OK,FALSE,
5424 {TRUE,"",NULL,Uri_PROPERTY_HOST,S_OK,FALSE}
5426 {FALSE},
5427 0,S_OK,FALSE,
5428 0,S_OK,FALSE,
5429 0,0,0,S_OK,FALSE,
5431 {"http:///",S_OK},
5432 {"",S_OK},
5433 {"http:///",S_OK},
5434 {"",S_FALSE},
5435 {"",S_FALSE},
5436 {"",S_FALSE},
5437 {"",S_OK},
5438 {"",S_FALSE},
5439 {"/",S_OK},
5440 {"/",S_OK},
5441 {"",S_FALSE},
5442 {"http:///",S_OK},
5443 {"http",S_OK},
5444 {"",S_FALSE},
5445 {"",S_FALSE}
5448 {Uri_HOST_UNKNOWN,S_OK},
5449 {80,S_OK},
5450 {URL_SCHEME_HTTP,S_OK},
5451 {URLZONE_INVALID,E_NOTIMPL}
5454 { "http://google.com/",0,S_OK,FALSE,
5456 {TRUE,"/path?query",NULL,Uri_PROPERTY_PATH,S_OK,FALSE}
5458 {FALSE},
5459 0,INET_E_INVALID_URL,FALSE,
5460 0,INET_E_INVALID_URL,FALSE,
5461 0,0,0,INET_E_INVALID_URL,FALSE
5463 { "http://google.com/",0,S_OK,FALSE,
5465 {TRUE,"/path#test",NULL,Uri_PROPERTY_PATH,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 { "http://google.com/",0,S_OK,FALSE,
5474 {TRUE,"?path#test",NULL,Uri_PROPERTY_QUERY,S_OK,FALSE}
5476 {FALSE},
5477 0,INET_E_INVALID_URL,FALSE,
5478 0,INET_E_INVALID_URL,FALSE,
5479 0,0,0,INET_E_INVALID_URL,FALSE
5483 typedef struct _uri_builder_remove_test {
5484 const char *uri;
5485 DWORD create_flags;
5486 HRESULT create_builder_expected;
5487 BOOL create_builder_todo;
5489 DWORD remove_properties;
5490 HRESULT remove_expected;
5491 BOOL remove_todo;
5493 const char *expected_uri;
5494 DWORD expected_flags;
5495 HRESULT expected_hres;
5496 BOOL expected_todo;
5497 } uri_builder_remove_test;
5499 static const uri_builder_remove_test uri_builder_remove_tests[] = {
5500 { "http://google.com/test?test=y#Frag",0,S_OK,FALSE,
5501 Uri_HAS_FRAGMENT|Uri_HAS_PATH|Uri_HAS_QUERY,S_OK,FALSE,
5502 "http://google.com/",0,S_OK,FALSE
5504 { "http://user:pass@winehq.org/",0,S_OK,FALSE,
5505 Uri_HAS_USER_NAME|Uri_HAS_PASSWORD,S_OK,FALSE,
5506 "http://winehq.org/",0,S_OK,FALSE
5508 { "zip://google.com?Test=x",0,S_OK,FALSE,
5509 Uri_HAS_HOST,S_OK,FALSE,
5510 "zip:/?Test=x",0,S_OK,FALSE
5512 /* Doesn't remove the whole userinfo component. */
5513 { "http://username:pass@google.com/",0,S_OK,FALSE,
5514 Uri_HAS_USER_INFO,S_OK,FALSE,
5515 "http://username:pass@google.com/",0,S_OK,FALSE
5517 /* Doesn't remove the domain. */
5518 { "http://google.com/",0,S_OK,FALSE,
5519 Uri_HAS_DOMAIN,S_OK,FALSE,
5520 "http://google.com/",0,S_OK,FALSE
5522 { "http://google.com:120/",0,S_OK,FALSE,
5523 Uri_HAS_AUTHORITY,S_OK,FALSE,
5524 "http://google.com:120/",0,S_OK,FALSE
5526 { "http://google.com/test.com/",0,S_OK,FALSE,
5527 Uri_HAS_EXTENSION,S_OK,FALSE,
5528 "http://google.com/test.com/",0,S_OK,FALSE
5530 { "http://google.com/?test=x",0,S_OK,FALSE,
5531 Uri_HAS_PATH_AND_QUERY,S_OK,FALSE,
5532 "http://google.com/?test=x",0,S_OK,FALSE
5534 /* Can't remove the scheme name. */
5535 { "http://google.com/?test=x",0,S_OK,FALSE,
5536 Uri_HAS_SCHEME_NAME|Uri_HAS_QUERY,E_INVALIDARG,FALSE,
5537 "http://google.com/?test=x",0,S_OK,FALSE
5541 typedef struct _uri_combine_str_property {
5542 const char *value;
5543 HRESULT expected;
5544 BOOL todo;
5545 const char *broken_value;
5546 const char *value_ex;
5547 } uri_combine_str_property;
5549 typedef struct _uri_combine_test {
5550 const char *base_uri;
5551 DWORD base_create_flags;
5552 const char *relative_uri;
5553 DWORD relative_create_flags;
5554 DWORD combine_flags;
5555 HRESULT expected;
5556 BOOL todo;
5558 uri_combine_str_property str_props[URI_STR_PROPERTY_COUNT];
5559 uri_dword_property dword_props[URI_DWORD_PROPERTY_COUNT];
5560 } uri_combine_test;
5562 static const uri_combine_test uri_combine_tests[] = {
5563 { "http://google.com/fun/stuff",0,
5564 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE,
5565 0,S_OK,FALSE,
5567 {"http://google.com/not/fun/stuff",S_OK},
5568 {"google.com",S_OK},
5569 {"http://google.com/not/fun/stuff",S_OK},
5570 {"google.com",S_OK},
5571 {"",S_FALSE},
5572 {"",S_FALSE},
5573 {"google.com",S_OK},
5574 {"",S_FALSE},
5575 {"/not/fun/stuff",S_OK},
5576 {"/not/fun/stuff",S_OK},
5577 {"",S_FALSE},
5578 {"http://google.com/not/fun/stuff",S_OK},
5579 {"http",S_OK},
5580 {"",S_FALSE},
5581 {"",S_FALSE}
5584 {Uri_HOST_DNS,S_OK},
5585 {80,S_OK},
5586 {URL_SCHEME_HTTP,S_OK},
5587 {URLZONE_INVALID,E_NOTIMPL}
5590 { "http://google.com/test",0,
5591 "zip://test.com/cool",0,
5592 0,S_OK,FALSE,
5594 {"zip://test.com/cool",S_OK},
5595 {"test.com",S_OK},
5596 {"zip://test.com/cool",S_OK},
5597 {"test.com",S_OK},
5598 {"",S_FALSE},
5599 {"",S_FALSE},
5600 {"test.com",S_OK},
5601 {"",S_FALSE},
5602 {"/cool",S_OK},
5603 {"/cool",S_OK},
5604 {"",S_FALSE},
5605 {"zip://test.com/cool",S_OK},
5606 {"zip",S_OK},
5607 {"",S_FALSE},
5608 {"",S_FALSE}
5611 {Uri_HOST_DNS,S_OK},
5612 {0,S_FALSE},
5613 {URL_SCHEME_UNKNOWN,S_OK},
5614 {URLZONE_INVALID,E_NOTIMPL}
5617 { "http://google.com/use/base/path",0,
5618 "?relative",Uri_CREATE_ALLOW_RELATIVE,
5619 0,S_OK,FALSE,
5621 {"http://google.com/use/base/path?relative",S_OK},
5622 {"google.com",S_OK},
5623 {"http://google.com/use/base/path?relative",S_OK},
5624 {"google.com",S_OK},
5625 {"",S_FALSE},
5626 {"",S_FALSE},
5627 {"google.com",S_OK},
5628 {"",S_FALSE},
5629 {"/use/base/path",S_OK},
5630 {"/use/base/path?relative",S_OK},
5631 {"?relative",S_OK},
5632 {"http://google.com/use/base/path?relative",S_OK},
5633 {"http",S_OK},
5634 {"",S_FALSE},
5635 {"",S_FALSE}
5638 {Uri_HOST_DNS,S_OK},
5639 {80,S_OK},
5640 {URL_SCHEME_HTTP,S_OK},
5641 {URLZONE_INVALID,E_NOTIMPL}
5644 { "http://google.com/path",0,
5645 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5646 0,S_OK,FALSE,
5648 {"http://google.com/testing",S_OK},
5649 {"google.com",S_OK},
5650 {"http://google.com/testing",S_OK},
5651 {"google.com",S_OK},
5652 {"",S_FALSE},
5653 {"",S_FALSE},
5654 {"google.com",S_OK},
5655 {"",S_FALSE},
5656 {"/testing",S_OK},
5657 {"/testing",S_OK},
5658 {"",S_FALSE},
5659 {"http://google.com/testing",S_OK},
5660 {"http",S_OK},
5661 {"",S_FALSE},
5662 {"",S_FALSE}
5665 {Uri_HOST_DNS,S_OK},
5666 {80,S_OK},
5667 {URL_SCHEME_HTTP,S_OK},
5668 {URLZONE_INVALID,E_NOTIMPL}
5671 { "http://google.com/path",0,
5672 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE,
5673 URL_DONT_SIMPLIFY,S_OK,FALSE,
5675 {"http://google.com:80/test/../test/.././testing",S_OK},
5676 {"google.com",S_OK},
5677 {"http://google.com:80/test/../test/.././testing",S_OK},
5678 {"google.com",S_OK},
5679 {"",S_FALSE},
5680 {"",S_FALSE},
5681 {"google.com",S_OK},
5682 {"",S_FALSE},
5683 {"/test/../test/.././testing",S_OK},
5684 {"/test/../test/.././testing",S_OK},
5685 {"",S_FALSE},
5686 {"http://google.com:80/test/../test/.././testing",S_OK},
5687 {"http",S_OK},
5688 {"",S_FALSE},
5689 {"",S_FALSE}
5692 {Uri_HOST_DNS,S_OK},
5693 {80,S_OK},
5694 {URL_SCHEME_HTTP,S_OK},
5695 {URLZONE_INVALID,E_NOTIMPL}
5698 { "http://winehq.org/test/abc",0,
5699 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5700 0,S_OK,FALSE,
5702 {"http://winehq.org/test/testing/test",S_OK},
5703 {"winehq.org",S_OK},
5704 {"http://winehq.org/test/testing/test",S_OK},
5705 {"winehq.org",S_OK},
5706 {"",S_FALSE},
5707 {"",S_FALSE},
5708 {"winehq.org",S_OK},
5709 {"",S_FALSE},
5710 {"/test/testing/test",S_OK},
5711 {"/test/testing/test",S_OK},
5712 {"",S_FALSE},
5713 {"http://winehq.org/test/testing/test",S_OK},
5714 {"http",S_OK},
5715 {"",S_FALSE},
5716 {"",S_FALSE}
5719 {Uri_HOST_DNS,S_OK},
5720 {80,S_OK},
5721 {URL_SCHEME_HTTP,S_OK},
5722 {URLZONE_INVALID,E_NOTIMPL}
5725 { "http://winehq.org/test/abc",0,
5726 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE,
5727 URL_DONT_SIMPLIFY,S_OK,FALSE,
5729 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5730 /* Default port is hidden in the authority. */
5731 {"winehq.org",S_OK},
5732 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5733 {"winehq.org",S_OK},
5734 {"",S_FALSE},
5735 {"",S_FALSE},
5736 {"winehq.org",S_OK},
5737 {"",S_FALSE},
5738 {"/test/testing/abc/../test",S_OK},
5739 {"/test/testing/abc/../test",S_OK},
5740 {"",S_FALSE},
5741 {"http://winehq.org:80/test/testing/abc/../test",S_OK},
5742 {"http",S_OK},
5743 {"",S_FALSE},
5744 {"",S_FALSE}
5747 {Uri_HOST_DNS,S_OK},
5748 {80,S_OK},
5749 {URL_SCHEME_HTTP,S_OK},
5750 {URLZONE_INVALID,E_NOTIMPL}
5753 { "http://winehq.org/test?query",0,
5754 "testing",Uri_CREATE_ALLOW_RELATIVE,
5755 0,S_OK,FALSE,
5757 {"http://winehq.org/testing",S_OK},
5758 {"winehq.org",S_OK},
5759 {"http://winehq.org/testing",S_OK},
5760 {"winehq.org",S_OK},
5761 {"",S_FALSE},
5762 {"",S_FALSE},
5763 {"winehq.org",S_OK},
5764 {"",S_FALSE},
5765 {"/testing",S_OK},
5766 {"/testing",S_OK},
5767 {"",S_FALSE},
5768 {"http://winehq.org/testing",S_OK},
5769 {"http",S_OK},
5770 {"",S_FALSE},
5771 {"",S_FALSE}
5774 {Uri_HOST_DNS,S_OK},
5775 {80,S_OK},
5776 {URL_SCHEME_HTTP,S_OK},
5777 {URLZONE_INVALID,E_NOTIMPL}
5780 { "http://winehq.org/test#frag",0,
5781 "testing",Uri_CREATE_ALLOW_RELATIVE,
5782 0,S_OK,FALSE,
5784 {"http://winehq.org/testing",S_OK},
5785 {"winehq.org",S_OK},
5786 {"http://winehq.org/testing",S_OK},
5787 {"winehq.org",S_OK},
5788 {"",S_FALSE},
5789 {"",S_FALSE},
5790 {"winehq.org",S_OK},
5791 {"",S_FALSE},
5792 {"/testing",S_OK},
5793 {"/testing",S_OK},
5794 {"",S_FALSE},
5795 {"http://winehq.org/testing",S_OK},
5796 {"http",S_OK},
5797 {"",S_FALSE},
5798 {"",S_FALSE}
5801 {Uri_HOST_DNS,S_OK},
5802 {80,S_OK},
5803 {URL_SCHEME_HTTP,S_OK},
5804 {URLZONE_INVALID,E_NOTIMPL}
5807 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE,
5808 "test",Uri_CREATE_ALLOW_RELATIVE,
5809 0,S_OK,FALSE,
5811 {"test",S_OK},
5812 {"",S_FALSE},
5813 {"test",S_OK},
5814 {"",S_FALSE},
5815 {"",S_FALSE},
5816 {"",S_FALSE},
5817 {"",S_FALSE},
5818 {"",S_FALSE},
5819 {"test",S_OK},
5820 {"test",S_OK},
5821 {"",S_FALSE},
5822 {"test",S_OK},
5823 {"",S_FALSE},
5824 {"",S_FALSE},
5825 {"",S_FALSE}
5828 {Uri_HOST_UNKNOWN,S_OK},
5829 {0,S_FALSE},
5830 {URL_SCHEME_UNKNOWN,S_OK},
5831 {URLZONE_INVALID,E_NOTIMPL}
5834 { "file:///c:/test/test",0,
5835 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5836 URL_FILE_USE_PATHURL,S_OK,FALSE,
5838 {"file://c:\\testing.mp3",S_OK},
5839 {"",S_FALSE},
5840 {"file://c:\\testing.mp3",S_OK},
5841 {"",S_FALSE},
5842 {".mp3",S_OK},
5843 {"",S_FALSE},
5844 {"",S_FALSE},
5845 {"",S_FALSE},
5846 {"c:\\testing.mp3",S_OK},
5847 {"c:\\testing.mp3",S_OK},
5848 {"",S_FALSE},
5849 {"file://c:\\testing.mp3",S_OK},
5850 {"file",S_OK},
5851 {"",S_FALSE},
5852 {"",S_FALSE}
5855 {Uri_HOST_UNKNOWN,S_OK},
5856 {0,S_FALSE},
5857 {URL_SCHEME_FILE,S_OK},
5858 {URLZONE_INVALID,E_NOTIMPL}
5861 { "file:///c:/test/test",0,
5862 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5863 0,S_OK,FALSE,
5865 {"file:///c:/testing.mp3",S_OK},
5866 {"",S_FALSE},
5867 {"file:///c:/testing.mp3",S_OK},
5868 {"",S_FALSE},
5869 {".mp3",S_OK},
5870 {"",S_FALSE},
5871 {"",S_FALSE},
5872 {"",S_FALSE},
5873 {"/c:/testing.mp3",S_OK},
5874 {"/c:/testing.mp3",S_OK},
5875 {"",S_FALSE},
5876 {"file:///c:/testing.mp3",S_OK},
5877 {"file",S_OK},
5878 {"",S_FALSE},
5879 {"",S_FALSE}
5882 {Uri_HOST_UNKNOWN,S_OK},
5883 {0,S_FALSE},
5884 {URL_SCHEME_FILE,S_OK},
5885 {URLZONE_INVALID,E_NOTIMPL}
5888 { "file://test.com/test/test",0,
5889 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE,
5890 URL_FILE_USE_PATHURL,S_OK,FALSE,
5892 {"file://\\\\test.com\\testing.mp3",S_OK},
5893 {"test.com",S_OK},
5894 {"file://\\\\test.com\\testing.mp3",S_OK},
5895 {"test.com",S_OK},
5896 {".mp3",S_OK},
5897 {"",S_FALSE},
5898 {"test.com",S_OK},
5899 {"",S_FALSE},
5900 {"\\testing.mp3",S_OK},
5901 {"\\testing.mp3",S_OK},
5902 {"",S_FALSE},
5903 {"file://\\\\test.com\\testing.mp3",S_OK},
5904 {"file",S_OK},
5905 {"",S_FALSE},
5906 {"",S_FALSE}
5909 {Uri_HOST_DNS,S_OK},
5910 {0,S_FALSE},
5911 {URL_SCHEME_FILE,S_OK},
5912 {URLZONE_INVALID,E_NOTIMPL}
5915 /* URL_DONT_SIMPLIFY has no effect. */
5916 { "http://google.com/test",0,
5917 "zip://test.com/cool/../cool/test",0,
5918 URL_DONT_SIMPLIFY,S_OK,FALSE,
5920 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5921 {"test.com",S_OK},
5922 {"zip://test.com/cool/test",S_OK,FALSE,NULL,"zip://test.com/cool/../cool/test"},
5923 {"test.com",S_OK},
5924 {"",S_FALSE},
5925 {"",S_FALSE},
5926 {"test.com",S_OK},
5927 {"",S_FALSE},
5928 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5929 {"/cool/test",S_OK,FALSE,NULL,"/cool/../cool/test"},
5930 {"",S_FALSE},
5931 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
5932 * On IE 7 it reduces the path in the Raw URI.
5934 {"zip://test.com/cool/../cool/test",S_OK,FALSE,"zip://test.com/cool/test"},
5935 {"zip",S_OK},
5936 {"",S_FALSE},
5937 {"",S_FALSE}
5940 {Uri_HOST_DNS,S_OK},
5941 {0,S_FALSE},
5942 {URL_SCHEME_UNKNOWN,S_OK},
5943 {URLZONE_INVALID,E_NOTIMPL}
5946 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
5947 * resulting URI is converted into a dos path.
5949 { "http://google.com/test",0,
5950 "file:///c:/test/",0,
5951 URL_FILE_USE_PATHURL,S_OK,FALSE,
5953 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5954 {"",S_FALSE},
5955 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5956 {"",S_FALSE},
5957 {"",S_FALSE},
5958 {"",S_FALSE},
5959 {"",S_FALSE},
5960 {"",S_FALSE},
5961 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5962 {"/c:/test/",S_OK,FALSE,"c:\\test\\"},
5963 {"",S_FALSE},
5964 {"file:///c:/test/",S_OK,FALSE,"file://c:\\test\\"},
5965 {"file",S_OK},
5966 {"",S_FALSE},
5967 {"",S_FALSE}
5970 {Uri_HOST_UNKNOWN,S_OK},
5971 {0,S_FALSE},
5972 {URL_SCHEME_FILE,S_OK},
5973 {URLZONE_INVALID,E_NOTIMPL}
5976 { "http://google.com/test",0,
5977 "http://test.com/test#%30test",0,
5978 URL_DONT_UNESCAPE_EXTRA_INFO,S_OK,FALSE,
5980 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5981 {"test.com",S_OK},
5982 {"http://test.com/test#0test",S_OK,FALSE,NULL,"http://test.com/test#%30test"},
5983 {"test.com",S_OK},
5984 {"",S_FALSE},
5985 {"#0test",S_OK,FALSE,NULL,"#%30test"},
5986 {"test.com",S_OK},
5987 {"",S_FALSE},
5988 {"/test",S_OK},
5989 {"/test",S_OK},
5990 {"",S_FALSE},
5991 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
5992 {"http://test.com/test#%30test",S_OK,FALSE,"http://test.com/test#0test"},
5993 {"http",S_OK},
5994 {"",S_FALSE},
5995 {"",S_FALSE}
5998 {Uri_HOST_DNS,S_OK},
5999 {80,S_OK},
6000 {URL_SCHEME_HTTP,S_OK},
6001 {URLZONE_INVALID,E_NOTIMPL}
6004 /* Windows validates the path component from the relative Uri. */
6005 { "http://google.com/test",0,
6006 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE,
6007 0,E_INVALIDARG,FALSE
6009 /* Windows doesn't validate the query from the relative Uri. */
6010 { "http://google.com/test",0,
6011 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6012 0,S_OK,FALSE,
6014 {"http://google.com/test?Tes%XXt",S_OK},
6015 {"google.com",S_OK},
6016 {"http://google.com/test?Tes%XXt",S_OK},
6017 {"google.com",S_OK},
6018 {"",S_FALSE},
6019 {"",S_FALSE},
6020 {"google.com",S_OK},
6021 {"",S_FALSE},
6022 {"/test",S_OK},
6023 {"/test?Tes%XXt",S_OK},
6024 {"?Tes%XXt",S_OK},
6025 {"http://google.com/test?Tes%XXt",S_OK},
6026 {"http",S_OK},
6027 {"",S_FALSE},
6028 {"",S_FALSE}
6031 {Uri_HOST_DNS,S_OK},
6032 {80,S_OK},
6033 {URL_SCHEME_HTTP,S_OK},
6034 {URLZONE_INVALID,E_NOTIMPL}
6037 /* Windows doesn't validate the fragment from the relative Uri. */
6038 { "http://google.com/test",0,
6039 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE,
6040 0,S_OK,FALSE,
6042 {"http://google.com/test#Tes%XXt",S_OK},
6043 {"google.com",S_OK},
6044 {"http://google.com/test#Tes%XXt",S_OK},
6045 {"google.com",S_OK},
6046 {"",S_FALSE},
6047 {"#Tes%XXt",S_OK},
6048 {"google.com",S_OK},
6049 {"",S_FALSE},
6050 {"/test",S_OK},
6051 {"/test",S_OK},
6052 {"",S_FALSE},
6053 {"http://google.com/test#Tes%XXt",S_OK},
6054 {"http",S_OK},
6055 {"",S_FALSE},
6056 {"",S_FALSE}
6059 {Uri_HOST_DNS,S_OK},
6060 {80,S_OK},
6061 {URL_SCHEME_HTTP,S_OK},
6062 {URLZONE_INVALID,E_NOTIMPL}
6065 /* Creates an IUri which contains an invalid dos path char. */
6066 { "file:///c:/test",0,
6067 "/test<ing",Uri_CREATE_ALLOW_RELATIVE,
6068 URL_FILE_USE_PATHURL,S_OK,FALSE,
6070 {"file://c:\\test<ing",S_OK},
6071 {"",S_FALSE},
6072 {"file://c:\\test<ing",S_OK},
6073 {"",S_FALSE},
6074 {"",S_FALSE},
6075 {"",S_FALSE},
6076 {"",S_FALSE},
6077 {"",S_FALSE},
6078 {"c:\\test<ing",S_OK},
6079 {"c:\\test<ing",S_OK},
6080 {"",S_FALSE},
6081 {"file://c:\\test<ing",S_OK},
6082 {"file",S_OK},
6083 {"",S_FALSE},
6084 {"",S_FALSE}
6087 {Uri_HOST_UNKNOWN,S_OK},
6088 {0,S_FALSE},
6089 {URL_SCHEME_FILE,S_OK},
6090 {URLZONE_INVALID,E_NOTIMPL}
6093 /* Appends the path after the drive letter (if any). */
6094 { "file:///c:/test",0,
6095 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE,
6096 0,S_OK,FALSE,
6098 {"file:///c:/c:/testing",S_OK},
6099 {"",S_FALSE},
6100 {"file:///c:/c:/testing",S_OK},
6101 {"",S_FALSE},
6102 {"",S_FALSE},
6103 {"",S_FALSE},
6104 {"",S_FALSE},
6105 {"",S_FALSE},
6106 {"/c:/c:/testing",S_OK},
6107 {"/c:/c:/testing",S_OK},
6108 {"",S_FALSE},
6109 {"file:///c:/c:/testing",S_OK},
6110 {"file",S_OK},
6111 {"",S_FALSE},
6112 {"",S_FALSE}
6115 {Uri_HOST_UNKNOWN,S_OK},
6116 {0,S_FALSE},
6117 {URL_SCHEME_FILE,S_OK},
6118 {URLZONE_INVALID,E_NOTIMPL}
6121 /* A '/' is added if the base URI doesn't have a path and the
6122 * relative URI doesn't contain a path (since the base URI is
6123 * hierarchical.
6125 { "http://google.com",Uri_CREATE_NO_CANONICALIZE,
6126 "?test",Uri_CREATE_ALLOW_RELATIVE,
6127 0,S_OK,FALSE,
6129 {"http://google.com/?test",S_OK},
6130 {"google.com",S_OK},
6131 {"http://google.com/?test",S_OK},
6132 {"google.com",S_OK},
6133 {"",S_FALSE},
6134 {"",S_FALSE},
6135 {"google.com",S_OK},
6136 {"",S_FALSE},
6137 {"/",S_OK},
6138 {"/?test",S_OK},
6139 {"?test",S_OK},
6140 {"http://google.com/?test",S_OK},
6141 {"http",S_OK},
6142 {"",S_FALSE},
6143 {"",S_FALSE}
6146 {Uri_HOST_DNS,S_OK},
6147 {80,S_OK},
6148 {URL_SCHEME_HTTP,S_OK},
6149 {URLZONE_INVALID,E_NOTIMPL}
6152 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE,
6153 "?test",Uri_CREATE_ALLOW_RELATIVE,
6154 0,S_OK,FALSE,
6156 {"zip://google.com/?test",S_OK},
6157 {"google.com",S_OK},
6158 {"zip://google.com/?test",S_OK},
6159 {"google.com",S_OK},
6160 {"",S_FALSE},
6161 {"",S_FALSE},
6162 {"google.com",S_OK},
6163 {"",S_FALSE},
6164 {"/",S_OK},
6165 {"/?test",S_OK},
6166 {"?test",S_OK},
6167 {"zip://google.com/?test",S_OK},
6168 {"zip",S_OK},
6169 {"",S_FALSE},
6170 {"",S_FALSE}
6173 {Uri_HOST_DNS,S_OK},
6174 {0,S_FALSE},
6175 {URL_SCHEME_UNKNOWN,S_OK},
6176 {URLZONE_INVALID,E_NOTIMPL}
6179 /* No path is appended since the base URI is opaque. */
6180 { "zip:?testing",0,
6181 "?test",Uri_CREATE_ALLOW_RELATIVE,
6182 0,S_OK,FALSE,
6184 {"zip:?test",S_OK},
6185 {"",S_FALSE},
6186 {"zip:?test",S_OK},
6187 {"",S_FALSE},
6188 {"",S_FALSE},
6189 {"",S_FALSE},
6190 {"",S_FALSE},
6191 {"",S_FALSE},
6192 {"",S_OK},
6193 {"?test",S_OK},
6194 {"?test",S_OK},
6195 {"zip:?test",S_OK},
6196 {"zip",S_OK},
6197 {"",S_FALSE},
6198 {"",S_FALSE}
6201 {Uri_HOST_UNKNOWN,S_OK},
6202 {0,S_FALSE},
6203 {URL_SCHEME_UNKNOWN,S_OK},
6204 {URLZONE_INVALID,E_NOTIMPL}
6207 { "file:///c:/",0,
6208 "../testing/test",Uri_CREATE_ALLOW_RELATIVE,
6209 0,S_OK,FALSE,
6211 {"file:///c:/testing/test",S_OK},
6212 {"",S_FALSE},
6213 {"file:///c:/testing/test",S_OK},
6214 {"",S_FALSE},
6215 {"",S_FALSE},
6216 {"",S_FALSE},
6217 {"",S_FALSE},
6218 {"",S_FALSE},
6219 {"/c:/testing/test",S_OK},
6220 {"/c:/testing/test",S_OK},
6221 {"",S_FALSE},
6222 {"file:///c:/testing/test",S_OK},
6223 {"file",S_OK},
6224 {"",S_FALSE},
6225 {"",S_FALSE}
6228 {Uri_HOST_UNKNOWN,S_OK},
6229 {0,S_FALSE},
6230 {URL_SCHEME_FILE,S_OK},
6231 {URLZONE_INVALID,E_NOTIMPL}
6234 { "http://winehq.org/dir/testfile",0,
6235 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6236 0,S_OK,FALSE,
6238 {"http://winehq.org/dir/test?querystring",S_OK},
6239 {"winehq.org",S_OK},
6240 {"http://winehq.org/dir/test?querystring",S_OK},
6241 {"winehq.org",S_OK},
6242 {"",S_FALSE},
6243 {"",S_FALSE},
6244 {"winehq.org",S_OK},
6245 {"",S_FALSE},
6246 {"/dir/test",S_OK},
6247 {"/dir/test?querystring",S_OK},
6248 {"?querystring",S_OK},
6249 {"http://winehq.org/dir/test?querystring",S_OK},
6250 {"http",S_OK},
6251 {"",S_FALSE},
6252 {"",S_FALSE}
6255 {Uri_HOST_DNS,S_OK},
6256 {80,S_OK},
6257 {URL_SCHEME_HTTP,S_OK},
6258 {URLZONE_INVALID,E_NOTIMPL}
6261 { "http://winehq.org/dir/test",0,
6262 "test?querystring",Uri_CREATE_ALLOW_RELATIVE,
6263 0,S_OK,FALSE,
6265 {"http://winehq.org/dir/test?querystring",S_OK},
6266 {"winehq.org",S_OK},
6267 {"http://winehq.org/dir/test?querystring",S_OK},
6268 {"winehq.org",S_OK},
6269 {"",S_FALSE},
6270 {"",S_FALSE},
6271 {"winehq.org",S_OK},
6272 {"",S_FALSE},
6273 {"/dir/test",S_OK},
6274 {"/dir/test?querystring",S_OK},
6275 {"?querystring",S_OK},
6276 {"http://winehq.org/dir/test?querystring",S_OK},
6277 {"http",S_OK},
6278 {"",S_FALSE},
6279 {"",S_FALSE}
6282 {Uri_HOST_DNS,S_OK},
6283 {80,S_OK},
6284 {URL_SCHEME_HTTP,S_OK},
6285 {URLZONE_INVALID,E_NOTIMPL}
6288 { "http://winehq.org/dir/test?querystring",0,
6289 "#hash",Uri_CREATE_ALLOW_RELATIVE,
6290 0,S_OK,FALSE,
6292 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6293 {"winehq.org",S_OK},
6294 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6295 {"winehq.org",S_OK},
6296 {"",S_FALSE},
6297 {"#hash",S_OK},
6298 {"winehq.org",S_OK},
6299 {"",S_FALSE},
6300 {"/dir/test",S_OK},
6301 {"/dir/test?querystring",S_OK},
6302 {"?querystring",S_OK},
6303 {"http://winehq.org/dir/test?querystring#hash",S_OK},
6304 {"http",S_OK},
6305 {"",S_FALSE},
6306 {"",S_FALSE}
6309 {Uri_HOST_DNS,S_OK},
6310 {80,S_OK},
6311 {URL_SCHEME_HTTP,S_OK},
6312 {URLZONE_INVALID,E_NOTIMPL}
6317 typedef struct _uri_parse_test {
6318 const char *uri;
6319 DWORD uri_flags;
6320 PARSEACTION action;
6321 DWORD flags;
6322 const char *property;
6323 HRESULT expected;
6324 BOOL todo;
6325 } uri_parse_test;
6327 static const uri_parse_test uri_parse_tests[] = {
6328 /* PARSE_CANONICALIZE tests. */
6329 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE,0,"zip://google.com/test<|>",S_OK,FALSE},
6330 {"http://google.com/test<|>",0,PARSE_CANONICALIZE,0,"http://google.com/test%3C%7C%3E",S_OK,FALSE},
6331 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE,URL_UNESCAPE,"http://google.com/0#?",S_OK,FALSE},
6332 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_UNSAFE,"test %3C%7C%3E",S_OK,FALSE},
6333 {"test <|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_ESCAPE_SPACES_ONLY,"test%20<|>",S_OK,FALSE},
6334 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE,PARSE_CANONICALIZE,URL_UNESCAPE|URL_ESCAPE_UNSAFE,"test%20%3C%7C%3E",S_OK,FALSE},
6335 {"http://google.com/%20",0,PARSE_CANONICALIZE,URL_ESCAPE_PERCENT,"http://google.com/%2520",S_OK,FALSE},
6336 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"http://google.com/test/../",S_OK,FALSE},
6337 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_NO_META,"http://google.com/test/../",S_OK,FALSE},
6338 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"http://google.com/",S_OK,FALSE},
6339 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,0,"zip://google.com/",S_OK,FALSE},
6340 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE,PARSE_CANONICALIZE,URL_DONT_SIMPLIFY,"file:///c:/test/../test",S_OK,FALSE},
6342 /* PARSE_FRIENDLY tests. */
6343 {"http://test@google.com/test#test",0,PARSE_FRIENDLY,0,"http://google.com/test#test",S_OK,FALSE},
6344 {"zip://test@google.com/test",0,PARSE_FRIENDLY,0,"zip://test@google.com/test",S_OK,FALSE},
6346 /* PARSE_ROOTDOCUMENT tests. */
6347 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT,0,"http://google.com:200/",S_OK,FALSE},
6348 {"http://google.com",Uri_CREATE_NO_CANONICALIZE,PARSE_ROOTDOCUMENT,0,"http://google.com/",S_OK,FALSE},
6349 {"zip://google.com/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6350 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6351 {"file://server/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6352 {"zip:test/test",0,PARSE_ROOTDOCUMENT,0,"",S_OK,FALSE},
6354 /* PARSE_DOCUMENT tests. */
6355 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT,0,"http://test@google.com/test?query",S_OK,FALSE},
6356 {"http:testing#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6357 {"file:///c:/test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6358 {"zip://google.com/#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6359 {"zip:test#frag",0,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6360 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOCUMENT,0,"",S_OK,FALSE},
6362 /* PARSE_PATH_FROM_URL tests. */
6363 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\test.mp3",S_OK,FALSE},
6364 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL,0,"c:\\t<|>est.mp3",S_OK,FALSE},
6365 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL,0,"c:\\te%XX t\\",S_OK,FALSE},
6366 {"file://server/test",0,PARSE_PATH_FROM_URL,0,"\\\\server\\test",S_OK,FALSE},
6367 {"http://google.com/",0,PARSE_PATH_FROM_URL,0,"",E_INVALIDARG,FALSE},
6369 /* PARSE_URL_FROM_PATH tests. */
6370 /* This function almost seems to useless (just returns the absolute uri). */
6371 {"test.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"test.com",S_OK,FALSE},
6372 {"/test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_URL_FROM_PATH,0,"/test/test",S_OK,FALSE},
6373 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH,PARSE_URL_FROM_PATH,0,"file://c:\\test\\test",S_OK,FALSE},
6374 {"file:c:/test",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6375 {"http:google.com/",0,PARSE_URL_FROM_PATH,0,"",S_OK,FALSE},
6377 /* PARSE_SCHEMA tests. */
6378 {"http://google.com/test",0,PARSE_SCHEMA,0,"http",S_OK,FALSE},
6379 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_SCHEMA,0,"",S_OK,FALSE},
6381 /* PARSE_SITE tests. */
6382 {"http://google.uk.com/",0,PARSE_SITE,0,"google.uk.com",S_OK,FALSE},
6383 {"http://google.com.com/",0,PARSE_SITE,0,"google.com.com",S_OK,FALSE},
6384 {"google.com",Uri_CREATE_ALLOW_RELATIVE,PARSE_SITE,0,"",S_OK,FALSE},
6385 {"file://server/test",0,PARSE_SITE,0,"server",S_OK,FALSE},
6387 /* PARSE_DOMAIN tests. */
6388 {"http://google.com.uk/",0,PARSE_DOMAIN,0,"google.com.uk",S_OK,FALSE},
6389 {"http://google.com.com/",0,PARSE_DOMAIN,0,"com.com",S_OK,FALSE},
6390 {"test/test",Uri_CREATE_ALLOW_RELATIVE,PARSE_DOMAIN,0,"",S_OK,FALSE},
6391 {"file://server/test",0,PARSE_DOMAIN,0,"",S_OK,FALSE},
6393 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6394 {"http://google.com/test#Test",0,PARSE_ANCHOR,0,"#Test",S_OK,FALSE},
6395 {"http://google.com/test#Test",0,PARSE_LOCATION,0,"#Test",S_OK,FALSE},
6396 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_ANCHOR,0,"",S_OK,FALSE},
6397 {"test",Uri_CREATE_ALLOW_RELATIVE,PARSE_LOCATION,0,"",S_OK,FALSE}
6400 static inline LPWSTR a2w(LPCSTR str) {
6401 LPWSTR ret = NULL;
6403 if(str) {
6404 DWORD len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
6405 ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
6406 MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
6409 return ret;
6412 static inline BOOL heap_free(void* mem) {
6413 return HeapFree(GetProcessHeap(), 0, mem);
6416 static inline DWORD strcmp_aw(LPCSTR strA, LPCWSTR strB) {
6417 LPWSTR strAW = a2w(strA);
6418 DWORD ret = lstrcmpW(strAW, strB);
6419 heap_free(strAW);
6420 return ret;
6423 static inline ULONG get_refcnt(IUri *uri) {
6424 IUri_AddRef(uri);
6425 return IUri_Release(uri);
6428 static void change_property(IUriBuilder *builder, const uri_builder_property *prop,
6429 DWORD test_index) {
6430 HRESULT hr;
6431 LPWSTR valueW;
6433 valueW = a2w(prop->value);
6434 switch(prop->property) {
6435 case Uri_PROPERTY_FRAGMENT:
6436 hr = IUriBuilder_SetFragment(builder, valueW);
6437 if(prop->todo) {
6438 todo_wine {
6439 ok(hr == prop->expected,
6440 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6441 hr, prop->expected, test_index);
6443 } else {
6444 ok(hr == prop->expected,
6445 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6446 hr, prop->expected, test_index);
6448 break;
6449 case Uri_PROPERTY_HOST:
6450 hr = IUriBuilder_SetHost(builder, valueW);
6451 if(prop->todo) {
6452 todo_wine {
6453 ok(hr == prop->expected,
6454 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6455 hr, prop->expected, test_index);
6457 } else {
6458 ok(hr == prop->expected,
6459 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6460 hr, prop->expected, test_index);
6462 break;
6463 case Uri_PROPERTY_PASSWORD:
6464 hr = IUriBuilder_SetPassword(builder, valueW);
6465 if(prop->todo) {
6466 todo_wine {
6467 ok(hr == prop->expected,
6468 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6469 hr, prop->expected, test_index);
6471 } else {
6472 ok(hr == prop->expected,
6473 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6474 hr, prop->expected, test_index);
6476 break;
6477 case Uri_PROPERTY_PATH:
6478 hr = IUriBuilder_SetPath(builder, valueW);
6479 if(prop->todo) {
6480 todo_wine {
6481 ok(hr == prop->expected,
6482 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6483 hr, prop->expected, test_index);
6485 } else {
6486 ok(hr == prop->expected,
6487 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6488 hr, prop->expected, test_index);
6490 break;
6491 case Uri_PROPERTY_QUERY:
6492 hr = IUriBuilder_SetQuery(builder, valueW);
6493 if(prop->todo) {
6494 todo_wine {
6495 ok(hr == prop->expected,
6496 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6497 hr, prop->expected, test_index);
6499 } else {
6500 ok(hr == prop->expected,
6501 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6502 hr, prop->expected, test_index);
6504 break;
6505 case Uri_PROPERTY_SCHEME_NAME:
6506 hr = IUriBuilder_SetSchemeName(builder, valueW);
6507 if(prop->todo) {
6508 todo_wine {
6509 ok(hr == prop->expected,
6510 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6511 hr, prop->expected, test_index);
6513 } else {
6514 ok(hr == prop->expected,
6515 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6516 hr, prop->expected, test_index);
6518 break;
6519 case Uri_PROPERTY_USER_NAME:
6520 hr = IUriBuilder_SetUserName(builder, valueW);
6521 if(prop->todo) {
6522 todo_wine {
6523 ok(hr == prop->expected,
6524 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6525 hr, prop->expected, test_index);
6527 } else {
6528 ok(hr == prop->expected,
6529 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6530 hr, prop->expected, test_index);
6532 break;
6533 default:
6534 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop->property, test_index);
6537 heap_free(valueW);
6541 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6542 * correctly.
6544 static void test_CreateUri_InvalidFlags(void) {
6545 DWORD i;
6547 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
6548 HRESULT hr;
6549 IUri *uri = (void*) 0xdeadbeef;
6551 hr = pCreateUri(http_urlW, invalid_flag_tests[i].flags, 0, &uri);
6552 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6553 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
6554 ok(uri == NULL, "Error: expected the IUri to be NULL, but it was %p instead\n", uri);
6558 static void test_CreateUri_InvalidArgs(void) {
6559 HRESULT hr;
6560 IUri *uri = (void*) 0xdeadbeef;
6562 const WCHAR invalidW[] = {'i','n','v','a','l','i','d',0};
6563 static const WCHAR emptyW[] = {0};
6565 hr = pCreateUri(http_urlW, 0, 0, NULL);
6566 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6568 hr = pCreateUri(NULL, 0, 0, &uri);
6569 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr, E_INVALIDARG);
6570 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6572 uri = (void*) 0xdeadbeef;
6573 hr = pCreateUri(invalidW, 0, 0, &uri);
6574 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6575 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6577 uri = (void*) 0xdeadbeef;
6578 hr = pCreateUri(emptyW, 0, 0, &uri);
6579 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6580 ok(uri == NULL, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri);
6583 static void test_CreateUri_InvalidUri(void) {
6584 DWORD i;
6586 for(i = 0; i < sizeof(invalid_uri_tests)/sizeof(invalid_uri_tests[0]); ++i) {
6587 invalid_uri test = invalid_uri_tests[i];
6588 IUri *uri = NULL;
6589 LPWSTR uriW;
6590 HRESULT hr;
6592 uriW = a2w(test.uri);
6593 hr = pCreateUri(uriW, test.flags, 0, &uri);
6594 if(test.todo) {
6595 todo_wine {
6596 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6597 hr, E_INVALIDARG, i);
6599 } else {
6600 ok(hr == E_INVALIDARG, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6601 hr, E_INVALIDARG, i);
6603 if(uri) IUri_Release(uri);
6605 heap_free(uriW);
6609 static void test_IUri_GetPropertyBSTR(void) {
6610 IUri *uri = NULL;
6611 HRESULT hr;
6612 DWORD i;
6614 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6615 hr = pCreateUri(http_urlW, 0, 0, &uri);
6616 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6617 if(SUCCEEDED(hr)) {
6618 BSTR received = NULL;
6620 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_RAW_URI, NULL, 0);
6621 ok(hr == E_POINTER, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6623 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6624 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_PORT, &received, 0);
6625 ok(hr == S_OK, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6626 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6627 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6628 SysFreeString(received);
6630 /* Make sure it handles the ZONE property correctly. */
6631 received = NULL;
6632 hr = IUri_GetPropertyBSTR(uri, Uri_PROPERTY_ZONE, &received, 0);
6633 ok(hr == S_FALSE, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr, S_FALSE);
6634 ok(received != NULL, "Error: Expected the string not to be NULL.\n");
6635 ok(!SysStringLen(received), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received));
6636 SysFreeString(received);
6638 if(uri) IUri_Release(uri);
6640 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6641 uri_properties test = uri_tests[i];
6642 LPWSTR uriW;
6643 uri = NULL;
6645 uriW = a2w(test.uri);
6646 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6647 if(test.create_todo) {
6648 todo_wine {
6649 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6650 hr, test.create_expected, i);
6652 } else {
6653 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6654 hr, test.create_expected, i);
6657 if(SUCCEEDED(hr)) {
6658 DWORD j;
6660 /* Checks all the string properties of the uri. */
6661 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
6662 BSTR received = NULL;
6663 uri_str_property prop = test.str_props[j];
6665 hr = IUri_GetPropertyBSTR(uri, j, &received, 0);
6666 if(prop.todo) {
6667 todo_wine {
6668 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6669 hr, prop.expected, i, j);
6671 todo_wine {
6672 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6673 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6674 prop.value, wine_dbgstr_w(received), i, j);
6676 } else {
6677 ok(hr == prop.expected, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6678 hr, prop.expected, i, j);
6679 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6680 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6681 prop.value, wine_dbgstr_w(received), i, j);
6684 SysFreeString(received);
6688 if(uri) IUri_Release(uri);
6690 heap_free(uriW);
6694 static void test_IUri_GetPropertyDWORD(void) {
6695 IUri *uri = NULL;
6696 HRESULT hr;
6697 DWORD i;
6699 hr = pCreateUri(http_urlW, 0, 0, &uri);
6700 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6701 if(SUCCEEDED(hr)) {
6702 DWORD received = 0xdeadbeef;
6704 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_DWORD_START, NULL, 0);
6705 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6707 hr = IUri_GetPropertyDWORD(uri, Uri_PROPERTY_ABSOLUTE_URI, &received, 0);
6708 ok(hr == E_INVALIDARG, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
6709 ok(received == 0, "Error: Expected received=%d but instead received=%d.\n", 0, received);
6711 if(uri) IUri_Release(uri);
6713 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6714 uri_properties test = uri_tests[i];
6715 LPWSTR uriW;
6716 uri = NULL;
6718 uriW = a2w(test.uri);
6719 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6720 if(test.create_todo) {
6721 todo_wine {
6722 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6723 hr, test.create_expected, i);
6725 } else {
6726 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6727 hr, test.create_expected, i);
6730 if(SUCCEEDED(hr)) {
6731 DWORD j;
6733 /* Checks all the DWORD properties of the uri. */
6734 for(j = 0; j < sizeof(test.dword_props)/sizeof(test.dword_props[0]); ++j) {
6735 DWORD received;
6736 uri_dword_property prop = test.dword_props[j];
6738 hr = IUri_GetPropertyDWORD(uri, j+Uri_PROPERTY_DWORD_START, &received, 0);
6739 if(prop.todo) {
6740 todo_wine {
6741 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6742 hr, prop.expected, i, j);
6744 todo_wine {
6745 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6746 prop.value, received, i, j);
6748 } else {
6749 ok(hr == prop.expected, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
6750 hr, prop.expected, i, j);
6751 ok(prop.value == received, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
6752 prop.value, received, i, j);
6757 if(uri) IUri_Release(uri);
6759 heap_free(uriW);
6763 /* Tests all the 'Get*' property functions which deal with strings. */
6764 static void test_IUri_GetStrProperties(void) {
6765 IUri *uri = NULL;
6766 HRESULT hr;
6767 DWORD i;
6769 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
6770 hr = pCreateUri(http_urlW, 0, 0, &uri);
6771 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
6772 if(SUCCEEDED(hr)) {
6773 hr = IUri_GetAbsoluteUri(uri, NULL);
6774 ok(hr == E_POINTER, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6776 hr = IUri_GetAuthority(uri, NULL);
6777 ok(hr == E_POINTER, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6779 hr = IUri_GetDisplayUri(uri, NULL);
6780 ok(hr == E_POINTER, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6782 hr = IUri_GetDomain(uri, NULL);
6783 ok(hr == E_POINTER, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6785 hr = IUri_GetExtension(uri, NULL);
6786 ok(hr == E_POINTER, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6788 hr = IUri_GetFragment(uri, NULL);
6789 ok(hr == E_POINTER, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6791 hr = IUri_GetHost(uri, NULL);
6792 ok(hr == E_POINTER, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6794 hr = IUri_GetPassword(uri, NULL);
6795 ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6797 hr = IUri_GetPath(uri, NULL);
6798 ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6800 hr = IUri_GetPathAndQuery(uri, NULL);
6801 ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6803 hr = IUri_GetQuery(uri, NULL);
6804 ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6806 hr = IUri_GetRawUri(uri, NULL);
6807 ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6809 hr = IUri_GetSchemeName(uri, NULL);
6810 ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6812 hr = IUri_GetUserInfo(uri, NULL);
6813 ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6815 hr = IUri_GetUserName(uri, NULL);
6816 ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
6818 if(uri) IUri_Release(uri);
6820 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
6821 uri_properties test = uri_tests[i];
6822 LPWSTR uriW;
6823 uri = NULL;
6825 uriW = a2w(test.uri);
6826 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
6827 if(test.create_todo) {
6828 todo_wine {
6829 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6830 hr, test.create_expected, i);
6832 } else {
6833 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6834 hr, test.create_expected, i);
6837 if(SUCCEEDED(hr)) {
6838 uri_str_property prop;
6839 BSTR received = NULL;
6841 /* GetAbsoluteUri() tests. */
6842 prop = test.str_props[Uri_PROPERTY_ABSOLUTE_URI];
6843 hr = IUri_GetAbsoluteUri(uri, &received);
6844 if(prop.todo) {
6845 todo_wine {
6846 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6847 hr, prop.expected, i);
6849 todo_wine {
6850 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6851 "Error: Expected %s but got %s on uri_tests[%d].\n",
6852 prop.value, wine_dbgstr_w(received), i);
6854 } else {
6855 ok(hr == prop.expected, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6856 hr, prop.expected, i);
6857 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6858 "Error: Expected %s but got %s on uri_tests[%d].\n",
6859 prop.value, wine_dbgstr_w(received), i);
6861 SysFreeString(received);
6862 received = NULL;
6864 /* GetAuthority() tests. */
6865 prop = test.str_props[Uri_PROPERTY_AUTHORITY];
6866 hr = IUri_GetAuthority(uri, &received);
6867 if(prop.todo) {
6868 todo_wine {
6869 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6870 hr, prop.expected, i);
6872 todo_wine {
6873 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6874 prop.value, wine_dbgstr_w(received), i);
6876 } else {
6877 ok(hr == prop.expected, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6878 hr, prop.expected, i);
6879 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6880 prop.value, wine_dbgstr_w(received), i);
6882 SysFreeString(received);
6883 received = NULL;
6885 /* GetDisplayUri() tests. */
6886 prop = test.str_props[Uri_PROPERTY_DISPLAY_URI];
6887 hr = IUri_GetDisplayUri(uri, &received);
6888 if(prop.todo) {
6889 todo_wine {
6890 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6891 hr, prop.expected, i);
6893 todo_wine {
6894 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6895 "Error: Expected %s but got %s on uri_test[%d].\n",
6896 prop.value, wine_dbgstr_w(received), i);
6898 } else {
6899 ok(hr == prop.expected, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6900 hr, prop.expected, i);
6901 ok(!strcmp_aw(prop.value, received) || broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
6902 "Error: Expected %s but got %s on uri_tests[%d].\n",
6903 prop.value, wine_dbgstr_w(received), i);
6905 SysFreeString(received);
6906 received = NULL;
6908 /* GetDomain() tests. */
6909 prop = test.str_props[Uri_PROPERTY_DOMAIN];
6910 hr = IUri_GetDomain(uri, &received);
6911 if(prop.todo) {
6912 todo_wine {
6913 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6914 hr, prop.expected, i);
6916 todo_wine {
6917 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6918 prop.value, wine_dbgstr_w(received), i);
6920 } else {
6921 ok(hr == prop.expected, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6922 hr, prop.expected, i);
6923 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6924 prop.value, wine_dbgstr_w(received), i);
6926 SysFreeString(received);
6927 received = NULL;
6929 /* GetExtension() tests. */
6930 prop = test.str_props[Uri_PROPERTY_EXTENSION];
6931 hr = IUri_GetExtension(uri, &received);
6932 if(prop.todo) {
6933 todo_wine {
6934 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6935 hr, prop.expected, i);
6937 todo_wine {
6938 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6939 prop.value, wine_dbgstr_w(received), i);
6941 } else {
6942 ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6943 hr, prop.expected, i);
6944 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6945 prop.value, wine_dbgstr_w(received), i);
6947 SysFreeString(received);
6948 received = NULL;
6950 /* GetFragment() tests. */
6951 prop = test.str_props[Uri_PROPERTY_FRAGMENT];
6952 hr = IUri_GetFragment(uri, &received);
6953 if(prop.todo) {
6954 todo_wine {
6955 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6956 hr, prop.expected, i);
6958 todo_wine {
6959 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6960 prop.value, wine_dbgstr_w(received), i);
6962 } else {
6963 ok(hr == prop.expected, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6964 hr, prop.expected, i);
6965 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6966 prop.value, wine_dbgstr_w(received), i);
6968 SysFreeString(received);
6969 received = NULL;
6971 /* GetHost() tests. */
6972 prop = test.str_props[Uri_PROPERTY_HOST];
6973 hr = IUri_GetHost(uri, &received);
6974 if(prop.todo) {
6975 todo_wine {
6976 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6977 hr, prop.expected, i);
6979 todo_wine {
6980 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6981 prop.value, wine_dbgstr_w(received), i);
6983 } else {
6984 ok(hr == prop.expected, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6985 hr, prop.expected, i);
6986 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
6987 prop.value, wine_dbgstr_w(received), i);
6989 SysFreeString(received);
6990 received = NULL;
6992 /* GetPassword() tests. */
6993 prop = test.str_props[Uri_PROPERTY_PASSWORD];
6994 hr = IUri_GetPassword(uri, &received);
6995 if(prop.todo) {
6996 todo_wine {
6997 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
6998 hr, prop.expected, i);
7000 todo_wine {
7001 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7002 prop.value, wine_dbgstr_w(received), i);
7004 } else {
7005 ok(hr == prop.expected, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7006 hr, prop.expected, i);
7007 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7008 prop.value, wine_dbgstr_w(received), i);
7010 SysFreeString(received);
7011 received = NULL;
7013 /* GetPath() tests. */
7014 prop = test.str_props[Uri_PROPERTY_PATH];
7015 hr = IUri_GetPath(uri, &received);
7016 if(prop.todo) {
7017 todo_wine {
7018 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7019 hr, prop.expected, i);
7021 todo_wine {
7022 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7023 prop.value, wine_dbgstr_w(received), i);
7025 } else {
7026 ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7027 hr, prop.expected, i);
7028 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7029 prop.value, wine_dbgstr_w(received), i);
7031 SysFreeString(received);
7032 received = NULL;
7034 /* GetPathAndQuery() tests. */
7035 prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY];
7036 hr = IUri_GetPathAndQuery(uri, &received);
7037 if(prop.todo) {
7038 todo_wine {
7039 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7040 hr, prop.expected, i);
7042 todo_wine {
7043 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7044 prop.value, wine_dbgstr_w(received), i);
7046 } else {
7047 ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7048 hr, prop.expected, i);
7049 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7050 prop.value, wine_dbgstr_w(received), i);
7052 SysFreeString(received);
7053 received = NULL;
7055 /* GetQuery() tests. */
7056 prop = test.str_props[Uri_PROPERTY_QUERY];
7057 hr = IUri_GetQuery(uri, &received);
7058 if(prop.todo) {
7059 todo_wine {
7060 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7061 hr, prop.expected, i);
7063 todo_wine {
7064 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7065 prop.value, wine_dbgstr_w(received), i);
7067 } else {
7068 ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7069 hr, prop.expected, i);
7070 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7071 prop.value, wine_dbgstr_w(received), i);
7073 SysFreeString(received);
7074 received = NULL;
7076 /* GetRawUri() tests. */
7077 prop = test.str_props[Uri_PROPERTY_RAW_URI];
7078 hr = IUri_GetRawUri(uri, &received);
7079 if(prop.todo) {
7080 todo_wine {
7081 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7082 hr, prop.expected, i);
7084 todo_wine {
7085 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7086 prop.value, wine_dbgstr_w(received), i);
7088 } else {
7089 ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7090 hr, prop.expected, i);
7091 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7092 prop.value, wine_dbgstr_w(received), i);
7094 SysFreeString(received);
7095 received = NULL;
7097 /* GetSchemeName() tests. */
7098 prop = test.str_props[Uri_PROPERTY_SCHEME_NAME];
7099 hr = IUri_GetSchemeName(uri, &received);
7100 if(prop.todo) {
7101 todo_wine {
7102 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7103 hr, prop.expected, i);
7105 todo_wine {
7106 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7107 prop.value, wine_dbgstr_w(received), i);
7109 } else {
7110 ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7111 hr, prop.expected, i);
7112 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7113 prop.value, wine_dbgstr_w(received), i);
7115 SysFreeString(received);
7116 received = NULL;
7118 /* GetUserInfo() tests. */
7119 prop = test.str_props[Uri_PROPERTY_USER_INFO];
7120 hr = IUri_GetUserInfo(uri, &received);
7121 if(prop.todo) {
7122 todo_wine {
7123 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7124 hr, prop.expected, i);
7126 todo_wine {
7127 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7128 prop.value, wine_dbgstr_w(received), i);
7130 } else {
7131 ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7132 hr, prop.expected, i);
7133 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7134 prop.value, wine_dbgstr_w(received), i);
7136 SysFreeString(received);
7137 received = NULL;
7139 /* GetUserName() tests. */
7140 prop = test.str_props[Uri_PROPERTY_USER_NAME];
7141 hr = IUri_GetUserName(uri, &received);
7142 if(prop.todo) {
7143 todo_wine {
7144 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7145 hr, prop.expected, i);
7147 todo_wine {
7148 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7149 prop.value, wine_dbgstr_w(received), i);
7151 } else {
7152 ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7153 hr, prop.expected, i);
7154 ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n",
7155 prop.value, wine_dbgstr_w(received), i);
7157 SysFreeString(received);
7160 if(uri) IUri_Release(uri);
7162 heap_free(uriW);
7166 static void test_IUri_GetDwordProperties(void) {
7167 IUri *uri = NULL;
7168 HRESULT hr;
7169 DWORD i;
7171 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7172 hr = pCreateUri(http_urlW, 0, 0, &uri);
7173 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7174 if(SUCCEEDED(hr)) {
7175 hr = IUri_GetHostType(uri, NULL);
7176 ok(hr == E_INVALIDARG, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7178 hr = IUri_GetPort(uri, NULL);
7179 ok(hr == E_INVALIDARG, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7181 hr = IUri_GetScheme(uri, NULL);
7182 ok(hr == E_INVALIDARG, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7184 hr = IUri_GetZone(uri, NULL);
7185 ok(hr == E_INVALIDARG, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7187 if(uri) IUri_Release(uri);
7189 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7190 uri_properties test = uri_tests[i];
7191 LPWSTR uriW;
7192 uri = NULL;
7194 uriW = a2w(test.uri);
7195 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7196 if(test.create_todo) {
7197 todo_wine {
7198 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7199 hr, test.create_expected, i);
7201 } else {
7202 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7203 hr, test.create_expected, i);
7206 if(SUCCEEDED(hr)) {
7207 uri_dword_property prop;
7208 DWORD received;
7210 /* Assign an insane value so tests don't accidentally pass when
7211 * they shouldn't!
7213 received = -9999999;
7215 /* GetHostType() tests. */
7216 prop = test.dword_props[Uri_PROPERTY_HOST_TYPE-Uri_PROPERTY_DWORD_START];
7217 hr = IUri_GetHostType(uri, &received);
7218 if(prop.todo) {
7219 todo_wine {
7220 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7221 hr, prop.expected, i);
7223 todo_wine {
7224 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7226 } else {
7227 ok(hr == prop.expected, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7228 hr, prop.expected, i);
7229 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7231 received = -9999999;
7233 /* GetPort() tests. */
7234 prop = test.dword_props[Uri_PROPERTY_PORT-Uri_PROPERTY_DWORD_START];
7235 hr = IUri_GetPort(uri, &received);
7236 if(prop.todo) {
7237 todo_wine {
7238 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7239 hr, prop.expected, i);
7241 todo_wine {
7242 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7244 } else {
7245 ok(hr == prop.expected, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7246 hr, prop.expected, i);
7247 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7249 received = -9999999;
7251 /* GetScheme() tests. */
7252 prop = test.dword_props[Uri_PROPERTY_SCHEME-Uri_PROPERTY_DWORD_START];
7253 hr = IUri_GetScheme(uri, &received);
7254 if(prop.todo) {
7255 todo_wine {
7256 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7257 hr, prop.expected, i);
7259 todo_wine {
7260 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7262 } else {
7263 ok(hr == prop.expected, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7264 hr, prop.expected, i);
7265 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7267 received = -9999999;
7269 /* GetZone() tests. */
7270 prop = test.dword_props[Uri_PROPERTY_ZONE-Uri_PROPERTY_DWORD_START];
7271 hr = IUri_GetZone(uri, &received);
7272 if(prop.todo) {
7273 todo_wine {
7274 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7275 hr, prop.expected, i);
7277 todo_wine {
7278 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7280 } else {
7281 ok(hr == prop.expected, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7282 hr, prop.expected, i);
7283 ok(received == prop.value, "Error: Expected %d but got %d on uri_tests[%d].\n", prop.value, received, i);
7287 if(uri) IUri_Release(uri);
7289 heap_free(uriW);
7293 static void test_IUri_GetPropertyLength(void) {
7294 IUri *uri = NULL;
7295 HRESULT hr;
7296 DWORD i;
7298 /* Make sure it handles invalid args correctly. */
7299 hr = pCreateUri(http_urlW, 0, 0, &uri);
7300 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7301 if(SUCCEEDED(hr)) {
7302 DWORD received = 0xdeadbeef;
7304 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_STRING_START, NULL, 0);
7305 ok(hr == E_INVALIDARG, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7307 hr = IUri_GetPropertyLength(uri, Uri_PROPERTY_DWORD_START, &received, 0);
7308 ok(hr == E_INVALIDARG, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7309 ok(received == 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received);
7311 if(uri) IUri_Release(uri);
7313 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7314 uri_properties test = uri_tests[i];
7315 LPWSTR uriW;
7316 uri = NULL;
7318 uriW = a2w(test.uri);
7319 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7320 if(test.create_todo) {
7321 todo_wine {
7322 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7323 hr, test.create_expected, i);
7325 } else {
7326 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7327 hr, test.create_expected, i);
7330 if(SUCCEEDED(hr)) {
7331 DWORD j;
7333 for(j = Uri_PROPERTY_STRING_START; j <= Uri_PROPERTY_STRING_LAST; ++j) {
7334 DWORD expectedLen, brokenLen, receivedLen;
7335 uri_str_property prop = test.str_props[j];
7337 expectedLen = lstrlen(prop.value);
7338 brokenLen = lstrlen(prop.broken_value);
7340 /* This won't be necessary once GetPropertyLength is implemented. */
7341 receivedLen = -1;
7343 hr = IUri_GetPropertyLength(uri, j, &receivedLen, 0);
7344 if(prop.todo) {
7345 todo_wine {
7346 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7347 hr, prop.expected, i, j);
7349 todo_wine {
7350 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7351 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7352 expectedLen, receivedLen, i, j);
7354 } else {
7355 ok(hr == prop.expected, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7356 hr, prop.expected, i, j);
7357 ok(receivedLen == expectedLen || broken(receivedLen == brokenLen),
7358 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7359 expectedLen, receivedLen, i, j);
7364 if(uri) IUri_Release(uri);
7366 heap_free(uriW);
7370 static DWORD compute_expected_props(uri_properties *test)
7372 DWORD ret = 0, i;
7374 for(i=Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_STRING_LAST; i++) {
7375 if(test->str_props[i-Uri_PROPERTY_STRING_START].expected == S_OK)
7376 ret |= 1<<i;
7379 for(i=Uri_PROPERTY_DWORD_START; i <= Uri_PROPERTY_DWORD_LAST; i++) {
7380 if(test->dword_props[i-Uri_PROPERTY_DWORD_START].expected == S_OK)
7381 ret |= 1<<i;
7384 return ret;
7387 static void test_IUri_GetProperties(void) {
7388 IUri *uri = NULL;
7389 HRESULT hr;
7390 DWORD i;
7392 hr = pCreateUri(http_urlW, 0, 0, &uri);
7393 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7394 if(SUCCEEDED(hr)) {
7395 hr = IUri_GetProperties(uri, NULL);
7396 ok(hr == E_INVALIDARG, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7398 if(uri) IUri_Release(uri);
7400 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7401 uri_properties test = uri_tests[i];
7402 LPWSTR uriW;
7403 uri = NULL;
7405 uriW = a2w(test.uri);
7406 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7407 if(test.create_todo) {
7408 todo_wine {
7409 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7411 } else {
7412 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7415 if(SUCCEEDED(hr)) {
7416 DWORD received = 0, expected_props;
7417 DWORD j;
7419 hr = IUri_GetProperties(uri, &received);
7420 ok(hr == S_OK, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7422 expected_props = compute_expected_props(&test);
7424 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7425 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7426 if(expected_props & (1 << j))
7427 ok(received & (1 << j), "Error: Expected flag for property %d on uri_tests[%d].\n", j, i);
7428 else
7429 ok(!(received & (1 << j)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j, i);
7433 if(uri) IUri_Release(uri);
7435 heap_free(uriW);
7439 static void test_IUri_HasProperty(void) {
7440 IUri *uri = NULL;
7441 HRESULT hr;
7442 DWORD i;
7444 hr = pCreateUri(http_urlW, 0, 0, &uri);
7445 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7446 if(SUCCEEDED(hr)) {
7447 hr = IUri_HasProperty(uri, Uri_PROPERTY_RAW_URI, NULL);
7448 ok(hr == E_INVALIDARG, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7450 if(uri) IUri_Release(uri);
7452 for(i = 0; i < sizeof(uri_tests)/sizeof(uri_tests[0]); ++i) {
7453 uri_properties test = uri_tests[i];
7454 LPWSTR uriW;
7455 uri = NULL;
7457 uriW = a2w(test.uri);
7459 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
7460 if(test.create_todo) {
7461 todo_wine {
7462 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7464 } else {
7465 ok(hr == test.create_expected, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, test.create_expected);
7468 if(SUCCEEDED(hr)) {
7469 DWORD expected_props, j;
7471 expected_props = compute_expected_props(&test);
7473 for(j = 0; j <= Uri_PROPERTY_DWORD_LAST; ++j) {
7474 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7475 BOOL received = -1;
7477 hr = IUri_HasProperty(uri, j, &received);
7478 ok(hr == S_OK, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7479 hr, S_OK, j, i);
7481 if(expected_props & (1 << j)) {
7482 ok(received == TRUE, "Error: Expected to have property %d on uri_tests[%d].\n", j, i);
7483 } else {
7484 ok(received == FALSE, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j, i);
7489 if(uri) IUri_Release(uri);
7491 heap_free(uriW);
7495 static void test_IUri_IsEqual(void) {
7496 IUri *uriA, *uriB;
7497 HRESULT hrA, hrB;
7498 DWORD i;
7500 uriA = uriB = NULL;
7502 /* Make sure IsEqual handles invalid args correctly. */
7503 hrA = pCreateUri(http_urlW, 0, 0, &uriA);
7504 hrB = pCreateUri(http_urlW, 0, 0, &uriB);
7505 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7506 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hrB, S_OK);
7507 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7508 BOOL equal = -1;
7509 hrA = IUri_IsEqual(uriA, NULL, &equal);
7510 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, S_OK);
7511 ok(equal == FALSE, "Error: Expected equal to be FALSE, but was %d instead.\n", equal);
7513 hrA = IUri_IsEqual(uriA, uriB, NULL);
7514 ok(hrA == E_POINTER, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hrA, E_POINTER);
7516 if(uriA) IUri_Release(uriA);
7517 if(uriB) IUri_Release(uriB);
7519 for(i = 0; i < sizeof(equality_tests)/sizeof(equality_tests[0]); ++i) {
7520 uri_equality test = equality_tests[i];
7521 LPWSTR uriA_W, uriB_W;
7523 uriA = uriB = NULL;
7525 uriA_W = a2w(test.a);
7526 uriB_W = a2w(test.b);
7528 hrA = pCreateUri(uriA_W, test.create_flags_a, 0, &uriA);
7529 if(test.create_todo_a) {
7530 todo_wine {
7531 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7532 hrA, S_OK, i);
7534 } else {
7535 ok(hrA == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n",
7536 hrA, S_OK, i);
7539 hrB = pCreateUri(uriB_W, test.create_flags_b, 0, &uriB);
7540 if(test.create_todo_b) {
7541 todo_wine {
7542 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7543 hrB, S_OK, i);
7545 } else {
7546 ok(hrB == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n",
7547 hrB, S_OK, i);
7550 if(SUCCEEDED(hrA) && SUCCEEDED(hrB)) {
7551 BOOL equal = -1;
7553 hrA = IUri_IsEqual(uriA, uriB, &equal);
7554 if(test.todo) {
7555 todo_wine {
7556 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n",
7557 hrA, S_OK, i);
7559 todo_wine {
7560 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7562 } else {
7563 ok(hrA == S_OK, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hrA, S_OK, i);
7564 ok(equal == test.equal, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test.equal, i);
7567 if(uriA) IUri_Release(uriA);
7568 if(uriB) IUri_Release(uriB);
7570 heap_free(uriA_W);
7571 heap_free(uriB_W);
7575 static void test_CreateUriWithFragment_InvalidArgs(void) {
7576 HRESULT hr;
7577 IUri *uri = (void*) 0xdeadbeef;
7578 const WCHAR fragmentW[] = {'#','f','r','a','g','m','e','n','t',0};
7580 hr = pCreateUriWithFragment(NULL, fragmentW, 0, 0, &uri);
7581 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7582 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7584 hr = pCreateUriWithFragment(http_urlW, fragmentW, 0, 0, NULL);
7585 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7587 /* Original URI can't already contain a fragment component. */
7588 uri = (void*) 0xdeadbeef;
7589 hr = pCreateUriWithFragment(http_url_fragW, fragmentW, 0, 0, &uri);
7590 ok(hr == E_INVALIDARG, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
7591 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7594 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7595 static void test_CreateUriWithFragment_InvalidFlags(void) {
7596 DWORD i;
7598 for(i = 0; i < sizeof(invalid_flag_tests)/sizeof(invalid_flag_tests[0]); ++i) {
7599 HRESULT hr;
7600 IUri *uri = (void*) 0xdeadbeef;
7602 hr = pCreateUriWithFragment(http_urlW, NULL, invalid_flag_tests[i].flags, 0, &uri);
7603 ok(hr == invalid_flag_tests[i].expected, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7604 hr, invalid_flag_tests[i].expected, invalid_flag_tests[i].flags);
7605 ok(uri == NULL, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7609 static void test_CreateUriWithFragment(void) {
7610 DWORD i;
7612 for(i = 0; i < sizeof(uri_fragment_tests)/sizeof(uri_fragment_tests[0]); ++i) {
7613 HRESULT hr;
7614 IUri *uri = NULL;
7615 LPWSTR uriW, fragW;
7616 uri_with_fragment test = uri_fragment_tests[i];
7618 uriW = a2w(test.uri);
7619 fragW = a2w(test.fragment);
7621 hr = pCreateUriWithFragment(uriW, fragW, test.create_flags, 0, &uri);
7622 if(test.expected_todo) {
7623 todo_wine {
7624 ok(hr == test.create_expected,
7625 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7626 hr, test.create_expected, i);
7628 } else
7629 ok(hr == test.create_expected,
7630 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7631 hr, test.create_expected, i);
7633 if(SUCCEEDED(hr)) {
7634 BSTR received = NULL;
7636 hr = IUri_GetAbsoluteUri(uri, &received);
7637 if(test.expected_todo) {
7638 todo_wine {
7639 ok(hr == S_OK,
7640 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7641 hr, S_OK, i);
7643 todo_wine {
7644 ok(!strcmp_aw(test.expected_uri, received),
7645 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7646 test.expected_uri, wine_dbgstr_w(received), i);
7648 } else {
7649 ok(hr == S_OK, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7650 hr, S_OK, i);
7651 ok(!strcmp_aw(test.expected_uri, received), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7652 test.expected_uri, wine_dbgstr_w(received), i);
7655 SysFreeString(received);
7658 if(uri) IUri_Release(uri);
7659 heap_free(uriW);
7660 heap_free(fragW);
7664 static void test_CreateIUriBuilder(void) {
7665 HRESULT hr;
7666 IUriBuilder *builder = NULL;
7667 IUri *uri;
7669 hr = pCreateIUriBuilder(NULL, 0, 0, NULL);
7670 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7671 hr, E_POINTER);
7673 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7674 hr = pCreateUri(http_urlW, 0, 0, &uri);
7675 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7676 if(SUCCEEDED(hr)) {
7677 ULONG cur_count, orig_count;
7679 orig_count = get_refcnt(uri);
7680 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
7681 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7682 ok(builder != NULL, "Error: Expecting builder not to be NULL\n");
7684 cur_count = get_refcnt(uri);
7685 ok(cur_count == orig_count+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count+1, cur_count);
7687 if(builder) IUriBuilder_Release(builder);
7688 cur_count = get_refcnt(uri);
7689 ok(cur_count == orig_count, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count, cur_count);
7691 if(uri) IUri_Release(uri);
7694 static void test_IUriBuilder_CreateUri(IUriBuilder *builder, const uri_builder_test *test,
7695 DWORD test_index) {
7696 HRESULT hr;
7697 IUri *uri = NULL;
7699 hr = IUriBuilder_CreateUri(builder, test->uri_flags, 0, 0, &uri);
7700 if(test->uri_todo) {
7701 todo_wine {
7702 ok(hr == test->uri_hres,
7703 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7704 hr, test->uri_hres, test_index);
7706 } else {
7707 ok(hr == test->uri_hres,
7708 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7709 hr, test->uri_hres, test_index);
7712 if(SUCCEEDED(hr)) {
7713 DWORD i;
7715 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7716 uri_builder_str_property prop = test->expected_str_props[i];
7717 BSTR received = NULL;
7719 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7720 if(prop.todo) {
7721 todo_wine {
7722 ok(hr == prop.result,
7723 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7724 hr, prop.result, test_index, i);
7726 } else {
7727 ok(hr == prop.result,
7728 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7729 hr, prop.result, test_index, i);
7731 if(SUCCEEDED(hr)) {
7732 if(prop.todo) {
7733 todo_wine {
7734 ok(!strcmp_aw(prop.expected, received),
7735 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7736 prop.expected, wine_dbgstr_w(received), test_index, i);
7738 } else {
7739 ok(!strcmp_aw(prop.expected, received),
7740 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7741 prop.expected, wine_dbgstr_w(received), test_index, i);
7744 SysFreeString(received);
7747 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7748 uri_builder_dword_property prop = test->expected_dword_props[i];
7749 DWORD received = -2;
7751 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7752 if(prop.todo) {
7753 todo_wine {
7754 ok(hr == prop.result,
7755 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7756 hr, prop.result, test_index, i);
7758 } else {
7759 ok(hr == prop.result,
7760 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7761 hr, prop.result, test_index, i);
7763 if(SUCCEEDED(hr)) {
7764 if(prop.todo) {
7765 todo_wine {
7766 ok(received == prop.expected,
7767 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7768 prop.expected, received, test_index, i);
7770 } else {
7771 ok(received == prop.expected,
7772 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7773 prop.expected, received, test_index, i);
7778 if(uri) IUri_Release(uri);
7781 static void test_IUriBuilder_CreateUriSimple(IUriBuilder *builder, const uri_builder_test *test,
7782 DWORD test_index) {
7783 HRESULT hr;
7784 IUri *uri = NULL;
7786 hr = IUriBuilder_CreateUriSimple(builder, test->uri_simple_encode_flags, 0, &uri);
7787 if(test->uri_simple_todo) {
7788 todo_wine {
7789 ok(hr == test->uri_simple_hres,
7790 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7791 hr, test->uri_simple_hres, test_index);
7793 } else {
7794 ok(hr == test->uri_simple_hres,
7795 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7796 hr, test->uri_simple_hres, test_index);
7799 if(SUCCEEDED(hr)) {
7800 DWORD i;
7802 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7803 uri_builder_str_property prop = test->expected_str_props[i];
7804 BSTR received = NULL;
7806 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7807 if(prop.todo) {
7808 todo_wine {
7809 ok(hr == prop.result,
7810 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7811 hr, prop.result, test_index, i);
7813 } else {
7814 ok(hr == prop.result,
7815 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7816 hr, prop.result, test_index, i);
7818 if(SUCCEEDED(hr)) {
7819 if(prop.todo) {
7820 todo_wine {
7821 ok(!strcmp_aw(prop.expected, received),
7822 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7823 prop.expected, wine_dbgstr_w(received), test_index, i);
7825 } else {
7826 ok(!strcmp_aw(prop.expected, received),
7827 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7828 prop.expected, wine_dbgstr_w(received), test_index, i);
7831 SysFreeString(received);
7834 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7835 uri_builder_dword_property prop = test->expected_dword_props[i];
7836 DWORD received = -2;
7838 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7839 if(prop.todo) {
7840 todo_wine {
7841 ok(hr == prop.result,
7842 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7843 hr, prop.result, test_index, i);
7845 } else {
7846 ok(hr == prop.result,
7847 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7848 hr, prop.result, test_index, i);
7850 if(SUCCEEDED(hr)) {
7851 if(prop.todo) {
7852 todo_wine {
7853 ok(received == prop.expected,
7854 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7855 prop.expected, received, test_index, i);
7857 } else {
7858 ok(received == prop.expected,
7859 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7860 prop.expected, received, test_index, i);
7865 if(uri) IUri_Release(uri);
7868 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder *builder, const uri_builder_test *test,
7869 DWORD test_index) {
7870 HRESULT hr;
7871 IUri *uri = NULL;
7873 hr = IUriBuilder_CreateUriWithFlags(builder, test->uri_with_flags, test->uri_with_builder_flags,
7874 test->uri_with_encode_flags, 0, &uri);
7875 if(test->uri_with_todo) {
7876 todo_wine {
7877 ok(hr == test->uri_with_hres,
7878 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7879 hr, test->uri_with_hres, test_index);
7881 } else {
7882 ok(hr == test->uri_with_hres,
7883 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7884 hr, test->uri_with_hres, test_index);
7887 if(SUCCEEDED(hr)) {
7888 DWORD i;
7890 for(i = 0; i < sizeof(test->expected_str_props)/sizeof(test->expected_str_props[0]); ++i) {
7891 uri_builder_str_property prop = test->expected_str_props[i];
7892 BSTR received = NULL;
7894 hr = IUri_GetPropertyBSTR(uri, i, &received, 0);
7895 if(prop.todo) {
7896 todo_wine {
7897 ok(hr == prop.result,
7898 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7899 hr, prop.result, test_index, i);
7901 } else {
7902 ok(hr == prop.result,
7903 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
7904 hr, prop.result, test_index, i);
7906 if(SUCCEEDED(hr)) {
7907 if(prop.todo) {
7908 todo_wine {
7909 ok(!strcmp_aw(prop.expected, received),
7910 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7911 prop.expected, wine_dbgstr_w(received), test_index, i);
7913 } else {
7914 ok(!strcmp_aw(prop.expected, received),
7915 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
7916 prop.expected, wine_dbgstr_w(received), test_index, i);
7919 SysFreeString(received);
7922 for(i = 0; i < sizeof(test->expected_dword_props)/sizeof(test->expected_dword_props[0]); ++i) {
7923 uri_builder_dword_property prop = test->expected_dword_props[i];
7924 DWORD received = -2;
7926 hr = IUri_GetPropertyDWORD(uri, i+Uri_PROPERTY_DWORD_START, &received, 0);
7927 if(prop.todo) {
7928 todo_wine {
7929 ok(hr == prop.result,
7930 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7931 hr, prop.result, test_index, i);
7933 } else {
7934 ok(hr == prop.result,
7935 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
7936 hr, prop.result, test_index, i);
7938 if(SUCCEEDED(hr)) {
7939 if(prop.todo) {
7940 todo_wine {
7941 ok(received == prop.expected,
7942 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7943 prop.expected, received, test_index, i);
7945 } else {
7946 ok(received == prop.expected,
7947 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
7948 prop.expected, received, test_index, i);
7953 if(uri) IUri_Release(uri);
7956 static void test_IUriBuilder_CreateInvalidArgs(void) {
7957 IUriBuilder *builder;
7958 HRESULT hr;
7960 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
7961 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7962 if(SUCCEEDED(hr)) {
7963 IUri *test = NULL, *uri = (void*) 0xdeadbeef;
7965 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
7966 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, NULL);
7967 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER);
7969 uri = (void*) 0xdeadbeef;
7970 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
7971 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, E_NOTIMPL);
7972 ok(uri == NULL, "Error: expected uri to be NULL, but was %p instead.\n", uri);
7974 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, NULL);
7975 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7976 hr, E_POINTER);
7978 uri = (void*) 0xdeadbeef;
7979 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
7980 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
7981 hr, E_NOTIMPL);
7982 ok(!uri, "Error: Expected uri to NULL, but was %p instead.\n", uri);
7984 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, NULL);
7985 ok(hr == E_POINTER, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7986 hr, E_POINTER);
7988 uri = (void*) 0xdeadbeef;
7989 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
7990 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
7991 hr, E_NOTIMPL);
7992 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
7994 hr = pCreateUri(http_urlW, 0, 0, &test);
7995 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
7996 if(SUCCEEDED(hr)) {
7997 hr = IUriBuilder_SetIUri(builder, test);
7998 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8000 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8001 uri = NULL;
8002 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8003 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8004 ok(uri != NULL, "Error: The uri was NULL.\n");
8005 if(uri) IUri_Release(uri);
8007 uri = NULL;
8008 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8009 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8010 hr, S_OK);
8011 ok(uri != NULL, "Error: uri was NULL.\n");
8012 if(uri) IUri_Release(uri);
8014 uri = NULL;
8015 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &uri);
8016 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8017 hr, S_OK);
8018 ok(uri != NULL, "Error: uri was NULL.\n");
8019 if(uri) IUri_Release(uri);
8021 hr = IUriBuilder_SetFragment(builder, NULL);
8022 ok(hr == S_OK, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8024 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8025 uri = (void*) 0xdeadbeef;
8026 hr = IUriBuilder_CreateUri(builder, 0, Uri_HAS_USER_NAME, 0, &uri);
8027 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8028 ok(!uri, "Error: Expected uri to be NULL but was %p instead.\n", uri);
8030 uri = (void*) 0xdeadbeef;
8031 hr = IUriBuilder_CreateUriSimple(builder, Uri_HAS_USER_NAME, 0, &uri);
8032 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8033 hr, S_OK);
8034 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8036 uri = (void*) 0xdeadbeef;
8037 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, Uri_HAS_USER_NAME, 0, &uri);
8038 ok(hr == E_NOTIMPL, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8039 hr, E_NOTIMPL);
8040 ok(!uri, "Error: Expected uri to be NULL, but was %p instead.\n", uri);
8042 if(test) IUri_Release(test);
8044 if(builder) IUriBuilder_Release(builder);
8047 /* Tests invalid args to the "Get*" functions. */
8048 static void test_IUriBuilder_GetInvalidArgs(void) {
8049 IUriBuilder *builder = NULL;
8050 HRESULT hr;
8052 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
8053 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
8054 if(SUCCEEDED(hr)) {
8055 LPCWSTR received = (void*) 0xdeadbeef;
8056 DWORD len = -1, port = -1;
8057 BOOL set = -1;
8059 hr = IUriBuilder_GetFragment(builder, NULL, NULL);
8060 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8061 hr, E_POINTER);
8062 hr = IUriBuilder_GetFragment(builder, NULL, &received);
8063 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8064 hr, E_POINTER);
8065 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8066 hr = IUriBuilder_GetFragment(builder, &len, NULL);
8067 ok(hr == E_POINTER, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8068 hr, E_POINTER);
8069 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8071 hr = IUriBuilder_GetHost(builder, NULL, NULL);
8072 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8073 hr, E_POINTER);
8074 received = (void*) 0xdeadbeef;
8075 hr = IUriBuilder_GetHost(builder, NULL, &received);
8076 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8077 hr, E_POINTER);
8078 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8079 len = -1;
8080 hr = IUriBuilder_GetHost(builder, &len, NULL);
8081 ok(hr == E_POINTER, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8082 hr, E_POINTER);
8083 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8085 hr = IUriBuilder_GetPassword(builder, NULL, NULL);
8086 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8087 hr, E_POINTER);
8088 received = (void*) 0xdeadbeef;
8089 hr = IUriBuilder_GetPassword(builder, NULL, &received);
8090 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8091 hr, E_POINTER);
8092 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8093 len = -1;
8094 hr = IUriBuilder_GetPassword(builder, &len, NULL);
8095 ok(hr == E_POINTER, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8096 hr, E_POINTER);
8097 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8099 hr = IUriBuilder_GetPath(builder, NULL, NULL);
8100 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8101 hr, E_POINTER);
8102 received = (void*) 0xdeadbeef;
8103 hr = IUriBuilder_GetPath(builder, NULL, &received);
8104 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8105 hr, E_POINTER);
8106 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8107 len = -1;
8108 hr = IUriBuilder_GetPath(builder, &len, NULL);
8109 ok(hr == E_POINTER, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8110 hr, E_POINTER);
8111 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8113 hr = IUriBuilder_GetPort(builder, NULL, NULL);
8114 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8115 hr, E_POINTER);
8116 hr = IUriBuilder_GetPort(builder, NULL, &port);
8117 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8118 hr, E_POINTER);
8119 ok(!port, "Error: Expected port to be 0, but was %d instead.\n", port);
8120 hr = IUriBuilder_GetPort(builder, &set, NULL);
8121 ok(hr == E_POINTER, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8122 hr, E_POINTER);
8123 ok(!set, "Error: Expected set to be FALSE, but was %d instead.\n", set);
8125 hr = IUriBuilder_GetQuery(builder, NULL, NULL);
8126 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8127 hr, E_POINTER);
8128 received = (void*) 0xdeadbeef;
8129 hr = IUriBuilder_GetQuery(builder, NULL, &received);
8130 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8131 hr, E_POINTER);
8132 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8133 len = -1;
8134 hr = IUriBuilder_GetQuery(builder, &len, NULL);
8135 ok(hr == E_POINTER, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8136 hr, E_POINTER);
8137 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8139 hr = IUriBuilder_GetSchemeName(builder, NULL, NULL);
8140 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8141 hr, E_POINTER);
8142 received = (void*) 0xdeadbeef;
8143 hr = IUriBuilder_GetSchemeName(builder, NULL, &received);
8144 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8145 hr, E_POINTER);
8146 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8147 len = -1;
8148 hr = IUriBuilder_GetSchemeName(builder, &len, NULL);
8149 ok(hr == E_POINTER, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8150 hr, E_POINTER);
8151 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8153 hr = IUriBuilder_GetUserName(builder, NULL, NULL);
8154 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8155 hr, E_POINTER);
8156 received = (void*) 0xdeadbeef;
8157 hr = IUriBuilder_GetUserName(builder, NULL, &received);
8158 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8159 hr, E_POINTER);
8160 ok(!received, "Error: Expected received to be NULL, but was %p instead.\n", received);
8161 len = -1;
8162 hr = IUriBuilder_GetUserName(builder, &len, NULL);
8163 ok(hr == E_POINTER, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8164 hr, E_POINTER);
8165 ok(!len, "Error: Expected len to be 0, but was %d instead.\n", len);
8167 if(builder) IUriBuilder_Release(builder);
8170 static void test_IUriBuilder_GetFragment(IUriBuilder *builder, const uri_builder_test *test,
8171 DWORD test_index) {
8172 HRESULT hr;
8173 DWORD i;
8174 LPCWSTR received = NULL;
8175 DWORD len = -1;
8176 const uri_builder_property *prop = NULL;
8178 /* Check if the property was set earlier. */
8179 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8180 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_FRAGMENT)
8181 prop = &(test->properties[i]);
8184 if(prop) {
8185 /* Use expected_value unless it's NULL, then use value. */
8186 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8187 hr = IUriBuilder_GetFragment(builder, &len, &received);
8188 if(prop->todo) {
8189 todo_wine {
8190 ok(hr == (expected ? S_OK : S_FALSE),
8191 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8192 hr, (expected ? S_OK : S_FALSE), test_index);
8194 if(SUCCEEDED(hr)) {
8195 todo_wine {
8196 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8197 expected, wine_dbgstr_w(received), test_index);
8199 todo_wine {
8200 ok(lstrlen(expected) == len,
8201 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8202 lstrlen(expected), len, test_index);
8205 } else {
8206 ok(hr == (expected ? S_OK : S_FALSE),
8207 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8208 hr, (expected ? S_OK : S_FALSE), test_index);
8209 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8210 expected, wine_dbgstr_w(received), test_index);
8211 ok(lstrlen(expected) == len,
8212 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8213 lstrlen(expected), len, test_index);
8215 } else {
8216 /* The property wasn't set earlier, so it should return whatever
8217 * the base IUri contains (if anything).
8219 IUri *uri = NULL;
8220 hr = IUriBuilder_GetIUri(builder, &uri);
8221 ok(hr == S_OK,
8222 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8223 hr, S_OK, test_index);
8224 if(SUCCEEDED(hr)) {
8225 if(!uri) {
8226 received = (void*) 0xdeadbeef;
8227 len = -1;
8229 hr = IUriBuilder_GetFragment(builder, &len, &received);
8230 ok(hr == S_FALSE,
8231 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8232 hr, S_FALSE, test_index);
8233 if(SUCCEEDED(hr)) {
8234 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8235 len, test_index);
8236 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8237 received, test_index);
8239 } else {
8240 BOOL has_prop = FALSE;
8241 BSTR expected = NULL;
8243 hr = IUri_GetFragment(uri, &expected);
8244 ok(SUCCEEDED(hr),
8245 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8246 hr, test_index);
8247 has_prop = hr == S_OK;
8249 hr = IUriBuilder_GetFragment(builder, &len, &received);
8250 if(has_prop) {
8251 ok(hr == S_OK,
8252 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8253 hr, S_OK, test_index);
8254 if(SUCCEEDED(hr)) {
8255 ok(!lstrcmpW(expected, received),
8256 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8257 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8258 ok(lstrlenW(expected) == len,
8259 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8260 lstrlenW(expected), len, test_index);
8262 } else {
8263 ok(hr == S_FALSE,
8264 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8265 hr, S_FALSE, test_index);
8266 if(SUCCEEDED(hr)) {
8267 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8268 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8269 len, test_index);
8272 SysFreeString(expected);
8275 if(uri) IUri_Release(uri);
8279 static void test_IUriBuilder_GetHost(IUriBuilder *builder, const uri_builder_test *test,
8280 DWORD test_index) {
8281 HRESULT hr;
8282 DWORD i;
8283 LPCWSTR received = NULL;
8284 DWORD len = -1;
8285 const uri_builder_property *prop = NULL;
8287 /* Check if the property was set earlier. */
8288 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8289 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_HOST)
8290 prop = &(test->properties[i]);
8293 if(prop) {
8294 /* Use expected_value unless it's NULL, then use value. */
8295 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8296 hr = IUriBuilder_GetHost(builder, &len, &received);
8297 if(prop->todo) {
8298 todo_wine {
8299 ok(hr == (expected ? S_OK : S_FALSE),
8300 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8301 hr, (expected ? S_OK : S_FALSE), test_index);
8303 if(SUCCEEDED(hr)) {
8304 todo_wine {
8305 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8306 expected, wine_dbgstr_w(received), test_index);
8308 todo_wine {
8309 ok(lstrlen(expected) == len,
8310 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8311 lstrlen(expected), len, test_index);
8314 } else {
8315 ok(hr == (expected ? S_OK : S_FALSE),
8316 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8317 hr, (expected ? S_OK : S_FALSE), test_index);
8318 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8319 expected, wine_dbgstr_w(received), test_index);
8320 ok(lstrlen(expected) == len,
8321 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8322 lstrlen(expected), len, test_index);
8324 } else {
8325 /* The property wasn't set earlier, so it should return whatever
8326 * the base IUri contains (if anything).
8328 IUri *uri = NULL;
8329 hr = IUriBuilder_GetIUri(builder, &uri);
8330 ok(hr == S_OK,
8331 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8332 hr, S_OK, test_index);
8333 if(SUCCEEDED(hr)) {
8334 if(!uri) {
8335 received = (void*) 0xdeadbeef;
8336 len = -1;
8338 hr = IUriBuilder_GetHost(builder, &len, &received);
8339 ok(hr == S_FALSE,
8340 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8341 hr, S_FALSE, test_index);
8342 if(SUCCEEDED(hr)) {
8343 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8344 len, test_index);
8345 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8346 received, test_index);
8348 } else {
8349 BOOL has_prop = FALSE;
8350 BSTR expected = NULL;
8352 hr = IUri_GetHost(uri, &expected);
8353 ok(SUCCEEDED(hr),
8354 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8355 hr, test_index);
8356 has_prop = hr == S_OK;
8358 hr = IUriBuilder_GetHost(builder, &len, &received);
8359 if(has_prop) {
8360 ok(hr == S_OK,
8361 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8362 hr, S_OK, test_index);
8363 if(SUCCEEDED(hr)) {
8364 ok(!lstrcmpW(expected, received),
8365 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8366 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8367 ok(lstrlenW(expected) == len,
8368 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8369 lstrlenW(expected), len, test_index);
8371 } else {
8372 ok(hr == S_FALSE,
8373 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8374 hr, S_FALSE, test_index);
8375 if(SUCCEEDED(hr)) {
8376 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8377 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8378 len, test_index);
8381 SysFreeString(expected);
8384 if(uri) IUri_Release(uri);
8388 static void test_IUriBuilder_GetPassword(IUriBuilder *builder, const uri_builder_test *test,
8389 DWORD test_index) {
8390 HRESULT hr;
8391 DWORD i;
8392 LPCWSTR received = NULL;
8393 DWORD len = -1;
8394 const uri_builder_property *prop = NULL;
8396 /* Check if the property was set earlier. */
8397 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8398 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PASSWORD)
8399 prop = &(test->properties[i]);
8402 if(prop) {
8403 /* Use expected_value unless it's NULL, then use value. */
8404 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8405 hr = IUriBuilder_GetPassword(builder, &len, &received);
8406 if(prop->todo) {
8407 todo_wine {
8408 ok(hr == (expected ? S_OK : S_FALSE),
8409 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8410 hr, (expected ? S_OK : S_FALSE), test_index);
8412 if(SUCCEEDED(hr)) {
8413 todo_wine {
8414 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8415 expected, wine_dbgstr_w(received), test_index);
8417 todo_wine {
8418 ok(lstrlen(expected) == len,
8419 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8420 lstrlen(expected), len, test_index);
8423 } else {
8424 ok(hr == (expected ? S_OK : S_FALSE),
8425 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8426 hr, (expected ? S_OK : S_FALSE), test_index);
8427 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8428 expected, wine_dbgstr_w(received), test_index);
8429 ok(lstrlen(expected) == len,
8430 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8431 lstrlen(expected), len, test_index);
8433 } else {
8434 /* The property wasn't set earlier, so it should return whatever
8435 * the base IUri contains (if anything).
8437 IUri *uri = NULL;
8438 hr = IUriBuilder_GetIUri(builder, &uri);
8439 ok(hr == S_OK,
8440 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8441 hr, S_OK, test_index);
8442 if(SUCCEEDED(hr)) {
8443 if(!uri) {
8444 received = (void*) 0xdeadbeef;
8445 len = -1;
8447 hr = IUriBuilder_GetPassword(builder, &len, &received);
8448 ok(hr == S_FALSE,
8449 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8450 hr, S_FALSE, test_index);
8451 if(SUCCEEDED(hr)) {
8452 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8453 len, test_index);
8454 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8455 received, test_index);
8457 } else {
8458 BOOL has_prop = FALSE;
8459 BSTR expected = NULL;
8461 hr = IUri_GetPassword(uri, &expected);
8462 ok(SUCCEEDED(hr),
8463 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8464 hr, test_index);
8465 has_prop = hr == S_OK;
8467 hr = IUriBuilder_GetPassword(builder, &len, &received);
8468 if(has_prop) {
8469 ok(hr == S_OK,
8470 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8471 hr, S_OK, test_index);
8472 if(SUCCEEDED(hr)) {
8473 ok(!lstrcmpW(expected, received),
8474 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8475 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8476 ok(lstrlenW(expected) == len,
8477 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8478 lstrlenW(expected), len, test_index);
8480 } else {
8481 ok(hr == S_FALSE,
8482 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8483 hr, S_FALSE, test_index);
8484 if(SUCCEEDED(hr)) {
8485 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8486 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8487 len, test_index);
8490 SysFreeString(expected);
8493 if(uri) IUri_Release(uri);
8497 static void test_IUriBuilder_GetPath(IUriBuilder *builder, const uri_builder_test *test,
8498 DWORD test_index) {
8499 HRESULT hr;
8500 DWORD i;
8501 LPCWSTR received = NULL;
8502 DWORD len = -1;
8503 const uri_builder_property *prop = NULL;
8505 /* Check if the property was set earlier. */
8506 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8507 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_PATH)
8508 prop = &(test->properties[i]);
8511 if(prop) {
8512 /* Use expected_value unless it's NULL, then use value. */
8513 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8514 hr = IUriBuilder_GetPath(builder, &len, &received);
8515 if(prop->todo) {
8516 todo_wine {
8517 ok(hr == (expected ? S_OK : S_FALSE),
8518 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8519 hr, (expected ? S_OK : S_FALSE), test_index);
8521 if(SUCCEEDED(hr)) {
8522 todo_wine {
8523 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8524 expected, wine_dbgstr_w(received), test_index);
8526 todo_wine {
8527 ok(lstrlen(expected) == len,
8528 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8529 lstrlen(expected), len, test_index);
8532 } else {
8533 ok(hr == (expected ? S_OK : S_FALSE),
8534 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8535 hr, (expected ? S_OK : S_FALSE), test_index);
8536 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8537 expected, wine_dbgstr_w(received), test_index);
8538 ok(lstrlen(expected) == len,
8539 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8540 lstrlen(expected), len, test_index);
8542 } else {
8543 /* The property wasn't set earlier, so it should return whatever
8544 * the base IUri contains (if anything).
8546 IUri *uri = NULL;
8547 hr = IUriBuilder_GetIUri(builder, &uri);
8548 ok(hr == S_OK,
8549 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8550 hr, S_OK, test_index);
8551 if(SUCCEEDED(hr)) {
8552 if(!uri) {
8553 received = (void*) 0xdeadbeef;
8554 len = -1;
8556 hr = IUriBuilder_GetPath(builder, &len, &received);
8557 ok(hr == S_FALSE,
8558 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8559 hr, S_FALSE, test_index);
8560 if(SUCCEEDED(hr)) {
8561 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8562 len, test_index);
8563 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8564 received, test_index);
8566 } else {
8567 BOOL has_prop = FALSE;
8568 BSTR expected = NULL;
8570 hr = IUri_GetPath(uri, &expected);
8571 ok(SUCCEEDED(hr),
8572 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8573 hr, test_index);
8574 has_prop = hr == S_OK;
8576 hr = IUriBuilder_GetPath(builder, &len, &received);
8577 if(has_prop) {
8578 ok(hr == S_OK,
8579 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8580 hr, S_OK, test_index);
8581 if(SUCCEEDED(hr)) {
8582 ok(!lstrcmpW(expected, received),
8583 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8584 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8585 ok(lstrlenW(expected) == len,
8586 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8587 lstrlenW(expected), len, test_index);
8589 } else {
8590 ok(hr == S_FALSE,
8591 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8592 hr, S_FALSE, test_index);
8593 if(SUCCEEDED(hr)) {
8594 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8595 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8596 len, test_index);
8599 SysFreeString(expected);
8602 if(uri) IUri_Release(uri);
8606 static void test_IUriBuilder_GetPort(IUriBuilder *builder, const uri_builder_test *test,
8607 DWORD test_index) {
8608 HRESULT hr;
8609 BOOL has_port = FALSE;
8610 DWORD received = -1;
8612 if(test->port_prop.change) {
8613 DWORD expected = test->port_prop.value;
8615 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8616 if(test->port_prop.todo) {
8617 todo_wine {
8618 ok(hr == S_OK,
8619 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8620 hr, S_OK, test_index);
8622 if(SUCCEEDED(hr)) {
8623 todo_wine {
8624 ok(has_port == test->port_prop.set,
8625 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8626 test->port_prop.set, has_port, test_index);
8628 todo_wine {
8629 ok(received == expected,
8630 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8631 expected, received, test_index);
8634 } else {
8635 ok(hr == S_OK,
8636 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8637 hr, S_OK, test_index);
8638 ok(has_port == test->port_prop.set,
8639 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8640 test->port_prop.set, has_port, test_index);
8641 ok(received == test->port_prop.value,
8642 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8643 test->port_prop.value, received, test_index);
8645 } else {
8646 IUri *uri = NULL;
8648 hr = IUriBuilder_GetIUri(builder, &uri);
8649 ok(hr == S_OK,
8650 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8651 hr, S_OK, test_index);
8652 if(SUCCEEDED(hr)) {
8653 if(!uri) {
8654 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8655 ok(hr == S_OK,
8656 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8657 hr, S_OK, test_index);
8658 if(SUCCEEDED(hr)) {
8659 ok(has_port == FALSE,
8660 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8661 has_port, test_index);
8662 ok(!received, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8663 received, test_index);
8665 } else {
8666 DWORD expected;
8668 hr = IUri_GetPort(uri, &expected);
8669 ok(SUCCEEDED(hr),
8670 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8671 hr, test_index);
8673 hr = IUriBuilder_GetPort(builder, &has_port, &received);
8674 ok(hr == S_OK,
8675 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8676 hr, S_OK, test_index);
8677 if(SUCCEEDED(hr)) {
8678 ok(!has_port,
8679 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8680 test_index);
8681 ok(received == expected,
8682 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8683 expected, received, test_index);
8687 if(uri) IUri_Release(uri);
8691 static void test_IUriBuilder_GetQuery(IUriBuilder *builder, const uri_builder_test *test,
8692 DWORD test_index) {
8693 HRESULT hr;
8694 DWORD i;
8695 LPCWSTR received = NULL;
8696 DWORD len = -1;
8697 const uri_builder_property *prop = NULL;
8699 /* Check if the property was set earlier. */
8700 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8701 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_QUERY)
8702 prop = &(test->properties[i]);
8705 if(prop) {
8706 /* Use expected_value unless it's NULL, then use value. */
8707 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8708 hr = IUriBuilder_GetQuery(builder, &len, &received);
8709 if(prop->todo) {
8710 todo_wine {
8711 ok(hr == (expected ? S_OK : S_FALSE),
8712 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8713 hr, (expected ? S_OK : S_FALSE), test_index);
8715 if(SUCCEEDED(hr)) {
8716 todo_wine {
8717 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8718 expected, wine_dbgstr_w(received), test_index);
8720 todo_wine {
8721 ok(lstrlen(expected) == len,
8722 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8723 lstrlen(expected), len, test_index);
8726 } else {
8727 ok(hr == (expected ? S_OK : S_FALSE),
8728 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8729 hr, (expected ? S_OK : S_FALSE), test_index);
8730 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8731 expected, wine_dbgstr_w(received), test_index);
8732 ok(lstrlen(expected) == len,
8733 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8734 lstrlen(expected), len, test_index);
8736 } else {
8737 /* The property wasn't set earlier, so it should return whatever
8738 * the base IUri contains (if anything).
8740 IUri *uri = NULL;
8741 hr = IUriBuilder_GetIUri(builder, &uri);
8742 ok(hr == S_OK,
8743 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8744 hr, S_OK, test_index);
8745 if(SUCCEEDED(hr)) {
8746 if(!uri) {
8747 received = (void*) 0xdeadbeef;
8748 len = -1;
8750 hr = IUriBuilder_GetQuery(builder, &len, &received);
8751 ok(hr == S_FALSE,
8752 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8753 hr, S_FALSE, test_index);
8754 if(SUCCEEDED(hr)) {
8755 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8756 len, test_index);
8757 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8758 received, test_index);
8760 } else {
8761 BOOL has_prop = FALSE;
8762 BSTR expected = NULL;
8764 hr = IUri_GetQuery(uri, &expected);
8765 ok(SUCCEEDED(hr),
8766 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8767 hr, test_index);
8768 has_prop = hr == S_OK;
8770 hr = IUriBuilder_GetQuery(builder, &len, &received);
8771 if(has_prop) {
8772 ok(hr == S_OK,
8773 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8774 hr, S_OK, test_index);
8775 if(SUCCEEDED(hr)) {
8776 ok(!lstrcmpW(expected, received),
8777 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8778 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8779 ok(lstrlenW(expected) == len,
8780 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8781 lstrlenW(expected), len, test_index);
8783 } else {
8784 ok(hr == S_FALSE,
8785 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8786 hr, S_FALSE, test_index);
8787 if(SUCCEEDED(hr)) {
8788 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8789 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8790 len, test_index);
8793 SysFreeString(expected);
8796 if(uri) IUri_Release(uri);
8800 static void test_IUriBuilder_GetSchemeName(IUriBuilder *builder, const uri_builder_test *test,
8801 DWORD test_index) {
8802 HRESULT hr;
8803 DWORD i;
8804 LPCWSTR received = NULL;
8805 DWORD len = -1;
8806 const uri_builder_property *prop = NULL;
8808 /* Check if the property was set earlier. */
8809 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8810 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_SCHEME_NAME)
8811 prop = &(test->properties[i]);
8814 if(prop) {
8815 /* Use expected_value unless it's NULL, then use value. */
8816 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8817 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8818 if(prop->todo) {
8819 todo_wine {
8820 ok(hr == (expected ? S_OK : S_FALSE),
8821 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8822 hr, (expected ? S_OK : S_FALSE), test_index);
8824 if(SUCCEEDED(hr)) {
8825 todo_wine {
8826 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8827 expected, wine_dbgstr_w(received), test_index);
8829 todo_wine {
8830 ok(lstrlen(expected) == len,
8831 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8832 lstrlen(expected), len, test_index);
8835 } else {
8836 ok(hr == (expected ? S_OK : S_FALSE),
8837 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8838 hr, (expected ? S_OK : S_FALSE), test_index);
8839 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8840 expected, wine_dbgstr_w(received), test_index);
8841 ok(lstrlen(expected) == len,
8842 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8843 lstrlen(expected), len, test_index);
8845 } else {
8846 /* The property wasn't set earlier, so it should return whatever
8847 * the base IUri contains (if anything).
8849 IUri *uri = NULL;
8850 hr = IUriBuilder_GetIUri(builder, &uri);
8851 ok(hr == S_OK,
8852 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8853 hr, S_OK, test_index);
8854 if(SUCCEEDED(hr)) {
8855 if(!uri) {
8856 received = (void*) 0xdeadbeef;
8857 len = -1;
8859 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8860 ok(hr == S_FALSE,
8861 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8862 hr, S_FALSE, test_index);
8863 if(SUCCEEDED(hr)) {
8864 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8865 len, test_index);
8866 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8867 received, test_index);
8869 } else {
8870 BOOL has_prop = FALSE;
8871 BSTR expected = NULL;
8873 hr = IUri_GetSchemeName(uri, &expected);
8874 ok(SUCCEEDED(hr),
8875 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8876 hr, test_index);
8877 has_prop = hr == S_OK;
8879 hr = IUriBuilder_GetSchemeName(builder, &len, &received);
8880 if(has_prop) {
8881 ok(hr == S_OK,
8882 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8883 hr, S_OK, test_index);
8884 if(SUCCEEDED(hr)) {
8885 ok(!lstrcmpW(expected, received),
8886 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8887 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8888 ok(lstrlenW(expected) == len,
8889 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8890 lstrlenW(expected), len, test_index);
8892 } else {
8893 ok(hr == S_FALSE,
8894 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8895 hr, S_FALSE, test_index);
8896 if(SUCCEEDED(hr)) {
8897 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
8898 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8899 len, test_index);
8902 SysFreeString(expected);
8905 if(uri) IUri_Release(uri);
8909 static void test_IUriBuilder_GetUserName(IUriBuilder *builder, const uri_builder_test *test,
8910 DWORD test_index) {
8911 HRESULT hr;
8912 DWORD i;
8913 LPCWSTR received = NULL;
8914 DWORD len = -1;
8915 const uri_builder_property *prop = NULL;
8917 /* Check if the property was set earlier. */
8918 for(i = 0; i < sizeof(test->properties)/sizeof(test->properties[0]); ++i) {
8919 if(test->properties[i].change && test->properties[i].property == Uri_PROPERTY_USER_NAME)
8920 prop = &(test->properties[i]);
8923 if(prop && prop->value && *prop->value) {
8924 /* Use expected_value unless it's NULL, then use value. */
8925 LPCSTR expected = prop->expected_value ? prop->expected_value : prop->value;
8926 hr = IUriBuilder_GetUserName(builder, &len, &received);
8927 if(prop->todo) {
8928 todo_wine {
8929 ok(hr == (expected ? S_OK : S_FALSE),
8930 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8931 hr, (expected ? S_OK : S_FALSE), test_index);
8933 if(SUCCEEDED(hr)) {
8934 todo_wine {
8935 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8936 expected, wine_dbgstr_w(received), test_index);
8938 todo_wine {
8939 ok(lstrlen(expected) == len,
8940 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8941 lstrlen(expected), len, test_index);
8944 } else {
8945 ok(hr == (expected ? S_OK : S_FALSE),
8946 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8947 hr, (expected ? S_OK : S_FALSE), test_index);
8948 ok(!strcmp_aw(expected, received), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8949 expected, wine_dbgstr_w(received), test_index);
8950 ok(lstrlen(expected) == len,
8951 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8952 lstrlen(expected), len, test_index);
8954 } else {
8955 /* The property wasn't set earlier, so it should return whatever
8956 * the base IUri contains (if anything).
8958 IUri *uri = NULL;
8959 hr = IUriBuilder_GetIUri(builder, &uri);
8960 ok(hr == S_OK,
8961 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8962 hr, S_OK, test_index);
8963 if(SUCCEEDED(hr)) {
8964 if(!uri) {
8965 received = (void*) 0xdeadbeef;
8966 len = -1;
8968 hr = IUriBuilder_GetUserName(builder, &len, &received);
8969 ok(hr == S_FALSE,
8970 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8971 hr, S_FALSE, test_index);
8972 if(SUCCEEDED(hr)) {
8973 ok(!len, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8974 len, test_index);
8975 ok(!received, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8976 received, test_index);
8978 } else {
8979 BSTR expected = NULL;
8980 BOOL has_prop = FALSE;
8982 hr = IUri_GetUserName(uri, &expected);
8983 ok(SUCCEEDED(hr),
8984 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8985 hr, test_index);
8986 has_prop = hr == S_OK;
8988 hr = IUriBuilder_GetUserName(builder, &len, &received);
8989 if(has_prop) {
8990 ok(hr == S_OK,
8991 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8992 hr, S_OK, test_index);
8993 if(SUCCEEDED(hr)) {
8994 ok(!lstrcmpW(expected, received),
8995 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8996 wine_dbgstr_w(expected), wine_dbgstr_w(received), test_index);
8997 ok(lstrlenW(expected) == len,
8998 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8999 lstrlenW(expected), len, test_index);
9001 } else {
9002 ok(hr == S_FALSE,
9003 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9004 hr, S_FALSE, test_index);
9005 if(SUCCEEDED(hr)) {
9006 ok(!received, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index);
9007 ok(!len, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9008 len, test_index);
9011 SysFreeString(expected);
9014 if(uri) IUri_Release(uri);
9018 /* Tests IUriBuilder functions. */
9019 static void test_IUriBuilder(void) {
9020 HRESULT hr;
9021 IUriBuilder *builder;
9022 DWORD i;
9024 for(i = 0; i < sizeof(uri_builder_tests)/sizeof(uri_builder_tests[0]); ++i) {
9025 IUri *uri = NULL;
9026 uri_builder_test test = uri_builder_tests[i];
9027 LPWSTR uriW = NULL;
9029 if(test.uri) {
9030 uriW = a2w(test.uri);
9031 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9032 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9033 hr, S_OK, i);
9034 if(FAILED(hr)) continue;
9036 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9037 if(test.create_builder_todo) {
9038 todo_wine {
9039 ok(hr == test.create_builder_expected,
9040 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9041 hr, test.create_builder_expected, i);
9043 } else {
9044 ok(hr == test.create_builder_expected,
9045 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9046 hr, test.create_builder_expected, i);
9048 if(SUCCEEDED(hr)) {
9049 DWORD j;
9050 BOOL modified = FALSE, received = FALSE;
9052 /* Perform all the string property changes. */
9053 for(j = 0; j < URI_BUILDER_STR_PROPERTY_COUNT; ++j) {
9054 uri_builder_property prop = test.properties[j];
9055 if(prop.change) {
9056 change_property(builder, &prop, i);
9057 if(prop.property != Uri_PROPERTY_SCHEME_NAME &&
9058 prop.property != Uri_PROPERTY_HOST)
9059 modified = TRUE;
9060 else if(prop.value && *prop.value)
9061 modified = TRUE;
9062 else if(prop.value && !*prop.value && prop.property == Uri_PROPERTY_HOST)
9063 /* Host name property can't be NULL, but it can be empty. */
9064 modified = TRUE;
9068 if(test.port_prop.change) {
9069 hr = IUriBuilder_SetPort(builder, test.port_prop.set, test.port_prop.value);
9070 modified = TRUE;
9071 if(test.port_prop.todo) {
9072 todo_wine {
9073 ok(hr == test.port_prop.expected,
9074 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9075 hr, test.port_prop.expected, i);
9077 } else {
9078 ok(hr == test.port_prop.expected,
9079 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9080 hr, test.port_prop.expected, i);
9084 hr = IUriBuilder_HasBeenModified(builder, &received);
9085 ok(hr == S_OK,
9086 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9087 hr, S_OK, i);
9088 if(SUCCEEDED(hr))
9089 ok(received == modified,
9090 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9091 modified, received, i);
9093 /* Test the "Get*" functions. */
9094 test_IUriBuilder_GetFragment(builder, &test, i);
9095 test_IUriBuilder_GetHost(builder, &test, i);
9096 test_IUriBuilder_GetPassword(builder, &test, i);
9097 test_IUriBuilder_GetPath(builder, &test, i);
9098 test_IUriBuilder_GetPort(builder, &test, i);
9099 test_IUriBuilder_GetQuery(builder, &test, i);
9100 test_IUriBuilder_GetSchemeName(builder, &test, i);
9101 test_IUriBuilder_GetUserName(builder, &test, i);
9103 test_IUriBuilder_CreateUri(builder, &test, i);
9104 test_IUriBuilder_CreateUriSimple(builder, &test, i);
9105 test_IUriBuilder_CreateUriWithFlags(builder, &test, i);
9107 if(builder) IUriBuilder_Release(builder);
9108 if(uri) IUri_Release(uri);
9109 heap_free(uriW);
9113 static void test_IUriBuilder_HasBeenModified(void) {
9114 HRESULT hr;
9115 IUriBuilder *builder = NULL;
9117 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9118 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9119 if(SUCCEEDED(hr)) {
9120 static const WCHAR hostW[] = {'g','o','o','g','l','e','.','c','o','m',0};
9121 IUri *uri = NULL;
9122 BOOL received;
9124 hr = IUriBuilder_HasBeenModified(builder, NULL);
9125 ok(hr == E_POINTER, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9126 hr, E_POINTER);
9128 hr = IUriBuilder_SetHost(builder, hostW);
9129 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9130 hr, S_OK);
9132 hr = IUriBuilder_HasBeenModified(builder, &received);
9133 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9134 hr, S_OK);
9135 if(SUCCEEDED(hr))
9136 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9138 hr = pCreateUri(http_urlW, 0, 0, &uri);
9139 ok(hr == S_OK, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9140 if(SUCCEEDED(hr)) {
9141 LPCWSTR prop;
9142 DWORD len = -1;
9144 hr = IUriBuilder_SetIUri(builder, uri);
9145 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9146 hr, S_OK);
9148 hr = IUriBuilder_HasBeenModified(builder, &received);
9149 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9150 hr, S_OK);
9151 if(SUCCEEDED(hr))
9152 ok(received == FALSE, "Error: Expected received to be FALSE.\n");
9154 /* Test what happens with you call SetIUri with the same IUri again. */
9155 hr = IUriBuilder_SetHost(builder, hostW);
9156 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9158 hr = IUriBuilder_HasBeenModified(builder, &received);
9159 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9160 hr, S_OK);
9161 if(SUCCEEDED(hr))
9162 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9164 hr = IUriBuilder_SetIUri(builder, uri);
9165 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9167 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9168 * reset any of the changes that were made to the IUriBuilder.
9170 hr = IUriBuilder_HasBeenModified(builder, &received);
9171 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9172 if(SUCCEEDED(hr))
9173 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9175 hr = IUriBuilder_GetHost(builder, &len, &prop);
9176 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9177 if(SUCCEEDED(hr)) {
9178 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9179 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9180 ok(len == lstrlenW(hostW), "Error: Expected len to be %d, but was %d instead.\n",
9181 lstrlenW(hostW), len);
9184 hr = IUriBuilder_SetIUri(builder, NULL);
9185 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9187 hr = IUriBuilder_SetHost(builder, hostW);
9188 ok(hr == S_OK, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9189 hr = IUriBuilder_HasBeenModified(builder, &received);
9190 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9191 hr, S_OK);
9192 if(SUCCEEDED(hr))
9193 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9195 hr = IUriBuilder_SetIUri(builder, NULL);
9196 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr, S_OK);
9198 hr = IUriBuilder_HasBeenModified(builder, &received);
9199 ok(hr == S_OK, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9200 hr, S_OK);
9201 if(SUCCEEDED(hr))
9202 ok(received == TRUE, "Error: Expected received to be TRUE.\n");
9204 hr = IUriBuilder_GetHost(builder, &len, &prop);
9205 ok(hr == S_OK, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9206 if(SUCCEEDED(hr)) {
9207 ok(!lstrcmpW(prop, hostW), "Error: Expected %s but got %s instead.\n",
9208 wine_dbgstr_w(hostW), wine_dbgstr_w(prop));
9209 ok(len == lstrlenW(hostW), "Error: Expected len to %d, but was %d instead.\n",
9210 lstrlenW(hostW), len);
9213 if(uri) IUri_Release(uri);
9215 if(builder) IUriBuilder_Release(builder);
9218 /* Test IUriBuilder {Get,Set}IUri functions. */
9219 static void test_IUriBuilder_IUriProperty(void) {
9220 IUriBuilder *builder = NULL;
9221 HRESULT hr;
9223 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9224 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9225 if(SUCCEEDED(hr)) {
9226 IUri *uri = NULL;
9228 hr = IUriBuilder_GetIUri(builder, NULL);
9229 ok(hr == E_POINTER, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9230 hr, E_POINTER);
9232 hr = pCreateUri(http_urlW, 0, 0, &uri);
9233 if(SUCCEEDED(hr)) {
9234 IUri *test = NULL;
9235 ULONG cur_count, orig_count;
9237 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9238 orig_count = get_refcnt(uri);
9239 hr = IUriBuilder_SetIUri(builder, uri);
9240 cur_count = get_refcnt(uri);
9241 if(SUCCEEDED(hr))
9242 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9243 orig_count+1, cur_count);
9245 hr = IUriBuilder_SetIUri(builder, NULL);
9246 cur_count = get_refcnt(uri);
9247 if(SUCCEEDED(hr))
9248 ok(cur_count == orig_count, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9249 orig_count, cur_count);
9251 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9252 hr = IUriBuilder_SetIUri(builder, uri);
9253 ok(hr == S_OK, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9254 orig_count = get_refcnt(uri);
9256 hr = IUriBuilder_CreateUri(builder, 0, 0, 0, &test);
9257 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9258 if(SUCCEEDED(hr)) {
9259 cur_count = get_refcnt(uri);
9260 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9261 orig_count+1, cur_count);
9262 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n",
9263 uri, test);
9265 if(test) IUri_Release(test);
9267 test = NULL;
9268 hr = IUriBuilder_CreateUri(builder, -1, 0, 0, &test);
9269 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9270 if(SUCCEEDED(hr)) {
9271 cur_count = get_refcnt(uri);
9272 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9273 orig_count+1, cur_count);
9274 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9276 if(test) IUri_Release(test);
9278 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9279 * the base IUri.
9281 test = NULL;
9282 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, &test);
9283 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9284 if(SUCCEEDED(hr))
9285 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9287 if(test) IUri_Release(test);
9289 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9290 * explicitly set (because it's a default flags).
9292 test = NULL;
9293 hr = IUriBuilder_CreateUri(builder, Uri_CREATE_CANONICALIZE, 0, 0, &test);
9294 ok(hr == S_OK, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9295 if(SUCCEEDED(hr)) {
9296 cur_count = get_refcnt(uri);
9297 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9298 orig_count+1, cur_count);
9299 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9301 if(test) IUri_Release(test);
9303 test = NULL;
9304 hr = IUriBuilder_CreateUriSimple(builder, 0, 0, &test);
9305 ok(hr == S_OK, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9306 if(SUCCEEDED(hr)) {
9307 cur_count = get_refcnt(uri);
9308 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9309 orig_count+1, cur_count);
9310 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9312 if(test) IUri_Release(test);
9314 test = NULL;
9315 hr = IUriBuilder_CreateUriWithFlags(builder, 0, 0, 0, 0, &test);
9316 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9317 hr, S_OK);
9318 if(SUCCEEDED(hr)) {
9319 cur_count = get_refcnt(uri);
9320 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9321 orig_count+1, cur_count);
9322 ok(test == uri, "Error: Expected test to be %p, but was %p instead.\n", uri, test);
9324 if(test) IUri_Release(test);
9326 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9327 * the base IUri.
9329 test = NULL;
9330 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_ALLOW_RELATIVE, 0, 0, 0, &test);
9331 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9332 if(SUCCEEDED(hr))
9333 ok(test != uri, "Error: Wasn't expecting 'test' to be 'uri'\n");
9335 if(test) IUri_Release(test);
9337 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9338 * explicitly set (because it's a default flags).
9340 test = NULL;
9341 hr = IUriBuilder_CreateUriWithFlags(builder, Uri_CREATE_CANONICALIZE, 0, 0, 0, &test);
9342 ok(hr == S_OK, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9343 if(SUCCEEDED(hr)) {
9344 cur_count = get_refcnt(uri);
9345 ok(cur_count == orig_count+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9346 orig_count+1, cur_count);
9347 ok(test == uri, "Error: Expected 'test' to be %p, but was %p instead.\n", uri, test);
9349 if(test) IUri_Release(test);
9351 if(uri) IUri_Release(uri);
9353 if(builder) IUriBuilder_Release(builder);
9356 static void test_IUriBuilder_RemoveProperties(void) {
9357 IUriBuilder *builder = NULL;
9358 HRESULT hr;
9359 DWORD i;
9361 hr = pCreateIUriBuilder(NULL, 0, 0, &builder);
9362 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9363 if(SUCCEEDED(hr)) {
9364 /* Properties that can't be removed. */
9365 const DWORD invalid = Uri_HAS_ABSOLUTE_URI|Uri_HAS_DISPLAY_URI|Uri_HAS_RAW_URI|Uri_HAS_HOST_TYPE|
9366 Uri_HAS_SCHEME|Uri_HAS_ZONE;
9368 for(i = Uri_PROPERTY_STRING_START; i <= Uri_PROPERTY_DWORD_LAST; ++i) {
9369 hr = IUriBuilder_RemoveProperties(builder, i << 1);
9370 if((i << 1) & invalid) {
9371 ok(hr == E_INVALIDARG,
9372 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9373 hr, E_INVALIDARG, i);
9374 } else {
9375 ok(hr == S_OK,
9376 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9377 hr, S_OK, i);
9381 /* Also doesn't accept anything that's outside the range of the
9382 * Uri_HAS flags.
9384 hr = IUriBuilder_RemoveProperties(builder, (Uri_PROPERTY_DWORD_LAST+1) << 1);
9385 ok(hr == E_INVALIDARG, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9386 hr, E_INVALIDARG);
9388 if(builder) IUriBuilder_Release(builder);
9390 for(i = 0; i < sizeof(uri_builder_remove_tests)/sizeof(uri_builder_remove_tests[0]); ++i) {
9391 uri_builder_remove_test test = uri_builder_remove_tests[i];
9392 IUri *uri = NULL;
9393 LPWSTR uriW;
9395 uriW = a2w(test.uri);
9396 hr = pCreateUri(uriW, test.create_flags, 0, &uri);
9397 if(SUCCEEDED(hr)) {
9398 builder = NULL;
9400 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9401 if(test.create_builder_todo) {
9402 todo_wine {
9403 ok(hr == test.create_builder_expected,
9404 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9405 hr, test.create_builder_expected, i);
9407 } else {
9408 ok(hr == test.create_builder_expected,
9409 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9410 hr, test.create_builder_expected, i);
9412 if(SUCCEEDED(hr)) {
9413 hr = IUriBuilder_RemoveProperties(builder, test.remove_properties);
9414 if(test.remove_todo) {
9415 todo_wine {
9416 ok(hr == test.remove_expected,
9417 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9418 hr, test.remove_expected, i);
9420 } else {
9421 ok(hr == test.remove_expected,
9422 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9423 hr, test.remove_expected, i);
9425 if(SUCCEEDED(hr)) {
9426 IUri *result = NULL;
9428 hr = IUriBuilder_CreateUri(builder, test.expected_flags, 0, 0, &result);
9429 if(test.expected_todo) {
9430 todo_wine {
9431 ok(hr == test.expected_hres,
9432 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9433 hr, test.expected_hres, i);
9435 } else {
9436 ok(hr == test.expected_hres,
9437 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9438 hr, test.expected_hres, i);
9440 if(SUCCEEDED(hr)) {
9441 BSTR received = NULL;
9443 hr = IUri_GetAbsoluteUri(result, &received);
9444 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9445 ok(!strcmp_aw(test.expected_uri, received),
9446 "Error: Expected %s but got %s instead on test %d.\n",
9447 test.expected_uri, wine_dbgstr_w(received), i);
9448 SysFreeString(received);
9450 if(result) IUri_Release(result);
9453 if(builder) IUriBuilder_Release(builder);
9455 if(uri) IUri_Release(uri);
9456 heap_free(uriW);
9460 static void test_IUriBuilder_Misc(void) {
9461 HRESULT hr;
9462 IUri *uri;
9464 hr = pCreateUri(http_urlW, 0, 0, &uri);
9465 if(SUCCEEDED(hr)) {
9466 IUriBuilder *builder;
9468 hr = pCreateIUriBuilder(uri, 0, 0, &builder);
9469 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9470 if(SUCCEEDED(hr)) {
9471 BOOL has = -1;
9472 DWORD port = -1;
9474 hr = IUriBuilder_GetPort(builder, &has, &port);
9475 ok(hr == S_OK, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9476 if(SUCCEEDED(hr)) {
9477 /* 'has' will be set to FALSE, even though uri had a port. */
9478 ok(has == FALSE, "Error: Expected 'has' to be FALSE, was %d instead.\n", has);
9479 /* Still sets 'port' to 80. */
9480 ok(port == 80, "Error: Expected the port to be 80, but, was %d instead.\n", port);
9483 if(builder) IUriBuilder_Release(builder);
9485 if(uri) IUri_Release(uri);
9488 static void test_IUriBuilderFactory(void) {
9489 HRESULT hr;
9490 IUri *uri;
9491 IUriBuilderFactory *factory;
9492 IUriBuilder *builder;
9494 hr = pCreateUri(http_urlW, 0, 0, &uri);
9495 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9496 if(SUCCEEDED(hr)) {
9497 factory = NULL;
9498 hr = IUri_QueryInterface(uri, &IID_IUriBuilderFactory, (void**)&factory);
9499 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x.\n", hr);
9500 ok(factory != NULL, "Error: Expected 'factory' to not be NULL.\n");
9502 if(SUCCEEDED(hr)) {
9503 builder = (void*) 0xdeadbeef;
9504 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 10, 0, &builder);
9505 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9506 hr, E_INVALIDARG);
9507 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9509 builder = (void*) 0xdeadbeef;
9510 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 10, &builder);
9511 ok(hr == E_INVALIDARG, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9512 hr, E_INVALIDARG);
9513 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9515 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, NULL);
9516 ok(hr == E_POINTER, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9517 hr, E_POINTER);
9519 builder = NULL;
9520 hr = IUriBuilderFactory_CreateIUriBuilder(factory, 0, 0, &builder);
9521 ok(hr == S_OK, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9522 hr, S_OK);
9523 if(SUCCEEDED(hr)) {
9524 IUri *tmp = (void*) 0xdeadbeef;
9525 LPCWSTR result;
9526 DWORD result_len;
9528 hr = IUriBuilder_GetIUri(builder, &tmp);
9529 ok(hr == S_OK, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9530 hr, S_OK);
9531 ok(!tmp, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp);
9533 hr = IUriBuilder_GetHost(builder, &result_len, &result);
9534 ok(hr == S_FALSE, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9535 hr, S_FALSE);
9537 if(builder) IUriBuilder_Release(builder);
9539 builder = (void*) 0xdeadbeef;
9540 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 10, 0, &builder);
9541 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9542 hr, E_INVALIDARG);
9543 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9545 builder = (void*) 0xdeadbeef;
9546 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 10, &builder);
9547 ok(hr == E_INVALIDARG, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9548 hr, E_INVALIDARG);
9549 ok(!builder, "Error: Expected 'builder' to be NULL, but was %p.\n", builder);
9551 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, NULL);
9552 ok(hr == E_POINTER, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9553 hr, E_POINTER);
9555 builder = NULL;
9556 hr = IUriBuilderFactory_CreateInitializedIUriBuilder(factory, 0, 0, &builder);
9557 ok(hr == S_OK, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9558 hr, S_OK);
9559 if(SUCCEEDED(hr)) {
9560 IUri *tmp = NULL;
9562 hr = IUriBuilder_GetIUri(builder, &tmp);
9563 ok(hr == S_OK, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9564 hr, S_OK);
9565 ok(tmp == uri, "Error: Expected tmp to be %p, but was %p.\n", uri, tmp);
9566 if(uri) IUri_Release(uri);
9568 if(builder) IUriBuilder_Release(builder);
9570 if(factory) IUriBuilderFactory_Release(factory);
9572 if(uri) IUri_Release(uri);
9575 static void test_CoInternetCombineIUri(void) {
9576 HRESULT hr;
9577 IUri *base, *relative, *result;
9578 DWORD i;
9580 base = NULL;
9581 hr = pCreateUri(http_urlW, 0, 0, &base);
9582 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9583 if(SUCCEEDED(hr)) {
9584 result = (void*) 0xdeadbeef;
9585 hr = pCoInternetCombineIUri(base, NULL, 0, &result, 0);
9586 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9587 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9590 relative = NULL;
9591 hr = pCreateUri(http_urlW, 0, 0, &relative);
9592 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr);
9593 if(SUCCEEDED(hr)) {
9594 result = (void*) 0xdeadbeef;
9595 hr = pCoInternetCombineIUri(NULL, relative, 0, &result, 0);
9596 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9597 ok(!result, "Error: Expected 'result' to be NULL, was %p.\n", result);
9600 hr = pCoInternetCombineIUri(base, relative, 0, NULL, 0);
9601 ok(hr == E_INVALIDARG, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, E_INVALIDARG);
9603 if(base) IUri_Release(base);
9604 if(relative) IUri_Release(relative);
9606 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9607 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9609 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9610 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9611 if(SUCCEEDED(hr)) {
9612 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9614 hr = pCreateUri(relativeW, uri_combine_tests[i].relative_create_flags, 0, &relative);
9615 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr, i);
9616 if(SUCCEEDED(hr)) {
9617 result = NULL;
9619 hr = pCoInternetCombineIUri(base, relative, uri_combine_tests[i].combine_flags, &result, 0);
9620 if(uri_combine_tests[i].todo) {
9621 todo_wine {
9622 ok(hr == uri_combine_tests[i].expected,
9623 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9624 hr, uri_combine_tests[i].expected, i);
9626 } else {
9627 ok(hr == uri_combine_tests[i].expected,
9628 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9629 hr, uri_combine_tests[i]. expected, i);
9631 if(SUCCEEDED(hr)) {
9632 DWORD j;
9634 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9635 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9636 BSTR received;
9638 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9639 if(prop.todo) {
9640 todo_wine {
9641 ok(hr == prop.expected,
9642 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9643 hr, prop.expected, i, j);
9645 todo_wine {
9646 ok(!strcmp_aw(prop.value, received) ||
9647 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9648 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9649 prop.value, wine_dbgstr_w(received), i, j);
9651 } else {
9652 ok(hr == prop.expected,
9653 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9654 hr, prop.expected, i, j);
9655 ok(!strcmp_aw(prop.value, received) ||
9656 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9657 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9658 prop.value, wine_dbgstr_w(received), i, j);
9660 SysFreeString(received);
9663 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9664 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9665 DWORD received;
9667 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9668 if(prop.todo) {
9669 todo_wine {
9670 ok(hr == prop.expected,
9671 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9672 hr, prop.expected, i, j);
9674 todo_wine {
9675 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9676 prop.value, received, i, j);
9678 } else {
9679 ok(hr == prop.expected,
9680 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9681 hr, prop.expected, i, j);
9682 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9683 prop.value, received, i, j);
9687 if(result) IUri_Release(result);
9689 if(relative) IUri_Release(relative);
9690 heap_free(relativeW);
9692 if(base) IUri_Release(base);
9693 heap_free(baseW);
9697 static HRESULT WINAPI InternetProtocolInfo_QueryInterface(IInternetProtocolInfo *iface,
9698 REFIID riid, void **ppv)
9700 ok(0, "unexpected call\n");
9701 return E_NOINTERFACE;
9704 static ULONG WINAPI InternetProtocolInfo_AddRef(IInternetProtocolInfo *iface)
9706 return 2;
9709 static ULONG WINAPI InternetProtocolInfo_Release(IInternetProtocolInfo *iface)
9711 return 1;
9714 static HRESULT WINAPI InternetProtocolInfo_ParseUrl(IInternetProtocolInfo *iface, LPCWSTR pwzUrl,
9715 PARSEACTION ParseAction, DWORD dwParseFlags, LPWSTR pwzResult, DWORD cchResult,
9716 DWORD *pcchResult, DWORD dwReserved)
9718 CHECK_EXPECT(ParseUrl);
9719 ok(!lstrcmpW(pwzUrl, parse_urlW), "Error: Expected %s, but got %s instead.\n",
9720 wine_dbgstr_w(parse_urlW), wine_dbgstr_w(pwzUrl));
9721 ok(ParseAction == parse_action, "Error: Expected %d, but got %d.\n", parse_action, ParseAction);
9722 ok(dwParseFlags == parse_flags, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags, dwParseFlags);
9723 ok(cchResult == 200, "Error: Got %d.\n", cchResult);
9725 memcpy(pwzResult, parse_resultW, sizeof(parse_resultW));
9726 *pcchResult = lstrlenW(parse_resultW);
9728 return S_OK;
9731 static HRESULT WINAPI InternetProtocolInfo_CombineUrl(IInternetProtocolInfo *iface,
9732 LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags,
9733 LPWSTR pwzResult, DWORD cchResult, DWORD *pcchResult, DWORD dwReserved)
9735 CHECK_EXPECT(CombineUrl);
9736 ok(!lstrcmpW(pwzBaseUrl, combine_baseW), "Error: Expected %s, but got %s instead.\n",
9737 wine_dbgstr_w(combine_baseW), wine_dbgstr_w(pwzBaseUrl));
9738 ok(!lstrcmpW(pwzRelativeUrl, combine_relativeW), "Error: Expected %s, but got %s instead.\n",
9739 wine_dbgstr_w(combine_relativeW), wine_dbgstr_w(pwzRelativeUrl));
9740 ok(dwCombineFlags == (URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO),
9741 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags);
9742 ok(cchResult == INTERNET_MAX_URL_LENGTH+1, "Error: Got %d.\n", cchResult);
9744 memcpy(pwzResult, combine_resultW, sizeof(combine_resultW));
9745 *pcchResult = lstrlenW(combine_resultW);
9747 return S_OK;
9750 static HRESULT WINAPI InternetProtocolInfo_CompareUrl(IInternetProtocolInfo *iface,
9751 LPCWSTR pwzUrl1, LPCWSTR pwzUrl2, DWORD dwCompareFlags)
9753 ok(0, "unexpected call\n");
9754 return E_NOTIMPL;
9757 static HRESULT WINAPI InternetProtocolInfo_QueryInfo(IInternetProtocolInfo *iface,
9758 LPCWSTR pwzUrl, QUERYOPTION OueryOption, DWORD dwQueryFlags, LPVOID pBuffer,
9759 DWORD cbBuffer, DWORD *pcbBuf, DWORD dwReserved)
9761 ok(0, "unexpected call\n");
9762 return E_NOTIMPL;
9765 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl = {
9766 InternetProtocolInfo_QueryInterface,
9767 InternetProtocolInfo_AddRef,
9768 InternetProtocolInfo_Release,
9769 InternetProtocolInfo_ParseUrl,
9770 InternetProtocolInfo_CombineUrl,
9771 InternetProtocolInfo_CompareUrl,
9772 InternetProtocolInfo_QueryInfo
9775 static IInternetProtocolInfo protocol_info = { &InternetProtocolInfoVtbl };
9777 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
9779 if(IsEqualGUID(&IID_IInternetProtocolInfo, riid)) {
9780 *ppv = &protocol_info;
9781 return S_OK;
9784 ok(0, "unexpected call\n");
9785 return E_NOINTERFACE;
9788 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
9790 return 2;
9793 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
9795 return 1;
9798 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *pOuter,
9799 REFIID riid, void **ppv)
9801 ok(0, "unexpected call\n");
9802 return E_NOTIMPL;
9805 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
9807 ok(0, "unexpected call\n");
9808 return S_OK;
9811 static const IClassFactoryVtbl ClassFactoryVtbl = {
9812 ClassFactory_QueryInterface,
9813 ClassFactory_AddRef,
9814 ClassFactory_Release,
9815 ClassFactory_CreateInstance,
9816 ClassFactory_LockServer
9819 static IClassFactory protocol_cf = { &ClassFactoryVtbl };
9821 static void register_protocols(void)
9823 IInternetSession *session;
9824 HRESULT hres;
9826 hres = pCoInternetGetSession(0, &session, 0);
9827 ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
9828 if(FAILED(hres))
9829 return;
9831 hres = IInternetSession_RegisterNameSpace(session, &protocol_cf, &IID_NULL,
9832 winetestW, 0, NULL, 0);
9833 ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
9835 IInternetSession_Release(session);
9838 static void unregister_protocols(void) {
9839 IInternetSession *session;
9840 HRESULT hr;
9842 hr = pCoInternetGetSession(0, &session, 0);
9843 ok(hr == S_OK, "CoInternetGetSession failed: 0x%08x\n", hr);
9844 if(FAILED(hr))
9845 return;
9847 hr = IInternetSession_UnregisterNameSpace(session, &protocol_cf, winetestW);
9848 ok(hr == S_OK, "UnregisterNameSpace failed: 0x%08x\n", hr);
9850 IInternetSession_Release(session);
9853 static void test_CoInternetCombineIUri_Pluggable(void) {
9854 HRESULT hr;
9855 IUri *base = NULL;
9857 hr = pCreateUri(combine_baseW, 0, 0, &base);
9858 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9859 if(SUCCEEDED(hr)) {
9860 IUri *relative = NULL;
9862 hr = pCreateUri(combine_relativeW, Uri_CREATE_ALLOW_RELATIVE, 0, &relative);
9863 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9864 if(SUCCEEDED(hr)) {
9865 IUri *result = NULL;
9867 SET_EXPECT(CombineUrl);
9869 hr = pCoInternetCombineIUri(base, relative, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
9870 &result, 0);
9871 ok(hr == S_OK, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
9873 CHECK_CALLED(CombineUrl);
9875 if(SUCCEEDED(hr)) {
9876 BSTR received = NULL;
9877 hr = IUri_GetAbsoluteUri(result, &received);
9878 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
9879 if(SUCCEEDED(hr)) {
9880 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
9881 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
9883 SysFreeString(received);
9885 if(result) IUri_Release(result);
9887 if(relative) IUri_Release(relative);
9889 if(base) IUri_Release(base);
9892 static void test_CoInternetCombineUrlEx(void) {
9893 HRESULT hr;
9894 IUri *base, *result;
9895 DWORD i;
9897 base = NULL;
9898 hr = pCreateUri(http_urlW, 0, 0, &base);
9899 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
9900 if(SUCCEEDED(hr)) {
9901 result = (void*) 0xdeadbeef;
9902 hr = pCoInternetCombineUrlEx(base, NULL, 0, &result, 0);
9903 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9904 hr, E_UNEXPECTED);
9905 ok(!result, "Error: Expected 'result' to be NULL was %p instead.\n", result);
9908 result = (void*) 0xdeadbeef;
9909 hr = pCoInternetCombineUrlEx(NULL, http_urlW, 0, &result, 0);
9910 ok(hr == E_INVALIDARG, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9911 hr, E_INVALIDARG);
9912 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9914 result = (void*) 0xdeadbeef;
9915 hr = pCoInternetCombineUrlEx(NULL, NULL, 0, &result, 0);
9916 ok(hr == E_UNEXPECTED, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9917 hr, E_UNEXPECTED);
9918 ok(!result, "Error: Expected 'result' to be NULL, but was %p instead.\n", result);
9920 hr = pCoInternetCombineUrlEx(base, http_urlW, 0, NULL, 0);
9921 ok(hr == E_POINTER, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
9922 hr, E_POINTER);
9923 if(base) IUri_Release(base);
9925 for(i = 0; i < sizeof(uri_combine_tests)/sizeof(uri_combine_tests[0]); ++i) {
9926 LPWSTR baseW = a2w(uri_combine_tests[i].base_uri);
9928 hr = pCreateUri(baseW, uri_combine_tests[i].base_create_flags, 0, &base);
9929 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr, i);
9930 if(SUCCEEDED(hr)) {
9931 LPWSTR relativeW = a2w(uri_combine_tests[i].relative_uri);
9933 hr = pCoInternetCombineUrlEx(base, relativeW, uri_combine_tests[i].combine_flags,
9934 &result, 0);
9935 if(uri_combine_tests[i].todo) {
9936 todo_wine {
9937 ok(hr == uri_combine_tests[i].expected,
9938 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9939 hr, uri_combine_tests[i].expected, i);
9941 } else {
9942 ok(hr == uri_combine_tests[i].expected,
9943 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9944 hr, uri_combine_tests[i]. expected, i);
9946 if(SUCCEEDED(hr)) {
9947 DWORD j;
9949 for(j = 0; j < sizeof(uri_combine_tests[i].str_props)/sizeof(uri_combine_tests[i].str_props[0]); ++j) {
9950 uri_combine_str_property prop = uri_combine_tests[i].str_props[j];
9951 BSTR received;
9952 LPCSTR value = (prop.value_ex) ? prop.value_ex : prop.value;
9954 hr = IUri_GetPropertyBSTR(result, j, &received, 0);
9955 if(prop.todo) {
9956 todo_wine {
9957 ok(hr == prop.expected,
9958 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9959 hr, prop.expected, i, j);
9961 todo_wine {
9962 ok(!strcmp_aw(value, received) ||
9963 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9964 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9965 value, wine_dbgstr_w(received), i, j);
9967 } else {
9968 ok(hr == prop.expected,
9969 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9970 hr, prop.expected, i, j);
9971 ok(!strcmp_aw(value, received) ||
9972 broken(prop.broken_value && !strcmp_aw(prop.broken_value, received)),
9973 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9974 value, wine_dbgstr_w(received), i, j);
9976 SysFreeString(received);
9979 for(j = 0; j < sizeof(uri_combine_tests[i].dword_props)/sizeof(uri_combine_tests[i].dword_props[0]); ++j) {
9980 uri_dword_property prop = uri_combine_tests[i].dword_props[j];
9981 DWORD received;
9983 hr = IUri_GetPropertyDWORD(result, j+Uri_PROPERTY_DWORD_START, &received, 0);
9984 if(prop.todo) {
9985 todo_wine {
9986 ok(hr == prop.expected,
9987 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9988 hr, prop.expected, i, j);
9990 todo_wine {
9991 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9992 prop.value, received, i, j);
9994 } else {
9995 ok(hr == prop.expected,
9996 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9997 hr, prop.expected, i, j);
9998 ok(prop.value == received, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9999 prop.value, received, i, j);
10003 if(result) IUri_Release(result);
10004 heap_free(relativeW);
10006 if(base) IUri_Release(base);
10007 heap_free(baseW);
10011 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10012 HRESULT hr;
10013 IUri *base = NULL;
10015 hr = pCreateUri(combine_baseW, 0, 0, &base);
10016 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10017 if(SUCCEEDED(hr)) {
10018 IUri *result = NULL;
10020 SET_EXPECT(CombineUrl);
10022 hr = pCoInternetCombineUrlEx(base, combine_relativeW, URL_DONT_SIMPLIFY|URL_FILE_USE_PATHURL|URL_DONT_UNESCAPE_EXTRA_INFO,
10023 &result, 0);
10024 ok(hr == S_OK, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10026 CHECK_CALLED(CombineUrl);
10028 if(SUCCEEDED(hr)) {
10029 BSTR received = NULL;
10030 hr = IUri_GetAbsoluteUri(result, &received);
10031 ok(hr == S_OK, "Error: Expected S_OK, but got 0x%08x instead.\n", hr);
10032 if(SUCCEEDED(hr)) {
10033 ok(!lstrcmpW(combine_resultW, received), "Error: Expected %s, but got %s.\n",
10034 wine_dbgstr_w(combine_resultW), wine_dbgstr_w(received));
10036 SysFreeString(received);
10038 if(result) IUri_Release(result);
10040 if(base) IUri_Release(base);
10043 static void test_CoInternetParseIUri_InvalidArgs(void) {
10044 HRESULT hr;
10045 IUri *uri = NULL;
10046 WCHAR tmp[3];
10047 DWORD result = -1;
10049 hr = pCoInternetParseIUri(NULL, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10050 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10051 hr, E_INVALIDARG);
10052 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10054 hr = pCreateUri(http_urlW, 0, 0, &uri);
10055 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x.\n", hr);
10056 if(SUCCEEDED(hr)) {
10057 DWORD expected_len;
10059 result = -1;
10060 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, NULL, 0, &result, 0);
10061 ok(hr == E_INVALIDARG, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10062 hr, E_INVALIDARG);
10063 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10065 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, NULL, 0);
10066 ok(hr == E_POINTER, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10067 hr, E_POINTER);
10069 result = -1;
10070 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_URL, 0, tmp, 3, &result, 0);
10071 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10072 hr, E_FAIL);
10073 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10075 result = -1;
10076 hr = pCoInternetParseIUri(uri, PARSE_MIME, 0, tmp, 3, &result, 0);
10077 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10078 hr, E_FAIL);
10079 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10081 result = -1;
10082 hr = pCoInternetParseIUri(uri, PARSE_SERVER, 0, tmp, 3, &result, 0);
10083 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10084 hr, E_FAIL);
10085 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10087 result = -1;
10088 hr = pCoInternetParseIUri(uri, PARSE_SECURITY_DOMAIN, 0, tmp, 3, &result, 0);
10089 ok(hr == E_FAIL, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10090 hr, E_FAIL);
10091 ok(!result, "Error: Expected 'result' to be 0, but was %d.\n", result);
10093 expected_len = lstrlenW(http_urlW);
10094 result = -1;
10095 hr = pCoInternetParseIUri(uri, PARSE_CANONICALIZE, 0, tmp, 3, &result, 0);
10096 ok(hr == STRSAFE_E_INSUFFICIENT_BUFFER,
10097 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10098 hr, STRSAFE_E_INSUFFICIENT_BUFFER);
10099 ok(result == expected_len, "Error: Expected 'result' to be %d, but was %d instead.\n",
10100 expected_len, result);
10102 if(uri) IUri_Release(uri);
10105 static void test_CoInternetParseIUri(void) {
10106 DWORD i;
10108 for(i = 0; i < sizeof(uri_parse_tests)/sizeof(uri_parse_tests[0]); ++i) {
10109 HRESULT hr;
10110 IUri *uri;
10111 LPWSTR uriW;
10112 uri_parse_test test = uri_parse_tests[i];
10114 uriW = a2w(test.uri);
10115 hr = pCreateUri(uriW, test.uri_flags, 0, &uri);
10116 ok(SUCCEEDED(hr), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr, i);
10117 if(SUCCEEDED(hr)) {
10118 WCHAR result[INTERNET_MAX_URL_LENGTH+1];
10119 DWORD result_len = -1;
10121 hr = pCoInternetParseIUri(uri, test.action, test.flags, result, INTERNET_MAX_URL_LENGTH+1, &result_len, 0);
10122 if(test.todo) {
10123 todo_wine {
10124 ok(hr == test.expected,
10125 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10126 hr, test.expected, i);
10128 } else {
10129 ok(hr == test.expected,
10130 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10131 hr, test.expected, i);
10133 if(SUCCEEDED(hr)) {
10134 DWORD len = lstrlenA(test.property);
10135 ok(!strcmp_aw(test.property, result),
10136 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10137 test.property, wine_dbgstr_w(result), i);
10138 ok(len == result_len,
10139 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10140 len, result_len, i);
10141 } else {
10142 ok(!result_len,
10143 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10144 result_len, i);
10147 if(uri) IUri_Release(uri);
10148 heap_free(uriW);
10152 static void test_CoInternetParseIUri_Pluggable(void) {
10153 HRESULT hr;
10154 IUri *uri = NULL;
10156 hr = pCreateUri(parse_urlW, 0, 0, &uri);
10157 ok(SUCCEEDED(hr), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr);
10158 if(SUCCEEDED(hr)) {
10159 WCHAR result[200];
10160 DWORD result_len;
10162 SET_EXPECT(ParseUrl);
10164 parse_action = PARSE_CANONICALIZE;
10165 parse_flags = URL_UNESCAPE|URL_ESCAPE_UNSAFE;
10167 hr = pCoInternetParseIUri(uri, parse_action, parse_flags, result, 200, &result_len, 0);
10168 ok(hr == S_OK, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr, S_OK);
10170 CHECK_CALLED(ParseUrl);
10172 if(SUCCEEDED(hr)) {
10173 ok(result_len == lstrlenW(parse_resultW), "Error: Expected %d, but got %d.\n",
10174 lstrlenW(parse_resultW), result_len);
10175 ok(!lstrcmpW(result, parse_resultW), "Error: Expected %s, but got %s.\n",
10176 wine_dbgstr_w(parse_resultW), wine_dbgstr_w(result));
10179 if(uri) IUri_Release(uri);
10182 typedef struct {
10183 const char *url;
10184 DWORD uri_flags;
10185 const char *base_url;
10186 DWORD base_uri_flags;
10187 const char *legacy_url;
10188 const char *uniform_url;
10189 const char *no_canon_url;
10190 const char *uri_url;
10191 } create_urlmon_test_t;
10193 static const create_urlmon_test_t create_urlmon_tests[] = {
10195 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE,
10196 NULL,0,
10197 "http://www.winehq.org/",
10198 "http://www.winehq.org/",
10199 "http://www.winehq.org",
10200 "http://www.winehq.org"
10203 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE,
10204 NULL,0,
10205 "file://c:\\dir\\file.txt",
10206 "file:///c:/dir/file.txt",
10207 "file:///c:/dir/file.txt",
10208 "file:///c:/dir/file.txt"
10211 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH,
10212 NULL,0,
10213 "file://c:\\dir\\file.txt",
10214 "file:///c:/dir/file.txt",
10215 "file:///c:/dir/file.txt",
10216 "file://c:\\dir\\file.txt"
10219 "dat%61",Uri_CREATE_ALLOW_RELATIVE,
10220 "http://www.winehq.org",0,
10221 "http://www.winehq.org/data",
10222 "http://www.winehq.org/data",
10223 "http://www.winehq.org:80/data",
10226 "file.txt",Uri_CREATE_ALLOW_RELATIVE,
10227 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE,
10228 "file://c:\\dir\\file.txt",
10229 "file:///c:/dir/file.txt",
10230 "file:///c:/dir/file.txt",
10233 "",Uri_CREATE_ALLOW_RELATIVE,
10234 NULL,0,
10241 "test",Uri_CREATE_ALLOW_RELATIVE,
10242 NULL,0,
10243 "test",
10244 "test",
10245 "test",
10246 "test"
10249 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME,
10250 NULL,0,
10251 "file://c:\\dir\\file.txt",
10252 "file:///c:/dir/file.txt",
10253 "file:///c:/dir/file.txt",
10254 "file:///c:/dir/file.txt",
10258 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10259 static void _test_urlmon_display_name(unsigned line, IMoniker *mon, const char *exurl)
10261 WCHAR *display_name;
10262 HRESULT hres;
10264 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &display_name);
10265 ok_(__FILE__,line)(hres == S_OK, "GetDisplayName failed: %08x\n", hres);
10266 ok_(__FILE__,line)(!strcmp_aw(exurl, display_name), "unexpected display name: %s, expected %s\n",
10267 wine_dbgstr_w(display_name), exurl);
10269 CoTaskMemFree(display_name);
10272 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10273 static void _test_display_uri(unsigned line, IMoniker *mon, const char *exurl)
10275 IUriContainer *uri_container;
10276 IUri *uri;
10277 BSTR display_uri;
10278 HRESULT hres;
10280 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
10281 ok(hres == S_OK, "Could not get IUriContainer iface: %08x\n", hres);
10283 uri = NULL;
10284 hres = IUriContainer_GetIUri(uri_container, &uri);
10285 IUriContainer_Release(uri_container);
10286 ok(hres == S_OK, "GetIUri failed: %08x\n", hres);
10287 ok(uri != NULL, "uri == NULL\n");
10289 hres = IUri_GetDisplayUri(uri, &display_uri);
10290 IUri_Release(uri);
10291 ok(hres == S_OK, "GetDisplayUri failed: %08x\n", hres);
10292 ok_(__FILE__,line)(!strcmp_aw(exurl, display_uri), "unexpected display uri: %s, expected %s\n",
10293 wine_dbgstr_w(display_uri), exurl);
10294 SysFreeString(display_uri);
10297 static void test_CreateURLMoniker(void)
10299 const create_urlmon_test_t *test;
10300 IMoniker *mon, *base_mon;
10301 WCHAR *url, *base_url;
10302 IUri *uri, *base_uri;
10303 HRESULT hres;
10305 for(test = create_urlmon_tests; test < create_urlmon_tests + sizeof(create_urlmon_tests)/sizeof(*create_urlmon_tests); test++) {
10306 url = a2w(test->url);
10307 base_url = a2w(test->base_url);
10309 if(base_url) {
10310 hres = pCreateUri(base_url, test->base_uri_flags, 0, &base_uri);
10311 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10313 hres = pCreateURLMonikerEx2(NULL, base_uri, &base_mon, URL_MK_NO_CANONICALIZE);
10314 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10315 }else {
10316 base_uri = NULL;
10317 base_mon = NULL;
10320 hres = CreateURLMoniker(base_mon, url, &mon);
10321 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10322 test_urlmon_display_name(mon, test->legacy_url);
10323 test_display_uri(mon, test->legacy_url);
10324 IMoniker_Release(mon);
10326 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_LEGACY);
10327 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10328 test_urlmon_display_name(mon, test->legacy_url);
10329 test_display_uri(mon, test->legacy_url);
10330 IMoniker_Release(mon);
10332 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_UNIFORM);
10333 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10334 test_urlmon_display_name(mon, test->uniform_url);
10335 test_display_uri(mon, test->uniform_url);
10336 IMoniker_Release(mon);
10338 hres = pCreateURLMonikerEx(base_mon, url, &mon, URL_MK_NO_CANONICALIZE);
10339 ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
10340 test_urlmon_display_name(mon, test->no_canon_url);
10341 test_display_uri(mon, test->no_canon_url);
10342 IMoniker_Release(mon);
10344 hres = pCreateUri(url, test->uri_flags, 0, &uri);
10345 ok(hres == S_OK, "CreateUri failed: %08x\n", hres);
10347 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_LEGACY);
10348 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10349 test_urlmon_display_name(mon, base_url ? test->legacy_url : test->uri_url);
10350 test_display_uri(mon, base_url ? test->legacy_url : test->uri_url);
10351 IMoniker_Release(mon);
10353 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_UNIFORM);
10354 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10355 test_urlmon_display_name(mon, base_url ? test->uniform_url : test->uri_url);
10356 test_display_uri(mon, base_url ? test->uniform_url : test->uri_url);
10357 IMoniker_Release(mon);
10359 hres = pCreateURLMonikerEx2(base_mon, uri, &mon, URL_MK_NO_CANONICALIZE);
10360 ok(hres == S_OK, "CreateURLMonikerEx2 failed: %08x\n", hres);
10361 test_urlmon_display_name(mon, base_url ? test->no_canon_url : test->uri_url);
10362 test_display_uri(mon, base_url ? test->no_canon_url : test->uri_url);
10363 IMoniker_Release(mon);
10365 IUri_Release(uri);
10366 heap_free(url);
10367 heap_free(base_url);
10368 if(base_uri)
10369 IUri_Release(base_uri);
10370 if(base_mon)
10371 IMoniker_Release(base_mon);
10375 START_TEST(uri) {
10376 HMODULE hurlmon;
10378 hurlmon = GetModuleHandle("urlmon.dll");
10379 pCoInternetGetSession = (void*) GetProcAddress(hurlmon, "CoInternetGetSession");
10380 pCreateUri = (void*) GetProcAddress(hurlmon, "CreateUri");
10381 pCreateUriWithFragment = (void*) GetProcAddress(hurlmon, "CreateUriWithFragment");
10382 pCreateIUriBuilder = (void*) GetProcAddress(hurlmon, "CreateIUriBuilder");
10383 pCoInternetCombineIUri = (void*) GetProcAddress(hurlmon, "CoInternetCombineIUri");
10384 pCoInternetCombineUrlEx = (void*) GetProcAddress(hurlmon, "CoInternetCombineUrlEx");
10385 pCoInternetParseIUri = (void*) GetProcAddress(hurlmon, "CoInternetParseIUri");
10386 pCreateURLMonikerEx = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx");
10387 pCreateURLMonikerEx2 = (void*) GetProcAddress(hurlmon, "CreateURLMonikerEx2");
10389 if(!pCreateUri) {
10390 win_skip("CreateUri is not present, skipping tests.\n");
10391 return;
10394 trace("test CreateUri invalid flags...\n");
10395 test_CreateUri_InvalidFlags();
10397 trace("test CreateUri invalid args...\n");
10398 test_CreateUri_InvalidArgs();
10400 trace("test CreateUri invalid URIs...\n");
10401 test_CreateUri_InvalidUri();
10403 trace("test IUri_GetPropertyBSTR...\n");
10404 test_IUri_GetPropertyBSTR();
10406 trace("test IUri_GetPropertyDWORD...\n");
10407 test_IUri_GetPropertyDWORD();
10409 trace("test IUri_GetStrProperties...\n");
10410 test_IUri_GetStrProperties();
10412 trace("test IUri_GetDwordProperties...\n");
10413 test_IUri_GetDwordProperties();
10415 trace("test IUri_GetPropertyLength...\n");
10416 test_IUri_GetPropertyLength();
10418 trace("test IUri_GetProperties...\n");
10419 test_IUri_GetProperties();
10421 trace("test IUri_HasProperty...\n");
10422 test_IUri_HasProperty();
10424 trace("test IUri_IsEqual...\n");
10425 test_IUri_IsEqual();
10427 trace("test CreateUriWithFragment invalid args...\n");
10428 test_CreateUriWithFragment_InvalidArgs();
10430 trace("test CreateUriWithFragment invalid flags...\n");
10431 test_CreateUriWithFragment_InvalidFlags();
10433 trace("test CreateUriWithFragment...\n");
10434 test_CreateUriWithFragment();
10436 trace("test CreateIUriBuilder...\n");
10437 test_CreateIUriBuilder();
10439 trace("test IUriBuilder_CreateInvalidArgs...\n");
10440 test_IUriBuilder_CreateInvalidArgs();
10442 trace("test IUriBuilder...\n");
10443 test_IUriBuilder();
10445 trace("test IUriBuilder_GetInvalidArgs...\n");
10446 test_IUriBuilder_GetInvalidArgs();
10448 trace("test IUriBuilder_HasBeenModified...\n");
10449 test_IUriBuilder_HasBeenModified();
10451 trace("test IUriBuilder_IUriProperty...\n");
10452 test_IUriBuilder_IUriProperty();
10454 trace("test IUriBuilder_RemoveProperties...\n");
10455 test_IUriBuilder_RemoveProperties();
10457 trace("test IUriBuilder miscellaneous...\n");
10458 test_IUriBuilder_Misc();
10460 trace("test IUriBuilderFactory...\n");
10461 test_IUriBuilderFactory();
10463 trace("test CoInternetCombineIUri...\n");
10464 test_CoInternetCombineIUri();
10466 trace("test CoInternetCombineUrlEx...\n");
10467 test_CoInternetCombineUrlEx();
10469 trace("test CoInternetParseIUri Invalid Args...\n");
10470 test_CoInternetParseIUri_InvalidArgs();
10472 trace("test CoInternetParseIUri...\n");
10473 test_CoInternetParseIUri();
10475 register_protocols();
10477 trace("test CoInternetCombineIUri pluggable...\n");
10478 test_CoInternetCombineIUri_Pluggable();
10480 trace("test CoInternetCombineUrlEx Pluggable...\n");
10481 test_CoInternetCombineUrlEx_Pluggable();
10483 trace("test CoInternetParseIUri pluggable...\n");
10484 test_CoInternetParseIUri_Pluggable();
10486 trace("test CreateURLMoniker...\n");
10487 test_CreateURLMoniker();
10489 unregister_protocols();