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>
27 #define WIN32_LEAN_AND_MEAN
36 #include <wine/heap.h>
38 DEFINE_GUID(CLSID_CUri
, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
40 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
41 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
42 #define URI_BUILDER_STR_PROPERTY_COUNT 7
44 #define DEFINE_EXPECT(func) \
45 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
47 #define SET_EXPECT(func) \
48 expect_ ## func = TRUE
50 #define CHECK_EXPECT(func) \
52 ok(expect_ ##func, "unexpected call " #func "\n"); \
53 expect_ ## func = FALSE; \
54 called_ ## func = TRUE; \
57 #define CHECK_EXPECT2(func) \
59 ok(expect_ ##func, "unexpected call " #func "\n"); \
60 called_ ## func = TRUE; \
63 #define CHECK_CALLED(func) \
65 ok(called_ ## func, "expected " #func "\n"); \
66 expect_ ## func = called_ ## func = FALSE; \
69 DEFINE_EXPECT(CombineUrl
);
70 DEFINE_EXPECT(ParseUrl
);
72 static HRESULT (WINAPI
*pCreateUri
)(LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
73 static HRESULT (WINAPI
*pCreateUriWithFragment
)(LPCWSTR
, LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
74 static HRESULT (WINAPI
*pCreateIUriBuilder
)(IUri
*, DWORD
, DWORD_PTR
, IUriBuilder
**);
75 static HRESULT (WINAPI
*pCoInternetCombineIUri
)(IUri
*,IUri
*,DWORD
,IUri
**,DWORD_PTR
);
76 static HRESULT (WINAPI
*pCoInternetGetSession
)(DWORD
,IInternetSession
**,DWORD
);
77 static HRESULT (WINAPI
*pCoInternetCombineUrlEx
)(IUri
*,LPCWSTR
,DWORD
,IUri
**,DWORD_PTR
);
78 static HRESULT (WINAPI
*pCoInternetParseIUri
)(IUri
*,PARSEACTION
,DWORD
,LPWSTR
,DWORD
,DWORD
*,DWORD_PTR
);
79 static HRESULT (WINAPI
*pCreateURLMonikerEx
)(IMoniker
*,LPCWSTR
,IMoniker
**,DWORD
);
80 static HRESULT (WINAPI
*pCreateURLMonikerEx2
)(IMoniker
*,IUri
*,IMoniker
**,DWORD
);
82 static const WCHAR http_urlW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
83 '.','o','r','g','/',0};
84 static const WCHAR http_url_fragW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
85 '.','o','r','g','/','#','F','r','a','g',0};
87 static const WCHAR combine_baseW
[] = {'w','i','n','e','t','e','s','t',':','?','t',
88 'e','s','t','i','n','g',0};
89 static const WCHAR combine_relativeW
[] = {'?','t','e','s','t',0};
90 static const WCHAR combine_resultW
[] = {'z','i','p',':','t','e','s','t',0};
92 static const WCHAR winetestW
[] = {'w','i','n','e','t','e','s','t',0};
94 static const WCHAR parse_urlW
[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
95 static const WCHAR parse_resultW
[] = {'z','i','p',':','t','e','s','t',0};
97 static PARSEACTION parse_action
;
98 static DWORD parse_flags
;
100 typedef struct _uri_create_flag_test
{
103 } uri_create_flag_test
;
105 static const uri_create_flag_test invalid_flag_tests
[] = {
106 /* Set of invalid flag combinations to test for. */
107 {Uri_CREATE_DECODE_EXTRA_INFO
| Uri_CREATE_NO_DECODE_EXTRA_INFO
, E_INVALIDARG
},
108 {Uri_CREATE_CANONICALIZE
| Uri_CREATE_NO_CANONICALIZE
, E_INVALIDARG
},
109 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES
| Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, E_INVALIDARG
},
110 {Uri_CREATE_PRE_PROCESS_HTML_URI
| Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, E_INVALIDARG
},
111 {Uri_CREATE_IE_SETTINGS
| Uri_CREATE_NO_IE_SETTINGS
, E_INVALIDARG
}
114 typedef struct _uri_str_property
{
118 const char* broken_value
;
123 typedef struct _uri_dword_property
{
127 BOOL broken_combine_hres
;
128 } uri_dword_property
;
130 typedef struct _uri_properties
{
133 HRESULT create_expected
;
136 uri_str_property str_props
[URI_STR_PROPERTY_COUNT
];
137 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
140 static const uri_properties uri_tests
[] = {
141 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK
, FALSE
,
143 {"http://www.winehq.org/",S_OK
,FALSE
}, /* ABSOLUTE_URI */
144 {"www.winehq.org",S_OK
,FALSE
}, /* AUTHORITY */
145 {"http://www.winehq.org/",S_OK
,FALSE
}, /* DISPLAY_URI */
146 {"winehq.org",S_OK
,FALSE
}, /* DOMAIN */
147 {"",S_FALSE
,FALSE
}, /* EXTENSION */
148 {"",S_FALSE
,FALSE
}, /* FRAGMENT */
149 {"www.winehq.org",S_OK
,FALSE
}, /* HOST */
150 {"",S_FALSE
,FALSE
}, /* PASSWORD */
151 {"/",S_OK
,FALSE
}, /* PATH */
152 {"/",S_OK
,FALSE
}, /* PATH_AND_QUERY */
153 {"",S_FALSE
,FALSE
}, /* QUERY */
154 {"http://www.winehq.org/tests/../tests/../..",S_OK
,FALSE
}, /* RAW_URI */
155 {"http",S_OK
,FALSE
}, /* SCHEME_NAME */
156 {"",S_FALSE
,FALSE
}, /* USER_INFO */
157 {"",S_FALSE
,FALSE
} /* USER_NAME */
160 {Uri_HOST_DNS
,S_OK
,FALSE
}, /* HOST_TYPE */
161 {80,S_OK
,FALSE
}, /* PORT */
162 {URL_SCHEME_HTTP
,S_OK
,FALSE
}, /* SCHEME */
163 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
} /* ZONE */
166 { "http://winehq.org/tests/.././tests", 0, S_OK
, FALSE
,
168 {"http://winehq.org/tests",S_OK
,FALSE
},
169 {"winehq.org",S_OK
,FALSE
},
170 {"http://winehq.org/tests",S_OK
,FALSE
},
171 {"winehq.org",S_OK
,FALSE
},
174 {"winehq.org",S_OK
,FALSE
},
176 {"/tests",S_OK
,FALSE
},
177 {"/tests",S_OK
,FALSE
},
179 {"http://winehq.org/tests/.././tests",S_OK
,FALSE
},
185 {Uri_HOST_DNS
,S_OK
,FALSE
},
187 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
188 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
191 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
193 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
194 {"www.winehq.org",S_OK
,FALSE
},
195 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
196 {"winehq.org",S_OK
,FALSE
},
199 {"www.winehq.org",S_OK
,FALSE
},
202 {"/?query=x&return=y",S_OK
,FALSE
},
203 {"?query=x&return=y",S_OK
,FALSE
},
204 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
210 {Uri_HOST_DNS
,S_OK
,FALSE
},
212 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
213 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
216 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
218 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
219 {"www.winehq.org",S_OK
,FALSE
},
220 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
221 {"winehq.org",S_OK
,FALSE
},
224 {"www.winehq.org",S_OK
,FALSE
},
227 {"/?query=x&return=y",S_OK
,FALSE
},
228 {"?query=x&return=y",S_OK
,FALSE
},
229 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
230 {"https",S_OK
,FALSE
},
235 {Uri_HOST_DNS
,S_OK
,FALSE
},
237 {URL_SCHEME_HTTPS
,S_OK
,FALSE
},
238 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
241 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK
, FALSE
,
243 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
244 {"usEr%3Ainfo@example.com",S_OK
,FALSE
},
245 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
246 {"example.com",S_OK
,FALSE
},
249 {"example.com",S_OK
,FALSE
},
251 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
252 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
254 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK
,FALSE
},
256 {"usEr%3Ainfo",S_OK
,FALSE
},
257 {"usEr%3Ainfo",S_OK
,FALSE
}
260 {Uri_HOST_DNS
,S_OK
,FALSE
},
262 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
263 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
266 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK
, FALSE
,
268 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
269 {"winepass:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
270 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
271 {"winehq.org",S_OK
,FALSE
},
274 {"ftp.winehq.org",S_OK
,FALSE
},
276 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
277 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
279 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK
,FALSE
},
281 {"winepass:wine",S_OK
,FALSE
},
282 {"winepass",S_OK
,FALSE
}
285 {Uri_HOST_DNS
,S_OK
,FALSE
},
287 {URL_SCHEME_FTP
,S_OK
,FALSE
},
288 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
291 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK
, FALSE
,
293 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
295 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
301 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
302 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
304 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
310 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
312 {URL_SCHEME_FILE
,S_OK
,FALSE
},
313 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
316 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
318 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
320 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
326 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
327 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
329 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
335 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
337 {URL_SCHEME_FILE
,S_OK
,FALSE
},
338 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
341 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK
, FALSE
,
343 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
345 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
351 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
352 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
354 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK
,FALSE
},
360 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
362 {URL_SCHEME_FILE
,S_OK
,FALSE
},
363 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
366 { "file:///z:/test dir/README.txt", 0, S_OK
, FALSE
,
368 {"file:///z:/test%20dir/README.txt",S_OK
},
370 {"file:///z:/test%20dir/README.txt",S_OK
},
376 {"/z:/test%20dir/README.txt",S_OK
},
377 {"/z:/test%20dir/README.txt",S_OK
},
379 {"file:///z:/test dir/README.txt",S_OK
},
385 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
387 {URL_SCHEME_FILE
,S_OK
,FALSE
},
388 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
391 { "file:///z:/test dir/README.txt#hash part", 0, S_OK
, FALSE
,
393 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK
},
395 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK
},
397 {".txt#hash%20part",S_OK
},
401 {"/z:/test%20dir/README.txt#hash%20part",S_OK
},
402 {"/z:/test%20dir/README.txt#hash%20part",S_OK
},
404 {"file:///z:/test dir/README.txt#hash part",S_OK
},
410 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
412 {URL_SCHEME_FILE
,S_OK
,FALSE
},
413 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
416 { "urn:nothing:should:happen here", 0, S_OK
, FALSE
,
418 {"urn:nothing:should:happen here",S_OK
,FALSE
},
420 {"urn:nothing:should:happen here",S_OK
,FALSE
},
426 {"nothing:should:happen here",S_OK
,FALSE
},
427 {"nothing:should:happen here",S_OK
,FALSE
},
429 {"urn:nothing:should:happen here",S_OK
,FALSE
},
435 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
437 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
438 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
441 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK
, FALSE
,
443 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
444 {"127.0.0.1",S_OK
,FALSE
},
445 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
449 {"127.0.0.1",S_OK
,FALSE
},
451 {"/test%20dir/test.txt",S_OK
,FALSE
},
452 {"/test%20dir/test.txt",S_OK
,FALSE
},
454 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK
,FALSE
},
460 {Uri_HOST_IPV4
,S_OK
,FALSE
},
462 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
463 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
466 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK
, FALSE
,
468 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
469 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK
,FALSE
},
470 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
474 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK
,FALSE
},
479 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK
,FALSE
},
485 {Uri_HOST_IPV6
,S_OK
,FALSE
},
487 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
488 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
491 { "ftp://[::13.1.68.3]", 0, S_OK
, FALSE
,
493 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
494 {"[::13.1.68.3]",S_OK
,FALSE
},
495 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
499 {"::13.1.68.3",S_OK
,FALSE
},
504 {"ftp://[::13.1.68.3]",S_OK
,FALSE
},
510 {Uri_HOST_IPV6
,S_OK
,FALSE
},
512 {URL_SCHEME_FTP
,S_OK
,FALSE
},
513 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
516 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK
, FALSE
,
518 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
519 {"[fedc:ba98::3210]",S_OK
,FALSE
},
520 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
524 {"fedc:ba98::3210",S_OK
,FALSE
},
529 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK
,FALSE
},
535 {Uri_HOST_IPV6
,S_OK
,FALSE
},
537 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
538 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
541 { "1234://www.winehq.org", 0, S_OK
, FALSE
,
543 {"1234://www.winehq.org/",S_OK
,FALSE
},
544 {"www.winehq.org",S_OK
,FALSE
},
545 {"1234://www.winehq.org/",S_OK
,FALSE
},
546 {"winehq.org",S_OK
,FALSE
},
549 {"www.winehq.org",S_OK
,FALSE
},
554 {"1234://www.winehq.org",S_OK
,FALSE
},
560 {Uri_HOST_DNS
,S_OK
,FALSE
},
562 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
563 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
566 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
567 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
569 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
571 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
577 {"/C:/test/test.mp3",S_OK
,FALSE
},
578 {"/C:/test/test.mp3",S_OK
,FALSE
},
580 {"C:/test/test.mp3",S_OK
,FALSE
},
586 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
588 {URL_SCHEME_FILE
,S_OK
,FALSE
},
589 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
592 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
593 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
595 {"file://server/test.mp3",S_OK
,FALSE
},
596 {"server",S_OK
,FALSE
},
597 {"file://server/test.mp3",S_OK
,FALSE
},
601 {"server",S_OK
,FALSE
},
603 {"/test.mp3",S_OK
,FALSE
},
604 {"/test.mp3",S_OK
,FALSE
},
606 {"\\\\Server/test.mp3",S_OK
,FALSE
},
612 {Uri_HOST_DNS
,S_OK
,FALSE
},
614 {URL_SCHEME_FILE
,S_OK
,FALSE
},
615 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
618 { "C:/test/test.mp3#fragment|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
|Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
620 {"file://C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
622 {"file://C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
624 {".mp3#fragment|part",S_OK
,FALSE
},
628 {"C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
629 {"C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
631 {"C:/test/test.mp3#fragment|part",S_OK
,FALSE
},
637 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
639 {URL_SCHEME_FILE
,S_OK
,FALSE
},
640 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
643 { "C:/test/test.mp3?query|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
|Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
645 {"file://C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
647 {"file://C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
653 {"C:\\test\\test.mp3",S_OK
,FALSE
},
654 {"C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
655 {"?query|part",S_OK
,FALSE
},
656 {"C:/test/test.mp3?query|part",S_OK
,FALSE
},
662 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
664 {URL_SCHEME_FILE
,S_OK
,FALSE
},
665 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
668 { "C:/test/test.mp3?query|part#hash|part", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
|Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
670 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK
,FALSE
},
672 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK
,FALSE
},
675 {"#hash|part",S_OK
,FALSE
},
678 {"C:\\test\\test.mp3",S_OK
,FALSE
},
679 {"C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
680 {"?query|part",S_OK
,FALSE
},
681 {"C:/test/test.mp3?query|part#hash|part",S_OK
,FALSE
},
687 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
689 {URL_SCHEME_FILE
,S_OK
,FALSE
},
690 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
693 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
695 {"*:www.winehq.org/test",S_OK
,FALSE
},
696 {"www.winehq.org",S_OK
,FALSE
},
697 {"*:www.winehq.org/test",S_OK
,FALSE
},
698 {"winehq.org",S_OK
,FALSE
},
701 {"www.winehq.org",S_OK
,FALSE
},
703 {"/test",S_OK
,FALSE
},
704 {"/test",S_OK
,FALSE
},
706 {"www.winehq.org/test",S_OK
,FALSE
},
712 {Uri_HOST_DNS
,S_OK
,FALSE
},
714 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
715 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
718 /* Valid since the '*' is the only character in the scheme name. */
719 { "*:www.winehq.org/test", 0, S_OK
, FALSE
,
721 {"*:www.winehq.org/test",S_OK
,FALSE
},
722 {"www.winehq.org",S_OK
,FALSE
},
723 {"*:www.winehq.org/test",S_OK
,FALSE
},
724 {"winehq.org",S_OK
,FALSE
},
727 {"www.winehq.org",S_OK
,FALSE
},
729 {"/test",S_OK
,FALSE
},
730 {"/test",S_OK
,FALSE
},
732 {"*:www.winehq.org/test",S_OK
,FALSE
},
738 {Uri_HOST_DNS
,S_OK
,FALSE
},
740 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
741 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
744 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
746 {"/../some dir/test.ext",S_OK
,FALSE
},
748 {"/../some dir/test.ext",S_OK
,FALSE
},
754 {"/../some dir/test.ext",S_OK
,FALSE
},
755 {"/../some dir/test.ext",S_OK
,FALSE
},
757 {"/../some dir/test.ext",S_OK
,FALSE
},
763 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
765 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
766 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
769 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE
|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
771 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
773 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
779 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
780 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
782 {"//implicit/wildcard/uri scheme",S_OK
,FALSE
},
788 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
790 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
791 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
794 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
795 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, S_OK
, FALSE
,
797 {"zip:/.//google.com",S_OK
,FALSE
},
799 {"zip:/.//google.com",S_OK
,FALSE
},
805 {"/.//google.com",S_OK
,FALSE
},
806 {"/.//google.com",S_OK
,FALSE
},
808 {"zip://google.com",S_OK
,FALSE
},
814 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
816 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
817 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
820 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
821 { "ftp://user:pass:word@winehq.org/", 0, S_OK
, FALSE
,
823 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
824 {"user:pass:word@winehq.org",S_OK
,FALSE
},
825 {"ftp://winehq.org/",S_OK
,FALSE
},
826 {"winehq.org",S_OK
,FALSE
},
829 {"winehq.org",S_OK
,FALSE
},
830 {"pass:word",S_OK
,FALSE
},
834 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
836 {"user:pass:word",S_OK
,FALSE
},
840 {Uri_HOST_DNS
,S_OK
,FALSE
},
842 {URL_SCHEME_FTP
,S_OK
,FALSE
},
843 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
846 /* Make sure % encoded unreserved characters are decoded. */
847 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK
, FALSE
,
849 {"ftp://wINe:PASS@ftp.google.com/",S_OK
,FALSE
},
850 {"wINe:PASS@ftp.google.com",S_OK
,FALSE
},
851 {"ftp://ftp.google.com/",S_OK
,FALSE
},
852 {"google.com",S_OK
,FALSE
},
855 {"ftp.google.com",S_OK
,FALSE
},
860 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK
,FALSE
},
862 {"wINe:PASS",S_OK
,FALSE
},
866 {Uri_HOST_DNS
,S_OK
,FALSE
},
868 {URL_SCHEME_FTP
,S_OK
,FALSE
},
869 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
872 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
873 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK
, FALSE
,
875 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
876 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK
,FALSE
},
877 {"ftp://ftp.google.com/",S_OK
,FALSE
},
878 {"google.com",S_OK
,FALSE
},
881 {"ftp.google.com",S_OK
,FALSE
},
882 {"PA%7B%7D",S_OK
,FALSE
},
886 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
888 {"w%5D%5Be:PA%7B%7D",S_OK
,FALSE
},
889 {"w%5D%5Be",S_OK
,FALSE
}
892 {Uri_HOST_DNS
,S_OK
,FALSE
},
894 {URL_SCHEME_FTP
,S_OK
,FALSE
},
895 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
898 /* You're allowed to have an empty password portion in the userinfo section. */
899 { "ftp://empty:@ftp.google.com/", 0, S_OK
, FALSE
,
901 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
902 {"empty:@ftp.google.com",S_OK
,FALSE
},
903 {"ftp://ftp.google.com/",S_OK
,FALSE
},
904 {"google.com",S_OK
,FALSE
},
907 {"ftp.google.com",S_OK
,FALSE
},
912 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
914 {"empty:",S_OK
,FALSE
},
918 {Uri_HOST_DNS
,S_OK
,FALSE
},
920 {URL_SCHEME_FTP
,S_OK
,FALSE
},
921 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
924 /* Make sure forbidden characters in "userinfo" get encoded. */
925 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK
, FALSE
,
927 {"ftp://%22%20%22weird@ftp.google.com/",S_OK
,FALSE
},
928 {"%22%20%22weird@ftp.google.com",S_OK
,FALSE
},
929 {"ftp://ftp.google.com/",S_OK
,FALSE
},
930 {"google.com",S_OK
,FALSE
},
933 {"ftp.google.com",S_OK
,FALSE
},
938 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
940 {"%22%20%22weird",S_OK
,FALSE
},
941 {"%22%20%22weird",S_OK
,FALSE
}
944 {Uri_HOST_DNS
,S_OK
,FALSE
},
946 {URL_SCHEME_FTP
,S_OK
,FALSE
},
947 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
950 /* Make sure the forbidden characters don't get percent encoded. */
951 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
953 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
954 {"\" \"weird@ftp.google.com",S_OK
,FALSE
},
955 {"ftp://ftp.google.com/",S_OK
,FALSE
},
956 {"google.com",S_OK
,FALSE
},
959 {"ftp.google.com",S_OK
,FALSE
},
964 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
966 {"\" \"weird",S_OK
,FALSE
},
967 {"\" \"weird",S_OK
,FALSE
}
970 {Uri_HOST_DNS
,S_OK
,FALSE
},
972 {URL_SCHEME_FTP
,S_OK
,FALSE
},
973 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
976 /* Make sure already percent encoded characters don't get unencoded. */
977 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
979 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
980 {"\"%20\"weird@ftp.google.com",S_OK
,FALSE
},
981 {"ftp://ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
982 {"google.com",S_OK
,FALSE
},
985 {"ftp.google.com",S_OK
,FALSE
},
987 {"/\"%20\"weird",S_OK
,FALSE
},
988 {"/\"%20\"weird",S_OK
,FALSE
},
990 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
992 {"\"%20\"weird",S_OK
,FALSE
},
993 {"\"%20\"weird",S_OK
,FALSE
}
996 {Uri_HOST_DNS
,S_OK
,FALSE
},
998 {URL_SCHEME_FTP
,S_OK
,FALSE
},
999 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1002 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1003 { "zip://%xy:word@winehq.org/", 0, S_OK
, FALSE
,
1005 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1006 {"%xy:word@winehq.org",S_OK
,FALSE
},
1007 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1008 {"winehq.org",S_OK
,FALSE
},
1011 {"winehq.org",S_OK
,FALSE
},
1012 {"word",S_OK
,FALSE
},
1016 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1018 {"%xy:word",S_OK
,FALSE
},
1022 {Uri_HOST_DNS
,S_OK
,FALSE
},
1024 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1025 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1028 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1031 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK
, FALSE
,
1033 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1034 {"%2E:%52%53ord@winehq.org",S_OK
,FALSE
},
1035 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1036 {"winehq.org",S_OK
,FALSE
},
1039 {"winehq.org",S_OK
,FALSE
},
1040 {"%52%53ord",S_OK
,FALSE
},
1044 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1046 {"%2E:%52%53ord",S_OK
,FALSE
},
1050 {Uri_HOST_DNS
,S_OK
,FALSE
},
1052 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1053 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1056 { "ftp://[](),'test':word@winehq.org/", 0, S_OK
, FALSE
,
1058 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
1059 {"[](),'test':word@winehq.org",S_OK
,FALSE
},
1060 {"ftp://winehq.org/",S_OK
,FALSE
},
1061 {"winehq.org",S_OK
,FALSE
},
1064 {"winehq.org",S_OK
,FALSE
},
1065 {"word",S_OK
,FALSE
},
1069 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
1071 {"[](),'test':word",S_OK
,FALSE
},
1072 {"[](),'test'",S_OK
,FALSE
}
1075 {Uri_HOST_DNS
,S_OK
,FALSE
},
1077 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1078 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1081 { "ftp://test?:word@winehq.org/", 0, S_OK
, FALSE
,
1083 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
1084 {"test",S_OK
,FALSE
},
1085 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
1089 {"test",S_OK
,FALSE
},
1092 {"/?:word@winehq.org/",S_OK
,FALSE
},
1093 {"?:word@winehq.org/",S_OK
,FALSE
},
1094 {"ftp://test?:word@winehq.org/",S_OK
,FALSE
},
1100 {Uri_HOST_DNS
,S_OK
,FALSE
},
1102 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1103 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1106 { "ftp://test#:word@winehq.org/", 0, S_OK
, FALSE
,
1108 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
1109 {"test",S_OK
,FALSE
},
1110 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
1113 {"#:word@winehq.org/",S_OK
,FALSE
},
1114 {"test",S_OK
,FALSE
},
1119 {"ftp://test#:word@winehq.org/",S_OK
,FALSE
},
1125 {Uri_HOST_DNS
,S_OK
,FALSE
},
1127 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1128 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1131 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1132 { "zip://test\\:word@winehq.org/", 0, S_OK
, FALSE
,
1134 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1135 {"test\\:word@winehq.org",S_OK
,FALSE
},
1136 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1137 {"winehq.org",S_OK
,FALSE
},
1140 {"winehq.org",S_OK
,FALSE
},
1141 {"word",S_OK
,FALSE
},
1145 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1147 {"test\\:word",S_OK
,FALSE
},
1148 {"test\\",S_OK
,FALSE
}
1151 {Uri_HOST_DNS
,S_OK
,FALSE
},
1153 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1154 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1157 /* It normalizes IPv4 addresses correctly. */
1158 { "http://127.000.000.100/", 0, S_OK
, FALSE
,
1160 {"http://127.0.0.100/",S_OK
,FALSE
},
1161 {"127.0.0.100",S_OK
,FALSE
},
1162 {"http://127.0.0.100/",S_OK
,FALSE
},
1166 {"127.0.0.100",S_OK
,FALSE
},
1171 {"http://127.000.000.100/",S_OK
,FALSE
},
1172 {"http",S_OK
,FALSE
},
1177 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1179 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1180 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1183 { "http://127.0.0.1:8000", 0, S_OK
, FALSE
,
1185 {"http://127.0.0.1:8000/",S_OK
},
1186 {"127.0.0.1:8000",S_OK
},
1187 {"http://127.0.0.1:8000/",S_OK
},
1196 {"http://127.0.0.1:8000",S_OK
},
1202 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1204 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1205 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1208 /* Make sure it normalizes partial IPv4 addresses correctly. */
1209 { "http://127.0/", 0, S_OK
, FALSE
,
1211 {"http://127.0.0.0/",S_OK
,FALSE
},
1212 {"127.0.0.0",S_OK
,FALSE
},
1213 {"http://127.0.0.0/",S_OK
,FALSE
},
1217 {"127.0.0.0",S_OK
,FALSE
},
1222 {"http://127.0/",S_OK
,FALSE
},
1223 {"http",S_OK
,FALSE
},
1228 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1230 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1231 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1234 /* Make sure it converts implicit IPv4's correctly. */
1235 { "http://123456/", 0, S_OK
, FALSE
,
1237 {"http://0.1.226.64/",S_OK
,FALSE
},
1238 {"0.1.226.64",S_OK
,FALSE
},
1239 {"http://0.1.226.64/",S_OK
,FALSE
},
1243 {"0.1.226.64",S_OK
,FALSE
},
1248 {"http://123456/",S_OK
,FALSE
},
1249 {"http",S_OK
,FALSE
},
1254 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1256 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1257 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1261 { "http://4294967295/", 0, S_OK
, FALSE
,
1263 {"http://255.255.255.255/",S_OK
,FALSE
},
1264 {"255.255.255.255",S_OK
,FALSE
},
1265 {"http://255.255.255.255/",S_OK
,FALSE
},
1269 {"255.255.255.255",S_OK
,FALSE
},
1274 {"http://4294967295/",S_OK
,FALSE
},
1275 {"http",S_OK
,FALSE
},
1280 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1282 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1283 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1287 { "http://4294967296/", 0, S_OK
, FALSE
,
1289 {"http://4294967296/",S_OK
,FALSE
},
1290 {"4294967296",S_OK
,FALSE
},
1291 {"http://4294967296/",S_OK
,FALSE
},
1295 {"4294967296",S_OK
,FALSE
},
1300 {"http://4294967296/",S_OK
,FALSE
},
1301 {"http",S_OK
,FALSE
},
1306 {Uri_HOST_DNS
,S_OK
,FALSE
},
1308 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1309 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1312 /* Window's doesn't normalize IP address for unknown schemes. */
1313 { "1234://4294967295/", 0, S_OK
, FALSE
,
1315 {"1234://4294967295/",S_OK
,FALSE
},
1316 {"4294967295",S_OK
,FALSE
},
1317 {"1234://4294967295/",S_OK
,FALSE
},
1321 {"4294967295",S_OK
,FALSE
},
1326 {"1234://4294967295/",S_OK
,FALSE
},
1327 {"1234",S_OK
,FALSE
},
1332 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1334 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1335 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1338 /* Window's doesn't normalize IP address for unknown schemes. */
1339 { "1234://127.001/", 0, S_OK
, FALSE
,
1341 {"1234://127.001/",S_OK
,FALSE
},
1342 {"127.001",S_OK
,FALSE
},
1343 {"1234://127.001/",S_OK
,FALSE
},
1347 {"127.001",S_OK
,FALSE
},
1352 {"1234://127.001/",S_OK
,FALSE
},
1353 {"1234",S_OK
,FALSE
},
1358 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1360 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1361 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1364 { "http://[FEDC:BA98::3210]", 0, S_OK
, FALSE
,
1366 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1367 {"[fedc:ba98::3210]",S_OK
,FALSE
},
1368 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1372 {"fedc:ba98::3210",S_OK
,FALSE
},
1377 {"http://[FEDC:BA98::3210]",S_OK
,FALSE
},
1378 {"http",S_OK
,FALSE
},
1383 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1385 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1386 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1389 { "http://[::]", 0, S_OK
, FALSE
,
1391 {"http://[::]/",S_OK
,FALSE
},
1392 {"[::]",S_OK
,FALSE
},
1393 {"http://[::]/",S_OK
,FALSE
},
1402 {"http://[::]",S_OK
,FALSE
},
1403 {"http",S_OK
,FALSE
},
1408 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1410 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1411 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1414 { "http://[FEDC:BA98::]", 0, S_OK
, FALSE
,
1416 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1417 {"[fedc:ba98::]",S_OK
,FALSE
},
1418 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1422 {"fedc:ba98::",S_OK
,FALSE
},
1427 {"http://[FEDC:BA98::]",S_OK
,FALSE
},
1428 {"http",S_OK
,FALSE
},
1433 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1435 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1436 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1439 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1440 { "http://[1::3:4:5:6:7:8]", 0, S_OK
, FALSE
,
1442 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1443 {"[1:0:3:4:5:6:7:8]",S_OK
,FALSE
},
1444 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1448 {"1:0:3:4:5:6:7:8",S_OK
,FALSE
},
1453 {"http://[1::3:4:5:6:7:8]",S_OK
,FALSE
},
1454 {"http",S_OK
,FALSE
},
1459 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1461 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1462 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1465 { "http://[v2.34]/", 0, S_OK
, FALSE
,
1467 {"http://[v2.34]/",S_OK
,FALSE
},
1468 {"[v2.34]",S_OK
,FALSE
},
1469 {"http://[v2.34]/",S_OK
,FALSE
},
1473 {"[v2.34]",S_OK
,FALSE
},
1478 {"http://[v2.34]/",S_OK
,FALSE
},
1479 {"http",S_OK
,FALSE
},
1484 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
1486 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1487 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1490 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1491 { "http://[xyz:12345.com/test", 0, S_OK
, FALSE
,
1493 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1494 {"[xyz:12345.com",S_OK
,FALSE
},
1495 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1496 {"[xyz:12345.com",S_OK
,FALSE
},
1499 {"[xyz:12345.com",S_OK
,FALSE
},
1501 {"/test",S_OK
,FALSE
},
1502 {"/test",S_OK
,FALSE
},
1504 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1505 {"http",S_OK
,FALSE
},
1510 {Uri_HOST_DNS
,S_OK
,FALSE
},
1512 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1513 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1516 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1517 * of the host name (respectively).
1519 { "ftp://www.[works].com/", 0, S_OK
, FALSE
,
1521 {"ftp://www.[works].com/",S_OK
,FALSE
},
1522 {"www.[works].com",S_OK
,FALSE
},
1523 {"ftp://www.[works].com/",S_OK
,FALSE
},
1524 {"[works].com",S_OK
,FALSE
},
1527 {"www.[works].com",S_OK
,FALSE
},
1532 {"ftp://www.[works].com/",S_OK
,FALSE
},
1538 {Uri_HOST_DNS
,S_OK
,FALSE
},
1540 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1541 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1544 /* Considers ':' a delimiter since it appears after the ']'. */
1545 { "http://www.google.com]:12345/", 0, S_OK
, FALSE
,
1547 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1548 {"www.google.com]:12345",S_OK
,FALSE
},
1549 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1550 {"google.com]",S_OK
,FALSE
},
1553 {"www.google.com]",S_OK
,FALSE
},
1558 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1559 {"http",S_OK
,FALSE
},
1564 {Uri_HOST_DNS
,S_OK
,FALSE
},
1566 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1567 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1570 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1571 { "zip://w%XXw%GEw.google.com/", 0, S_OK
, FALSE
,
1573 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1574 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1575 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1576 {"google.com",S_OK
,FALSE
},
1579 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1584 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1590 {Uri_HOST_DNS
,S_OK
,FALSE
},
1592 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1593 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1596 /* Unknown scheme types hostname doesn't get lower cased. */
1597 { "zip://GOOGLE.com/", 0, S_OK
, FALSE
,
1599 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1600 {"GOOGLE.com",S_OK
,FALSE
},
1601 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1602 {"GOOGLE.com",S_OK
,FALSE
},
1605 {"GOOGLE.com",S_OK
,FALSE
},
1610 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1616 {Uri_HOST_DNS
,S_OK
,FALSE
},
1618 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1619 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1622 /* Hostname gets lower-cased for known scheme types. */
1623 { "http://WWW.GOOGLE.com/", 0, S_OK
, FALSE
,
1625 {"http://www.google.com/",S_OK
,FALSE
},
1626 {"www.google.com",S_OK
,FALSE
},
1627 {"http://www.google.com/",S_OK
,FALSE
},
1628 {"google.com",S_OK
,FALSE
},
1631 {"www.google.com",S_OK
,FALSE
},
1636 {"http://WWW.GOOGLE.com/",S_OK
,FALSE
},
1637 {"http",S_OK
,FALSE
},
1642 {Uri_HOST_DNS
,S_OK
,FALSE
},
1644 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1645 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1648 /* Characters that get % encoded in the hostname also have their percent
1649 * encoded forms lower cased.
1651 { "http://www.%7Cgoogle|.com/", 0, S_OK
, FALSE
,
1653 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1654 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1655 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1656 {"%7cgoogle%7c.com",S_OK
,FALSE
},
1659 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1664 {"http://www.%7Cgoogle|.com/",S_OK
,FALSE
},
1665 {"http",S_OK
,FALSE
},
1670 {Uri_HOST_DNS
,S_OK
,FALSE
},
1672 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1673 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1676 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1677 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK
, FALSE
,
1679 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1680 {"[1:2:3:4:5:6::]",S_OK
,FALSE
},
1681 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1685 {"1:2:3:4:5:6::",S_OK
,FALSE
},
1690 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK
,FALSE
},
1691 {"http",S_OK
,FALSE
},
1696 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1698 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1699 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1702 /* IPv4 addresses get normalized. */
1703 { "http://[::001.002.003.000]", 0, S_OK
, FALSE
,
1705 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1706 {"[::1.2.3.0]",S_OK
,FALSE
},
1707 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1711 {"::1.2.3.0",S_OK
,FALSE
},
1716 {"http://[::001.002.003.000]",S_OK
,FALSE
},
1717 {"http",S_OK
,FALSE
},
1722 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1724 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1725 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1728 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1729 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK
, FALSE
,
1731 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1732 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1733 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1737 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK
,FALSE
},
1742 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1748 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1750 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1751 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1754 /* IPv4 address is converted into 2 h16 components. */
1755 { "http://[ffff::192.222.111.32]", 0, S_OK
, FALSE
,
1757 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1758 {"[ffff::c0de:6f20]",S_OK
,FALSE
},
1759 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1763 {"ffff::c0de:6f20",S_OK
,FALSE
},
1768 {"http://[ffff::192.222.111.32]",S_OK
,FALSE
},
1769 {"http",S_OK
,FALSE
},
1774 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1776 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1777 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1780 /* Max value for a port. */
1781 { "http://google.com:65535", 0, S_OK
, FALSE
,
1783 {"http://google.com:65535/",S_OK
,FALSE
},
1784 {"google.com:65535",S_OK
,FALSE
},
1785 {"http://google.com:65535/",S_OK
,FALSE
},
1786 {"google.com",S_OK
,FALSE
},
1789 {"google.com",S_OK
,FALSE
},
1794 {"http://google.com:65535",S_OK
,FALSE
},
1795 {"http",S_OK
,FALSE
},
1800 {Uri_HOST_DNS
,S_OK
,FALSE
},
1802 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1803 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1806 { "zip://google.com:65536", 0, S_OK
, FALSE
,
1808 {"zip://google.com:65536/",S_OK
,FALSE
},
1809 {"google.com:65536",S_OK
,FALSE
},
1810 {"zip://google.com:65536/",S_OK
,FALSE
},
1811 {"google.com:65536",S_OK
,FALSE
},
1814 {"google.com:65536",S_OK
,FALSE
},
1819 {"zip://google.com:65536",S_OK
,FALSE
},
1825 {Uri_HOST_DNS
,S_OK
,FALSE
},
1827 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1828 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1831 { "zip://google.com:65536:25", 0, S_OK
, FALSE
,
1833 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1834 {"google.com:65536:25",S_OK
,FALSE
},
1835 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1836 {"google.com:65536:25",S_OK
,FALSE
},
1839 {"google.com:65536:25",S_OK
,FALSE
},
1844 {"zip://google.com:65536:25",S_OK
,FALSE
},
1850 {Uri_HOST_DNS
,S_OK
,FALSE
},
1852 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1853 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1856 { "zip://[::ffff]:abcd", 0, S_OK
, FALSE
,
1858 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1859 {"[::ffff]:abcd",S_OK
,FALSE
},
1860 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1864 {"[::ffff]:abcd",S_OK
,FALSE
},
1869 {"zip://[::ffff]:abcd",S_OK
,FALSE
},
1875 {Uri_HOST_DNS
,S_OK
,FALSE
},
1877 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1878 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1881 { "zip://127.0.0.1:abcd", 0, S_OK
, FALSE
,
1883 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1884 {"127.0.0.1:abcd",S_OK
,FALSE
},
1885 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1886 {"0.1:abcd",S_OK
,FALSE
},
1889 {"127.0.0.1:abcd",S_OK
,FALSE
},
1894 {"zip://127.0.0.1:abcd",S_OK
,FALSE
},
1900 {Uri_HOST_DNS
,S_OK
,FALSE
},
1902 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1903 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1906 /* Port is just copied over. */
1907 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1909 {"http://google.com:00035",S_OK
,FALSE
},
1910 {"google.com:00035",S_OK
,FALSE
},
1911 {"http://google.com:00035",S_OK
,FALSE
,"http://google.com:35"},
1912 {"google.com",S_OK
,FALSE
},
1915 {"google.com",S_OK
,FALSE
},
1920 {"http://google.com:00035",S_OK
,FALSE
},
1921 {"http",S_OK
,FALSE
},
1926 {Uri_HOST_DNS
,S_OK
,FALSE
},
1928 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1929 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1932 /* Default port is copied over. */
1933 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1935 {"http://google.com:80",S_OK
,FALSE
},
1936 {"google.com:80",S_OK
,FALSE
},
1937 {"http://google.com:80",S_OK
,FALSE
},
1938 {"google.com",S_OK
,FALSE
},
1941 {"google.com",S_OK
,FALSE
},
1946 {"http://google.com:80",S_OK
,FALSE
},
1947 {"http",S_OK
,FALSE
},
1952 {Uri_HOST_DNS
,S_OK
,FALSE
},
1954 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1955 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1958 { "http://google.com.uk", 0, S_OK
, FALSE
,
1960 {"http://google.com.uk/",S_OK
,FALSE
},
1961 {"google.com.uk",S_OK
,FALSE
},
1962 {"http://google.com.uk/",S_OK
,FALSE
},
1963 {"google.com.uk",S_OK
,FALSE
,NULL
,"com.uk",S_OK
}, /* cf. google.co.uk below */
1966 {"google.com.uk",S_OK
,FALSE
},
1971 {"http://google.com.uk",S_OK
,FALSE
},
1972 {"http",S_OK
,FALSE
},
1977 {Uri_HOST_DNS
,S_OK
,FALSE
},
1979 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1980 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1983 { "http://google.co.uk", 0, S_OK
, FALSE
,
1985 {"http://google.co.uk/",S_OK
,FALSE
},
1986 {"google.co.uk",S_OK
,FALSE
},
1987 {"http://google.co.uk/",S_OK
,FALSE
},
1988 {"google.co.uk",S_OK
,FALSE
},
1991 {"google.co.uk",S_OK
,FALSE
},
1996 {"http://google.co.uk",S_OK
,FALSE
},
1997 {"http",S_OK
,FALSE
},
2002 {Uri_HOST_DNS
,S_OK
,FALSE
},
2004 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2005 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2008 { "http://google.com.com", 0, S_OK
, FALSE
,
2010 {"http://google.com.com/",S_OK
,FALSE
},
2011 {"google.com.com",S_OK
,FALSE
},
2012 {"http://google.com.com/",S_OK
,FALSE
},
2013 {"com.com",S_OK
,FALSE
},
2016 {"google.com.com",S_OK
,FALSE
},
2021 {"http://google.com.com",S_OK
,FALSE
},
2022 {"http",S_OK
,FALSE
},
2027 {Uri_HOST_DNS
,S_OK
,FALSE
},
2029 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2030 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2033 { "http://google.uk.1", 0, S_OK
, FALSE
,
2035 {"http://google.uk.1/",S_OK
,FALSE
},
2036 {"google.uk.1",S_OK
,FALSE
},
2037 {"http://google.uk.1/",S_OK
,FALSE
},
2038 {"google.uk.1",S_OK
,FALSE
,NULL
,"uk.1",S_OK
},
2041 {"google.uk.1",S_OK
,FALSE
},
2046 {"http://google.uk.1",S_OK
,FALSE
},
2047 {"http",S_OK
,FALSE
},
2052 {Uri_HOST_DNS
,S_OK
,FALSE
},
2054 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2055 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2058 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2059 { "http://google.foo.uk", 0, S_OK
, FALSE
,
2061 {"http://google.foo.uk/",S_OK
,FALSE
},
2062 {"google.foo.uk",S_OK
,FALSE
},
2063 {"http://google.foo.uk/",S_OK
,FALSE
},
2064 {"foo.uk",S_OK
,FALSE
},
2067 {"google.foo.uk",S_OK
,FALSE
},
2072 {"http://google.foo.uk",S_OK
,FALSE
},
2073 {"http",S_OK
,FALSE
},
2078 {Uri_HOST_DNS
,S_OK
,FALSE
},
2080 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2081 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2084 { "http://.com", 0, S_OK
, FALSE
,
2086 {"http://.com/",S_OK
,FALSE
},
2087 {".com",S_OK
,FALSE
},
2088 {"http://.com/",S_OK
,FALSE
},
2089 {".com",S_OK
,FALSE
},
2092 {".com",S_OK
,FALSE
},
2097 {"http://.com",S_OK
,FALSE
},
2098 {"http",S_OK
,FALSE
},
2103 {Uri_HOST_DNS
,S_OK
,FALSE
},
2105 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2106 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2109 { "http://.uk", 0, S_OK
, FALSE
,
2111 {"http://.uk/",S_OK
,FALSE
},
2113 {"http://.uk/",S_OK
,FALSE
},
2114 {"",S_FALSE
,FALSE
,NULL
,".uk",S_OK
},
2122 {"http://.uk",S_OK
,FALSE
},
2123 {"http",S_OK
,FALSE
},
2128 {Uri_HOST_DNS
,S_OK
,FALSE
},
2130 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2131 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2134 { "http://www.co.google.com.[]", 0, S_OK
, FALSE
,
2136 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
2137 {"www.co.google.com.[]",S_OK
,FALSE
},
2138 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
2139 {"google.com.[]",S_OK
,FALSE
,NULL
,"com.[]",S_OK
},
2142 {"www.co.google.com.[]",S_OK
,FALSE
},
2147 {"http://www.co.google.com.[]",S_OK
,FALSE
},
2148 {"http",S_OK
,FALSE
},
2153 {Uri_HOST_DNS
,S_OK
,FALSE
},
2155 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2156 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2159 { "http://co.uk", 0, S_OK
, FALSE
,
2161 {"http://co.uk/",S_OK
,FALSE
},
2162 {"co.uk",S_OK
,FALSE
},
2163 {"http://co.uk/",S_OK
,FALSE
},
2167 {"co.uk",S_OK
,FALSE
},
2172 {"http://co.uk",S_OK
,FALSE
},
2173 {"http",S_OK
,FALSE
},
2178 {Uri_HOST_DNS
,S_OK
,FALSE
},
2180 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2181 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2184 { "http://www.co.google.us.test", 0, S_OK
, FALSE
,
2186 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2187 {"www.co.google.us.test",S_OK
,FALSE
},
2188 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2189 {"us.test",S_OK
,FALSE
},
2192 {"www.co.google.us.test",S_OK
,FALSE
},
2197 {"http://www.co.google.us.test",S_OK
,FALSE
},
2198 {"http",S_OK
,FALSE
},
2203 {Uri_HOST_DNS
,S_OK
,FALSE
},
2205 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2206 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2209 { "http://gov.uk", 0, S_OK
, FALSE
,
2211 {"http://gov.uk/",S_OK
,FALSE
},
2212 {"gov.uk",S_OK
,FALSE
},
2213 {"http://gov.uk/",S_OK
,FALSE
},
2217 {"gov.uk",S_OK
,FALSE
},
2222 {"http://gov.uk",S_OK
,FALSE
},
2223 {"http",S_OK
,FALSE
},
2228 {Uri_HOST_DNS
,S_OK
,FALSE
},
2230 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2231 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2234 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2236 {"zip://www.google.com\\test",S_OK
,FALSE
},
2237 {"www.google.com\\test",S_OK
,FALSE
},
2238 {"zip://www.google.com\\test",S_OK
,FALSE
},
2239 {"google.com\\test",S_OK
,FALSE
},
2242 {"www.google.com\\test",S_OK
,FALSE
},
2247 {"zip://www.google.com\\test",S_OK
,FALSE
},
2253 {Uri_HOST_DNS
,S_OK
,FALSE
},
2255 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2256 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2259 { "urn:excepts:bad:%XY:encoded", 0, S_OK
, FALSE
,
2261 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2263 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2269 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2270 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2272 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2278 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2280 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2281 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2284 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2285 * are decoded and all '%' are encoded.
2287 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK
, FALSE
,
2289 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2291 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2293 {".mp3",S_OK
,FALSE
},
2297 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2298 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2300 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK
,FALSE
},
2301 {"file",S_OK
,FALSE
},
2306 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2308 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2309 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2312 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2313 * is decoded and only %'s in front of invalid hex digits are encoded.
2315 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK
, FALSE
,
2317 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2319 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2321 {".mp3",S_OK
,FALSE
},
2325 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2326 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2328 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK
,FALSE
},
2329 {"file",S_OK
,FALSE
},
2334 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2336 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2337 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2340 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2341 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK
, FALSE
,
2343 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2344 {"[::1.2.3.0]",S_OK
,FALSE
},
2345 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2349 {"::1.2.3.0",S_OK
,FALSE
},
2351 {"/%3F%23.T/test",S_OK
,FALSE
},
2352 {"/%3F%23.T/test",S_OK
,FALSE
},
2354 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK
,FALSE
},
2355 {"http",S_OK
,FALSE
},
2360 {Uri_HOST_IPV6
,S_OK
,FALSE
},
2362 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2363 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2366 /* Forbidden characters are always encoded for file URIs. */
2367 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2369 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2371 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2373 {".mp3",S_OK
,FALSE
},
2377 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2378 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2380 {"file:///C:/\"test\"/test.mp3",S_OK
,FALSE
},
2381 {"file",S_OK
,FALSE
},
2386 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2388 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2389 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2392 /* Forbidden characters are never encoded for unknown scheme types. */
2393 { "1234://4294967295/<|>\" test<|>", 0, S_OK
, FALSE
,
2395 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2396 {"4294967295",S_OK
,FALSE
},
2397 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2401 {"4294967295",S_OK
,FALSE
},
2403 {"/<|>\" test<|>",S_OK
,FALSE
},
2404 {"/<|>\" test<|>",S_OK
,FALSE
},
2406 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2407 {"1234",S_OK
,FALSE
},
2412 {Uri_HOST_IPV4
,S_OK
,FALSE
},
2414 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2415 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2418 /* Make sure forbidden characters are percent encoded. */
2419 { "http://gov.uk/<|> test<|>", 0, S_OK
, FALSE
,
2421 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2422 {"gov.uk",S_OK
,FALSE
},
2423 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2427 {"gov.uk",S_OK
,FALSE
},
2429 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2430 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2432 {"http://gov.uk/<|> test<|>",S_OK
,FALSE
},
2433 {"http",S_OK
,FALSE
},
2438 {Uri_HOST_DNS
,S_OK
,FALSE
},
2440 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2441 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2444 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK
, FALSE
,
2446 {"http://gov.uk/",S_OK
,FALSE
},
2447 {"gov.uk",S_OK
,FALSE
},
2448 {"http://gov.uk/",S_OK
,FALSE
},
2452 {"gov.uk",S_OK
,FALSE
},
2457 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK
,FALSE
},
2458 {"http",S_OK
,FALSE
},
2463 {Uri_HOST_DNS
,S_OK
,FALSE
},
2465 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2466 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2469 { "http://gov.uk/test/test2/../../..", 0, S_OK
, FALSE
,
2471 {"http://gov.uk/",S_OK
,FALSE
},
2472 {"gov.uk",S_OK
,FALSE
},
2473 {"http://gov.uk/",S_OK
,FALSE
},
2477 {"gov.uk",S_OK
,FALSE
},
2482 {"http://gov.uk/test/test2/../../..",S_OK
,FALSE
},
2483 {"http",S_OK
,FALSE
},
2488 {Uri_HOST_DNS
,S_OK
,FALSE
},
2490 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2491 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2494 { "http://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2496 {"http://gov.uk/",S_OK
,FALSE
},
2497 {"gov.uk",S_OK
,FALSE
},
2498 {"http://gov.uk/",S_OK
,FALSE
},
2502 {"gov.uk",S_OK
,FALSE
},
2507 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2508 {"http",S_OK
,FALSE
},
2513 {Uri_HOST_DNS
,S_OK
,FALSE
},
2515 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2516 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2519 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK
, FALSE
,
2521 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2523 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2525 {".mp3",S_OK
,FALSE
},
2529 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2530 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2532 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK
,FALSE
},
2533 {"file",S_OK
,FALSE
},
2538 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2540 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2541 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2544 /* Dot removal happens for unknown scheme types. */
2545 { "zip://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2547 {"zip://gov.uk/",S_OK
,FALSE
},
2548 {"gov.uk",S_OK
,FALSE
},
2549 {"zip://gov.uk/",S_OK
,FALSE
},
2553 {"gov.uk",S_OK
,FALSE
},
2558 {"zip://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2564 {Uri_HOST_DNS
,S_OK
,FALSE
},
2566 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2567 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2570 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2571 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2573 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2574 {"gov.uk",S_OK
,FALSE
},
2575 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2579 {"gov.uk",S_OK
,FALSE
},
2581 {"/test/test2/../../.",S_OK
,FALSE
},
2582 {"/test/test2/../../.",S_OK
,FALSE
},
2584 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2585 {"http",S_OK
,FALSE
},
2590 {Uri_HOST_DNS
,S_OK
,FALSE
},
2592 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2593 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2596 /* Dot removal doesn't happen for wildcard scheme types. */
2597 { "*:gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2599 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2600 {"gov.uk",S_OK
,FALSE
},
2601 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2605 {"gov.uk",S_OK
,FALSE
},
2607 {"/test/test2/../../.",S_OK
,FALSE
},
2608 {"/test/test2/../../.",S_OK
,FALSE
},
2610 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2616 {Uri_HOST_DNS
,S_OK
,FALSE
},
2618 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
2619 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2622 /* Forbidden characters are encoded for opaque known scheme types. */
2623 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK
, FALSE
,
2625 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2627 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2629 {".com%22",S_OK
,FALSE
},
2633 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2634 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2636 {"mailto:\"acco<|>unt@example.com\"",S_OK
,FALSE
},
2637 {"mailto",S_OK
,FALSE
},
2642 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2644 {URL_SCHEME_MAILTO
,S_OK
,FALSE
},
2645 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2648 { "news:test.tes<|>t.com", 0, S_OK
, FALSE
,
2650 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2652 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2654 {".com",S_OK
,FALSE
},
2658 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2659 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2661 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2662 {"news",S_OK
,FALSE
},
2667 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2669 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2670 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2673 /* Don't encode forbidden characters. */
2674 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2676 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2678 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2680 {".com",S_OK
,FALSE
},
2684 {"test.tes<|>t.com",S_OK
,FALSE
},
2685 {"test.tes<|>t.com",S_OK
,FALSE
},
2687 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2688 {"news",S_OK
,FALSE
},
2693 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2695 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2696 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2699 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2700 { "urn:test.tes<|>t.com", 0, S_OK
, FALSE
,
2702 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2704 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2706 {".com",S_OK
,FALSE
},
2710 {"test.tes<|>t.com",S_OK
,FALSE
},
2711 {"test.tes<|>t.com",S_OK
,FALSE
},
2713 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2719 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2721 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2722 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2725 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2726 { "news:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2728 {"news:test.test.com",S_OK
,FALSE
},
2730 {"news:test.test.com",S_OK
,FALSE
},
2732 {".com",S_OK
,FALSE
},
2736 {"test.test.com",S_OK
,FALSE
},
2737 {"test.test.com",S_OK
,FALSE
},
2739 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2740 {"news",S_OK
,FALSE
},
2745 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2747 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2748 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2751 /* Percent encoded characters are still decoded for known scheme types. */
2752 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2754 {"news:test.test.com",S_OK
,FALSE
},
2756 {"news:test.test.com",S_OK
,FALSE
},
2758 {".com",S_OK
,FALSE
},
2762 {"test.test.com",S_OK
,FALSE
},
2763 {"test.test.com",S_OK
,FALSE
},
2765 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2766 {"news",S_OK
,FALSE
},
2771 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2773 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2774 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2777 /* Percent encoded characters aren't decoded for unknown scheme types. */
2778 { "urn:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2780 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2782 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2784 {".com",S_OK
,FALSE
},
2788 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2789 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2791 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2797 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2799 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2800 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2803 /* Unknown scheme types can have invalid % encoded data in query string. */
2804 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK
, FALSE
,
2806 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2807 {"www.winehq.org",S_OK
,FALSE
},
2808 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2809 {"winehq.org",S_OK
,FALSE
},
2812 {"www.winehq.org",S_OK
,FALSE
},
2815 {"/?query=%xx&return=y",S_OK
,FALSE
},
2816 {"?query=%xx&return=y",S_OK
,FALSE
},
2817 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2823 {Uri_HOST_DNS
,S_OK
,FALSE
},
2825 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2826 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2829 /* Known scheme types can have invalid % encoded data with the right flags. */
2830 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2832 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2833 {"www.winehq.org",S_OK
,FALSE
},
2834 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2835 {"winehq.org",S_OK
,FALSE
},
2838 {"www.winehq.org",S_OK
,FALSE
},
2841 {"/?query=%xx&return=y",S_OK
,FALSE
},
2842 {"?query=%xx&return=y",S_OK
,FALSE
},
2843 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2844 {"http",S_OK
,FALSE
},
2849 {Uri_HOST_DNS
,S_OK
,FALSE
},
2851 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2852 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2855 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2856 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2858 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2859 {"www.winehq.org",S_OK
,FALSE
},
2860 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2861 {"winehq.org",S_OK
,FALSE
},
2864 {"www.winehq.org",S_OK
,FALSE
},
2867 {"/?query=<|>&return=y",S_OK
,FALSE
},
2868 {"?query=<|>&return=y",S_OK
,FALSE
},
2869 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2870 {"http",S_OK
,FALSE
},
2875 {Uri_HOST_DNS
,S_OK
,FALSE
},
2877 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2878 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2881 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2882 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2884 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2885 {"www.winehq.org",S_OK
,FALSE
},
2886 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2887 {"winehq.org",S_OK
,FALSE
},
2890 {"www.winehq.org",S_OK
,FALSE
},
2893 {"/?query=<|>&return=y",S_OK
,FALSE
},
2894 {"?query=<|>&return=y",S_OK
,FALSE
},
2895 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2896 {"http",S_OK
,FALSE
},
2901 {Uri_HOST_DNS
,S_OK
,FALSE
},
2903 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2904 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2907 /* Forbidden characters are encoded for known scheme types. */
2908 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2910 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2911 {"www.winehq.org",S_OK
,FALSE
},
2912 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2913 {"winehq.org",S_OK
,FALSE
},
2916 {"www.winehq.org",S_OK
,FALSE
},
2919 {"/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2920 {"?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2921 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2922 {"http",S_OK
,FALSE
},
2927 {Uri_HOST_DNS
,S_OK
,FALSE
},
2929 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2930 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2933 /* Forbidden characters are not encoded for unknown scheme types. */
2934 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2936 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2937 {"www.winehq.org",S_OK
,FALSE
},
2938 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2939 {"winehq.org",S_OK
,FALSE
},
2942 {"www.winehq.org",S_OK
,FALSE
},
2945 {"/?query=<|>&return=y",S_OK
,FALSE
},
2946 {"?query=<|>&return=y",S_OK
,FALSE
},
2947 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2953 {Uri_HOST_DNS
,S_OK
,FALSE
},
2955 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2956 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2959 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2960 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2962 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2963 {"www.winehq.org",S_OK
,FALSE
},
2964 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2965 {"winehq.org",S_OK
,FALSE
},
2968 {"www.winehq.org",S_OK
,FALSE
},
2971 {"/?query=01&return=y",S_OK
,FALSE
},
2972 {"?query=01&return=y",S_OK
,FALSE
},
2973 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2974 {"http",S_OK
,FALSE
},
2979 {Uri_HOST_DNS
,S_OK
,FALSE
},
2981 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2982 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2985 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2986 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2988 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2989 {"www.winehq.org",S_OK
,FALSE
},
2990 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2991 {"winehq.org",S_OK
,FALSE
},
2994 {"www.winehq.org",S_OK
,FALSE
},
2997 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2998 {"?query=%30%31&return=y",S_OK
,FALSE
},
2999 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
3005 {Uri_HOST_DNS
,S_OK
,FALSE
},
3007 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3008 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3011 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
3012 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3014 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
3015 {"www.winehq.org",S_OK
,FALSE
},
3016 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
3017 {"winehq.org",S_OK
,FALSE
},
3020 {"www.winehq.org",S_OK
,FALSE
},
3023 {"/?query=%30%31&return=y",S_OK
,FALSE
},
3024 {"?query=%30%31&return=y",S_OK
,FALSE
},
3025 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
3026 {"http",S_OK
,FALSE
},
3031 {Uri_HOST_DNS
,S_OK
,FALSE
},
3033 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3034 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3037 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3039 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3040 {"www.winehq.org",S_OK
,FALSE
},
3041 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3042 {"winehq.org",S_OK
,FALSE
},
3045 {"www.winehq.org",S_OK
,FALSE
},
3048 {"?query=12&return=y",S_OK
,FALSE
},
3049 {"?query=12&return=y",S_OK
,FALSE
},
3050 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3051 {"http",S_OK
,FALSE
},
3056 {Uri_HOST_DNS
,S_OK
,FALSE
},
3058 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3059 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3062 /* Unknown scheme types can have invalid % encoded data in fragments. */
3063 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK
, FALSE
,
3065 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3066 {"www.winehq.org",S_OK
,FALSE
},
3067 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3068 {"winehq.org",S_OK
,FALSE
},
3070 {"#Te%xx",S_OK
,FALSE
},
3071 {"www.winehq.org",S_OK
,FALSE
},
3073 {"/tests/",S_OK
,FALSE
},
3074 {"/tests/",S_OK
,FALSE
},
3076 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3082 {Uri_HOST_DNS
,S_OK
,FALSE
},
3084 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3085 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3088 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3089 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
3091 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3092 {"www.winehq.org",S_OK
,FALSE
},
3093 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3094 {"winehq.org",S_OK
,FALSE
},
3096 {"#Te<|>",S_OK
,FALSE
},
3097 {"www.winehq.org",S_OK
,FALSE
},
3099 {"/tests/",S_OK
,FALSE
},
3100 {"/tests/",S_OK
,FALSE
},
3102 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3108 {Uri_HOST_DNS
,S_OK
,FALSE
},
3110 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3111 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3114 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3115 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
3117 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
3118 {"www.winehq.org",S_OK
,FALSE
},
3119 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
3120 {"winehq.org",S_OK
,FALSE
},
3122 {"#Te%3C%7C%3E",S_OK
,FALSE
},
3123 {"www.winehq.org",S_OK
,FALSE
},
3125 {"/tests/",S_OK
,FALSE
},
3126 {"/tests/",S_OK
,FALSE
},
3128 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3129 {"http",S_OK
,FALSE
},
3134 {Uri_HOST_DNS
,S_OK
,FALSE
},
3136 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3137 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3140 /* Forbidden characters aren't encoded in the fragment with this flag. */
3141 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3143 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3144 {"www.winehq.org",S_OK
,FALSE
},
3145 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3146 {"winehq.org",S_OK
,FALSE
},
3148 {"#Te<|>",S_OK
,FALSE
},
3149 {"www.winehq.org",S_OK
,FALSE
},
3151 {"/tests/",S_OK
,FALSE
},
3152 {"/tests/",S_OK
,FALSE
},
3154 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3155 {"http",S_OK
,FALSE
},
3160 {Uri_HOST_DNS
,S_OK
,FALSE
},
3162 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3163 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3166 /* Forbidden characters aren't encoded in the fragment with this flag. */
3167 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
3169 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3170 {"www.winehq.org",S_OK
,FALSE
},
3171 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3172 {"winehq.org",S_OK
,FALSE
},
3174 {"#Te<|>",S_OK
,FALSE
},
3175 {"www.winehq.org",S_OK
,FALSE
},
3177 {"/tests/",S_OK
,FALSE
},
3178 {"/tests/",S_OK
,FALSE
},
3180 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3181 {"http",S_OK
,FALSE
},
3186 {Uri_HOST_DNS
,S_OK
,FALSE
},
3188 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3189 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3192 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3193 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3195 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3196 {"www.winehq.org",S_OK
,FALSE
},
3197 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3198 {"winehq.org",S_OK
,FALSE
},
3200 {"#Te%30%31%32",S_OK
,FALSE
},
3201 {"www.winehq.org",S_OK
,FALSE
},
3203 {"/tests/",S_OK
,FALSE
},
3204 {"/tests/",S_OK
,FALSE
},
3206 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3212 {Uri_HOST_DNS
,S_OK
,FALSE
},
3214 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3215 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3218 /* Percent encoded, unreserved characters are decoded for known schemes. */
3219 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3221 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3222 {"www.winehq.org",S_OK
,FALSE
},
3223 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3224 {"winehq.org",S_OK
,FALSE
},
3226 {"#Te012",S_OK
,FALSE
},
3227 {"www.winehq.org",S_OK
,FALSE
},
3229 {"/tests/",S_OK
,FALSE
},
3230 {"/tests/",S_OK
,FALSE
},
3232 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3233 {"http",S_OK
,FALSE
},
3238 {Uri_HOST_DNS
,S_OK
,FALSE
},
3240 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3241 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3244 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3245 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3247 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3248 {"www.winehq.org",S_OK
,FALSE
},
3249 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3250 {"winehq.org",S_OK
,FALSE
},
3252 {"#Te012",S_OK
,FALSE
},
3253 {"www.winehq.org",S_OK
,FALSE
},
3255 {"/tests/",S_OK
,FALSE
},
3256 {"/tests/",S_OK
,FALSE
},
3258 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3259 {"http",S_OK
,FALSE
},
3264 {Uri_HOST_DNS
,S_OK
,FALSE
},
3266 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3267 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3270 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3271 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3273 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3274 {"www.winehq.org",S_OK
,FALSE
},
3275 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3276 {"winehq.org",S_OK
,FALSE
},
3278 {"#Te%30%31%32",S_OK
,FALSE
},
3279 {"www.winehq.org",S_OK
,FALSE
},
3281 {"/tests/",S_OK
,FALSE
},
3282 {"/tests/",S_OK
,FALSE
},
3284 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3285 {"http",S_OK
,FALSE
},
3290 {Uri_HOST_DNS
,S_OK
,FALSE
},
3292 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3293 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3296 /* Leading/Trailing whitespace is removed. */
3297 { " http://google.com/ ", 0, S_OK
, FALSE
,
3299 {"http://google.com/",S_OK
,FALSE
},
3300 {"google.com",S_OK
,FALSE
},
3301 {"http://google.com/",S_OK
,FALSE
},
3302 {"google.com",S_OK
,FALSE
},
3305 {"google.com",S_OK
,FALSE
},
3310 {"http://google.com/",S_OK
,FALSE
},
3311 {"http",S_OK
,FALSE
},
3316 {Uri_HOST_DNS
,S_OK
,FALSE
},
3318 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3319 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3322 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK
, FALSE
,
3324 {"http://google.com/",S_OK
,FALSE
},
3325 {"google.com",S_OK
,FALSE
},
3326 {"http://google.com/",S_OK
,FALSE
},
3327 {"google.com",S_OK
,FALSE
},
3330 {"google.com",S_OK
,FALSE
},
3335 {"http://google.com/",S_OK
,FALSE
},
3336 {"http",S_OK
,FALSE
},
3341 {Uri_HOST_DNS
,S_OK
,FALSE
},
3343 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3344 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3347 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3349 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3350 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3351 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3352 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3355 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3357 {"/%0A%0A%0A",S_OK
,FALSE
},
3358 {"/%0A%0A%0A",S_OK
,FALSE
},
3360 {"http://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3361 {"http",S_OK
,FALSE
},
3366 {Uri_HOST_DNS
,S_OK
,FALSE
},
3368 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3369 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3372 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3374 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3375 {"g\noogle.co\rm",S_OK
,FALSE
},
3376 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3377 {"g\noogle.co\rm",S_OK
,FALSE
},
3380 {"g\noogle.co\rm",S_OK
,FALSE
},
3382 {"/\n\n\n",S_OK
,FALSE
},
3383 {"/\n\n\n",S_OK
,FALSE
},
3385 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3391 {Uri_HOST_DNS
,S_OK
,FALSE
},
3393 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3394 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3397 /* Since file URLs are usually hierarchical, it returns an empty string
3398 * for the absolute URI property since it was declared as an opaque URI.
3400 { "file:index.html", 0, S_OK
, FALSE
,
3404 {"file:index.html",S_OK
,FALSE
},
3406 {".html",S_OK
,FALSE
},
3410 {"index.html",S_OK
,FALSE
},
3411 {"index.html",S_OK
,FALSE
},
3413 {"file:index.html",S_OK
,FALSE
},
3414 {"file",S_OK
,FALSE
},
3419 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3421 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3422 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3425 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3426 { "http:test.com/index.html", 0, S_OK
, FALSE
,
3430 {"http:test.com/index.html",S_OK
,FALSE
},
3432 {".html",S_OK
,FALSE
},
3436 {"test.com/index.html",S_OK
,FALSE
},
3437 {"test.com/index.html",S_OK
,FALSE
},
3439 {"http:test.com/index.html",S_OK
,FALSE
},
3440 {"http",S_OK
,FALSE
},
3445 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3447 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3448 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3451 { "ftp:test.com/index.html", 0, S_OK
, FALSE
,
3455 {"ftp:test.com/index.html",S_OK
,FALSE
},
3457 {".html",S_OK
,FALSE
},
3461 {"test.com/index.html",S_OK
,FALSE
},
3462 {"test.com/index.html",S_OK
,FALSE
},
3464 {"ftp:test.com/index.html",S_OK
,FALSE
},
3470 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3472 {URL_SCHEME_FTP
,S_OK
,FALSE
},
3473 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3476 { "file://C|/test.mp3", 0, S_OK
, FALSE
,
3478 {"file:///C:/test.mp3",S_OK
,FALSE
},
3480 {"file:///C:/test.mp3",S_OK
,FALSE
},
3482 {".mp3",S_OK
,FALSE
},
3486 {"/C:/test.mp3",S_OK
,FALSE
},
3487 {"/C:/test.mp3",S_OK
,FALSE
},
3489 {"file://C|/test.mp3",S_OK
,FALSE
},
3490 {"file",S_OK
,FALSE
},
3495 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3497 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3498 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3501 { "file:///C|/test.mp3", 0, S_OK
, FALSE
,
3503 {"file:///C:/test.mp3",S_OK
,FALSE
},
3505 {"file:///C:/test.mp3",S_OK
,FALSE
},
3507 {".mp3",S_OK
,FALSE
},
3511 {"/C:/test.mp3",S_OK
,FALSE
},
3512 {"/C:/test.mp3",S_OK
,FALSE
},
3514 {"file:///C|/test.mp3",S_OK
,FALSE
},
3515 {"file",S_OK
,FALSE
},
3520 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3522 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3523 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3526 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3529 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3531 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3533 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3535 {".html",S_OK
,FALSE
},
3539 {"c:\\dir\\index.html",S_OK
,FALSE
},
3540 {"c:\\dir\\index.html",S_OK
,FALSE
},
3542 {"file://c:/dir/index.html",S_OK
,FALSE
},
3543 {"file",S_OK
,FALSE
},
3548 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3550 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3551 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3554 /* Extra '/' after "file://" is removed. */
3555 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3557 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3559 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3561 {".html",S_OK
,FALSE
},
3565 {"c:\\dir\\index.html",S_OK
,FALSE
},
3566 {"c:\\dir\\index.html",S_OK
,FALSE
},
3568 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3569 {"file",S_OK
,FALSE
},
3574 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3576 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3577 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3580 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3581 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3583 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3585 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3587 {".html",S_OK
,FALSE
},
3591 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3592 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3594 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK
,FALSE
},
3595 {"file",S_OK
,FALSE
},
3600 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3602 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3603 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3606 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3608 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3610 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3612 {".html",S_OK
,FALSE
},
3616 {"c:\\dir\\index.html",S_OK
,FALSE
},
3617 {"c:\\dir\\index.html",S_OK
,FALSE
},
3619 {"file://c|/dir\\index.html",S_OK
,FALSE
},
3620 {"file",S_OK
,FALSE
},
3625 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3627 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3628 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3631 /* The backslashes after the scheme name are converted to forward slashes. */
3632 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3634 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3636 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3638 {".html",S_OK
,FALSE
},
3642 {"c:\\dir\\index.html",S_OK
,FALSE
},
3643 {"c:\\dir\\index.html",S_OK
,FALSE
},
3645 {"file:\\\\c:\\dir\\index.html",S_OK
,FALSE
},
3646 {"file",S_OK
,FALSE
},
3651 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3653 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3654 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3657 { "file:\\\\c:/dir/index.html", 0, S_OK
, FALSE
,
3659 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3661 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3663 {".html",S_OK
,FALSE
},
3667 {"/c:/dir/index.html",S_OK
,FALSE
},
3668 {"/c:/dir/index.html",S_OK
,FALSE
},
3670 {"file:\\\\c:/dir/index.html",S_OK
,FALSE
},
3671 {"file",S_OK
,FALSE
},
3676 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3678 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3679 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3682 { "http:\\\\google.com", 0, S_OK
, FALSE
,
3684 {"http://google.com/",S_OK
,FALSE
},
3685 {"google.com",S_OK
,FALSE
},
3686 {"http://google.com/",S_OK
,FALSE
},
3687 {"google.com",S_OK
,FALSE
},
3690 {"google.com",S_OK
,FALSE
},
3695 {"http:\\\\google.com",S_OK
,FALSE
},
3696 {"http",S_OK
,FALSE
},
3701 {Uri_HOST_DNS
,S_OK
,FALSE
},
3703 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3704 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3707 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3708 { "zip:\\\\google.com", 0, S_OK
, FALSE
,
3710 {"zip:\\\\google.com",S_OK
,FALSE
},
3712 {"zip:\\\\google.com",S_OK
,FALSE
},
3714 {".com",S_OK
,FALSE
},
3718 {"\\\\google.com",S_OK
,FALSE
},
3719 {"\\\\google.com",S_OK
,FALSE
},
3721 {"zip:\\\\google.com",S_OK
,FALSE
},
3727 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3729 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3730 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3733 /* Dot segments aren't removed. */
3734 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3736 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3738 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3740 {".html",S_OK
,FALSE
},
3744 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3745 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3747 {"file://c:\\dir\\../..\\./index.html",S_OK
,FALSE
},
3748 {"file",S_OK
,FALSE
},
3753 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3755 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3756 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3759 /* Forbidden characters aren't percent encoded. */
3760 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3762 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3764 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3766 {".html",S_OK
,FALSE
},
3770 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3771 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3773 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3774 {"file",S_OK
,FALSE
},
3779 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3781 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3782 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3785 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3786 { "file:c:\\dir\\../..\\index.html", 0, S_OK
, FALSE
,
3790 {"file:c:/dir/../../index.html",S_OK
,FALSE
},
3792 {".html",S_OK
,FALSE
},
3796 {"c:/dir/../../index.html",S_OK
,FALSE
},
3797 {"c:/dir/../../index.html",S_OK
,FALSE
},
3799 {"file:c:\\dir\\../..\\index.html",S_OK
,FALSE
},
3800 {"file",S_OK
,FALSE
},
3805 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3807 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3808 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3811 /* '/' are still converted to '\' even though it's an opaque URI. */
3812 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3816 {"file:c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3818 {".html",S_OK
,FALSE
},
3822 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3823 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3825 {"file:c:/dir\\../..\\index.html",S_OK
,FALSE
},
3826 {"file",S_OK
,FALSE
},
3831 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3833 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3834 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3837 /* Forbidden characters aren't percent encoded. */
3838 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3842 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3844 {".html",S_OK
,FALSE
},
3848 {"c:\\in^|dex.html",S_OK
,FALSE
},
3849 {"c:\\in^|dex.html",S_OK
,FALSE
},
3851 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3852 {"file",S_OK
,FALSE
},
3857 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3859 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3860 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3863 /* Doesn't have a UserName since the ':' appears at the beginning of the
3866 { "http://:password@gov.uk", 0, S_OK
, FALSE
,
3868 {"http://:password@gov.uk/",S_OK
,FALSE
},
3869 {":password@gov.uk",S_OK
,FALSE
},
3870 {"http://gov.uk/",S_OK
,FALSE
},
3874 {"gov.uk",S_OK
,FALSE
},
3875 {"password",S_OK
,FALSE
},
3879 {"http://:password@gov.uk",S_OK
,FALSE
},
3880 {"http",S_OK
,FALSE
},
3881 {":password",S_OK
,FALSE
},
3885 {Uri_HOST_DNS
,S_OK
,FALSE
},
3887 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3888 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3891 /* Has a UserName since the userinfo section doesn't contain a password. */
3892 { "http://@gov.uk", 0, S_OK
, FALSE
,
3894 {"http://gov.uk/",S_OK
,FALSE
,"http://@gov.uk/"},
3895 {"@gov.uk",S_OK
,FALSE
},
3896 {"http://gov.uk/",S_OK
,FALSE
},
3900 {"gov.uk",S_OK
,FALSE
},
3905 {"http://@gov.uk",S_OK
,FALSE
},
3906 {"http",S_OK
,FALSE
},
3911 {Uri_HOST_DNS
,S_OK
,FALSE
},
3913 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3914 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3917 /* ":@" not included in the absolute URI. */
3918 { "http://:@gov.uk", 0, S_OK
, FALSE
,
3920 {"http://gov.uk/",S_OK
,FALSE
,"http://:@gov.uk/"},
3921 {":@gov.uk",S_OK
,FALSE
},
3922 {"http://gov.uk/",S_OK
,FALSE
},
3926 {"gov.uk",S_OK
,FALSE
},
3931 {"http://:@gov.uk",S_OK
,FALSE
},
3932 {"http",S_OK
,FALSE
},
3937 {Uri_HOST_DNS
,S_OK
,FALSE
},
3939 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3940 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3943 /* '@' is included because it's an unknown scheme type. */
3944 { "zip://@gov.uk", 0, S_OK
, FALSE
,
3946 {"zip://@gov.uk/",S_OK
,FALSE
},
3947 {"@gov.uk",S_OK
,FALSE
},
3948 {"zip://@gov.uk/",S_OK
,FALSE
},
3952 {"gov.uk",S_OK
,FALSE
},
3957 {"zip://@gov.uk",S_OK
,FALSE
},
3963 {Uri_HOST_DNS
,S_OK
,FALSE
},
3965 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3966 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3969 /* ":@" are included because it's an unknown scheme type. */
3970 { "zip://:@gov.uk", 0, S_OK
, FALSE
,
3972 {"zip://:@gov.uk/",S_OK
,FALSE
},
3973 {":@gov.uk",S_OK
,FALSE
},
3974 {"zip://:@gov.uk/",S_OK
,FALSE
},
3978 {"gov.uk",S_OK
,FALSE
},
3983 {"zip://:@gov.uk",S_OK
,FALSE
},
3989 {Uri_HOST_DNS
,S_OK
,FALSE
},
3991 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3992 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3995 { "about:blank", 0, S_OK
, FALSE
,
3997 {"about:blank",S_OK
,FALSE
},
3999 {"about:blank",S_OK
,FALSE
},
4005 {"blank",S_OK
,FALSE
},
4006 {"blank",S_OK
,FALSE
},
4008 {"about:blank",S_OK
,FALSE
},
4009 {"about",S_OK
,FALSE
},
4014 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4016 {URL_SCHEME_ABOUT
,S_OK
,FALSE
},
4017 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4020 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK
,FALSE
,
4022 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4024 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4026 {".htm",S_OK
,FALSE
},
4030 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4031 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4033 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4039 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4041 {URL_SCHEME_MK
,S_OK
,FALSE
},
4042 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4045 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK
,FALSE
,
4047 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4049 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4051 {".htm",S_OK
,FALSE
},
4055 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4056 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4058 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4064 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4066 {URL_SCHEME_MK
,S_OK
,FALSE
},
4067 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4070 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4071 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
4073 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
4074 {"server",S_OK
,FALSE
},
4075 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
4077 {".html",S_OK
,FALSE
},
4079 {"server",S_OK
,FALSE
},
4081 {"\\dir\\index.html",S_OK
,FALSE
},
4082 {"\\dir\\index.html",S_OK
,FALSE
},
4084 {"file://server/dir/index.html",S_OK
,FALSE
},
4085 {"file",S_OK
,FALSE
},
4090 {Uri_HOST_DNS
,S_OK
,FALSE
},
4092 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4093 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4096 /* When CreateUri generates an IUri, it still displays the default port in the
4099 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4101 {"http://google.com:80/",S_OK
,FALSE
},
4102 {"google.com:80",S_OK
,FALSE
},
4103 {"http://google.com:80/",S_OK
,FALSE
},
4104 {"google.com",S_OK
,FALSE
},
4107 {"google.com",S_OK
,FALSE
},
4112 {"http://google.com:80/",S_OK
,FALSE
},
4113 {"http",S_OK
,FALSE
},
4118 {Uri_HOST_DNS
,S_OK
,FALSE
},
4120 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
4121 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4124 /* For res URIs the host is everything up until the first '/'. */
4125 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK
, FALSE
,
4127 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4128 {"C:\\dir\\file.exe",S_OK
,FALSE
},
4129 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4131 {".html",S_OK
,FALSE
},
4133 {"C:\\dir\\file.exe",S_OK
,FALSE
},
4135 {"/DATA/test.html",S_OK
,FALSE
},
4136 {"/DATA/test.html",S_OK
,FALSE
},
4138 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4144 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4146 {URL_SCHEME_RES
,S_OK
,FALSE
},
4147 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4150 /* Res URI can contain a '|' in the host name. */
4151 { "res://c:\\di|r\\file.exe/test", 0, S_OK
, FALSE
,
4153 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4154 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4155 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4159 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4161 {"/test",S_OK
,FALSE
},
4162 {"/test",S_OK
,FALSE
},
4164 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4170 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4172 {URL_SCHEME_RES
,S_OK
,FALSE
},
4173 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4176 /* Res URIs can have invalid percent encoded values. */
4177 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK
, FALSE
,
4179 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4180 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4181 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4185 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4187 {"/test",S_OK
,FALSE
},
4188 {"/test",S_OK
,FALSE
},
4190 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4196 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4198 {URL_SCHEME_RES
,S_OK
,FALSE
},
4199 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4202 /* Res doesn't get forbidden characters percent encoded in its path. */
4203 { "res://c:\\test/tes<|>t", 0, S_OK
, FALSE
,
4205 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4206 {"c:\\test",S_OK
,FALSE
},
4207 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4211 {"c:\\test",S_OK
,FALSE
},
4213 {"/tes<|>t",S_OK
,FALSE
},
4214 {"/tes<|>t",S_OK
,FALSE
},
4216 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4222 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4224 {URL_SCHEME_RES
,S_OK
,FALSE
},
4225 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4228 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4230 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4232 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4234 {".jpg",S_OK
,FALSE
},
4238 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4239 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4241 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4247 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4249 {URL_SCHEME_MK
,S_OK
,FALSE
},
4250 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4253 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4255 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4257 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4259 {".jpg",S_OK
,FALSE
},
4263 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4264 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4266 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4272 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4274 {URL_SCHEME_MK
,S_OK
,FALSE
},
4275 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4278 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4280 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4282 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4284 {".jpg",S_OK
,FALSE
},
4288 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4289 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4291 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4297 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4299 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4300 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4303 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4305 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4307 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4309 {".jpg",S_OK
,FALSE
},
4313 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4314 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4316 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4322 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4324 {URL_SCHEME_MK
,S_OK
,FALSE
},
4325 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4328 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4330 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4332 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4334 {".jpg",S_OK
,FALSE
},
4338 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4339 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4341 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4347 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4349 {URL_SCHEME_MK
,S_OK
,FALSE
},
4350 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4353 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK
, FALSE
,
4355 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4357 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4359 {".jpg",S_OK
,FALSE
},
4363 {"images/xxx.jpg",S_OK
,FALSE
},
4364 {"images/xxx.jpg",S_OK
,FALSE
},
4366 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK
,FALSE
},
4372 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4374 {URL_SCHEME_MK
,S_OK
,FALSE
},
4375 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4378 { "", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4397 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4399 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4400 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4403 { " \t ", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4422 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4424 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4425 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4428 { "javascript:void", 0, S_OK
, FALSE
,
4430 {"javascript:void",S_OK
},
4432 {"javascript:void",S_OK
},
4441 {"javascript:void",S_OK
},
4442 {"javascript",S_OK
},
4447 {Uri_HOST_UNKNOWN
,S_OK
},
4449 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4450 {URLZONE_INVALID
,E_NOTIMPL
}
4453 { "javascript://undefined", 0, S_OK
, FALSE
,
4455 {"javascript://undefined",S_OK
},
4457 {"javascript://undefined",S_OK
},
4463 {"//undefined",S_OK
},
4464 {"//undefined",S_OK
},
4466 {"javascript://undefined",S_OK
},
4467 {"javascript",S_OK
},
4472 {Uri_HOST_UNKNOWN
,S_OK
},
4474 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4475 {URLZONE_INVALID
,E_NOTIMPL
}
4478 { "JavaSCript:escape('/\\?#?')", 0, S_OK
, FALSE
,
4480 {"javascript:escape('/\\?#?')",S_OK
},
4482 {"javascript:escape('/\\?#?')",S_OK
},
4488 {"escape('/\\?#?')",S_OK
},
4489 {"escape('/\\?#?')",S_OK
},
4491 {"JavaSCript:escape('/\\?#?')",S_OK
},
4492 {"javascript",S_OK
},
4497 {Uri_HOST_UNKNOWN
,S_OK
},
4499 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4500 {URLZONE_INVALID
,E_NOTIMPL
}
4503 { "*://google.com", 0, S_OK
, FALSE
,
4505 {"*:google.com/",S_OK
,FALSE
},
4506 {"google.com",S_OK
},
4507 {"*:google.com/",S_OK
,FALSE
},
4508 {"google.com",S_OK
,FALSE
},
4511 {"google.com",S_OK
,FALSE
},
4516 {"*://google.com",S_OK
,FALSE
},
4522 {Uri_HOST_DNS
,S_OK
,FALSE
},
4524 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
4525 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4528 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK
,FALSE
,
4530 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4532 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4538 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4539 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4541 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4547 {Uri_HOST_UNKNOWN
,S_OK
},
4549 {URL_SCHEME_MK
,S_OK
},
4550 {URLZONE_INVALID
,E_NOTIMPL
}
4553 { "gopher://test.winehq.org:151/file.txt",0,S_OK
,FALSE
,
4555 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4556 {"test.winehq.org:151",S_OK
},
4557 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4558 {"winehq.org",S_OK
},
4561 {"test.winehq.org",S_OK
},
4566 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4572 {Uri_HOST_DNS
,S_OK
},
4574 {URL_SCHEME_GOPHER
,S_OK
},
4575 {URLZONE_INVALID
,E_NOTIMPL
}
4578 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4580 {"//host.com/path/file.txt?query",S_OK
},
4582 {"//host.com/path/file.txt?query",S_OK
},
4588 {"/path/file.txt",S_OK
},
4589 {"/path/file.txt?query",S_OK
},
4591 {"//host.com/path/file.txt?query",S_OK
},
4597 {Uri_HOST_DNS
,S_OK
},
4599 {URL_SCHEME_UNKNOWN
,S_OK
},
4600 {URLZONE_INVALID
,E_NOTIMPL
}
4603 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4605 {"//host/path/file.txt?query",S_OK
},
4607 {"//host/path/file.txt?query",S_OK
},
4613 {"/path/file.txt",S_OK
},
4614 {"/path/file.txt?query",S_OK
},
4616 {"//host/path/file.txt?query",S_OK
},
4622 {Uri_HOST_DNS
,S_OK
},
4624 {URL_SCHEME_UNKNOWN
,S_OK
},
4625 {URLZONE_INVALID
,E_NOTIMPL
}
4628 { "//host", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4647 {Uri_HOST_DNS
,S_OK
},
4649 {URL_SCHEME_UNKNOWN
,S_OK
},
4650 {URLZONE_INVALID
,E_NOTIMPL
}
4653 { "mailto://", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4666 {"mailto://",S_OK
,FALSE
,"mailto:"},
4672 {Uri_HOST_UNKNOWN
,S_OK
},
4674 {URL_SCHEME_MAILTO
,S_OK
},
4675 {URLZONE_INVALID
,E_NOTIMPL
}
4678 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4680 {"mailto:a@b.com",S_OK
},
4682 {"mailto:a@b.com",S_OK
},
4691 {"mailto://a@b.com",S_OK
,FALSE
,"mailto:a@b.com"},
4697 {Uri_HOST_UNKNOWN
,S_OK
},
4699 {URL_SCHEME_MAILTO
,S_OK
},
4700 {URLZONE_INVALID
,E_NOTIMPL
}
4703 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4705 {"file://c:\\test file.html",S_OK
,FALSE
},
4707 {"file://c:\\test file.html",S_OK
,FALSE
},
4709 {".html",S_OK
,FALSE
},
4713 {"c:\\test file.html",S_OK
,FALSE
},
4714 {"c:\\test file.html",S_OK
,FALSE
},
4716 {"c:\\test file.html",S_OK
,FALSE
},
4717 {"file",S_OK
,FALSE
},
4722 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4724 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4725 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4728 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4730 {"file://c:\\test%20file.html",S_OK
,FALSE
},
4732 {"file://c:\\test%20file.html",S_OK
,FALSE
},
4734 {".html",S_OK
,FALSE
},
4738 {"c:\\test%20file.html",S_OK
,FALSE
},
4739 {"c:\\test%20file.html",S_OK
,FALSE
},
4741 {"c:\\test%20file.html",S_OK
,FALSE
},
4742 {"file",S_OK
,FALSE
},
4747 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4749 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4750 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4753 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4755 {"file:///c:/test%20file.html",S_OK
,FALSE
},
4757 {"file:///c:/test%20file.html",S_OK
,FALSE
},
4759 {".html",S_OK
,FALSE
},
4763 {"/c:/test%20file.html",S_OK
,FALSE
},
4764 {"/c:/test%20file.html",S_OK
,FALSE
},
4766 {"c:\\test file.html",S_OK
,FALSE
},
4767 {"file",S_OK
,FALSE
},
4772 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4774 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4775 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4778 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4780 {"file:///c:/test%2520file.html",S_OK
,FALSE
},
4782 {"file:///c:/test%2520file.html",S_OK
,FALSE
},
4784 {".html",S_OK
,FALSE
},
4788 {"/c:/test%2520file.html",S_OK
,FALSE
},
4789 {"/c:/test%2520file.html",S_OK
,FALSE
},
4791 {"c:\\test%20file.html",S_OK
,FALSE
},
4792 {"file",S_OK
,FALSE
},
4797 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4799 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4800 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4803 /* Path with Unicode characters. Unicode characters should not be encoded */
4804 {/* "http://127.0.0.1/测试/test.txt" with Chinese in UTF-8 encoding */
4805 "http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt", 0, S_OK
, FALSE
,
4807 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK
,FALSE
},
4808 {"127.0.0.1",S_OK
,FALSE
},
4809 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK
,FALSE
},
4811 {".txt",S_OK
,FALSE
},
4813 {"127.0.0.1",S_OK
,FALSE
},
4815 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK
,FALSE
},
4816 {"/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK
,FALSE
},
4818 {"http://127.0.0.1/\xE6\xB5\x8B\xE8\xAF\x95/test.txt",S_OK
,FALSE
},
4819 {"http",S_OK
,FALSE
},
4824 {Uri_HOST_IPV4
,S_OK
,FALSE
},
4826 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
4827 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4830 { "file:\xE6\xB5\x8B\xE8\xAF\x95.html", 0, S_OK
, FALSE
,
4834 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK
,FALSE
},
4836 {".html",S_OK
,FALSE
},
4840 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK
,FALSE
},
4841 {"\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK
,FALSE
},
4843 {"file:\xE6\xB5\x8B\xE8\xAF\x95.html",S_OK
,FALSE
},
4844 {"file",S_OK
,FALSE
},
4849 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4851 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4852 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4855 /* Username with Unicode characters. Unicode characters should not be encoded */
4856 { "ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK
, FALSE
,
4858 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4859 {"\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
4860 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4861 {"winehq.org",S_OK
,FALSE
},
4862 {".txt",S_OK
,FALSE
},
4864 {"ftp.winehq.org",S_OK
,FALSE
},
4865 {"wine",S_OK
,FALSE
},
4866 {"/dir/foobar.txt",S_OK
,FALSE
},
4867 {"/dir/foobar.txt",S_OK
,FALSE
},
4869 {"ftp://\xE6\xB5\x8B\xE8\xAF\x95:wine@ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4871 {"\xE6\xB5\x8B\xE8\xAF\x95:wine",S_OK
,FALSE
},
4872 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
}
4875 {Uri_HOST_DNS
,S_OK
,FALSE
},
4877 {URL_SCHEME_FTP
,S_OK
,FALSE
},
4878 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4881 /* Password with Unicode characters. Unicode characters should not be encoded */
4882 { "ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt", 0, S_OK
, FALSE
,
4884 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4885 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999",S_OK
,FALSE
},
4886 {"ftp://ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4887 {"winehq.org",S_OK
,FALSE
},
4888 {".txt",S_OK
,FALSE
},
4890 {"ftp.winehq.org",S_OK
,FALSE
},
4891 {"\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4892 {"/dir/foobar.txt",S_OK
,FALSE
},
4893 {"/dir/foobar.txt",S_OK
,FALSE
},
4895 {"ftp://winepass:\xE6\xB5\x8B\xE8\xAF\x95@ftp.winehq.org:9999/dir/foobar.txt",S_OK
,FALSE
},
4897 {"winepass:\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4898 {"winepass",S_OK
,FALSE
}
4901 {Uri_HOST_DNS
,S_OK
,FALSE
},
4903 {URL_SCHEME_FTP
,S_OK
,FALSE
},
4904 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4907 /* Query with Unicode characters. Unicode characters should not be encoded */
4908 { "http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y", 0, S_OK
, FALSE
,
4910 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK
,FALSE
},
4911 {"www.winehq.org",S_OK
,FALSE
},
4912 {"http://www.winehq.org/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK
,FALSE
},
4913 {"winehq.org",S_OK
,FALSE
},
4916 {"www.winehq.org",S_OK
,FALSE
},
4919 {"/?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK
,FALSE
},
4920 {"?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK
,FALSE
},
4921 {"http://www.winehq.org/tests/..?query=\xE6\xB5\x8B\xE8\xAF\x95&return=y",S_OK
,FALSE
},
4922 {"http",S_OK
,FALSE
},
4927 {Uri_HOST_DNS
,S_OK
,FALSE
},
4929 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
4930 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4933 /* Fragment with Unicode characters. Unicode characters should not be encoded */
4934 { "http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95", 0, S_OK
, FALSE
,
4936 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4937 {"www.winehq.org",S_OK
,FALSE
},
4938 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4939 {"winehq.org",S_OK
,FALSE
},
4941 {"#\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4942 {"www.winehq.org",S_OK
,FALSE
},
4944 {"/tests/",S_OK
,FALSE
},
4945 {"/tests/",S_OK
,FALSE
},
4947 {"http://www.winehq.org/tests/#\xE6\xB5\x8B\xE8\xAF\x95",S_OK
,FALSE
},
4948 {"http",S_OK
,FALSE
},
4953 {Uri_HOST_DNS
,S_OK
,FALSE
},
4955 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
4956 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4959 /* ZERO WIDTH JOINER as non-printing Unicode characters should not be encoded if not preprocessed. */
4960 { "file:a\xE2\x80\x8D.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
4964 {"file:a\xE2\x80\x8D.html",S_OK
,FALSE
},
4966 {".html",S_OK
,FALSE
},
4970 {"a\xE2\x80\x8D.html",S_OK
,FALSE
},
4971 {"a\xE2\x80\x8D.html",S_OK
,FALSE
},
4973 {"file:a\xE2\x80\x8D.html",S_OK
,FALSE
},
4974 {"file",S_OK
,FALSE
},
4979 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4981 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4982 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4985 /* LEFT-TO-RIGHT MARK as non-printing Unicode characters should not be encoded if not preprocessed. */
4986 { "file:ab\xE2\x80\x8E.html", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
4990 {"file:ab\xE2\x80\x8D.html",S_OK
,FALSE
},
4992 {".html",S_OK
,FALSE
},
4996 {"ab\xE2\x80\x8D.html",S_OK
,FALSE
},
4997 {"ab\xE2\x80\x8D.html",S_OK
,FALSE
},
4999 {"file:ab\xE2\x80\x8D.html",S_OK
,FALSE
},
5000 {"file",S_OK
,FALSE
},
5005 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
5007 {URL_SCHEME_FILE
,S_OK
,FALSE
},
5008 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
5011 /* Invalid Unicode characters should not be filtered */
5012 { "file:ab\xc3\x28.html", 0, S_OK
, FALSE
,
5016 {"file:ab\xc3\x28.html",S_OK
,FALSE
},
5018 {".html",S_OK
,FALSE
},
5022 {"ab\xc3\x28.html",S_OK
,FALSE
},
5023 {"ab\xc3\x28.html",S_OK
,FALSE
},
5025 {"file:ab\xc3\x28.html",S_OK
,FALSE
},
5026 {"file",S_OK
,FALSE
},
5031 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
5033 {URL_SCHEME_FILE
,S_OK
,FALSE
},
5034 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
5037 /* Make sure % encoded unicode characters are not decoded. */
5038 { "ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/", 0, S_OK
, FALSE
,
5040 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK
,FALSE
},
5041 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com",S_OK
,FALSE
},
5042 {"ftp://ftp.google.com/",S_OK
,FALSE
},
5043 {"google.com",S_OK
,FALSE
},
5046 {"ftp.google.com",S_OK
,FALSE
},
5047 {"%E6%B5%8B%E8%AF%95",S_OK
,FALSE
},
5051 {"ftp://%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95@ftp.google.com/",S_OK
,FALSE
},
5053 {"%E6%B5%8B%E8%AF%95:%E6%B5%8B%E8%AF%95",S_OK
,FALSE
},
5054 {"%E6%B5%8B%E8%AF%95",S_OK
,FALSE
}
5057 {Uri_HOST_DNS
,S_OK
,FALSE
},
5059 {URL_SCHEME_FTP
,S_OK
,FALSE
},
5060 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
5065 typedef struct _invalid_uri
{
5071 static const invalid_uri invalid_uri_tests
[] = {
5072 /* Has to have a scheme name. */
5073 {"://www.winehq.org",0,FALSE
},
5074 /* Windows doesn't like URIs which are implicitly file paths without the
5075 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
5077 {"C:/test/test.mp3",0,FALSE
},
5078 {"\\\\Server/test/test.mp3",0,FALSE
},
5079 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
,FALSE
},
5080 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE
,FALSE
},
5081 /* Invalid schemes. */
5082 {"*abcd://not.valid.com",0,FALSE
},
5083 {"*a*b*c*d://not.valid.com",0,FALSE
},
5084 /* Not allowed to have invalid % encoded data. */
5085 {"ftp://google.co%XX/",0,FALSE
},
5086 /* Too many h16 components. */
5087 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE
},
5088 /* Not enough room for IPv4 address. */
5089 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE
},
5090 /* Not enough h16 components. */
5091 {"http://[1:2:3:4]",0,FALSE
},
5092 /* Not enough components including IPv4. */
5093 {"http://[1:192.0.1.0]",0,FALSE
},
5094 /* Not allowed to have partial IPv4 in IPv6. */
5095 {"http://[::192.0]",0,FALSE
},
5096 /* Can't have elision of 1 h16 at beginning of address. */
5097 {"http://[::2:3:4:5:6:7:8]",0,FALSE
},
5098 /* Expects a valid IP Literal. */
5099 {"ftp://[not.valid.uri]/",0,FALSE
},
5100 /* Expects valid port for a known scheme type. */
5101 {"ftp://www.winehq.org:123fgh",0,FALSE
},
5102 /* Port exceeds USHORT_MAX for known scheme type. */
5103 {"ftp://www.winehq.org:65536",0,FALSE
},
5104 /* Invalid port with IPv4 address. */
5105 {"http://www.winehq.org:1abcd",0,FALSE
},
5106 /* Invalid port with IPv6 address. */
5107 {"http://[::ffff]:32xy",0,FALSE
},
5108 /* Not allowed to have backslashes with NO_CANONICALIZE. */
5109 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE
,FALSE
},
5110 /* Not allowed to have invalid % encoded data in opaque URI path. */
5111 {"news:test%XX",0,FALSE
},
5112 {"mailto:wine@winehq%G8.com",0,FALSE
},
5113 /* Known scheme types can't have invalid % encoded data in query string. */
5114 {"http://google.com/?query=te%xx",0,FALSE
},
5115 /* Invalid % encoded data in fragment of know scheme type. */
5116 {"ftp://google.com/#Test%xx",0,FALSE
},
5117 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
5118 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
5119 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5120 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5121 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5122 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5123 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5124 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
5125 /* res URIs aren't allowed to have forbidden dos path characters in the
5128 {"res://c:\\te<st\\test/test",0,FALSE
},
5129 {"res://c:\\te>st\\test/test",0,FALSE
},
5130 {"res://c:\\te\"st\\test/test",0,FALSE
},
5131 {"res://c:\\test/te%xxst",0,FALSE
}
5134 typedef struct _uri_equality
{
5136 DWORD create_flags_a
;
5138 DWORD create_flags_b
;
5143 static const uri_equality equality_tests
[] = {
5145 "HTTP://www.winehq.org/test dir/./",0,
5146 "http://www.winehq.org/test dir/../test dir/",0,
5150 /* http://www.winehq.org/test%20dir */
5151 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
5152 "http://www.winehq.org/test dir",0,
5156 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
5157 "file:///c:/test.mp3",0,
5161 "ftp://ftp.winehq.org/",0,
5162 "ftp://ftp.winehq.org",0,
5166 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
5167 "ftp://ftp.winehq.org/t%45stB/",0,
5171 "http://google.com/TEST",0,
5172 "http://google.com/test",0,
5176 "http://GOOGLE.com/",0,
5177 "http://google.com/",0,
5180 /* Performs case insensitive compare of host names (for known scheme types). */
5182 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE
,
5183 "ftp://google.com/",0,
5187 "zip://GOOGLE.com/",0,
5188 "zip://google.com/",0,
5192 "file:///c:/TEST/TeST/",0,
5193 "file:///c:/test/test/",0,
5197 "file:///server/TEST",0,
5198 "file:///SERVER/TEST",0,
5202 "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
5203 "http://google.com/",0,
5207 "ftp://google.com:21/",0,
5208 "ftp://google.com/",0,
5212 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE
,
5213 "http://google.com/",0,
5217 "http://google.com:70/",0,
5218 "http://google.com:71/",0,
5222 "file:///c:/dir/file.txt", 0,
5223 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
5227 "file:///c:/dir/file.txt", 0,
5228 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
5232 "file:///c:/dir/file.txt", 0,
5233 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
5237 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
5238 "file:///c:/%20dir/file.txt", 0,
5242 "file:///c:/Dir/file.txt", 0,
5243 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH
,
5247 "file:///c:/dir/file.txt", 0,
5248 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
5252 "file:///c:/dir/file.txt#a", 0,
5253 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH
,
5256 /* Tests of an empty hash/fragment part */
5258 "http://google.com/test",0,
5259 "http://google.com/test#",0,
5263 "ftp://ftp.winehq.org/",0,
5264 "ftp://ftp.winehq.org/#",0,
5268 "file:///c:/dir/file.txt#", 0,
5269 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
5274 typedef struct _uri_with_fragment
{
5276 const char* fragment
;
5278 HRESULT create_expected
;
5281 const char* expected_uri
;
5283 } uri_with_fragment
;
5285 static const uri_with_fragment uri_fragment_tests
[] = {
5287 "http://google.com/","#fragment",0,S_OK
,FALSE
,
5288 "http://google.com/#fragment",FALSE
5291 "http://google.com/","fragment",0,S_OK
,FALSE
,
5292 "http://google.com/#fragment",FALSE
5295 "zip://test.com/","?test",0,S_OK
,FALSE
,
5296 "zip://test.com/#?test",FALSE
5298 /* The fragment can be empty. */
5300 "ftp://ftp.google.com/","",0,S_OK
,FALSE
,
5301 "ftp://ftp.google.com/#",FALSE
5305 typedef struct _uri_builder_property
{
5308 const char *expected_value
;
5309 Uri_PROPERTY property
;
5312 } uri_builder_property
;
5314 typedef struct _uri_builder_port
{
5322 typedef struct _uri_builder_str_property
{
5323 const char* expected
;
5326 } uri_builder_str_property
;
5328 typedef struct _uri_builder_dword_property
{
5332 } uri_builder_dword_property
;
5334 typedef struct _uri_builder_test
{
5337 HRESULT create_builder_expected
;
5338 BOOL create_builder_todo
;
5340 uri_builder_property properties
[URI_BUILDER_STR_PROPERTY_COUNT
];
5342 uri_builder_port port_prop
;
5348 DWORD uri_simple_encode_flags
;
5349 HRESULT uri_simple_hres
;
5350 BOOL uri_simple_todo
;
5352 DWORD uri_with_flags
;
5353 DWORD uri_with_builder_flags
;
5354 DWORD uri_with_encode_flags
;
5355 HRESULT uri_with_hres
;
5358 uri_builder_str_property expected_str_props
[URI_STR_PROPERTY_COUNT
];
5359 uri_builder_dword_property expected_dword_props
[URI_DWORD_PROPERTY_COUNT
];
5362 static const uri_builder_test uri_builder_tests
[] = {
5363 { "http://google.com/",0,S_OK
,FALSE
,
5365 {TRUE
,"#fragment",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
5366 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
},
5367 {TRUE
,"?query=x",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5368 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5375 {"http://username:password@google.com/?query=x#fragment",S_OK
},
5376 {"username:password@google.com",S_OK
},
5377 {"http://google.com/?query=x#fragment",S_OK
},
5378 {"google.com",S_OK
},
5381 {"google.com",S_OK
},
5386 {"http://username:password@google.com/?query=x#fragment",S_OK
},
5388 {"username:password",S_OK
},
5392 {Uri_HOST_DNS
,S_OK
},
5394 {URL_SCHEME_HTTP
,S_OK
},
5395 {URLZONE_INVALID
,E_NOTIMPL
}
5398 { "http://google.com/",0,S_OK
,FALSE
,
5400 {TRUE
,"test",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5402 {TRUE
,TRUE
,120,S_OK
,FALSE
},
5407 {"test://google.com:120/",S_OK
},
5408 {"google.com:120",S_OK
},
5409 {"test://google.com:120/",S_OK
},
5410 {"google.com",S_OK
},
5413 {"google.com",S_OK
},
5418 {"test://google.com:120/",S_OK
},
5424 {Uri_HOST_DNS
,S_OK
},
5426 {URL_SCHEME_UNKNOWN
,S_OK
},
5427 {URLZONE_INVALID
,E_NOTIMPL
}
5430 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5432 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5433 {TRUE
,"::192.2.3.4",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5434 {TRUE
,NULL
,NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5441 {"http://[::192.2.3.4]/",S_OK
},
5442 {"[::192.2.3.4]",S_OK
},
5443 {"http://[::192.2.3.4]/",S_OK
},
5447 {"::192.2.3.4",S_OK
},
5452 {"http://[::192.2.3.4]/",S_OK
},
5458 {Uri_HOST_IPV6
,S_OK
},
5460 {URL_SCHEME_HTTP
,S_OK
},
5461 {URLZONE_INVALID
,E_NOTIMPL
}
5464 { "http://google.com/",0,S_OK
,FALSE
,
5466 {TRUE
,"Frag","#Frag",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5473 {"http://google.com/#Frag",S_OK
},
5474 {"google.com",S_OK
},
5475 {"http://google.com/#Frag",S_OK
},
5476 {"google.com",S_OK
},
5479 {"google.com",S_OK
},
5484 {"http://google.com/#Frag",S_OK
},
5490 {Uri_HOST_DNS
,S_OK
},
5492 {URL_SCHEME_HTTP
,S_OK
},
5493 {URLZONE_INVALID
,E_NOTIMPL
}
5496 { "http://google.com/",0,S_OK
,FALSE
,
5498 {TRUE
,"","#",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
5505 {"http://google.com/#",S_OK
},
5506 {"google.com",S_OK
},
5507 {"http://google.com/#",S_OK
},
5508 {"google.com",S_OK
},
5511 {"google.com",S_OK
},
5516 {"http://google.com/#",S_OK
},
5522 {Uri_HOST_DNS
,S_OK
},
5524 {URL_SCHEME_HTTP
,S_OK
},
5525 {URLZONE_INVALID
,E_NOTIMPL
}
5528 { "http://google.com/",0,S_OK
,FALSE
,
5530 {TRUE
,":password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5537 {"http://::password@google.com/",S_OK
},
5538 {"::password@google.com",S_OK
},
5539 {"http://google.com/",S_OK
},
5540 {"google.com",S_OK
},
5543 {"google.com",S_OK
},
5548 {"http://::password@google.com/",S_OK
},
5550 {"::password",S_OK
},
5554 {Uri_HOST_DNS
,S_OK
},
5556 {URL_SCHEME_HTTP
,S_OK
},
5557 {URLZONE_INVALID
,E_NOTIMPL
}
5560 { "test/test",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5562 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5565 Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5567 Uri_CREATE_ALLOW_RELATIVE
,0,0,S_OK
,FALSE
,
5569 {":password@test/test",S_OK
},
5570 {":password@",S_OK
},
5571 {":password@test/test",S_OK
},
5580 {":password@test/test",S_OK
},
5586 {Uri_HOST_UNKNOWN
,S_OK
},
5588 {URL_SCHEME_UNKNOWN
,S_OK
},
5589 {URLZONE_INVALID
,E_NOTIMPL
}
5592 { "http://google.com/",0,S_OK
,FALSE
,
5594 {TRUE
,"test/test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5601 {"http://google.com/test/test",S_OK
},
5602 {"google.com",S_OK
},
5603 {"http://google.com/test/test",S_OK
},
5604 {"google.com",S_OK
},
5607 {"google.com",S_OK
},
5609 {"/test/test",S_OK
},
5610 {"/test/test",S_OK
},
5612 {"http://google.com/test/test",S_OK
},
5618 {Uri_HOST_DNS
,S_OK
},
5620 {URL_SCHEME_HTTP
,S_OK
},
5621 {URLZONE_INVALID
,E_NOTIMPL
}
5624 { "zip:testing/test",0,S_OK
,FALSE
,
5626 {TRUE
,"test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5650 {Uri_HOST_UNKNOWN
,S_OK
},
5652 {URL_SCHEME_UNKNOWN
,S_OK
},
5653 {URLZONE_INVALID
,E_NOTIMPL
}
5656 { "http://google.com/",0,S_OK
,FALSE
,
5660 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5661 {TRUE
,FALSE
,555,S_OK
,FALSE
},
5666 {"http://google.com/",S_OK
},
5667 {"google.com",S_OK
},
5668 {"http://google.com/",S_OK
},
5669 {"google.com",S_OK
},
5672 {"google.com",S_OK
},
5677 {"http://google.com/",S_OK
},
5683 {Uri_HOST_DNS
,S_OK
},
5684 /* Still returns 80, even though earlier the port was disabled. */
5686 {URL_SCHEME_HTTP
,S_OK
},
5687 {URLZONE_INVALID
,E_NOTIMPL
}
5690 { "http://google.com/",0,S_OK
,FALSE
,
5694 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5695 * you'll get 122345 instead.
5697 {TRUE
,122345,222,S_OK
,FALSE
},
5702 {"http://google.com:222/",S_OK
},
5703 {"google.com:222",S_OK
},
5704 {"http://google.com:222/",S_OK
},
5705 {"google.com",S_OK
},
5708 {"google.com",S_OK
},
5713 {"http://google.com:222/",S_OK
},
5719 {Uri_HOST_DNS
,S_OK
},
5721 {URL_SCHEME_HTTP
,S_OK
},
5722 {URLZONE_INVALID
,E_NOTIMPL
}
5725 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5726 { "http://google.com/",0,S_OK
,FALSE
,
5730 {TRUE
,TRUE
,999999,S_OK
,FALSE
},
5735 {"http://google.com:999999/",S_OK
},
5736 {"google.com:999999",S_OK
},
5737 {"http://google.com:999999/",S_OK
},
5738 {"google.com",S_OK
},
5741 {"google.com",S_OK
},
5746 {"http://google.com:999999/",S_OK
},
5752 {Uri_HOST_DNS
,S_OK
},
5754 {URL_SCHEME_HTTP
,S_OK
},
5755 {URLZONE_INVALID
,E_NOTIMPL
}
5758 { "http://google.com/",0,S_OK
,FALSE
,
5760 {TRUE
,"test","?test",Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5768 {"http://google.com/?test",S_OK
},
5769 {"google.com",S_OK
},
5770 {"http://google.com/?test",S_OK
},
5771 {"google.com",S_OK
},
5774 {"google.com",S_OK
},
5779 {"http://google.com/?test",S_OK
},
5785 {Uri_HOST_DNS
,S_OK
},
5787 {URL_SCHEME_HTTP
,S_OK
},
5788 {URLZONE_INVALID
,E_NOTIMPL
}
5791 { "http://:password@google.com/",0,S_OK
,FALSE
,
5800 {"http://:password@google.com/",S_OK
},
5801 {":password@google.com",S_OK
},
5802 {"http://google.com/",S_OK
},
5803 {"google.com",S_OK
},
5806 {"google.com",S_OK
},
5811 {"http://:password@google.com/",S_OK
},
5817 {Uri_HOST_DNS
,S_OK
},
5819 {URL_SCHEME_HTTP
,S_OK
},
5820 {URLZONE_INVALID
,E_NOTIMPL
}
5823 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5824 { NULL
,0,S_OK
,FALSE
,
5826 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5827 {TRUE
,"google.com",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5834 {"http://google.com/",S_OK
},
5835 {"google.com",S_OK
},
5836 {"http://google.com/",S_OK
},
5837 {"google.com",S_OK
},
5840 {"google.com",S_OK
},
5845 {"http://google.com/",S_OK
},
5851 {Uri_HOST_DNS
,S_OK
},
5853 {URL_SCHEME_HTTP
,S_OK
},
5854 {URLZONE_INVALID
,E_NOTIMPL
}
5857 /* Can't set the scheme name to NULL. */
5858 { "zip://google.com/",0,S_OK
,FALSE
,
5860 {TRUE
,NULL
,"zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5867 {"zip://google.com/",S_OK
},
5868 {"google.com",S_OK
},
5869 {"zip://google.com/",S_OK
},
5870 {"google.com",S_OK
},
5873 {"google.com",S_OK
},
5878 {"zip://google.com/",S_OK
},
5884 {Uri_HOST_DNS
,S_OK
},
5886 {URL_SCHEME_UNKNOWN
,S_OK
},
5887 {URLZONE_INVALID
,E_NOTIMPL
}
5890 /* Can't set the scheme name to an empty string. */
5891 { "zip://google.com/",0,S_OK
,FALSE
,
5893 {TRUE
,"","zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5900 {"zip://google.com/",S_OK
},
5901 {"google.com",S_OK
},
5902 {"zip://google.com/",S_OK
},
5903 {"google.com",S_OK
},
5906 {"google.com",S_OK
},
5911 {"zip://google.com/",S_OK
},
5917 {Uri_HOST_DNS
,S_OK
},
5919 {URL_SCHEME_UNKNOWN
,S_OK
},
5920 {URLZONE_INVALID
,E_NOTIMPL
}
5923 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5924 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5926 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE
,S_OK
,FALSE
,
5931 0,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5933 {"http://google.com/../../",S_OK
},
5934 {"google.com",S_OK
},
5935 {"http://google.com/../../",S_OK
},
5936 {"google.com",S_OK
},
5939 {"google.com",S_OK
},
5944 {"http://google.com/../../",S_OK
},
5950 {Uri_HOST_DNS
,S_OK
},
5952 {URL_SCHEME_HTTP
,S_OK
},
5953 {URLZONE_INVALID
,E_NOTIMPL
}
5956 { "http://google.com/",0,S_OK
,FALSE
,
5958 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5963 Uri_CREATE_NO_DECODE_EXTRA_INFO
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5965 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5966 {"google.com",S_OK
},
5967 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5968 {"google.com",S_OK
},
5970 {"#Fr%3C%7C%3Eg",S_OK
},
5971 {"google.com",S_OK
},
5976 {"http://google.com/#Fr<|>g",S_OK
},
5982 {Uri_HOST_DNS
,S_OK
},
5984 {URL_SCHEME_HTTP
,S_OK
},
5985 {URLZONE_INVALID
,E_NOTIMPL
}
5988 { "http://google.com/",0,S_OK
,FALSE
,
5990 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5993 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,E_INVALIDARG
,FALSE
,
5995 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5997 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5998 {"google.com",S_OK
},
5999 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
6000 {"google.com",S_OK
},
6002 {"#Fr%3C%7C%3Eg",S_OK
},
6003 {"google.com",S_OK
},
6008 {"http://google.com/#Fr<|>g",S_OK
},
6014 {Uri_HOST_DNS
,S_OK
},
6016 {URL_SCHEME_HTTP
,S_OK
},
6017 {URLZONE_INVALID
,E_NOTIMPL
}
6020 { NULL
,0,S_OK
,FALSE
,
6022 {TRUE
,"/test/test/",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
6023 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
6026 0,INET_E_INVALID_URL
,FALSE
,
6027 0,INET_E_INVALID_URL
,FALSE
,
6028 0,0,0,INET_E_INVALID_URL
,FALSE
6030 { "http://google.com/",0,S_OK
,FALSE
,
6032 {TRUE
,"ht%xxtp",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
6035 0,INET_E_INVALID_URL
,FALSE
,
6036 0,INET_E_INVALID_URL
,FALSE
,
6037 0,0,0,INET_E_INVALID_URL
,FALSE
6039 /* File scheme's can't have a username set. */
6040 { "file://google.com/",0,S_OK
,FALSE
,
6042 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6045 0,INET_E_INVALID_URL
,FALSE
,
6046 0,INET_E_INVALID_URL
,FALSE
,
6047 0,0,0,INET_E_INVALID_URL
,FALSE
6049 /* File schemes can't have a password set. */
6050 { "file://google.com/",0,S_OK
,FALSE
,
6052 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
6055 0,INET_E_INVALID_URL
,FALSE
,
6056 0,INET_E_INVALID_URL
,FALSE
,
6057 0,0,0,INET_E_INVALID_URL
,FALSE
6059 /* UserName can't contain any character that is a delimiter for another
6060 * component that appears after it in a normal URI.
6062 { "http://google.com/",0,S_OK
,FALSE
,
6064 {TRUE
,"user:pass",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6067 0,INET_E_INVALID_URL
,FALSE
,
6068 0,INET_E_INVALID_URL
,FALSE
,
6069 0,0,0,INET_E_INVALID_URL
,FALSE
6071 { "http://google.com/",0,S_OK
,FALSE
,
6073 {TRUE
,"user@google.com",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6076 0,INET_E_INVALID_URL
,FALSE
,
6077 0,INET_E_INVALID_URL
,FALSE
,
6078 0,0,0,INET_E_INVALID_URL
,FALSE
6080 { "http://google.com/",0,S_OK
,FALSE
,
6082 {TRUE
,"user/path",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6085 0,INET_E_INVALID_URL
,FALSE
,
6086 0,INET_E_INVALID_URL
,FALSE
,
6087 0,0,0,INET_E_INVALID_URL
,FALSE
6089 { "http://google.com/",0,S_OK
,FALSE
,
6091 {TRUE
,"user?Query",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6094 0,INET_E_INVALID_URL
,FALSE
,
6095 0,INET_E_INVALID_URL
,FALSE
,
6096 0,0,0,INET_E_INVALID_URL
,FALSE
6098 { "http://google.com/",0,S_OK
,FALSE
,
6100 {TRUE
,"user#Frag",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
6103 0,INET_E_INVALID_URL
,FALSE
,
6104 0,INET_E_INVALID_URL
,FALSE
,
6105 0,0,0,INET_E_INVALID_URL
,FALSE
6107 { "http://google.com/",0,S_OK
,FALSE
,
6109 {TRUE
,"pass@google.com",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
6112 0,INET_E_INVALID_URL
,FALSE
,
6113 0,INET_E_INVALID_URL
,FALSE
,
6114 0,0,0,INET_E_INVALID_URL
,FALSE
6116 { "http://google.com/",0,S_OK
,FALSE
,
6118 {TRUE
,"pass/path",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
6121 0,INET_E_INVALID_URL
,FALSE
,
6122 0,INET_E_INVALID_URL
,FALSE
,
6123 0,0,0,INET_E_INVALID_URL
,FALSE
6125 { "http://google.com/",0,S_OK
,FALSE
,
6127 {TRUE
,"pass?query",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
6130 0,INET_E_INVALID_URL
,FALSE
,
6131 0,INET_E_INVALID_URL
,FALSE
,
6132 0,0,0,INET_E_INVALID_URL
,FALSE
6134 { "http://google.com/",0,S_OK
,FALSE
,
6136 {TRUE
,"pass#frag",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
6139 0,INET_E_INVALID_URL
,FALSE
,
6140 0,INET_E_INVALID_URL
,FALSE
,
6141 0,0,0,INET_E_INVALID_URL
,FALSE
6143 { "http://google.com/",0,S_OK
,FALSE
,
6145 {TRUE
,"winehq.org/test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
6148 0,INET_E_INVALID_URL
,FALSE
,
6149 0,INET_E_INVALID_URL
,FALSE
,
6150 0,0,0,INET_E_INVALID_URL
,FALSE
6152 { "http://google.com/",0,S_OK
,FALSE
,
6154 {TRUE
,"winehq.org?test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
6157 0,INET_E_INVALID_URL
,FALSE
,
6158 0,INET_E_INVALID_URL
,FALSE
,
6159 0,0,0,INET_E_INVALID_URL
,FALSE
6161 { "http://google.com/",0,S_OK
,FALSE
,
6163 {TRUE
,"winehq.org#test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
6166 0,INET_E_INVALID_URL
,FALSE
,
6167 0,INET_E_INVALID_URL
,FALSE
,
6168 0,0,0,INET_E_INVALID_URL
,FALSE
6170 /* Hostname is allowed to contain a ':' (even for known scheme types). */
6171 { "http://google.com/",0,S_OK
,FALSE
,
6173 {TRUE
,"winehq.org:test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
6180 {"http://winehq.org:test/",S_OK
},
6181 {"winehq.org:test",S_OK
},
6182 {"http://winehq.org:test/",S_OK
},
6183 {"winehq.org:test",S_OK
},
6186 {"winehq.org:test",S_OK
},
6191 {"http://winehq.org:test/",S_OK
},
6197 {Uri_HOST_DNS
,S_OK
},
6199 {URL_SCHEME_HTTP
,S_OK
},
6200 {URLZONE_INVALID
,E_NOTIMPL
}
6203 /* Can't set the host name to NULL. */
6204 { "http://google.com/",0,S_OK
,FALSE
,
6206 {TRUE
,NULL
,"google.com",Uri_PROPERTY_HOST
,E_INVALIDARG
,FALSE
}
6213 {"http://google.com/",S_OK
},
6214 {"google.com",S_OK
},
6215 {"http://google.com/",S_OK
},
6216 {"google.com",S_OK
},
6219 {"google.com",S_OK
},
6224 {"http://google.com/",S_OK
},
6230 {Uri_HOST_DNS
,S_OK
},
6232 {URL_SCHEME_HTTP
,S_OK
},
6233 {URLZONE_INVALID
,E_NOTIMPL
}
6236 /* Can set the host name to an empty string. */
6237 { "http://google.com/",0,S_OK
,FALSE
,
6239 {TRUE
,"",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
6263 {Uri_HOST_UNKNOWN
,S_OK
},
6265 {URL_SCHEME_HTTP
,S_OK
},
6266 {URLZONE_INVALID
,E_NOTIMPL
}
6269 { "http://google.com/",0,S_OK
,FALSE
,
6271 {TRUE
,"/path?query",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
6274 0,INET_E_INVALID_URL
,FALSE
,
6275 0,INET_E_INVALID_URL
,FALSE
,
6276 0,0,0,INET_E_INVALID_URL
,FALSE
6278 { "http://google.com/",0,S_OK
,FALSE
,
6280 {TRUE
,"/path#test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
6283 0,INET_E_INVALID_URL
,FALSE
,
6284 0,INET_E_INVALID_URL
,FALSE
,
6285 0,0,0,INET_E_INVALID_URL
,FALSE
6287 { "http://google.com/",0,S_OK
,FALSE
,
6289 {TRUE
,"?path#test",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
}
6292 0,INET_E_INVALID_URL
,FALSE
,
6293 0,INET_E_INVALID_URL
,FALSE
,
6294 0,0,0,INET_E_INVALID_URL
,FALSE
6296 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
6298 {TRUE
,NULL
,NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
6305 {"file:///c:/dir/file.html",S_OK
},
6307 {"file:///c:/dir/file.html",S_OK
},
6313 {"/c:/dir/file.html",S_OK
},
6314 {"/c:/dir/file.html",S_OK
},
6316 {"file:///c:/dir/file.html",S_OK
},
6322 {Uri_HOST_UNKNOWN
,S_OK
},
6324 {URL_SCHEME_FILE
,S_OK
},
6325 {URLZONE_INVALID
,E_NOTIMPL
}
6328 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
6330 {TRUE
,"#",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
6337 {"file:///c:/dir/file.html#",S_OK
},
6339 {"file:///c:/dir/file.html#",S_OK
},
6345 {"/c:/dir/file.html",S_OK
},
6346 {"/c:/dir/file.html",S_OK
},
6348 {"file:///c:/dir/file.html#",S_OK
},
6354 {Uri_HOST_UNKNOWN
,S_OK
},
6356 {URL_SCHEME_FILE
,S_OK
},
6357 {URLZONE_INVALID
,E_NOTIMPL
}
6362 typedef struct _uri_builder_remove_test
{
6365 HRESULT create_builder_expected
;
6366 BOOL create_builder_todo
;
6368 DWORD remove_properties
;
6369 HRESULT remove_expected
;
6372 const char *expected_uri
;
6373 DWORD expected_flags
;
6374 HRESULT expected_hres
;
6376 } uri_builder_remove_test
;
6378 static const uri_builder_remove_test uri_builder_remove_tests
[] = {
6379 { "http://google.com/test?test=y#Frag",0,S_OK
,FALSE
,
6380 Uri_HAS_FRAGMENT
|Uri_HAS_PATH
|Uri_HAS_QUERY
,S_OK
,FALSE
,
6381 "http://google.com/",0,S_OK
,FALSE
6383 { "http://user:pass@winehq.org/",0,S_OK
,FALSE
,
6384 Uri_HAS_USER_NAME
|Uri_HAS_PASSWORD
,S_OK
,FALSE
,
6385 "http://winehq.org/",0,S_OK
,FALSE
6387 { "zip://google.com?Test=x",0,S_OK
,FALSE
,
6388 Uri_HAS_HOST
,S_OK
,FALSE
,
6389 "zip:/?Test=x",0,S_OK
,FALSE
6391 /* Doesn't remove the whole userinfo component. */
6392 { "http://username:pass@google.com/",0,S_OK
,FALSE
,
6393 Uri_HAS_USER_INFO
,S_OK
,FALSE
,
6394 "http://username:pass@google.com/",0,S_OK
,FALSE
6396 /* Doesn't remove the domain. */
6397 { "http://google.com/",0,S_OK
,FALSE
,
6398 Uri_HAS_DOMAIN
,S_OK
,FALSE
,
6399 "http://google.com/",0,S_OK
,FALSE
6401 { "http://google.com:120/",0,S_OK
,FALSE
,
6402 Uri_HAS_AUTHORITY
,S_OK
,FALSE
,
6403 "http://google.com:120/",0,S_OK
,FALSE
6405 { "http://google.com/test.com/",0,S_OK
,FALSE
,
6406 Uri_HAS_EXTENSION
,S_OK
,FALSE
,
6407 "http://google.com/test.com/",0,S_OK
,FALSE
6409 { "http://google.com/?test=x",0,S_OK
,FALSE
,
6410 Uri_HAS_PATH_AND_QUERY
,S_OK
,FALSE
,
6411 "http://google.com/?test=x",0,S_OK
,FALSE
6413 /* Can't remove the scheme name. */
6414 { "http://google.com/?test=x",0,S_OK
,FALSE
,
6415 Uri_HAS_SCHEME_NAME
|Uri_HAS_QUERY
,E_INVALIDARG
,FALSE
,
6416 "http://google.com/?test=x",0,S_OK
,FALSE
6420 typedef struct _uri_combine_str_property
{
6424 const char *broken_value
;
6425 const char *value_ex
;
6426 } uri_combine_str_property
;
6428 typedef struct _uri_combine_test
{
6429 const char *base_uri
;
6430 DWORD base_create_flags
;
6431 const char *relative_uri
;
6432 DWORD relative_create_flags
;
6433 DWORD combine_flags
;
6437 uri_combine_str_property str_props
[URI_STR_PROPERTY_COUNT
];
6438 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
6441 static const uri_combine_test uri_combine_tests
[] = {
6442 { "http://google.com/fun/stuff",0,
6443 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE
,
6446 {"http://google.com/not/fun/stuff",S_OK
},
6447 {"google.com",S_OK
},
6448 {"http://google.com/not/fun/stuff",S_OK
},
6449 {"google.com",S_OK
},
6452 {"google.com",S_OK
},
6454 {"/not/fun/stuff",S_OK
},
6455 {"/not/fun/stuff",S_OK
},
6457 {"http://google.com/not/fun/stuff",S_OK
},
6463 {Uri_HOST_DNS
,S_OK
},
6465 {URL_SCHEME_HTTP
,S_OK
},
6466 {URLZONE_INVALID
,E_NOTIMPL
}
6469 { "http://google.com/test",0,
6470 "zip://test.com/cool",0,
6473 {"zip://test.com/cool",S_OK
},
6475 {"zip://test.com/cool",S_OK
},
6484 {"zip://test.com/cool",S_OK
},
6490 {Uri_HOST_DNS
,S_OK
},
6492 {URL_SCHEME_UNKNOWN
,S_OK
},
6493 {URLZONE_INVALID
,E_NOTIMPL
}
6496 { "http://google.com/use/base/path",0,
6497 "?relative",Uri_CREATE_ALLOW_RELATIVE
,
6500 {"http://google.com/use/base/path?relative",S_OK
},
6501 {"google.com",S_OK
},
6502 {"http://google.com/use/base/path?relative",S_OK
},
6503 {"google.com",S_OK
},
6506 {"google.com",S_OK
},
6508 {"/use/base/path",S_OK
},
6509 {"/use/base/path?relative",S_OK
},
6511 {"http://google.com/use/base/path?relative",S_OK
},
6517 {Uri_HOST_DNS
,S_OK
},
6519 {URL_SCHEME_HTTP
,S_OK
},
6520 {URLZONE_INVALID
,E_NOTIMPL
}
6523 { "http://google.com/path",0,
6524 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
6527 {"http://google.com/testing",S_OK
},
6528 {"google.com",S_OK
},
6529 {"http://google.com/testing",S_OK
},
6530 {"google.com",S_OK
},
6533 {"google.com",S_OK
},
6538 {"http://google.com/testing",S_OK
},
6544 {Uri_HOST_DNS
,S_OK
},
6546 {URL_SCHEME_HTTP
,S_OK
},
6547 {URLZONE_INVALID
,E_NOTIMPL
}
6550 { "http://google.com/path",0,
6551 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
6552 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6554 {"http://google.com:80/test/../test/.././testing",S_OK
},
6555 {"google.com",S_OK
},
6556 {"http://google.com:80/test/../test/.././testing",S_OK
},
6557 {"google.com",S_OK
},
6560 {"google.com",S_OK
},
6562 {"/test/../test/.././testing",S_OK
},
6563 {"/test/../test/.././testing",S_OK
},
6565 {"http://google.com:80/test/../test/.././testing",S_OK
},
6571 {Uri_HOST_DNS
,S_OK
},
6573 {URL_SCHEME_HTTP
,S_OK
},
6574 {URLZONE_INVALID
,E_NOTIMPL
}
6577 { "http://winehq.org/test/abc",0,
6578 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6581 {"http://winehq.org/test/testing/test",S_OK
},
6582 {"winehq.org",S_OK
},
6583 {"http://winehq.org/test/testing/test",S_OK
},
6584 {"winehq.org",S_OK
},
6587 {"winehq.org",S_OK
},
6589 {"/test/testing/test",S_OK
},
6590 {"/test/testing/test",S_OK
},
6592 {"http://winehq.org/test/testing/test",S_OK
},
6598 {Uri_HOST_DNS
,S_OK
},
6600 {URL_SCHEME_HTTP
,S_OK
},
6601 {URLZONE_INVALID
,E_NOTIMPL
}
6604 { "http://winehq.org/test/abc",0,
6605 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6606 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6608 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6609 /* Default port is hidden in the authority. */
6610 {"winehq.org",S_OK
},
6611 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6612 {"winehq.org",S_OK
},
6615 {"winehq.org",S_OK
},
6617 {"/test/testing/abc/../test",S_OK
},
6618 {"/test/testing/abc/../test",S_OK
},
6620 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6626 {Uri_HOST_DNS
,S_OK
},
6628 {URL_SCHEME_HTTP
,S_OK
},
6629 {URLZONE_INVALID
,E_NOTIMPL
}
6632 { "http://winehq.org/test?query",0,
6633 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6636 {"http://winehq.org/testing",S_OK
},
6637 {"winehq.org",S_OK
},
6638 {"http://winehq.org/testing",S_OK
},
6639 {"winehq.org",S_OK
},
6642 {"winehq.org",S_OK
},
6647 {"http://winehq.org/testing",S_OK
},
6653 {Uri_HOST_DNS
,S_OK
},
6655 {URL_SCHEME_HTTP
,S_OK
},
6656 {URLZONE_INVALID
,E_NOTIMPL
}
6659 { "http://winehq.org/test#frag",0,
6660 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6663 {"http://winehq.org/testing",S_OK
},
6664 {"winehq.org",S_OK
},
6665 {"http://winehq.org/testing",S_OK
},
6666 {"winehq.org",S_OK
},
6669 {"winehq.org",S_OK
},
6674 {"http://winehq.org/testing",S_OK
},
6680 {Uri_HOST_DNS
,S_OK
},
6682 {URL_SCHEME_HTTP
,S_OK
},
6683 {URLZONE_INVALID
,E_NOTIMPL
}
6686 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE
,
6687 "test",Uri_CREATE_ALLOW_RELATIVE
,
6707 {Uri_HOST_UNKNOWN
,S_OK
},
6709 {URL_SCHEME_UNKNOWN
,S_OK
},
6710 {URLZONE_INVALID
,E_NOTIMPL
}
6713 { "file:///c:/test/test",0,
6714 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6715 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6717 {"file://c:\\testing.mp3",S_OK
},
6719 {"file://c:\\testing.mp3",S_OK
},
6725 {"c:\\testing.mp3",S_OK
},
6726 {"c:\\testing.mp3",S_OK
},
6728 {"file://c:\\testing.mp3",S_OK
},
6734 {Uri_HOST_UNKNOWN
,S_OK
},
6736 {URL_SCHEME_FILE
,S_OK
},
6737 {URLZONE_INVALID
,E_NOTIMPL
}
6740 { "file:///c:/test/test",0,
6741 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6744 {"file:///c:/testing.mp3",S_OK
},
6746 {"file:///c:/testing.mp3",S_OK
},
6752 {"/c:/testing.mp3",S_OK
},
6753 {"/c:/testing.mp3",S_OK
},
6755 {"file:///c:/testing.mp3",S_OK
},
6761 {Uri_HOST_UNKNOWN
,S_OK
},
6763 {URL_SCHEME_FILE
,S_OK
},
6764 {URLZONE_INVALID
,E_NOTIMPL
}
6767 { "file://test.com/test/test",0,
6768 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6769 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6771 {"file://\\\\test.com\\testing.mp3",S_OK
},
6773 {"file://\\\\test.com\\testing.mp3",S_OK
},
6779 {"\\testing.mp3",S_OK
},
6780 {"\\testing.mp3",S_OK
},
6782 {"file://\\\\test.com\\testing.mp3",S_OK
},
6788 {Uri_HOST_DNS
,S_OK
},
6790 {URL_SCHEME_FILE
,S_OK
},
6791 {URLZONE_INVALID
,E_NOTIMPL
}
6794 /* URL_DONT_SIMPLIFY has no effect. */
6795 { "http://google.com/test",0,
6796 "zip://test.com/cool/../cool/test",0,
6797 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6799 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6801 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6807 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6808 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6810 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6811 * On IE 7 it reduces the path in the Raw URI.
6813 {"zip://test.com/cool/../cool/test",S_OK
,FALSE
,"zip://test.com/cool/test"},
6819 {Uri_HOST_DNS
,S_OK
},
6821 {URL_SCHEME_UNKNOWN
,S_OK
},
6822 {URLZONE_INVALID
,E_NOTIMPL
}
6825 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6826 * resulting URI is converted into a dos path.
6828 { "http://google.com/test",0,
6829 "file:///c:/test/",0,
6830 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6832 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6834 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6840 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6841 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6843 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6849 {Uri_HOST_UNKNOWN
,S_OK
},
6851 {URL_SCHEME_FILE
,S_OK
},
6852 {URLZONE_INVALID
,E_NOTIMPL
}
6855 { "http://google.com/test",0,
6856 "http://test.com/test#%30test",0,
6857 URL_DONT_UNESCAPE_EXTRA_INFO
,S_OK
,FALSE
,
6859 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6861 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6864 {"#0test",S_OK
,FALSE
,NULL
,"#%30test"},
6870 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6871 {"http://test.com/test#%30test",S_OK
,FALSE
,"http://test.com/test#0test"},
6877 {Uri_HOST_DNS
,S_OK
},
6879 {URL_SCHEME_HTTP
,S_OK
},
6880 {URLZONE_INVALID
,E_NOTIMPL
}
6883 /* Windows validates the path component from the relative Uri. */
6884 { "http://google.com/test",0,
6885 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE
,
6886 0,E_INVALIDARG
,FALSE
6888 /* Windows doesn't validate the query from the relative Uri. */
6889 { "http://google.com/test",0,
6890 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6893 {"http://google.com/test?Tes%XXt",S_OK
},
6894 {"google.com",S_OK
},
6895 {"http://google.com/test?Tes%XXt",S_OK
},
6896 {"google.com",S_OK
},
6899 {"google.com",S_OK
},
6902 {"/test?Tes%XXt",S_OK
},
6904 {"http://google.com/test?Tes%XXt",S_OK
},
6910 {Uri_HOST_DNS
,S_OK
},
6912 {URL_SCHEME_HTTP
,S_OK
},
6913 {URLZONE_INVALID
,E_NOTIMPL
}
6916 /* Windows doesn't validate the fragment from the relative Uri. */
6917 { "http://google.com/test",0,
6918 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6921 {"http://google.com/test#Tes%XXt",S_OK
},
6922 {"google.com",S_OK
},
6923 {"http://google.com/test#Tes%XXt",S_OK
},
6924 {"google.com",S_OK
},
6927 {"google.com",S_OK
},
6932 {"http://google.com/test#Tes%XXt",S_OK
},
6938 {Uri_HOST_DNS
,S_OK
},
6940 {URL_SCHEME_HTTP
,S_OK
},
6941 {URLZONE_INVALID
,E_NOTIMPL
}
6944 /* Creates an IUri which contains an invalid dos path char. */
6945 { "file:///c:/test",0,
6946 "/test<ing",Uri_CREATE_ALLOW_RELATIVE
,
6947 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6949 {"file://c:\\test<ing",S_OK
},
6951 {"file://c:\\test<ing",S_OK
},
6957 {"c:\\test<ing",S_OK
},
6958 {"c:\\test<ing",S_OK
},
6960 {"file://c:\\test<ing",S_OK
},
6966 {Uri_HOST_UNKNOWN
,S_OK
},
6968 {URL_SCHEME_FILE
,S_OK
},
6969 {URLZONE_INVALID
,E_NOTIMPL
}
6972 /* Appends the path after the drive letter (if any). */
6973 { "file:///c:/test",0,
6974 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE
,
6977 {"file:///c:/c:/testing",S_OK
},
6979 {"file:///c:/c:/testing",S_OK
},
6985 {"/c:/c:/testing",S_OK
},
6986 {"/c:/c:/testing",S_OK
},
6988 {"file:///c:/c:/testing",S_OK
},
6994 {Uri_HOST_UNKNOWN
,S_OK
},
6996 {URL_SCHEME_FILE
,S_OK
},
6997 {URLZONE_INVALID
,E_NOTIMPL
}
7000 /* A '/' is added if the base URI doesn't have a path and the
7001 * relative URI doesn't contain a path (since the base URI is
7004 { "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
7005 "?test",Uri_CREATE_ALLOW_RELATIVE
,
7008 {"http://google.com/?test",S_OK
},
7009 {"google.com",S_OK
},
7010 {"http://google.com/?test",S_OK
},
7011 {"google.com",S_OK
},
7014 {"google.com",S_OK
},
7019 {"http://google.com/?test",S_OK
},
7025 {Uri_HOST_DNS
,S_OK
},
7027 {URL_SCHEME_HTTP
,S_OK
},
7028 {URLZONE_INVALID
,E_NOTIMPL
}
7031 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE
,
7032 "?test",Uri_CREATE_ALLOW_RELATIVE
,
7035 {"zip://google.com/?test",S_OK
},
7036 {"google.com",S_OK
},
7037 {"zip://google.com/?test",S_OK
},
7038 {"google.com",S_OK
},
7041 {"google.com",S_OK
},
7046 {"zip://google.com/?test",S_OK
},
7052 {Uri_HOST_DNS
,S_OK
},
7054 {URL_SCHEME_UNKNOWN
,S_OK
},
7055 {URLZONE_INVALID
,E_NOTIMPL
}
7058 /* No path is appended since the base URI is opaque. */
7060 "?test",Uri_CREATE_ALLOW_RELATIVE
,
7080 {Uri_HOST_UNKNOWN
,S_OK
},
7082 {URL_SCHEME_UNKNOWN
,S_OK
},
7083 {URLZONE_INVALID
,E_NOTIMPL
}
7087 "../testing/test",Uri_CREATE_ALLOW_RELATIVE
,
7090 {"file:///c:/testing/test",S_OK
},
7092 {"file:///c:/testing/test",S_OK
},
7098 {"/c:/testing/test",S_OK
},
7099 {"/c:/testing/test",S_OK
},
7101 {"file:///c:/testing/test",S_OK
},
7107 {Uri_HOST_UNKNOWN
,S_OK
},
7109 {URL_SCHEME_FILE
,S_OK
},
7110 {URLZONE_INVALID
,E_NOTIMPL
}
7113 { "http://winehq.org/dir/testfile",0,
7114 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
7117 {"http://winehq.org/dir/test?querystring",S_OK
},
7118 {"winehq.org",S_OK
},
7119 {"http://winehq.org/dir/test?querystring",S_OK
},
7120 {"winehq.org",S_OK
},
7123 {"winehq.org",S_OK
},
7126 {"/dir/test?querystring",S_OK
},
7127 {"?querystring",S_OK
},
7128 {"http://winehq.org/dir/test?querystring",S_OK
},
7134 {Uri_HOST_DNS
,S_OK
},
7136 {URL_SCHEME_HTTP
,S_OK
},
7137 {URLZONE_INVALID
,E_NOTIMPL
}
7140 { "http://winehq.org/dir/test",0,
7141 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
7144 {"http://winehq.org/dir/test?querystring",S_OK
},
7145 {"winehq.org",S_OK
},
7146 {"http://winehq.org/dir/test?querystring",S_OK
},
7147 {"winehq.org",S_OK
},
7150 {"winehq.org",S_OK
},
7153 {"/dir/test?querystring",S_OK
},
7154 {"?querystring",S_OK
},
7155 {"http://winehq.org/dir/test?querystring",S_OK
},
7161 {Uri_HOST_DNS
,S_OK
},
7163 {URL_SCHEME_HTTP
,S_OK
},
7164 {URLZONE_INVALID
,E_NOTIMPL
}
7167 { "http://winehq.org/dir/test?querystring",0,
7168 "#hash",Uri_CREATE_ALLOW_RELATIVE
,
7171 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
7172 {"winehq.org",S_OK
},
7173 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
7174 {"winehq.org",S_OK
},
7177 {"winehq.org",S_OK
},
7180 {"/dir/test?querystring",S_OK
},
7181 {"?querystring",S_OK
},
7182 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
7188 {Uri_HOST_DNS
,S_OK
},
7190 {URL_SCHEME_HTTP
,S_OK
},
7191 {URLZONE_INVALID
,E_NOTIMPL
}
7194 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
7195 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7198 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7200 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7206 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7207 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7209 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7215 {Uri_HOST_UNKNOWN
,S_OK
},
7217 {URL_SCHEME_MK
,S_OK
},
7218 {URLZONE_INVALID
,E_NOTIMPL
}
7221 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
7222 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7225 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7227 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7233 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7234 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7236 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
7242 {Uri_HOST_UNKNOWN
,S_OK
},
7244 {URL_SCHEME_MK
,S_OK
},
7245 {URLZONE_INVALID
,E_NOTIMPL
}
7248 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
7249 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7252 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
7254 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
7260 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
7261 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
7263 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
7269 {Uri_HOST_UNKNOWN
,S_OK
},
7271 {URL_SCHEME_MK
,S_OK
},
7272 {URLZONE_INVALID
,E_NOTIMPL
}
7275 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7276 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7279 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7281 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7287 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7288 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7290 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7296 {Uri_HOST_UNKNOWN
,S_OK
},
7298 {URL_SCHEME_MK
,S_OK
},
7299 {URLZONE_INVALID
,E_NOTIMPL
}
7302 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7303 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7306 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7308 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7314 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7315 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7317 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7323 {Uri_HOST_UNKNOWN
,S_OK
},
7325 {URL_SCHEME_MK
,S_OK
},
7326 {URLZONE_INVALID
,E_NOTIMPL
}
7329 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7330 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7333 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7335 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7341 {"@MSITSTORE:/relative/path.txt",S_OK
},
7342 {"@MSITSTORE:/relative/path.txt",S_OK
},
7344 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7350 {Uri_HOST_UNKNOWN
,S_OK
},
7352 {URL_SCHEME_MK
,S_OK
},
7353 {URLZONE_INVALID
,E_NOTIMPL
}
7356 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7357 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7360 {"mk:@xxx:/relative/path.txt",S_OK
},
7362 {"mk:@xxx:/relative/path.txt",S_OK
},
7368 {"@xxx:/relative/path.txt",S_OK
},
7369 {"@xxx:/relative/path.txt",S_OK
},
7371 {"mk:@xxx:/relative/path.txt",S_OK
},
7377 {Uri_HOST_UNKNOWN
,S_OK
},
7379 {URL_SCHEME_MK
,S_OK
},
7380 {URLZONE_INVALID
,E_NOTIMPL
}
7383 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7384 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7387 {"mk:/relative/path.txt",S_OK
},
7389 {"mk:/relative/path.txt",S_OK
},
7395 {"/relative/path.txt",S_OK
},
7396 {"/relative/path.txt",S_OK
},
7398 {"mk:/relative/path.txt",S_OK
},
7404 {Uri_HOST_UNKNOWN
,S_OK
},
7406 {URL_SCHEME_MK
,S_OK
},
7407 {URLZONE_INVALID
,E_NOTIMPL
}
7410 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7411 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7414 {"ml:/relative/path.txt",S_OK
},
7416 {"ml:/relative/path.txt",S_OK
},
7422 {"/relative/path.txt",S_OK
},
7423 {"/relative/path.txt",S_OK
},
7425 {"ml:/relative/path.txt",S_OK
},
7431 {Uri_HOST_UNKNOWN
,S_OK
},
7433 {URL_SCHEME_UNKNOWN
,S_OK
},
7434 {URLZONE_INVALID
,E_NOTIMPL
}
7437 { "http://winehq.org/dir/test?querystring",0,
7438 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE
,
7441 {"http://winehq.com/#hash",S_OK
},
7442 {"winehq.com",S_OK
},
7443 {"http://winehq.com/#hash",S_OK
},
7444 {"winehq.com",S_OK
},
7447 {"winehq.com",S_OK
},
7452 {"http://winehq.com/#hash",S_OK
},
7458 {Uri_HOST_DNS
,S_OK
},
7459 {80,S_OK
,FALSE
,TRUE
},
7460 {URL_SCHEME_HTTP
,S_OK
},
7461 {URLZONE_INVALID
,E_NOTIMPL
}
7464 { "http://winehq.org/dir/test?querystring",0,
7465 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE
,
7468 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7469 {"winehq.com",S_OK
},
7470 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7471 {"winehq.com",S_OK
},
7474 {"winehq.com",S_OK
},
7476 {"/dir/file.txt",S_OK
},
7477 {"/dir/file.txt?query",S_OK
},
7479 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7485 {Uri_HOST_DNS
,S_OK
},
7486 {80,S_OK
,FALSE
,TRUE
},
7487 {URL_SCHEME_HTTP
,S_OK
},
7488 {URLZONE_INVALID
,E_NOTIMPL
}
7491 { "http://google.com/test",0,
7492 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
7495 {"file:///c:/test/",S_OK
},
7497 {"file:///c:/test/",S_OK
},
7506 {"c:\\test\\",S_OK
,FALSE
,"file:///c:/test/"},
7512 {Uri_HOST_UNKNOWN
,S_OK
},
7514 {URL_SCHEME_FILE
,S_OK
},
7515 {URLZONE_INVALID
,E_NOTIMPL
}
7518 { "http://google.com/test",0,
7519 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
7522 {"file:///c:/test/",S_OK
},
7524 {"file:///c:/test/",S_OK
},
7533 {"c:\\test\\",S_OK
,FALSE
,"file:///c:/test/"},
7539 {Uri_HOST_UNKNOWN
,S_OK
},
7541 {URL_SCHEME_FILE
,S_OK
},
7542 {URLZONE_INVALID
,E_NOTIMPL
}
7545 { "http://winehq.org",0,
7546 "mailto://",Uri_CREATE_NO_CANONICALIZE
,
7560 {"mailto://",S_OK
,FALSE
,"mailto:"},
7566 {Uri_HOST_UNKNOWN
,S_OK
},
7568 {URL_SCHEME_MAILTO
,S_OK
},
7569 {URLZONE_INVALID
,E_NOTIMPL
}
7572 { "http://winehq.org",0,
7573 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE
,
7576 {"mailto:a@b.com",S_OK
},
7578 {"mailto:a@b.com",S_OK
},
7587 {"mailto://a@b.com",S_OK
,FALSE
,"mailto:a@b.com"},
7593 {Uri_HOST_UNKNOWN
,S_OK
},
7595 {URL_SCHEME_MAILTO
,S_OK
},
7596 {URLZONE_INVALID
,E_NOTIMPL
}
7601 typedef struct _uri_parse_test
{
7606 const char *property
;
7609 const char *property2
;
7612 static const uri_parse_test uri_parse_tests
[] = {
7613 /* PARSE_CANONICALIZE tests. */
7614 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"zip://google.com/test<|>",S_OK
,FALSE
},
7615 {"http://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"http://google.com/test%3C%7C%3E",S_OK
,FALSE
},
7616 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE
,URL_UNESCAPE
,"http://google.com/0#?",S_OK
,FALSE
},
7617 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_UNSAFE
,"test %3C%7C%3E",S_OK
,FALSE
},
7618 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_SPACES_ONLY
,"test%20<|>",S_OK
,FALSE
},
7619 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_UNESCAPE
|URL_ESCAPE_UNSAFE
,"test%20%3C%7C%3E",S_OK
,FALSE
},
7620 {"http://google.com/%20",0,PARSE_CANONICALIZE
,URL_ESCAPE_PERCENT
,"http://google.com/%2520",S_OK
,FALSE
},
7621 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"http://google.com/test/../",S_OK
,FALSE
},
7622 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_NO_META
,"http://google.com/test/../",S_OK
,FALSE
},
7623 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"http://google.com/",S_OK
,FALSE
},
7624 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"zip://google.com/",S_OK
,FALSE
},
7625 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"file:///c:/test/../test",S_OK
,FALSE
},
7627 /* PARSE_FRIENDLY tests. */
7628 {"http://test@google.com/test#test",0,PARSE_FRIENDLY
,0,"http://google.com/test#test",S_OK
,FALSE
},
7629 {"zip://test@google.com/test",0,PARSE_FRIENDLY
,0,"zip://test@google.com/test",S_OK
,FALSE
},
7631 /* PARSE_ROOTDOCUMENT tests. */
7632 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT
,0,"http://google.com:200/",S_OK
,FALSE
},
7633 {"http://google.com",Uri_CREATE_NO_CANONICALIZE
,PARSE_ROOTDOCUMENT
,0,"http://google.com/",S_OK
,FALSE
},
7634 {"zip://google.com/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7635 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7636 {"file://server/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7637 {"zip:test/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7639 /* PARSE_DOCUMENT tests. */
7640 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT
,0,"http://test@google.com/test?query",S_OK
,FALSE
},
7641 {"http:testing#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7642 {"file:///c:/test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7643 {"zip://google.com/#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7644 {"zip:test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7645 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7647 /* PARSE_PATH_FROM_URL tests. */
7648 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
,FALSE
},
7649 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\t<|>est.mp3",S_OK
,FALSE
},
7650 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL
,0,"c:\\te%XX t\\",S_OK
,FALSE
},
7651 {"file://server/test",0,PARSE_PATH_FROM_URL
,0,"\\\\server\\test",S_OK
,FALSE
},
7652 {"http://google.com/",0,PARSE_PATH_FROM_URL
,0,"",E_INVALIDARG
,FALSE
},
7653 {"file:/c:/dir/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\dir\\test.mp3",S_OK
},
7654 {"file:/c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
},
7655 {"file://c:\\test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
},
7657 /* PARSE_URL_FROM_PATH tests. */
7658 /* This function almost seems to useless (just returns the absolute uri). */
7659 {"test.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"test.com",S_OK
,FALSE
},
7660 {"/test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"/test/test",S_OK
,FALSE
},
7661 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH
,PARSE_URL_FROM_PATH
,0,"file://c:\\test\\test",S_OK
,FALSE
},
7662 {"file:c:/test",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
7663 {"http:google.com/",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
7665 /* PARSE_SCHEMA tests. */
7666 {"http://google.com/test",0,PARSE_SCHEMA
,0,"http",S_OK
,FALSE
},
7667 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SCHEMA
,0,"",S_OK
,FALSE
},
7669 /* PARSE_SITE tests. */
7670 {"http://google.uk.com/",0,PARSE_SITE
,0,"google.uk.com",S_OK
,FALSE
},
7671 {"http://google.com.com/",0,PARSE_SITE
,0,"google.com.com",S_OK
,FALSE
},
7672 {"google.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SITE
,0,"",S_OK
,FALSE
},
7673 {"file://server/test",0,PARSE_SITE
,0,"server",S_OK
,FALSE
},
7675 /* PARSE_DOMAIN tests. */
7676 {"http://google.com.uk/",0,PARSE_DOMAIN
,0,"google.com.uk",S_OK
,FALSE
,"com.uk"},
7677 {"http://google.com.com/",0,PARSE_DOMAIN
,0,"com.com",S_OK
,FALSE
},
7678 {"test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
7679 {"file://server/test",0,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
7681 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7682 {"http://google.com/test#Test",0,PARSE_ANCHOR
,0,"#Test",S_OK
,FALSE
},
7683 {"http://google.com/test#Test",0,PARSE_LOCATION
,0,"#Test",S_OK
,FALSE
},
7684 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_ANCHOR
,0,"",S_OK
,FALSE
},
7685 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_LOCATION
,0,"",S_OK
,FALSE
}
7688 static inline LPWSTR
a2w(LPCSTR str
) {
7692 DWORD len
= MultiByteToWideChar(CP_UTF8
, 0, str
, -1, NULL
, 0);
7693 ret
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
7694 MultiByteToWideChar(CP_UTF8
, 0, str
, -1, ret
, len
);
7700 static inline DWORD
strcmp_aw(LPCSTR strA
, LPCWSTR strB
) {
7701 LPWSTR strAW
= a2w(strA
);
7702 DWORD ret
= lstrcmpW(strAW
, strB
);
7707 static inline ULONG
get_refcnt(IUri
*uri
) {
7709 return IUri_Release(uri
);
7712 static void change_property(IUriBuilder
*builder
, const uri_builder_property
*prop
,
7717 valueW
= a2w(prop
->value
);
7718 switch(prop
->property
) {
7719 case Uri_PROPERTY_FRAGMENT
:
7720 hr
= IUriBuilder_SetFragment(builder
, valueW
);
7721 todo_wine_if(prop
->todo
) {
7722 ok(hr
== prop
->expected
,
7723 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7724 hr
, prop
->expected
, test_index
);
7727 case Uri_PROPERTY_HOST
:
7728 hr
= IUriBuilder_SetHost(builder
, valueW
);
7729 todo_wine_if(prop
->todo
) {
7730 ok(hr
== prop
->expected
,
7731 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7732 hr
, prop
->expected
, test_index
);
7735 case Uri_PROPERTY_PASSWORD
:
7736 hr
= IUriBuilder_SetPassword(builder
, valueW
);
7737 todo_wine_if(prop
->todo
) {
7738 ok(hr
== prop
->expected
,
7739 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7740 hr
, prop
->expected
, test_index
);
7743 case Uri_PROPERTY_PATH
:
7744 hr
= IUriBuilder_SetPath(builder
, valueW
);
7745 todo_wine_if(prop
->todo
) {
7746 ok(hr
== prop
->expected
,
7747 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7748 hr
, prop
->expected
, test_index
);
7751 case Uri_PROPERTY_QUERY
:
7752 hr
= IUriBuilder_SetQuery(builder
, valueW
);
7753 todo_wine_if(prop
->todo
) {
7754 ok(hr
== prop
->expected
,
7755 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7756 hr
, prop
->expected
, test_index
);
7759 case Uri_PROPERTY_SCHEME_NAME
:
7760 hr
= IUriBuilder_SetSchemeName(builder
, valueW
);
7761 todo_wine_if(prop
->todo
) {
7762 ok(hr
== prop
->expected
,
7763 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7764 hr
, prop
->expected
, test_index
);
7767 case Uri_PROPERTY_USER_NAME
:
7768 hr
= IUriBuilder_SetUserName(builder
, valueW
);
7769 todo_wine_if(prop
->todo
) {
7770 ok(hr
== prop
->expected
,
7771 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7772 hr
, prop
->expected
, test_index
);
7776 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop
->property
, test_index
);
7783 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7786 static void test_CreateUri_InvalidFlags(void) {
7789 for(i
= 0; i
< ARRAY_SIZE(invalid_flag_tests
); ++i
) {
7791 IUri
*uri
= (void*) 0xdeadbeef;
7793 hr
= pCreateUri(http_urlW
, invalid_flag_tests
[i
].flags
, 0, &uri
);
7794 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7795 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
7796 ok(uri
== NULL
, "Error: expected the IUri to be NULL, but it was %p instead\n", uri
);
7800 static void test_CreateUri_InvalidArgs(void) {
7802 IUri
*uri
= (void*) 0xdeadbeef;
7804 const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
7805 static const WCHAR emptyW
[] = {0};
7807 hr
= pCreateUri(http_urlW
, 0, 0, NULL
);
7808 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7810 hr
= pCreateUri(NULL
, 0, 0, &uri
);
7811 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7812 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7814 uri
= (void*) 0xdeadbeef;
7815 hr
= pCreateUri(invalidW
, 0, 0, &uri
);
7816 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7817 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7819 uri
= (void*) 0xdeadbeef;
7820 hr
= pCreateUri(emptyW
, 0, 0, &uri
);
7821 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7822 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7825 static void test_CreateUri_InvalidUri(void) {
7828 for(i
= 0; i
< ARRAY_SIZE(invalid_uri_tests
); ++i
) {
7829 invalid_uri test
= invalid_uri_tests
[i
];
7834 uriW
= a2w(test
.uri
);
7835 hr
= pCreateUri(uriW
, test
.flags
, 0, &uri
);
7836 todo_wine_if(test
.todo
)
7837 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7838 hr
, E_INVALIDARG
, i
);
7839 if(uri
) IUri_Release(uri
);
7845 static void test_IUri_GetPropertyBSTR(void) {
7850 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7851 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7852 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7854 BSTR received
= NULL
;
7856 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, NULL
, 0);
7857 ok(hr
== E_POINTER
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7859 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7860 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_PORT
, &received
, 0);
7861 ok(hr
== E_INVALIDARG
/* IE10 */ || broken(hr
== S_OK
), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr
);
7863 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7864 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7865 SysFreeString(received
);
7867 ok(!received
, "received = %s\n", wine_dbgstr_w(received
));
7870 /* Make sure it handles the ZONE property correctly. */
7872 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_ZONE
, &received
, 0);
7873 ok(hr
== S_FALSE
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_FALSE
);
7874 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7875 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7876 SysFreeString(received
);
7878 if(uri
) IUri_Release(uri
);
7880 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
7881 uri_properties test
= uri_tests
[i
];
7885 uriW
= a2w(test
.uri
);
7886 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7887 todo_wine_if(test
.create_todo
)
7888 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7889 hr
, test
.create_expected
, i
);
7894 /* Checks all the string properties of the uri. */
7895 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7896 BSTR received
= NULL
;
7897 uri_str_property prop
= test
.str_props
[j
];
7899 hr
= IUri_GetPropertyBSTR(uri
, j
, &received
, 0);
7900 todo_wine_if(prop
.todo
) {
7901 ok(hr
== prop
.expected
||
7902 (prop
.value2
&& hr
== prop
.expected2
),
7903 "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7904 hr
, prop
.expected
, i
, j
);
7905 ok(!strcmp_aw(prop
.value
, received
) || (prop
.value2
&& !strcmp_aw(prop
.value2
, received
)) ||
7906 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7907 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7908 prop
.value
, wine_dbgstr_w(received
), i
, j
);
7911 SysFreeString(received
);
7915 if(uri
) IUri_Release(uri
);
7921 static void test_IUri_GetPropertyDWORD(void) {
7926 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7927 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7929 DWORD received
= 0xdeadbeef;
7931 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_DWORD_START
, NULL
, 0);
7932 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7934 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_ABSOLUTE_URI
, &received
, 0);
7935 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7936 ok(received
== 0, "Error: Expected received=%d but instead received=%d.\n", 0, received
);
7938 if(uri
) IUri_Release(uri
);
7940 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
7941 uri_properties test
= uri_tests
[i
];
7945 uriW
= a2w(test
.uri
);
7946 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7947 todo_wine_if(test
.create_todo
)
7948 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7949 hr
, test
.create_expected
, i
);
7954 /* Checks all the DWORD properties of the uri. */
7955 for(j
= 0; j
< ARRAY_SIZE(test
.dword_props
); ++j
) {
7957 uri_dword_property prop
= test
.dword_props
[j
];
7959 hr
= IUri_GetPropertyDWORD(uri
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
7960 todo_wine_if(prop
.todo
) {
7961 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7962 hr
, prop
.expected
, i
, j
);
7963 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7964 prop
.value
, received
, i
, j
);
7969 if(uri
) IUri_Release(uri
);
7975 /* Tests all the 'Get*' property functions which deal with strings. */
7976 static void test_IUri_GetStrProperties(void) {
7981 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7982 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7983 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7985 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
7986 ok(hr
== E_POINTER
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7988 hr
= IUri_GetAuthority(uri
, NULL
);
7989 ok(hr
== E_POINTER
, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7991 hr
= IUri_GetDisplayUri(uri
, NULL
);
7992 ok(hr
== E_POINTER
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7994 hr
= IUri_GetDomain(uri
, NULL
);
7995 ok(hr
== E_POINTER
, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7997 hr
= IUri_GetExtension(uri
, NULL
);
7998 ok(hr
== E_POINTER
, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8000 hr
= IUri_GetFragment(uri
, NULL
);
8001 ok(hr
== E_POINTER
, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8003 hr
= IUri_GetHost(uri
, NULL
);
8004 ok(hr
== E_POINTER
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8006 hr
= IUri_GetPassword(uri
, NULL
);
8007 ok(hr
== E_POINTER
, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8009 hr
= IUri_GetPath(uri
, NULL
);
8010 ok(hr
== E_POINTER
, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8012 hr
= IUri_GetPathAndQuery(uri
, NULL
);
8013 ok(hr
== E_POINTER
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8015 hr
= IUri_GetQuery(uri
, NULL
);
8016 ok(hr
== E_POINTER
, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8018 hr
= IUri_GetRawUri(uri
, NULL
);
8019 ok(hr
== E_POINTER
, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8021 hr
= IUri_GetSchemeName(uri
, NULL
);
8022 ok(hr
== E_POINTER
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8024 hr
= IUri_GetUserInfo(uri
, NULL
);
8025 ok(hr
== E_POINTER
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8027 hr
= IUri_GetUserName(uri
, NULL
);
8028 ok(hr
== E_POINTER
, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8030 if(uri
) IUri_Release(uri
);
8032 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
8033 uri_properties test
= uri_tests
[i
];
8037 uriW
= a2w(test
.uri
);
8038 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8039 todo_wine_if(test
.create_todo
)
8040 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8041 hr
, test
.create_expected
, i
);
8044 uri_str_property prop
;
8045 BSTR received
= NULL
;
8047 /* GetAbsoluteUri() tests. */
8048 prop
= test
.str_props
[Uri_PROPERTY_ABSOLUTE_URI
];
8049 hr
= IUri_GetAbsoluteUri(uri
, &received
);
8050 todo_wine_if(prop
.todo
) {
8051 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8052 hr
, prop
.expected
, i
);
8053 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
8054 "Error: Expected %s but got %s on uri_tests[%d].\n",
8055 prop
.value
, wine_dbgstr_w(received
), i
);
8057 SysFreeString(received
);
8060 /* GetAuthority() tests. */
8061 prop
= test
.str_props
[Uri_PROPERTY_AUTHORITY
];
8062 hr
= IUri_GetAuthority(uri
, &received
);
8063 todo_wine_if(prop
.todo
) {
8064 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8065 hr
, prop
.expected
, i
);
8066 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8067 prop
.value
, wine_dbgstr_w(received
), i
);
8069 SysFreeString(received
);
8072 /* GetDisplayUri() tests. */
8073 prop
= test
.str_props
[Uri_PROPERTY_DISPLAY_URI
];
8074 hr
= IUri_GetDisplayUri(uri
, &received
);
8075 todo_wine_if(prop
.todo
) {
8076 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8077 hr
, prop
.expected
, i
);
8078 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
8079 "Error: Expected %s but got %s on uri_tests[%d].\n",
8080 prop
.value
, wine_dbgstr_w(received
), i
);
8082 SysFreeString(received
);
8085 /* GetDomain() tests. */
8086 prop
= test
.str_props
[Uri_PROPERTY_DOMAIN
];
8087 hr
= IUri_GetDomain(uri
, &received
);
8088 todo_wine_if(prop
.todo
) {
8089 ok(hr
== prop
.expected
|| (prop
.value2
&& hr
== prop
.expected2
),
8090 "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8091 hr
, prop
.expected
, i
);
8092 ok(!strcmp_aw(prop
.value
, received
) || (prop
.value2
&& !strcmp_aw(prop
.value2
, received
)),
8093 "Error: Expected %s but got %s on uri_tests[%d].\n",
8094 prop
.value
, wine_dbgstr_w(received
), i
);
8096 SysFreeString(received
);
8099 /* GetExtension() tests. */
8100 prop
= test
.str_props
[Uri_PROPERTY_EXTENSION
];
8101 hr
= IUri_GetExtension(uri
, &received
);
8102 todo_wine_if(prop
.todo
) {
8103 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8104 hr
, prop
.expected
, i
);
8105 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8106 prop
.value
, wine_dbgstr_w(received
), i
);
8108 SysFreeString(received
);
8111 /* GetFragment() tests. */
8112 prop
= test
.str_props
[Uri_PROPERTY_FRAGMENT
];
8113 hr
= IUri_GetFragment(uri
, &received
);
8114 todo_wine_if(prop
.todo
) {
8115 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8116 hr
, prop
.expected
, i
);
8117 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8118 prop
.value
, wine_dbgstr_w(received
), i
);
8120 SysFreeString(received
);
8123 /* GetHost() tests. */
8124 prop
= test
.str_props
[Uri_PROPERTY_HOST
];
8125 hr
= IUri_GetHost(uri
, &received
);
8126 todo_wine_if(prop
.todo
) {
8127 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8128 hr
, prop
.expected
, i
);
8129 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8130 prop
.value
, wine_dbgstr_w(received
), i
);
8132 SysFreeString(received
);
8135 /* GetPassword() tests. */
8136 prop
= test
.str_props
[Uri_PROPERTY_PASSWORD
];
8137 hr
= IUri_GetPassword(uri
, &received
);
8138 todo_wine_if(prop
.todo
) {
8139 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8140 hr
, prop
.expected
, i
);
8141 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8142 prop
.value
, wine_dbgstr_w(received
), i
);
8144 SysFreeString(received
);
8147 /* GetPath() tests. */
8148 prop
= test
.str_props
[Uri_PROPERTY_PATH
];
8149 hr
= IUri_GetPath(uri
, &received
);
8150 todo_wine_if(prop
.todo
) {
8151 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8152 hr
, prop
.expected
, i
);
8153 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8154 prop
.value
, wine_dbgstr_w(received
), i
);
8156 SysFreeString(received
);
8159 /* GetPathAndQuery() tests. */
8160 prop
= test
.str_props
[Uri_PROPERTY_PATH_AND_QUERY
];
8161 hr
= IUri_GetPathAndQuery(uri
, &received
);
8162 todo_wine_if(prop
.todo
) {
8163 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8164 hr
, prop
.expected
, i
);
8165 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8166 prop
.value
, wine_dbgstr_w(received
), i
);
8168 SysFreeString(received
);
8171 /* GetQuery() tests. */
8172 prop
= test
.str_props
[Uri_PROPERTY_QUERY
];
8173 hr
= IUri_GetQuery(uri
, &received
);
8174 todo_wine_if(prop
.todo
) {
8175 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8176 hr
, prop
.expected
, i
);
8177 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8178 prop
.value
, wine_dbgstr_w(received
), i
);
8180 SysFreeString(received
);
8183 /* GetRawUri() tests. */
8184 prop
= test
.str_props
[Uri_PROPERTY_RAW_URI
];
8185 hr
= IUri_GetRawUri(uri
, &received
);
8186 todo_wine_if(prop
.todo
) {
8187 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8188 hr
, prop
.expected
, i
);
8189 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8190 prop
.value
, wine_dbgstr_w(received
), i
);
8192 SysFreeString(received
);
8195 /* GetSchemeName() tests. */
8196 prop
= test
.str_props
[Uri_PROPERTY_SCHEME_NAME
];
8197 hr
= IUri_GetSchemeName(uri
, &received
);
8198 todo_wine_if(prop
.todo
) {
8199 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8200 hr
, prop
.expected
, i
);
8201 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8202 prop
.value
, wine_dbgstr_w(received
), i
);
8204 SysFreeString(received
);
8207 /* GetUserInfo() tests. */
8208 prop
= test
.str_props
[Uri_PROPERTY_USER_INFO
];
8209 hr
= IUri_GetUserInfo(uri
, &received
);
8210 todo_wine_if(prop
.todo
) {
8211 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8212 hr
, prop
.expected
, i
);
8213 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8214 prop
.value
, wine_dbgstr_w(received
), i
);
8216 SysFreeString(received
);
8219 /* GetUserName() tests. */
8220 prop
= test
.str_props
[Uri_PROPERTY_USER_NAME
];
8221 hr
= IUri_GetUserName(uri
, &received
);
8222 todo_wine_if(prop
.todo
) {
8223 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8224 hr
, prop
.expected
, i
);
8225 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8226 prop
.value
, wine_dbgstr_w(received
), i
);
8228 SysFreeString(received
);
8231 if(uri
) IUri_Release(uri
);
8237 static void test_IUri_GetDwordProperties(void) {
8242 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8243 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8244 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8246 hr
= IUri_GetHostType(uri
, NULL
);
8247 ok(hr
== E_INVALIDARG
, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8249 hr
= IUri_GetPort(uri
, NULL
);
8250 ok(hr
== E_INVALIDARG
, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8252 hr
= IUri_GetScheme(uri
, NULL
);
8253 ok(hr
== E_INVALIDARG
, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8255 hr
= IUri_GetZone(uri
, NULL
);
8256 ok(hr
== E_INVALIDARG
, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8258 if(uri
) IUri_Release(uri
);
8260 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
8261 uri_properties test
= uri_tests
[i
];
8265 uriW
= a2w(test
.uri
);
8266 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8267 todo_wine_if(test
.create_todo
)
8268 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8269 hr
, test
.create_expected
, i
);
8272 uri_dword_property prop
;
8275 /* Assign an insane value so tests don't accidentally pass when
8278 received
= -9999999;
8280 /* GetHostType() tests. */
8281 prop
= test
.dword_props
[Uri_PROPERTY_HOST_TYPE
-Uri_PROPERTY_DWORD_START
];
8282 hr
= IUri_GetHostType(uri
, &received
);
8283 todo_wine_if(prop
.todo
) {
8284 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8285 hr
, prop
.expected
, i
);
8286 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8288 received
= -9999999;
8290 /* GetPort() tests. */
8291 prop
= test
.dword_props
[Uri_PROPERTY_PORT
-Uri_PROPERTY_DWORD_START
];
8292 hr
= IUri_GetPort(uri
, &received
);
8293 todo_wine_if(prop
.todo
) {
8294 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8295 hr
, prop
.expected
, i
);
8296 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8298 received
= -9999999;
8300 /* GetScheme() tests. */
8301 prop
= test
.dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
];
8302 hr
= IUri_GetScheme(uri
, &received
);
8303 todo_wine_if(prop
.todo
) {
8304 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8305 hr
, prop
.expected
, i
);
8306 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8308 received
= -9999999;
8310 /* GetZone() tests. */
8311 prop
= test
.dword_props
[Uri_PROPERTY_ZONE
-Uri_PROPERTY_DWORD_START
];
8312 hr
= IUri_GetZone(uri
, &received
);
8313 todo_wine_if(prop
.todo
) {
8314 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8315 hr
, prop
.expected
, i
);
8316 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8320 if(uri
) IUri_Release(uri
);
8326 static void test_IUri_GetPropertyLength(void) {
8331 /* Make sure it handles invalid args correctly. */
8332 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8333 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8335 DWORD received
= 0xdeadbeef;
8337 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_STRING_START
, NULL
, 0);
8338 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8340 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_DWORD_START
, &received
, 0);
8341 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8342 ok(received
== 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received
);
8344 if(uri
) IUri_Release(uri
);
8346 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
8347 uri_properties test
= uri_tests
[i
];
8351 uriW
= a2w(test
.uri
);
8352 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8353 todo_wine_if(test
.create_todo
)
8354 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8355 hr
, test
.create_expected
, i
);
8360 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
8361 DWORD expectedLen
, receivedLen
;
8362 uri_str_property prop
= test
.str_props
[j
];
8363 LPWSTR expectedValueW
;
8365 expectedLen
= lstrlenA(prop
.value
);
8366 /* Value may be unicode encoded */
8367 expectedValueW
= a2w(prop
.value
);
8368 expectedLen
= lstrlenW(expectedValueW
);
8369 heap_free(expectedValueW
);
8371 /* This won't be necessary once GetPropertyLength is implemented. */
8374 hr
= IUri_GetPropertyLength(uri
, j
, &receivedLen
, 0);
8375 todo_wine_if(prop
.todo
) {
8376 ok(hr
== prop
.expected
|| (prop
.value2
&& hr
== prop
.expected2
),
8377 "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8378 hr
, prop
.expected
, i
, j
);
8379 ok(receivedLen
== expectedLen
|| (prop
.value2
&& receivedLen
== lstrlenA(prop
.value2
)) ||
8380 broken(prop
.broken_value
&& receivedLen
== lstrlenA(prop
.broken_value
)),
8381 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8382 expectedLen
, receivedLen
, i
, j
);
8387 if(uri
) IUri_Release(uri
);
8393 static DWORD
compute_expected_props(uri_properties
*test
, DWORD
*mask
)
8399 for(i
=Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_STRING_LAST
; i
++) {
8400 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
== S_OK
)
8402 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].value2
== NULL
||
8403 test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
==
8404 test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected2
)
8408 for(i
=Uri_PROPERTY_DWORD_START
; i
<= Uri_PROPERTY_DWORD_LAST
; i
++) {
8409 if(test
->dword_props
[i
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
8417 static void test_IUri_GetProperties(void) {
8422 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8423 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8425 hr
= IUri_GetProperties(uri
, NULL
);
8426 ok(hr
== E_INVALIDARG
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8428 if(uri
) IUri_Release(uri
);
8430 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
8431 uri_properties test
= uri_tests
[i
];
8435 uriW
= a2w(test
.uri
);
8436 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8437 todo_wine_if(test
.create_todo
)
8438 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8441 DWORD received
= 0, expected_props
, mask
;
8444 hr
= IUri_GetProperties(uri
, &received
);
8445 ok(hr
== S_OK
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8447 expected_props
= compute_expected_props(&test
, &mask
);
8449 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
8450 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8451 if(mask
& (1 << j
)) {
8452 if(expected_props
& (1 << j
))
8453 ok(received
& (1 << j
), "Error: Expected flag for property %d on uri_tests[%d].\n", j
, i
);
8455 ok(!(received
& (1 << j
)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j
, i
);
8460 if(uri
) IUri_Release(uri
);
8466 static void test_IUri_HasProperty(void) {
8471 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8472 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8474 hr
= IUri_HasProperty(uri
, Uri_PROPERTY_RAW_URI
, NULL
);
8475 ok(hr
== E_INVALIDARG
, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8477 if(uri
) IUri_Release(uri
);
8479 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); ++i
) {
8480 uri_properties test
= uri_tests
[i
];
8484 uriW
= a2w(test
.uri
);
8486 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8487 todo_wine_if(test
.create_todo
)
8488 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8491 DWORD expected_props
, j
, mask
;
8493 expected_props
= compute_expected_props(&test
, &mask
);
8495 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
8496 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8499 hr
= IUri_HasProperty(uri
, j
, &received
);
8500 ok(hr
== S_OK
, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8503 if(mask
& (1 << j
)) {
8504 if(expected_props
& (1 << j
)) {
8505 ok(received
== TRUE
, "Error: Expected to have property %d on uri_tests[%d].\n", j
, i
);
8507 ok(received
== FALSE
, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j
, i
);
8513 if(uri
) IUri_Release(uri
);
8524 static inline struct custom_uri
* impl_from_IUri(IUri
*iface
)
8526 return CONTAINING_RECORD(iface
, struct custom_uri
, IUri_iface
);
8529 static HRESULT WINAPI
custom_uri_QueryInterface(IUri
*iface
, REFIID iid
, void **out
)
8531 if (IsEqualIID(iid
, &IID_IUri
) || IsEqualIID(iid
, &IID_IUnknown
))
8539 return E_NOINTERFACE
;
8542 static ULONG WINAPI
custom_uri_AddRef(IUri
*iface
)
8544 struct custom_uri
*uri
= impl_from_IUri(iface
);
8545 return IUri_AddRef(uri
->uri
);
8548 static ULONG WINAPI
custom_uri_Release(IUri
*iface
)
8550 struct custom_uri
*uri
= impl_from_IUri(iface
);
8551 return IUri_Release(uri
->uri
);
8554 static HRESULT WINAPI
custom_uri_GetPropertyBSTR(IUri
*iface
, Uri_PROPERTY property
, BSTR
*value
, DWORD flags
)
8556 struct custom_uri
*uri
= impl_from_IUri(iface
);
8557 return IUri_GetPropertyBSTR(uri
->uri
, property
, value
, flags
);
8560 static HRESULT WINAPI
custom_uri_GetPropertyLength(IUri
*iface
, Uri_PROPERTY property
, DWORD
*length
, DWORD flags
)
8562 struct custom_uri
*uri
= impl_from_IUri(iface
);
8563 return IUri_GetPropertyLength(uri
->uri
, property
, length
, flags
);
8566 static HRESULT WINAPI
custom_uri_GetPropertyDWORD(IUri
*iface
, Uri_PROPERTY property
, DWORD
*value
, DWORD flags
)
8568 struct custom_uri
*uri
= impl_from_IUri(iface
);
8569 return IUri_GetPropertyDWORD(uri
->uri
, property
, value
, flags
);
8572 static HRESULT WINAPI
custom_uri_HasProperty(IUri
*iface
, Uri_PROPERTY property
, BOOL
*has_property
)
8574 struct custom_uri
*uri
= impl_from_IUri(iface
);
8575 return IUri_HasProperty(uri
->uri
, property
, has_property
);
8578 static HRESULT WINAPI
custom_uri_GetAbsoluteUri(IUri
*iface
, BSTR
*value
)
8580 struct custom_uri
*uri
= impl_from_IUri(iface
);
8581 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8584 static HRESULT WINAPI
custom_uri_GetAuthority(IUri
*iface
, BSTR
*value
)
8586 struct custom_uri
*uri
= impl_from_IUri(iface
);
8587 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8590 static HRESULT WINAPI
custom_uri_GetDisplayUri(IUri
*iface
, BSTR
*value
)
8592 struct custom_uri
*uri
= impl_from_IUri(iface
);
8593 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8596 static HRESULT WINAPI
custom_uri_GetDomain(IUri
*iface
, BSTR
*value
)
8598 struct custom_uri
*uri
= impl_from_IUri(iface
);
8599 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8602 static HRESULT WINAPI
custom_uri_GetExtension(IUri
*iface
, BSTR
*value
)
8604 struct custom_uri
*uri
= impl_from_IUri(iface
);
8605 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8608 static HRESULT WINAPI
custom_uri_GetFragment(IUri
*iface
, BSTR
*value
)
8610 struct custom_uri
*uri
= impl_from_IUri(iface
);
8611 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8614 static HRESULT WINAPI
custom_uri_GetHost(IUri
*iface
, BSTR
*value
)
8616 struct custom_uri
*uri
= impl_from_IUri(iface
);
8617 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8620 static HRESULT WINAPI
custom_uri_GetPassword(IUri
*iface
, BSTR
*value
)
8622 struct custom_uri
*uri
= impl_from_IUri(iface
);
8623 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8626 static HRESULT WINAPI
custom_uri_GetPath(IUri
*iface
, BSTR
*value
)
8628 struct custom_uri
*uri
= impl_from_IUri(iface
);
8629 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8632 static HRESULT WINAPI
custom_uri_GetPathAndQuery(IUri
*iface
, BSTR
*value
)
8634 struct custom_uri
*uri
= impl_from_IUri(iface
);
8635 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8638 static HRESULT WINAPI
custom_uri_GetQuery(IUri
*iface
, BSTR
*value
)
8640 struct custom_uri
*uri
= impl_from_IUri(iface
);
8641 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8644 static HRESULT WINAPI
custom_uri_GetRawUri(IUri
*iface
, BSTR
*value
)
8646 struct custom_uri
*uri
= impl_from_IUri(iface
);
8647 return IUri_GetAbsoluteUri(uri
->uri
, value
);
8650 static HRESULT WINAPI
custom_uri_GetSchemeName(IUri
*iface
, BSTR
*value
)
8652 struct custom_uri
*uri
= impl_from_IUri(iface
);
8653 return IUri_GetSchemeName(uri
->uri
, value
);
8656 static HRESULT WINAPI
custom_uri_GetUserInfo(IUri
*iface
, BSTR
*value
)
8658 struct custom_uri
*uri
= impl_from_IUri(iface
);
8659 return IUri_GetUserInfo(uri
->uri
, value
);
8662 static HRESULT WINAPI
custom_uri_GetUserName(IUri
*iface
, BSTR
*value
)
8664 struct custom_uri
*uri
= impl_from_IUri(iface
);
8665 return IUri_GetUserName(uri
->uri
, value
);
8668 static HRESULT WINAPI
custom_uri_GetHostType(IUri
*iface
, DWORD
*value
)
8670 struct custom_uri
*uri
= impl_from_IUri(iface
);
8671 return IUri_GetHostType(uri
->uri
, value
);
8674 static HRESULT WINAPI
custom_uri_GetPort(IUri
*iface
, DWORD
*value
)
8676 struct custom_uri
*uri
= impl_from_IUri(iface
);
8677 return IUri_GetPort(uri
->uri
, value
);
8680 static HRESULT WINAPI
custom_uri_GetScheme(IUri
*iface
, DWORD
*value
)
8682 struct custom_uri
*uri
= impl_from_IUri(iface
);
8683 return IUri_GetScheme(uri
->uri
, value
);
8686 static HRESULT WINAPI
custom_uri_GetZone(IUri
*iface
, DWORD
*value
)
8688 struct custom_uri
*uri
= impl_from_IUri(iface
);
8689 return IUri_GetZone(uri
->uri
, value
);
8692 static HRESULT WINAPI
custom_uri_GetProperties(IUri
*iface
, DWORD
*flags
)
8694 struct custom_uri
*uri
= impl_from_IUri(iface
);
8695 return IUri_GetProperties(uri
->uri
, flags
);
8698 static HRESULT WINAPI
custom_uri_IsEqual(IUri
*iface
, IUri
*pUri
, BOOL
*is_equal
)
8700 struct custom_uri
*uri
= impl_from_IUri(iface
);
8701 return IUri_IsEqual(uri
->uri
, pUri
, is_equal
);
8704 static const IUriVtbl custom_uri_vtbl
=
8706 custom_uri_QueryInterface
,
8709 custom_uri_GetPropertyBSTR
,
8710 custom_uri_GetPropertyLength
,
8711 custom_uri_GetPropertyDWORD
,
8712 custom_uri_HasProperty
,
8713 custom_uri_GetAbsoluteUri
,
8714 custom_uri_GetAuthority
,
8715 custom_uri_GetDisplayUri
,
8716 custom_uri_GetDomain
,
8717 custom_uri_GetExtension
,
8718 custom_uri_GetFragment
,
8720 custom_uri_GetPassword
,
8722 custom_uri_GetPathAndQuery
,
8723 custom_uri_GetQuery
,
8724 custom_uri_GetRawUri
,
8725 custom_uri_GetSchemeName
,
8726 custom_uri_GetUserInfo
,
8727 custom_uri_GetUserName
,
8728 custom_uri_GetHostType
,
8730 custom_uri_GetScheme
,
8732 custom_uri_GetProperties
,
8736 static void test_IUri_IsEqual(void) {
8737 struct custom_uri custom_uri
;
8745 /* Make sure IsEqual handles invalid args correctly. */
8746 hres
= pCreateUri(http_urlW
, 0, 0, &uriA
);
8747 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8748 hres
= pCreateUri(http_urlW
, 0, 0, &uriB
);
8749 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8752 hres
= IUri_IsEqual(uriA
, NULL
, &equal
);
8753 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8754 ok(!equal
, "Error: Expected equal to be FALSE, but was %d instead.\n", equal
);
8756 hres
= IUri_IsEqual(uriA
, uriB
, NULL
);
8757 ok(hres
== E_POINTER
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, E_POINTER
);
8760 hres
= IUri_IsEqual(uriA
, uriA
, &equal
);
8761 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8762 ok(equal
, "Error: Expected equal URIs.\n");
8765 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
8766 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8767 ok(equal
, "Error: Expected equal URIs.\n");
8772 custom_uri
.IUri_iface
.lpVtbl
= &custom_uri_vtbl
;
8774 for(i
= 0; i
< ARRAY_SIZE(equality_tests
); ++i
) {
8775 uri_equality test
= equality_tests
[i
];
8776 LPWSTR uriA_W
, uriB_W
;
8780 uriA_W
= a2w(test
.a
);
8781 uriB_W
= a2w(test
.b
);
8783 hres
= pCreateUri(uriA_W
, test
.create_flags_a
, 0, &uriA
);
8784 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres
, S_OK
, i
);
8786 hres
= pCreateUri(uriB_W
, test
.create_flags_b
, 0, &uriB
);
8787 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres
, S_OK
, i
);
8790 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
8791 todo_wine_if(test
.todo
) {
8792 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
8793 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
8796 custom_uri
.uri
= uriB
;
8799 hres
= IUri_IsEqual(uriA
, &custom_uri
.IUri_iface
, &equal
);
8801 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
8802 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
8805 if(uriA
) IUri_Release(uriA
);
8806 if(uriB
) IUri_Release(uriB
);
8813 static void test_CreateUriWithFragment_InvalidArgs(void) {
8815 IUri
*uri
= (void*) 0xdeadbeef;
8816 const WCHAR fragmentW
[] = {'#','f','r','a','g','m','e','n','t',0};
8818 hr
= pCreateUriWithFragment(NULL
, fragmentW
, 0, 0, &uri
);
8819 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8820 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8822 hr
= pCreateUriWithFragment(http_urlW
, fragmentW
, 0, 0, NULL
);
8823 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8825 /* Original URI can't already contain a fragment component. */
8826 uri
= (void*) 0xdeadbeef;
8827 hr
= pCreateUriWithFragment(http_url_fragW
, fragmentW
, 0, 0, &uri
);
8828 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8829 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8832 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8833 static void test_CreateUriWithFragment_InvalidFlags(void) {
8836 for(i
= 0; i
< ARRAY_SIZE(invalid_flag_tests
); ++i
) {
8838 IUri
*uri
= (void*) 0xdeadbeef;
8840 hr
= pCreateUriWithFragment(http_urlW
, NULL
, invalid_flag_tests
[i
].flags
, 0, &uri
);
8841 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8842 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
8843 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8847 static void test_CreateUriWithFragment(void) {
8850 for(i
= 0; i
< ARRAY_SIZE(uri_fragment_tests
); ++i
) {
8854 uri_with_fragment test
= uri_fragment_tests
[i
];
8856 uriW
= a2w(test
.uri
);
8857 fragW
= a2w(test
.fragment
);
8859 hr
= pCreateUriWithFragment(uriW
, fragW
, test
.create_flags
, 0, &uri
);
8860 todo_wine_if(test
.expected_todo
)
8861 ok(hr
== test
.create_expected
,
8862 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8863 hr
, test
.create_expected
, i
);
8866 BSTR received
= NULL
;
8868 hr
= IUri_GetAbsoluteUri(uri
, &received
);
8869 todo_wine_if(test
.expected_todo
) {
8870 ok(hr
== S_OK
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8872 ok(!strcmp_aw(test
.expected_uri
, received
), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8873 test
.expected_uri
, wine_dbgstr_w(received
), i
);
8876 SysFreeString(received
);
8879 if(uri
) IUri_Release(uri
);
8885 static void test_CreateIUriBuilder(void) {
8887 IUriBuilder
*builder
= NULL
;
8890 hr
= pCreateIUriBuilder(NULL
, 0, 0, NULL
);
8891 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8894 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8895 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8896 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8898 ULONG cur_count
, orig_count
;
8900 orig_count
= get_refcnt(uri
);
8901 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
8902 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8903 ok(builder
!= NULL
, "Error: Expecting builder not to be NULL\n");
8905 cur_count
= get_refcnt(uri
);
8906 ok(cur_count
== orig_count
+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
+1, cur_count
);
8908 if(builder
) IUriBuilder_Release(builder
);
8909 cur_count
= get_refcnt(uri
);
8910 ok(cur_count
== orig_count
, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
, cur_count
);
8912 if(uri
) IUri_Release(uri
);
8915 static void test_IUriBuilder_CreateUri(IUriBuilder
*builder
, const uri_builder_test
*test
,
8920 hr
= IUriBuilder_CreateUri(builder
, test
->uri_flags
, 0, 0, &uri
);
8921 todo_wine_if(test
->uri_todo
)
8922 ok(hr
== test
->uri_hres
,
8923 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8924 hr
, test
->uri_hres
, test_index
);
8929 for(i
= 0; i
< ARRAY_SIZE(test
->expected_str_props
); ++i
) {
8930 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8931 BSTR received
= NULL
;
8933 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8934 todo_wine_if(prop
.todo
)
8935 ok(hr
== prop
.result
,
8936 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8937 hr
, prop
.result
, test_index
, i
);
8939 todo_wine_if(prop
.todo
)
8940 ok(!strcmp_aw(prop
.expected
, received
),
8941 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8942 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8944 SysFreeString(received
);
8947 for(i
= 0; i
< ARRAY_SIZE(test
->expected_dword_props
); ++i
) {
8948 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8949 DWORD received
= -2;
8951 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8952 todo_wine_if(prop
.todo
)
8953 ok(hr
== prop
.result
,
8954 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8955 hr
, prop
.result
, test_index
, i
);
8957 todo_wine_if(prop
.todo
)
8958 ok(received
== prop
.expected
,
8959 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8960 prop
.expected
, received
, test_index
, i
);
8964 if(uri
) IUri_Release(uri
);
8967 static void test_IUriBuilder_CreateUriSimple(IUriBuilder
*builder
, const uri_builder_test
*test
,
8972 hr
= IUriBuilder_CreateUriSimple(builder
, test
->uri_simple_encode_flags
, 0, &uri
);
8973 todo_wine_if(test
->uri_simple_todo
)
8974 ok(hr
== test
->uri_simple_hres
,
8975 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8976 hr
, test
->uri_simple_hres
, test_index
);
8981 for(i
= 0; i
< ARRAY_SIZE(test
->expected_str_props
); ++i
) {
8982 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8983 BSTR received
= NULL
;
8985 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8986 todo_wine_if(prop
.todo
)
8987 ok(hr
== prop
.result
,
8988 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8989 hr
, prop
.result
, test_index
, i
);
8991 todo_wine_if(prop
.todo
)
8992 ok(!strcmp_aw(prop
.expected
, received
),
8993 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8994 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8996 SysFreeString(received
);
8999 for(i
= 0; i
< ARRAY_SIZE(test
->expected_dword_props
); ++i
) {
9000 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
9001 DWORD received
= -2;
9003 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
9004 todo_wine_if(prop
.todo
)
9005 ok(hr
== prop
.result
,
9006 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9007 hr
, prop
.result
, test_index
, i
);
9009 todo_wine_if(prop
.todo
)
9010 ok(received
== prop
.expected
,
9011 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9012 prop
.expected
, received
, test_index
, i
);
9016 if(uri
) IUri_Release(uri
);
9019 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder
*builder
, const uri_builder_test
*test
,
9024 hr
= IUriBuilder_CreateUriWithFlags(builder
, test
->uri_with_flags
, test
->uri_with_builder_flags
,
9025 test
->uri_with_encode_flags
, 0, &uri
);
9026 todo_wine_if(test
->uri_with_todo
)
9027 ok(hr
== test
->uri_with_hres
,
9028 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9029 hr
, test
->uri_with_hres
, test_index
);
9034 for(i
= 0; i
< ARRAY_SIZE(test
->expected_str_props
); ++i
) {
9035 uri_builder_str_property prop
= test
->expected_str_props
[i
];
9036 BSTR received
= NULL
;
9038 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
9039 todo_wine_if(prop
.todo
)
9040 ok(hr
== prop
.result
,
9041 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
9042 hr
, prop
.result
, test_index
, i
);
9044 todo_wine_if(prop
.todo
)
9045 ok(!strcmp_aw(prop
.expected
, received
),
9046 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
9047 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
9049 SysFreeString(received
);
9052 for(i
= 0; i
< ARRAY_SIZE(test
->expected_dword_props
); ++i
) {
9053 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
9054 DWORD received
= -2;
9056 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
9057 todo_wine_if(prop
.todo
)
9058 ok(hr
== prop
.result
,
9059 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
9060 hr
, prop
.result
, test_index
, i
);
9062 todo_wine_if(prop
.todo
)
9063 ok(received
== prop
.expected
,
9064 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
9065 prop
.expected
, received
, test_index
, i
);
9069 if(uri
) IUri_Release(uri
);
9072 static void test_IUriBuilder_CreateInvalidArgs(void) {
9073 IUriBuilder
*builder
;
9076 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9077 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9079 IUri
*test
= NULL
, *uri
= (void*) 0xdeadbeef;
9081 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
9082 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, NULL
);
9083 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
9085 uri
= (void*) 0xdeadbeef;
9086 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9087 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_NOTIMPL
);
9088 ok(uri
== NULL
, "Error: expected uri to be NULL, but was %p instead.\n", uri
);
9090 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, NULL
);
9091 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9094 uri
= (void*) 0xdeadbeef;
9095 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
9096 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9098 ok(!uri
, "Error: Expected uri to NULL, but was %p instead.\n", uri
);
9100 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, NULL
);
9101 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9104 uri
= (void*) 0xdeadbeef;
9105 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9106 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9108 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
9110 hr
= pCreateUri(http_urlW
, 0, 0, &test
);
9111 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9113 hr
= IUriBuilder_SetIUri(builder
, test
);
9114 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9116 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
9118 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9119 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9120 ok(uri
!= NULL
, "Error: The uri was NULL.\n");
9121 if(uri
) IUri_Release(uri
);
9124 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
9125 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9127 ok(uri
!= NULL
, "Error: uri was NULL.\n");
9128 if(uri
) IUri_Release(uri
);
9131 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &uri
);
9132 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9134 ok(uri
!= NULL
, "Error: uri was NULL.\n");
9135 if(uri
) IUri_Release(uri
);
9137 hr
= IUriBuilder_SetFragment(builder
, NULL
);
9138 ok(hr
== S_OK
, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9140 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9141 uri
= (void*) 0xdeadbeef;
9142 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9143 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9144 ok(!uri
, "Error: Expected uri to be NULL but was %p instead.\n", uri
);
9146 uri
= (void*) 0xdeadbeef;
9147 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
9148 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9150 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
9152 uri
= (void*) 0xdeadbeef;
9153 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9154 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9156 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
9158 if(test
) IUri_Release(test
);
9160 if(builder
) IUriBuilder_Release(builder
);
9163 /* Tests invalid args to the "Get*" functions. */
9164 static void test_IUriBuilder_GetInvalidArgs(void) {
9165 IUriBuilder
*builder
= NULL
;
9168 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9169 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9171 LPCWSTR received
= (void*) 0xdeadbeef;
9172 DWORD len
= -1, port
= -1;
9175 hr
= IUriBuilder_GetFragment(builder
, NULL
, NULL
);
9176 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9178 hr
= IUriBuilder_GetFragment(builder
, NULL
, &received
);
9179 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9181 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9182 hr
= IUriBuilder_GetFragment(builder
, &len
, NULL
);
9183 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9185 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9187 hr
= IUriBuilder_GetHost(builder
, NULL
, NULL
);
9188 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9190 received
= (void*) 0xdeadbeef;
9191 hr
= IUriBuilder_GetHost(builder
, NULL
, &received
);
9192 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9194 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9196 hr
= IUriBuilder_GetHost(builder
, &len
, NULL
);
9197 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9199 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9201 hr
= IUriBuilder_GetPassword(builder
, NULL
, NULL
);
9202 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9204 received
= (void*) 0xdeadbeef;
9205 hr
= IUriBuilder_GetPassword(builder
, NULL
, &received
);
9206 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9208 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9210 hr
= IUriBuilder_GetPassword(builder
, &len
, NULL
);
9211 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9213 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9215 hr
= IUriBuilder_GetPath(builder
, NULL
, NULL
);
9216 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9218 received
= (void*) 0xdeadbeef;
9219 hr
= IUriBuilder_GetPath(builder
, NULL
, &received
);
9220 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9222 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9224 hr
= IUriBuilder_GetPath(builder
, &len
, NULL
);
9225 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9227 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9229 hr
= IUriBuilder_GetPort(builder
, NULL
, NULL
);
9230 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9232 hr
= IUriBuilder_GetPort(builder
, NULL
, &port
);
9233 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9235 ok(!port
, "Error: Expected port to be 0, but was %d instead.\n", port
);
9236 hr
= IUriBuilder_GetPort(builder
, &set
, NULL
);
9237 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9239 ok(!set
, "Error: Expected set to be FALSE, but was %d instead.\n", set
);
9241 hr
= IUriBuilder_GetQuery(builder
, NULL
, NULL
);
9242 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9244 received
= (void*) 0xdeadbeef;
9245 hr
= IUriBuilder_GetQuery(builder
, NULL
, &received
);
9246 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9248 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9250 hr
= IUriBuilder_GetQuery(builder
, &len
, NULL
);
9251 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9253 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9255 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, NULL
);
9256 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9258 received
= (void*) 0xdeadbeef;
9259 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, &received
);
9260 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9262 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9264 hr
= IUriBuilder_GetSchemeName(builder
, &len
, NULL
);
9265 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9267 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9269 hr
= IUriBuilder_GetUserName(builder
, NULL
, NULL
);
9270 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9272 received
= (void*) 0xdeadbeef;
9273 hr
= IUriBuilder_GetUserName(builder
, NULL
, &received
);
9274 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9276 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9278 hr
= IUriBuilder_GetUserName(builder
, &len
, NULL
);
9279 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9281 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9283 if(builder
) IUriBuilder_Release(builder
);
9286 static void test_IUriBuilder_GetFragment(IUriBuilder
*builder
, const uri_builder_test
*test
,
9290 LPCWSTR received
= NULL
;
9292 const uri_builder_property
*prop
= NULL
;
9294 /* Check if the property was set earlier. */
9295 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9296 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_FRAGMENT
)
9297 prop
= &(test
->properties
[i
]);
9301 /* Use expected_value unless it's NULL, then use value. */
9302 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9303 DWORD expected_len
= expected
? strlen(expected
) : 0;
9304 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9305 todo_wine_if(prop
->todo
) {
9306 ok(hr
== (expected
? S_OK
: S_FALSE
),
9307 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9308 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9310 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9311 expected
, wine_dbgstr_w(received
), test_index
);
9312 ok(expected_len
== len
,
9313 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9314 expected_len
, len
, test_index
);
9318 /* The property wasn't set earlier, so it should return whatever
9319 * the base IUri contains (if anything).
9322 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9324 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9325 hr
, S_OK
, test_index
);
9328 received
= (void*) 0xdeadbeef;
9331 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9333 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9334 hr
, S_FALSE
, test_index
);
9336 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9338 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9339 received
, test_index
);
9342 BOOL has_prop
= FALSE
;
9343 BSTR expected
= NULL
;
9345 hr
= IUri_GetFragment(uri
, &expected
);
9347 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9349 has_prop
= hr
== S_OK
;
9351 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9354 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9355 hr
, S_OK
, test_index
);
9357 ok(!lstrcmpW(expected
, received
),
9358 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9359 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9360 ok(lstrlenW(expected
) == len
,
9361 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9362 lstrlenW(expected
), len
, test_index
);
9366 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9367 hr
, S_FALSE
, test_index
);
9369 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9370 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9374 SysFreeString(expected
);
9377 if(uri
) IUri_Release(uri
);
9381 static void test_IUriBuilder_GetHost(IUriBuilder
*builder
, const uri_builder_test
*test
,
9385 LPCWSTR received
= NULL
;
9387 const uri_builder_property
*prop
= NULL
;
9389 /* Check if the property was set earlier. */
9390 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9391 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_HOST
)
9392 prop
= &(test
->properties
[i
]);
9396 /* Use expected_value unless it's NULL, then use value. */
9397 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9398 DWORD expected_len
= expected
? strlen(expected
) : 0;
9399 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9400 todo_wine_if(prop
->todo
) {
9401 ok(hr
== (expected
? S_OK
: S_FALSE
),
9402 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9403 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9405 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9406 expected
, wine_dbgstr_w(received
), test_index
);
9407 ok(expected_len
== len
,
9408 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9409 expected_len
, len
, test_index
);
9413 /* The property wasn't set earlier, so it should return whatever
9414 * the base IUri contains (if anything).
9417 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9419 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9420 hr
, S_OK
, test_index
);
9423 received
= (void*) 0xdeadbeef;
9426 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9428 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9429 hr
, S_FALSE
, test_index
);
9431 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9433 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9434 received
, test_index
);
9437 BOOL has_prop
= FALSE
;
9438 BSTR expected
= NULL
;
9440 hr
= IUri_GetHost(uri
, &expected
);
9442 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9444 has_prop
= hr
== S_OK
;
9446 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9449 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9450 hr
, S_OK
, test_index
);
9452 ok(!lstrcmpW(expected
, received
),
9453 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9454 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9455 ok(lstrlenW(expected
) == len
,
9456 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9457 lstrlenW(expected
), len
, test_index
);
9461 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9462 hr
, S_FALSE
, test_index
);
9464 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9465 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9469 SysFreeString(expected
);
9472 if(uri
) IUri_Release(uri
);
9476 static void test_IUriBuilder_GetPassword(IUriBuilder
*builder
, const uri_builder_test
*test
,
9480 LPCWSTR received
= NULL
;
9482 const uri_builder_property
*prop
= NULL
;
9484 /* Check if the property was set earlier. */
9485 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9486 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PASSWORD
)
9487 prop
= &(test
->properties
[i
]);
9491 /* Use expected_value unless it's NULL, then use value. */
9492 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9493 DWORD expected_len
= expected
? strlen(expected
) : 0;
9494 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9495 todo_wine_if(prop
->todo
) {
9496 ok(hr
== (expected
? S_OK
: S_FALSE
),
9497 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9498 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9500 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9501 expected
, wine_dbgstr_w(received
), test_index
);
9502 ok(expected_len
== len
,
9503 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9504 expected_len
, len
, test_index
);
9508 /* The property wasn't set earlier, so it should return whatever
9509 * the base IUri contains (if anything).
9512 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9514 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9515 hr
, S_OK
, test_index
);
9518 received
= (void*) 0xdeadbeef;
9521 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9523 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9524 hr
, S_FALSE
, test_index
);
9526 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9528 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9529 received
, test_index
);
9532 BOOL has_prop
= FALSE
;
9533 BSTR expected
= NULL
;
9535 hr
= IUri_GetPassword(uri
, &expected
);
9537 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9539 has_prop
= hr
== S_OK
;
9541 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9544 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9545 hr
, S_OK
, test_index
);
9547 ok(!lstrcmpW(expected
, received
),
9548 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9549 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9550 ok(lstrlenW(expected
) == len
,
9551 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9552 lstrlenW(expected
), len
, test_index
);
9556 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9557 hr
, S_FALSE
, test_index
);
9559 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9560 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9564 SysFreeString(expected
);
9567 if(uri
) IUri_Release(uri
);
9571 static void test_IUriBuilder_GetPath(IUriBuilder
*builder
, const uri_builder_test
*test
,
9575 LPCWSTR received
= NULL
;
9577 const uri_builder_property
*prop
= NULL
;
9579 /* Check if the property was set earlier. */
9580 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9581 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PATH
)
9582 prop
= &(test
->properties
[i
]);
9586 /* Use expected_value unless it's NULL, then use value. */
9587 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9588 DWORD expected_len
= expected
? strlen(expected
) : 0;
9589 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9590 todo_wine_if(prop
->todo
) {
9591 ok(hr
== (expected
? S_OK
: S_FALSE
),
9592 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9593 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9595 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9596 expected
, wine_dbgstr_w(received
), test_index
);
9597 ok(expected_len
== len
,
9598 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9599 expected_len
, len
, test_index
);
9603 /* The property wasn't set earlier, so it should return whatever
9604 * the base IUri contains (if anything).
9607 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9609 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9610 hr
, S_OK
, test_index
);
9613 received
= (void*) 0xdeadbeef;
9616 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9618 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9619 hr
, S_FALSE
, test_index
);
9621 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9623 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9624 received
, test_index
);
9627 BOOL has_prop
= FALSE
;
9628 BSTR expected
= NULL
;
9630 hr
= IUri_GetPath(uri
, &expected
);
9632 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9634 has_prop
= hr
== S_OK
;
9636 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9639 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9640 hr
, S_OK
, test_index
);
9642 ok(!lstrcmpW(expected
, received
),
9643 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9644 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9645 ok(lstrlenW(expected
) == len
,
9646 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9647 lstrlenW(expected
), len
, test_index
);
9651 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9652 hr
, S_FALSE
, test_index
);
9654 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9655 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9659 SysFreeString(expected
);
9662 if(uri
) IUri_Release(uri
);
9666 static void test_IUriBuilder_GetPort(IUriBuilder
*builder
, const uri_builder_test
*test
,
9669 BOOL has_port
= FALSE
;
9670 DWORD received
= -1;
9672 if(test
->port_prop
.change
) {
9673 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9674 todo_wine_if(test
->port_prop
.todo
) {
9676 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9677 hr
, S_OK
, test_index
);
9679 ok(has_port
== test
->port_prop
.set
,
9680 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9681 test
->port_prop
.set
, has_port
, test_index
);
9682 ok(received
== test
->port_prop
.value
,
9683 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9684 test
->port_prop
.value
, received
, test_index
);
9690 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9692 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9693 hr
, S_OK
, test_index
);
9696 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9698 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9699 hr
, S_OK
, test_index
);
9701 ok(has_port
== FALSE
,
9702 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9703 has_port
, test_index
);
9704 ok(!received
, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9705 received
, test_index
);
9710 hr
= IUri_GetPort(uri
, &expected
);
9712 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9715 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9717 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9718 hr
, S_OK
, test_index
);
9721 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9723 ok(received
== expected
,
9724 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9725 expected
, received
, test_index
);
9729 if(uri
) IUri_Release(uri
);
9733 static void test_IUriBuilder_GetQuery(IUriBuilder
*builder
, const uri_builder_test
*test
,
9737 LPCWSTR received
= NULL
;
9739 const uri_builder_property
*prop
= NULL
;
9741 /* Check if the property was set earlier. */
9742 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9743 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_QUERY
)
9744 prop
= &(test
->properties
[i
]);
9748 /* Use expected_value unless it's NULL, then use value. */
9749 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9750 DWORD expected_len
= expected
? strlen(expected
) : 0;
9751 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9752 todo_wine_if(prop
->todo
) {
9753 ok(hr
== (expected
? S_OK
: S_FALSE
),
9754 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9755 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9757 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9758 expected
, wine_dbgstr_w(received
), test_index
);
9759 ok(expected_len
== len
,
9760 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9761 expected_len
, len
, test_index
);
9765 /* The property wasn't set earlier, so it should return whatever
9766 * the base IUri contains (if anything).
9769 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9771 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9772 hr
, S_OK
, test_index
);
9775 received
= (void*) 0xdeadbeef;
9778 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9780 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9781 hr
, S_FALSE
, test_index
);
9783 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9785 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9786 received
, test_index
);
9789 BOOL has_prop
= FALSE
;
9790 BSTR expected
= NULL
;
9792 hr
= IUri_GetQuery(uri
, &expected
);
9794 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9796 has_prop
= hr
== S_OK
;
9798 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9801 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9802 hr
, S_OK
, test_index
);
9804 ok(!lstrcmpW(expected
, received
),
9805 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9806 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9807 ok(lstrlenW(expected
) == len
,
9808 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9809 lstrlenW(expected
), len
, test_index
);
9813 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9814 hr
, S_FALSE
, test_index
);
9816 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9817 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9821 SysFreeString(expected
);
9824 if(uri
) IUri_Release(uri
);
9828 static void test_IUriBuilder_GetSchemeName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9832 LPCWSTR received
= NULL
;
9834 const uri_builder_property
*prop
= NULL
;
9836 /* Check if the property was set earlier. */
9837 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9838 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_SCHEME_NAME
)
9839 prop
= &(test
->properties
[i
]);
9843 /* Use expected_value unless it's NULL, then use value. */
9844 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9845 DWORD expected_len
= expected
? strlen(expected
) : 0;
9846 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9847 todo_wine_if(prop
->todo
) {
9848 ok(hr
== (expected
? S_OK
: S_FALSE
),
9849 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9850 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9852 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9853 expected
, wine_dbgstr_w(received
), test_index
);
9854 ok(expected_len
== len
,
9855 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9856 expected_len
, len
, test_index
);
9860 /* The property wasn't set earlier, so it should return whatever
9861 * the base IUri contains (if anything).
9864 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9866 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9867 hr
, S_OK
, test_index
);
9870 received
= (void*) 0xdeadbeef;
9873 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9875 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9876 hr
, S_FALSE
, test_index
);
9878 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9880 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9881 received
, test_index
);
9884 BOOL has_prop
= FALSE
;
9885 BSTR expected
= NULL
;
9887 hr
= IUri_GetSchemeName(uri
, &expected
);
9889 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9891 has_prop
= hr
== S_OK
;
9893 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9896 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9897 hr
, S_OK
, test_index
);
9899 ok(!lstrcmpW(expected
, received
),
9900 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9901 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9902 ok(lstrlenW(expected
) == len
,
9903 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9904 lstrlenW(expected
), len
, test_index
);
9908 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9909 hr
, S_FALSE
, test_index
);
9911 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9912 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9916 SysFreeString(expected
);
9919 if(uri
) IUri_Release(uri
);
9923 static void test_IUriBuilder_GetUserName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9927 LPCWSTR received
= NULL
;
9929 const uri_builder_property
*prop
= NULL
;
9931 /* Check if the property was set earlier. */
9932 for(i
= 0; i
< ARRAY_SIZE(test
->properties
); ++i
) {
9933 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_USER_NAME
)
9934 prop
= &(test
->properties
[i
]);
9937 if(prop
&& prop
->value
&& *prop
->value
) {
9938 /* Use expected_value unless it's NULL, then use value. */
9939 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9940 DWORD expected_len
= expected
? strlen(expected
) : 0;
9941 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9942 todo_wine_if(prop
->todo
) {
9943 ok(hr
== (expected
? S_OK
: S_FALSE
),
9944 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9945 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9947 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9948 expected
, wine_dbgstr_w(received
), test_index
);
9949 ok(expected_len
== len
,
9950 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9951 expected_len
, len
, test_index
);
9955 /* The property wasn't set earlier, so it should return whatever
9956 * the base IUri contains (if anything).
9959 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9961 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9962 hr
, S_OK
, test_index
);
9965 received
= (void*) 0xdeadbeef;
9968 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9970 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9971 hr
, S_FALSE
, test_index
);
9973 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9975 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9976 received
, test_index
);
9979 BSTR expected
= NULL
;
9980 BOOL has_prop
= FALSE
;
9982 hr
= IUri_GetUserName(uri
, &expected
);
9984 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9986 has_prop
= hr
== S_OK
;
9988 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9991 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9992 hr
, S_OK
, test_index
);
9994 ok(!lstrcmpW(expected
, received
),
9995 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9996 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9997 ok(lstrlenW(expected
) == len
,
9998 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9999 lstrlenW(expected
), len
, test_index
);
10003 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10004 hr
, S_FALSE
, test_index
);
10005 if(SUCCEEDED(hr
)) {
10006 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
10007 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
10011 SysFreeString(expected
);
10014 if(uri
) IUri_Release(uri
);
10018 /* Tests IUriBuilder functions. */
10019 static void test_IUriBuilder(void) {
10021 IUriBuilder
*builder
;
10024 for(i
= 0; i
< ARRAY_SIZE(uri_builder_tests
); ++i
) {
10026 uri_builder_test test
= uri_builder_tests
[i
];
10027 LPWSTR uriW
= NULL
;
10030 uriW
= a2w(test
.uri
);
10031 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
10032 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10034 if(FAILED(hr
)) continue;
10036 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10037 todo_wine_if(test
.create_builder_todo
)
10038 ok(hr
== test
.create_builder_expected
,
10039 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10040 hr
, test
.create_builder_expected
, i
);
10041 if(SUCCEEDED(hr
)) {
10043 BOOL modified
= FALSE
, received
= FALSE
;
10045 /* Perform all the string property changes. */
10046 for(j
= 0; j
< URI_BUILDER_STR_PROPERTY_COUNT
; ++j
) {
10047 uri_builder_property prop
= test
.properties
[j
];
10049 change_property(builder
, &prop
, i
);
10050 if(prop
.property
!= Uri_PROPERTY_SCHEME_NAME
&&
10051 prop
.property
!= Uri_PROPERTY_HOST
)
10053 else if(prop
.value
&& *prop
.value
)
10055 else if(prop
.value
&& !*prop
.value
&& prop
.property
== Uri_PROPERTY_HOST
)
10056 /* Host name property can't be NULL, but it can be empty. */
10061 if(test
.port_prop
.change
) {
10062 hr
= IUriBuilder_SetPort(builder
, test
.port_prop
.set
, test
.port_prop
.value
);
10064 todo_wine_if(test
.port_prop
.todo
)
10065 ok(hr
== test
.port_prop
.expected
,
10066 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10067 hr
, test
.port_prop
.expected
, i
);
10070 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10072 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10075 ok(received
== modified
,
10076 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
10077 modified
, received
, i
);
10079 /* Test the "Get*" functions. */
10080 test_IUriBuilder_GetFragment(builder
, &test
, i
);
10081 test_IUriBuilder_GetHost(builder
, &test
, i
);
10082 test_IUriBuilder_GetPassword(builder
, &test
, i
);
10083 test_IUriBuilder_GetPath(builder
, &test
, i
);
10084 test_IUriBuilder_GetPort(builder
, &test
, i
);
10085 test_IUriBuilder_GetQuery(builder
, &test
, i
);
10086 test_IUriBuilder_GetSchemeName(builder
, &test
, i
);
10087 test_IUriBuilder_GetUserName(builder
, &test
, i
);
10089 test_IUriBuilder_CreateUri(builder
, &test
, i
);
10090 test_IUriBuilder_CreateUriSimple(builder
, &test
, i
);
10091 test_IUriBuilder_CreateUriWithFlags(builder
, &test
, i
);
10093 if(builder
) IUriBuilder_Release(builder
);
10094 if(uri
) IUri_Release(uri
);
10099 static void test_IUriBuilder_HasBeenModified(void) {
10101 IUriBuilder
*builder
= NULL
;
10103 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10104 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10105 if(SUCCEEDED(hr
)) {
10106 static const WCHAR hostW
[] = {'g','o','o','g','l','e','.','c','o','m',0};
10110 hr
= IUriBuilder_HasBeenModified(builder
, NULL
);
10111 ok(hr
== E_POINTER
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10114 hr
= IUriBuilder_SetHost(builder
, hostW
);
10115 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10118 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10119 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10122 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10124 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10125 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10126 if(SUCCEEDED(hr
)) {
10130 hr
= IUriBuilder_SetIUri(builder
, uri
);
10131 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10134 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10135 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10138 ok(received
== FALSE
, "Error: Expected received to be FALSE.\n");
10140 /* Test what happens with you call SetIUri with the same IUri again. */
10141 hr
= IUriBuilder_SetHost(builder
, hostW
);
10142 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10144 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10145 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10148 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10150 hr
= IUriBuilder_SetIUri(builder
, uri
);
10151 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10153 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10154 * reset any of the changes that were made to the IUriBuilder.
10156 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10157 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10159 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10161 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
10162 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10163 if(SUCCEEDED(hr
)) {
10164 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
10165 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
10166 ok(len
== lstrlenW(hostW
), "Error: Expected len to be %d, but was %d instead.\n",
10167 lstrlenW(hostW
), len
);
10170 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10171 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10173 hr
= IUriBuilder_SetHost(builder
, hostW
);
10174 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10175 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10176 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10179 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10181 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10182 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr
, S_OK
);
10184 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10185 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10188 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10190 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
10191 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10192 if(SUCCEEDED(hr
)) {
10193 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
10194 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
10195 ok(len
== lstrlenW(hostW
), "Error: Expected len to %d, but was %d instead.\n",
10196 lstrlenW(hostW
), len
);
10199 if(uri
) IUri_Release(uri
);
10201 if(builder
) IUriBuilder_Release(builder
);
10204 /* Test IUriBuilder {Get,Set}IUri functions. */
10205 static void test_IUriBuilder_IUriProperty(void) {
10206 IUriBuilder
*builder
= NULL
;
10209 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10210 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10211 if(SUCCEEDED(hr
)) {
10214 hr
= IUriBuilder_GetIUri(builder
, NULL
);
10215 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10218 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10219 if(SUCCEEDED(hr
)) {
10221 ULONG cur_count
, orig_count
;
10223 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10224 orig_count
= get_refcnt(uri
);
10225 hr
= IUriBuilder_SetIUri(builder
, uri
);
10226 cur_count
= get_refcnt(uri
);
10228 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10229 orig_count
+1, cur_count
);
10231 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10232 cur_count
= get_refcnt(uri
);
10234 ok(cur_count
== orig_count
, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10235 orig_count
, cur_count
);
10237 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10238 hr
= IUriBuilder_SetIUri(builder
, uri
);
10239 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10240 orig_count
= get_refcnt(uri
);
10242 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, &test
);
10243 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10244 if(SUCCEEDED(hr
)) {
10245 cur_count
= get_refcnt(uri
);
10246 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10247 orig_count
+1, cur_count
);
10248 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n",
10251 if(test
) IUri_Release(test
);
10254 hr
= IUriBuilder_CreateUri(builder
, -1, 0, 0, &test
);
10255 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10256 if(SUCCEEDED(hr
)) {
10257 cur_count
= get_refcnt(uri
);
10258 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10259 orig_count
+1, cur_count
);
10260 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10262 if(test
) IUri_Release(test
);
10264 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10268 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, &test
);
10269 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10271 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
10273 if(test
) IUri_Release(test
);
10275 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10276 * explicitly set (because it's a default flag).
10279 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, &test
);
10280 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10281 if(SUCCEEDED(hr
)) {
10282 cur_count
= get_refcnt(uri
);
10283 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10284 orig_count
+1, cur_count
);
10285 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
10287 if(test
) IUri_Release(test
);
10290 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, &test
);
10291 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10292 if(SUCCEEDED(hr
)) {
10293 cur_count
= get_refcnt(uri
);
10294 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10295 orig_count
+1, cur_count
);
10296 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10298 if(test
) IUri_Release(test
);
10301 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &test
);
10302 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10304 if(SUCCEEDED(hr
)) {
10305 cur_count
= get_refcnt(uri
);
10306 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10307 orig_count
+1, cur_count
);
10308 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10310 if(test
) IUri_Release(test
);
10312 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10316 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, 0, &test
);
10317 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10319 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
10321 if(test
) IUri_Release(test
);
10323 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10324 * explicitly set (because it's a default flag).
10327 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, 0, &test
);
10328 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10329 if(SUCCEEDED(hr
)) {
10330 cur_count
= get_refcnt(uri
);
10331 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10332 orig_count
+1, cur_count
);
10333 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
10335 if(test
) IUri_Release(test
);
10337 if(uri
) IUri_Release(uri
);
10339 if(builder
) IUriBuilder_Release(builder
);
10342 static void test_IUriBuilder_RemoveProperties(void) {
10343 IUriBuilder
*builder
= NULL
;
10347 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10348 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10349 if(SUCCEEDED(hr
)) {
10350 /* Properties that can't be removed. */
10351 const DWORD invalid
= Uri_HAS_ABSOLUTE_URI
|Uri_HAS_DISPLAY_URI
|Uri_HAS_RAW_URI
|Uri_HAS_HOST_TYPE
|
10352 Uri_HAS_SCHEME
|Uri_HAS_ZONE
;
10354 for(i
= Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_DWORD_LAST
; ++i
) {
10355 hr
= IUriBuilder_RemoveProperties(builder
, i
<< 1);
10356 if((i
<< 1) & invalid
) {
10357 ok(hr
== E_INVALIDARG
,
10358 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10359 hr
, E_INVALIDARG
, i
);
10362 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10367 /* Also doesn't accept anything that's outside the range of the
10370 hr
= IUriBuilder_RemoveProperties(builder
, (Uri_PROPERTY_DWORD_LAST
+1) << 1);
10371 ok(hr
== E_INVALIDARG
, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10374 if(builder
) IUriBuilder_Release(builder
);
10376 for(i
= 0; i
< ARRAY_SIZE(uri_builder_remove_tests
); ++i
) {
10377 uri_builder_remove_test test
= uri_builder_remove_tests
[i
];
10381 uriW
= a2w(test
.uri
);
10382 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
10383 if(SUCCEEDED(hr
)) {
10386 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10387 todo_wine_if(test
.create_builder_todo
)
10388 ok(hr
== test
.create_builder_expected
,
10389 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10390 hr
, test
.create_builder_expected
, i
);
10392 if(SUCCEEDED(hr
)) {
10393 hr
= IUriBuilder_RemoveProperties(builder
, test
.remove_properties
);
10394 todo_wine_if(test
.remove_todo
)
10395 ok(hr
== test
.remove_expected
,
10396 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10397 hr
, test
.remove_expected
, i
);
10398 if(SUCCEEDED(hr
)) {
10399 IUri
*result
= NULL
;
10401 hr
= IUriBuilder_CreateUri(builder
, test
.expected_flags
, 0, 0, &result
);
10402 todo_wine_if(test
.expected_todo
)
10403 ok(hr
== test
.expected_hres
,
10404 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10405 hr
, test
.expected_hres
, i
);
10406 if(SUCCEEDED(hr
)) {
10407 BSTR received
= NULL
;
10409 hr
= IUri_GetAbsoluteUri(result
, &received
);
10410 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10411 ok(!strcmp_aw(test
.expected_uri
, received
),
10412 "Error: Expected %s but got %s instead on test %d.\n",
10413 test
.expected_uri
, wine_dbgstr_w(received
), i
);
10414 SysFreeString(received
);
10416 if(result
) IUri_Release(result
);
10419 if(builder
) IUriBuilder_Release(builder
);
10421 if(uri
) IUri_Release(uri
);
10426 static void test_IUriBuilder_Misc(void) {
10430 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10431 if(SUCCEEDED(hr
)) {
10432 IUriBuilder
*builder
;
10434 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10435 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10436 if(SUCCEEDED(hr
)) {
10440 hr
= IUriBuilder_GetPort(builder
, &has
, &port
);
10441 ok(hr
== S_OK
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10442 if(SUCCEEDED(hr
)) {
10443 /* 'has' will be set to FALSE, even though uri had a port. */
10444 ok(has
== FALSE
, "Error: Expected 'has' to be FALSE, was %d instead.\n", has
);
10445 /* Still sets 'port' to 80. */
10446 ok(port
== 80, "Error: Expected the port to be 80, but, was %d instead.\n", port
);
10449 if(builder
) IUriBuilder_Release(builder
);
10451 if(uri
) IUri_Release(uri
);
10454 static void test_IUriBuilderFactory(void) {
10457 IUriBuilderFactory
*factory
;
10458 IUriBuilder
*builder
;
10460 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10461 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10462 if(SUCCEEDED(hr
)) {
10464 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&factory
);
10465 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x.\n", hr
);
10466 ok(factory
!= NULL
, "Error: Expected 'factory' to not be NULL.\n");
10468 if(SUCCEEDED(hr
)) {
10469 builder
= (void*) 0xdeadbeef;
10470 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 10, 0, &builder
);
10471 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10473 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10475 builder
= (void*) 0xdeadbeef;
10476 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 10, &builder
);
10477 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10479 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10481 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, NULL
);
10482 ok(hr
== E_POINTER
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10486 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, &builder
);
10487 ok(hr
== S_OK
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10489 if(SUCCEEDED(hr
)) {
10490 IUri
*tmp
= (void*) 0xdeadbeef;
10494 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
10495 ok(hr
== S_OK
, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10497 ok(!tmp
, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp
);
10499 hr
= IUriBuilder_GetHost(builder
, &result_len
, &result
);
10500 ok(hr
== S_FALSE
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10503 if(builder
) IUriBuilder_Release(builder
);
10505 builder
= (void*) 0xdeadbeef;
10506 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 10, 0, &builder
);
10507 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10509 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10511 builder
= (void*) 0xdeadbeef;
10512 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 10, &builder
);
10513 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10515 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10517 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, NULL
);
10518 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10522 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, &builder
);
10523 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10525 if(SUCCEEDED(hr
)) {
10528 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
10529 ok(hr
== S_OK
, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10531 ok(tmp
== uri
, "Error: Expected tmp to be %p, but was %p.\n", uri
, tmp
);
10532 if(tmp
) IUri_Release(tmp
);
10534 if(builder
) IUriBuilder_Release(builder
);
10536 if(factory
) IUriBuilderFactory_Release(factory
);
10538 if(uri
) IUri_Release(uri
);
10541 static void test_CoInternetCombineIUri(void) {
10543 IUri
*base
, *relative
, *result
;
10547 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10548 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
10549 if(SUCCEEDED(hr
)) {
10550 result
= (void*) 0xdeadbeef;
10551 hr
= pCoInternetCombineIUri(base
, NULL
, 0, &result
, 0);
10552 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10553 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10557 hr
= pCreateUri(http_urlW
, 0, 0, &relative
);
10558 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
10559 if(SUCCEEDED(hr
)) {
10560 result
= (void*) 0xdeadbeef;
10561 hr
= pCoInternetCombineIUri(NULL
, relative
, 0, &result
, 0);
10562 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10563 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10566 hr
= pCoInternetCombineIUri(base
, relative
, 0, NULL
, 0);
10567 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10569 if(base
) IUri_Release(base
);
10570 if(relative
) IUri_Release(relative
);
10572 for(i
= 0; i
< ARRAY_SIZE(uri_combine_tests
); ++i
) {
10573 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10575 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10576 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10577 if(SUCCEEDED(hr
)) {
10578 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10580 hr
= pCreateUri(relativeW
, uri_combine_tests
[i
].relative_create_flags
, 0, &relative
);
10581 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10582 if(SUCCEEDED(hr
)) {
10585 hr
= pCoInternetCombineIUri(base
, relative
, uri_combine_tests
[i
].combine_flags
, &result
, 0);
10586 todo_wine_if(uri_combine_tests
[i
].todo
)
10587 ok(hr
== uri_combine_tests
[i
].expected
||
10588 broken(hr
== S_OK
&& uri_combine_tests
[i
].expected
== E_INVALIDARG
) /* win10 1607 to 1709 */,
10589 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10590 hr
, uri_combine_tests
[i
]. expected
, i
);
10591 if(SUCCEEDED(hr
) && SUCCEEDED(uri_combine_tests
[i
].expected
)) {
10594 for(j
= 0; j
< ARRAY_SIZE(uri_combine_tests
[i
].str_props
); ++j
) {
10595 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10598 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10599 todo_wine_if(prop
.todo
) {
10600 ok(hr
== prop
.expected
,
10601 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10602 hr
, prop
.expected
, i
, j
);
10603 ok(!strcmp_aw(prop
.value
, received
) ||
10604 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10605 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10606 prop
.value
, wine_dbgstr_w(received
), i
, j
);
10608 SysFreeString(received
);
10611 for(j
= 0; j
< ARRAY_SIZE(uri_combine_tests
[i
].dword_props
); ++j
) {
10612 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10615 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10616 todo_wine_if(prop
.todo
) {
10617 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10618 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10619 hr
, prop
.expected
, i
, j
);
10620 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10621 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10622 prop
.value
, received
, i
, j
);
10626 if(result
) IUri_Release(result
);
10628 if(relative
) IUri_Release(relative
);
10629 heap_free(relativeW
);
10631 if(base
) IUri_Release(base
);
10636 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
10637 REFIID riid
, void **ppv
)
10639 ok(0, "unexpected call\n");
10640 return E_NOINTERFACE
;
10643 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
10648 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
10653 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
10654 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
10655 DWORD
*pcchResult
, DWORD dwReserved
)
10657 CHECK_EXPECT(ParseUrl
);
10658 ok(!lstrcmpW(pwzUrl
, parse_urlW
), "Error: Expected %s, but got %s instead.\n",
10659 wine_dbgstr_w(parse_urlW
), wine_dbgstr_w(pwzUrl
));
10660 ok(ParseAction
== parse_action
, "Error: Expected %d, but got %d.\n", parse_action
, ParseAction
);
10661 ok(dwParseFlags
== parse_flags
, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags
, dwParseFlags
);
10662 ok(cchResult
== 200, "Error: Got %d.\n", cchResult
);
10664 memcpy(pwzResult
, parse_resultW
, sizeof(parse_resultW
));
10665 *pcchResult
= lstrlenW(parse_resultW
);
10670 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
10671 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
10672 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
10674 CHECK_EXPECT(CombineUrl
);
10675 ok(!lstrcmpW(pwzBaseUrl
, combine_baseW
), "Error: Expected %s, but got %s instead.\n",
10676 wine_dbgstr_w(combine_baseW
), wine_dbgstr_w(pwzBaseUrl
));
10677 ok(!lstrcmpW(pwzRelativeUrl
, combine_relativeW
), "Error: Expected %s, but got %s instead.\n",
10678 wine_dbgstr_w(combine_relativeW
), wine_dbgstr_w(pwzRelativeUrl
));
10679 ok(dwCombineFlags
== (URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
),
10680 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags
);
10681 ok(cchResult
== INTERNET_MAX_URL_LENGTH
+1, "Error: Got %d.\n", cchResult
);
10683 memcpy(pwzResult
, combine_resultW
, sizeof(combine_resultW
));
10684 *pcchResult
= lstrlenW(combine_resultW
);
10689 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
10690 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
10692 ok(0, "unexpected call\n");
10696 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
10697 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
10698 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
10700 ok(0, "unexpected call\n");
10704 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
10705 InternetProtocolInfo_QueryInterface
,
10706 InternetProtocolInfo_AddRef
,
10707 InternetProtocolInfo_Release
,
10708 InternetProtocolInfo_ParseUrl
,
10709 InternetProtocolInfo_CombineUrl
,
10710 InternetProtocolInfo_CompareUrl
,
10711 InternetProtocolInfo_QueryInfo
10714 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
10716 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
10718 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
10719 *ppv
= &protocol_info
;
10723 ok(0, "unexpected call\n");
10724 return E_NOINTERFACE
;
10727 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
10732 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
10737 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
10738 REFIID riid
, void **ppv
)
10740 ok(0, "unexpected call\n");
10744 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
10746 ok(0, "unexpected call\n");
10750 static const IClassFactoryVtbl ClassFactoryVtbl
= {
10751 ClassFactory_QueryInterface
,
10752 ClassFactory_AddRef
,
10753 ClassFactory_Release
,
10754 ClassFactory_CreateInstance
,
10755 ClassFactory_LockServer
10758 static IClassFactory protocol_cf
= { &ClassFactoryVtbl
};
10760 static void register_protocols(void)
10762 IInternetSession
*session
;
10765 hres
= pCoInternetGetSession(0, &session
, 0);
10766 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
10770 hres
= IInternetSession_RegisterNameSpace(session
, &protocol_cf
, &IID_NULL
,
10771 winetestW
, 0, NULL
, 0);
10772 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
10774 IInternetSession_Release(session
);
10777 static void unregister_protocols(void) {
10778 IInternetSession
*session
;
10781 hr
= pCoInternetGetSession(0, &session
, 0);
10782 ok(hr
== S_OK
, "CoInternetGetSession failed: 0x%08x\n", hr
);
10786 hr
= IInternetSession_UnregisterNameSpace(session
, &protocol_cf
, winetestW
);
10787 ok(hr
== S_OK
, "UnregisterNameSpace failed: 0x%08x\n", hr
);
10789 IInternetSession_Release(session
);
10792 static void test_CoInternetCombineIUri_Pluggable(void) {
10796 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10797 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10798 if(SUCCEEDED(hr
)) {
10799 IUri
*relative
= NULL
;
10801 hr
= pCreateUri(combine_relativeW
, Uri_CREATE_ALLOW_RELATIVE
, 0, &relative
);
10802 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10803 if(SUCCEEDED(hr
)) {
10804 IUri
*result
= NULL
;
10806 SET_EXPECT(CombineUrl
);
10808 hr
= pCoInternetCombineIUri(base
, relative
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10810 ok(hr
== S_OK
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10812 CHECK_CALLED(CombineUrl
);
10814 if(SUCCEEDED(hr
)) {
10815 BSTR received
= NULL
;
10816 hr
= IUri_GetAbsoluteUri(result
, &received
);
10817 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10818 if(SUCCEEDED(hr
)) {
10819 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10820 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10822 SysFreeString(received
);
10824 if(result
) IUri_Release(result
);
10826 if(relative
) IUri_Release(relative
);
10828 if(base
) IUri_Release(base
);
10831 static void test_CoInternetCombineUrlEx(void) {
10833 IUri
*base
, *result
;
10837 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10838 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10839 if(SUCCEEDED(hr
)) {
10840 result
= (void*) 0xdeadbeef;
10841 hr
= pCoInternetCombineUrlEx(base
, NULL
, 0, &result
, 0);
10842 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10844 ok(!result
, "Error: Expected 'result' to be NULL was %p instead.\n", result
);
10847 result
= (void*) 0xdeadbeef;
10848 hr
= pCoInternetCombineUrlEx(NULL
, http_urlW
, 0, &result
, 0);
10849 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10851 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10853 result
= (void*) 0xdeadbeef;
10854 hr
= pCoInternetCombineUrlEx(NULL
, NULL
, 0, &result
, 0);
10855 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10857 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10859 hr
= pCoInternetCombineUrlEx(base
, http_urlW
, 0, NULL
, 0);
10860 ok(hr
== E_POINTER
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10862 if(base
) IUri_Release(base
);
10864 for(i
= 0; i
< ARRAY_SIZE(uri_combine_tests
); ++i
) {
10865 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10867 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10868 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10869 if(SUCCEEDED(hr
)) {
10870 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10872 hr
= pCoInternetCombineUrlEx(base
, relativeW
, uri_combine_tests
[i
].combine_flags
,
10874 todo_wine_if(uri_combine_tests
[i
].todo
)
10875 ok(hr
== uri_combine_tests
[i
].expected
,
10876 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10877 hr
, uri_combine_tests
[i
]. expected
, i
);
10878 if(SUCCEEDED(hr
)) {
10881 for(j
= 0; j
< ARRAY_SIZE(uri_combine_tests
[i
].str_props
); ++j
) {
10882 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10884 LPCSTR value
= (prop
.value_ex
) ? prop
.value_ex
: prop
.value
;
10886 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10887 todo_wine_if(prop
.todo
) {
10888 ok(hr
== prop
.expected
,
10889 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10890 hr
, prop
.expected
, i
, j
);
10891 ok(!strcmp_aw(value
, received
) ||
10892 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10893 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10894 value
, wine_dbgstr_w(received
), i
, j
);
10896 SysFreeString(received
);
10899 for(j
= 0; j
< ARRAY_SIZE(uri_combine_tests
[i
].dword_props
); ++j
) {
10900 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10903 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10904 todo_wine_if(prop
.todo
) {
10905 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10906 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10907 hr
, prop
.expected
, i
, j
);
10908 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10909 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10910 prop
.value
, received
, i
, j
);
10914 if(result
) IUri_Release(result
);
10915 heap_free(relativeW
);
10917 if(base
) IUri_Release(base
);
10922 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10926 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10927 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10928 if(SUCCEEDED(hr
)) {
10929 IUri
*result
= NULL
;
10931 SET_EXPECT(CombineUrl
);
10933 hr
= pCoInternetCombineUrlEx(base
, combine_relativeW
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10935 ok(hr
== S_OK
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10937 CHECK_CALLED(CombineUrl
);
10939 if(SUCCEEDED(hr
)) {
10940 BSTR received
= NULL
;
10941 hr
= IUri_GetAbsoluteUri(result
, &received
);
10942 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10943 if(SUCCEEDED(hr
)) {
10944 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10945 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10947 SysFreeString(received
);
10949 if(result
) IUri_Release(result
);
10951 if(base
) IUri_Release(base
);
10954 static void test_CoInternetParseIUri_InvalidArgs(void) {
10958 WCHAR
*longurl
, *copy
;
10962 hr
= pCoInternetParseIUri(NULL
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10963 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10965 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10967 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10968 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10969 if(SUCCEEDED(hr
)) {
10970 DWORD expected_len
;
10973 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, NULL
, 0, &result
, 0);
10974 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10976 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10978 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, NULL
, 0);
10979 ok(hr
== E_POINTER
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10983 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_URL
, 0, tmp
, 3, &result
, 0);
10984 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10986 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10989 hr
= pCoInternetParseIUri(uri
, PARSE_MIME
, 0, tmp
, 3, &result
, 0);
10990 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10992 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10995 hr
= pCoInternetParseIUri(uri
, PARSE_SERVER
, 0, tmp
, 3, &result
, 0);
10996 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10998 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11001 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_DOMAIN
, 0, tmp
, 3, &result
, 0);
11002 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11004 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11006 expected_len
= lstrlenW(http_urlW
);
11008 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
11009 ok(hr
== STRSAFE_E_INSUFFICIENT_BUFFER
,
11010 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11011 hr
, STRSAFE_E_INSUFFICIENT_BUFFER
);
11012 ok(result
== expected_len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
11013 expected_len
, result
);
11015 if(uri
) IUri_Release(uri
);
11017 /* a long url that causes a crash on Wine */
11018 len
= INTERNET_MAX_URL_LENGTH
*2;
11019 longurl
= heap_alloc((len
+1)*sizeof(WCHAR
));
11020 memcpy(longurl
, http_urlW
, sizeof(http_urlW
));
11021 for(i
= ARRAY_SIZE(http_urlW
)-1; i
< len
; i
++)
11025 copy
= heap_alloc((len
+1)*sizeof(WCHAR
));
11026 memcpy(copy
, longurl
, (len
+1)*sizeof(WCHAR
));
11028 hr
= pCreateUri(longurl
, 0, 0, &uri
);
11029 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
11030 if(SUCCEEDED(hr
)) {
11032 memset(longurl
, 0xcc, len
*sizeof(WCHAR
));
11033 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, longurl
, len
+1, &result
, 0);
11034 ok(SUCCEEDED(hr
), "Error: CoInternetParseIUri returned 0x%08x.\n", hr
);
11035 ok(!lstrcmpW(longurl
, copy
), "Error: expected long url '%s' but was '%s'.\n",
11036 wine_dbgstr_w(copy
), wine_dbgstr_w(longurl
));
11037 ok(result
== len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
11040 heap_free(longurl
);
11042 if(uri
) IUri_Release(uri
);
11045 static void test_CoInternetParseIUri(void) {
11048 for(i
= 0; i
< ARRAY_SIZE(uri_parse_tests
); ++i
) {
11052 uri_parse_test test
= uri_parse_tests
[i
];
11054 uriW
= a2w(test
.uri
);
11055 hr
= pCreateUri(uriW
, test
.uri_flags
, 0, &uri
);
11056 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr
, i
);
11057 if(SUCCEEDED(hr
)) {
11058 WCHAR result
[INTERNET_MAX_URL_LENGTH
+1];
11059 DWORD result_len
= -1;
11061 hr
= pCoInternetParseIUri(uri
, test
.action
, test
.flags
, result
, INTERNET_MAX_URL_LENGTH
+1, &result_len
, 0);
11062 todo_wine_if(test
.todo
)
11063 ok(hr
== test
.expected
,
11064 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11065 hr
, test
.expected
, i
);
11066 if(SUCCEEDED(hr
)) {
11067 DWORD len
= lstrlenA(test
.property
);
11068 ok(!strcmp_aw(test
.property
, result
) || (test
.property2
&& !strcmp_aw(test
.property2
, result
)),
11069 "Error: Expected %s but got %s instead on uri_parse_tests[%d] - %s.\n",
11070 test
.property
, wine_dbgstr_w(result
), i
, wine_dbgstr_w(uriW
));
11071 ok(len
== result_len
|| (test
.property2
&& lstrlenA(test
.property2
) == result_len
),
11072 "Error: Expected %d, but got %d instead on uri_parse_tests[%d] - %s.\n",
11073 len
, result_len
, i
, wine_dbgstr_w(uriW
));
11076 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11080 if(uri
) IUri_Release(uri
);
11085 static void test_CoInternetParseIUri_Pluggable(void) {
11089 hr
= pCreateUri(parse_urlW
, 0, 0, &uri
);
11090 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr
);
11091 if(SUCCEEDED(hr
)) {
11095 SET_EXPECT(ParseUrl
);
11097 parse_action
= PARSE_CANONICALIZE
;
11098 parse_flags
= URL_UNESCAPE
|URL_ESCAPE_UNSAFE
;
11100 hr
= pCoInternetParseIUri(uri
, parse_action
, parse_flags
, result
, 200, &result_len
, 0);
11101 ok(hr
== S_OK
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
11103 CHECK_CALLED(ParseUrl
);
11105 if(SUCCEEDED(hr
)) {
11106 ok(result_len
== lstrlenW(parse_resultW
), "Error: Expected %d, but got %d.\n",
11107 lstrlenW(parse_resultW
), result_len
);
11108 ok(!lstrcmpW(result
, parse_resultW
), "Error: Expected %s, but got %s.\n",
11109 wine_dbgstr_w(parse_resultW
), wine_dbgstr_w(result
));
11112 if(uri
) IUri_Release(uri
);
11118 const char *base_url
;
11119 DWORD base_uri_flags
;
11120 const char *legacy_url
;
11121 const char *uniform_url
;
11122 const char *no_canon_url
;
11123 const char *uri_url
;
11124 } create_urlmon_test_t
;
11126 static const create_urlmon_test_t create_urlmon_tests
[] = {
11128 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE
,
11130 "http://www.winehq.org/",
11131 "http://www.winehq.org/",
11132 "http://www.winehq.org",
11133 "http://www.winehq.org"
11136 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE
,
11138 "file://c:\\dir\\file.txt",
11139 "file:///c:/dir/file.txt",
11140 "file:///c:/dir/file.txt",
11141 "file:///c:/dir/file.txt"
11144 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH
,
11146 "file://c:\\dir\\file.txt",
11147 "file:///c:/dir/file.txt",
11148 "file:///c:/dir/file.txt",
11149 "file://c:\\dir\\file.txt"
11152 "dat%61",Uri_CREATE_ALLOW_RELATIVE
,
11153 "http://www.winehq.org",0,
11154 "http://www.winehq.org/data",
11155 "http://www.winehq.org/data",
11156 "http://www.winehq.org:80/data",
11159 "file.txt",Uri_CREATE_ALLOW_RELATIVE
,
11160 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE
,
11161 "file://c:\\dir\\file.txt",
11162 "file:///c:/dir/file.txt",
11163 "file:///c:/dir/file.txt",
11166 "",Uri_CREATE_ALLOW_RELATIVE
,
11174 "test",Uri_CREATE_ALLOW_RELATIVE
,
11182 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
11184 "file://c:\\dir\\file.txt",
11185 "file:///c:/dir/file.txt",
11186 "file:///c:/dir/file.txt",
11187 "file:///c:/dir/file.txt",
11190 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
11192 "file://c:\\dir\\file.txt#frag|part",
11193 "file:///c:/dir/file.txt#frag%7Cpart",
11194 "file:///c:/dir/file.txt#frag%7Cpart",
11195 "file:///c:/dir/file.txt#frag%7Cpart",
11199 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11200 static void _test_urlmon_display_name(unsigned line
, IMoniker
*mon
, const char *exurl
)
11202 WCHAR
*display_name
;
11205 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
11206 ok_(__FILE__
,line
)(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
11207 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_name
), "unexpected display name: %s, expected %s\n",
11208 wine_dbgstr_w(display_name
), exurl
);
11210 CoTaskMemFree(display_name
);
11213 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11214 static void _test_display_uri(unsigned line
, IMoniker
*mon
, const char *exurl
)
11216 IUriContainer
*uri_container
;
11221 hres
= IMoniker_QueryInterface(mon
, &IID_IUriContainer
, (void**)&uri_container
);
11222 ok(hres
== S_OK
, "Could not get IUriContainer iface: %08x\n", hres
);
11225 hres
= IUriContainer_GetIUri(uri_container
, &uri
);
11226 IUriContainer_Release(uri_container
);
11227 ok(hres
== S_OK
, "GetIUri failed: %08x\n", hres
);
11228 ok(uri
!= NULL
, "uri == NULL\n");
11230 hres
= IUri_GetDisplayUri(uri
, &display_uri
);
11232 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
11233 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_uri
), "unexpected display uri: %s, expected %s\n",
11234 wine_dbgstr_w(display_uri
), exurl
);
11235 SysFreeString(display_uri
);
11238 static void test_CreateURLMoniker(void)
11240 const create_urlmon_test_t
*test
;
11241 IMoniker
*mon
, *base_mon
;
11242 WCHAR
*url
, *base_url
;
11243 IUri
*uri
, *base_uri
;
11246 for(test
= create_urlmon_tests
; test
< create_urlmon_tests
+ ARRAY_SIZE(create_urlmon_tests
); test
++) {
11247 url
= a2w(test
->url
);
11248 base_url
= a2w(test
->base_url
);
11251 hres
= pCreateUri(base_url
, test
->base_uri_flags
, 0, &base_uri
);
11252 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
11254 hres
= pCreateURLMonikerEx2(NULL
, base_uri
, &base_mon
, URL_MK_NO_CANONICALIZE
);
11255 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11261 hres
= CreateURLMoniker(base_mon
, url
, &mon
);
11262 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11263 test_urlmon_display_name(mon
, test
->legacy_url
);
11264 test_display_uri(mon
, test
->legacy_url
);
11265 IMoniker_Release(mon
);
11267 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_LEGACY
);
11268 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11269 test_urlmon_display_name(mon
, test
->legacy_url
);
11270 test_display_uri(mon
, test
->legacy_url
);
11271 IMoniker_Release(mon
);
11273 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_UNIFORM
);
11274 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11275 test_urlmon_display_name(mon
, test
->uniform_url
);
11276 test_display_uri(mon
, test
->uniform_url
);
11277 IMoniker_Release(mon
);
11279 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_NO_CANONICALIZE
);
11280 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11281 test_urlmon_display_name(mon
, test
->no_canon_url
);
11282 test_display_uri(mon
, test
->no_canon_url
);
11283 IMoniker_Release(mon
);
11285 hres
= pCreateUri(url
, test
->uri_flags
, 0, &uri
);
11286 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
11288 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_LEGACY
);
11289 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11290 test_urlmon_display_name(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
11291 test_display_uri(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
11292 IMoniker_Release(mon
);
11294 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_UNIFORM
);
11295 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11296 test_urlmon_display_name(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
11297 test_display_uri(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
11298 IMoniker_Release(mon
);
11300 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_NO_CANONICALIZE
);
11301 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11302 test_urlmon_display_name(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
11303 test_display_uri(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
11304 IMoniker_Release(mon
);
11308 heap_free(base_url
);
11310 IUri_Release(base_uri
);
11312 IMoniker_Release(base_mon
);
11316 static int add_default_flags(DWORD flags
) {
11317 if(!(flags
& Uri_CREATE_NO_CANONICALIZE
))
11318 flags
|= Uri_CREATE_CANONICALIZE
;
11319 if(!(flags
& Uri_CREATE_NO_DECODE_EXTRA_INFO
))
11320 flags
|= Uri_CREATE_DECODE_EXTRA_INFO
;
11321 if(!(flags
& Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
))
11322 flags
|= Uri_CREATE_CRACK_UNKNOWN_SCHEMES
;
11323 if(!(flags
& Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
11324 flags
|= Uri_CREATE_PRE_PROCESS_HTML_URI
;
11325 if(!(flags
& Uri_CREATE_IE_SETTINGS
))
11326 flags
|= Uri_CREATE_NO_IE_SETTINGS
;
11331 static void test_IPersistStream(void)
11333 int i
, props_order
[Uri_PROPERTY_DWORD_LAST
+1] = { 0 };
11335 props_order
[Uri_PROPERTY_RAW_URI
] = 1;
11336 props_order
[Uri_PROPERTY_FRAGMENT
] = 2;
11337 props_order
[Uri_PROPERTY_HOST
] = 3;
11338 props_order
[Uri_PROPERTY_PASSWORD
] = 4;
11339 props_order
[Uri_PROPERTY_PATH
] = 5;
11340 props_order
[Uri_PROPERTY_PORT
] = 6;
11341 props_order
[Uri_PROPERTY_QUERY
] = 7;
11342 props_order
[Uri_PROPERTY_SCHEME_NAME
] = 8;
11343 props_order
[Uri_PROPERTY_USER_NAME
] = 9;
11345 for(i
= 0; i
< ARRAY_SIZE(uri_tests
); i
++) {
11346 const uri_properties
*test
= uri_tests
+i
;
11349 IPersistStream
*persist_stream
;
11352 DWORD props
, props_no
, dw_data
[6];
11353 WCHAR str_data
[1024];
11354 ULARGE_INTEGER size
, max_size
;
11355 LARGE_INTEGER no_off
;
11360 if(test
->create_todo
|| test
->create_expected
!=S_OK
)
11363 uriW
= a2w(test
->uri
);
11364 hr
= pCreateUri(uriW
, test
->create_flags
, 0, &uri
);
11365 ok(hr
== S_OK
, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i
, hr
);
11367 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
11368 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11370 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
11371 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed 0x%08x.\n", hr
);
11372 hr
= IPersistStream_IsDirty(persist_stream
);
11373 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
11374 hr
= IPersistStream_Save(persist_stream
, stream
, FALSE
);
11375 ok(hr
== S_OK
, "%d) Save failed 0x%08x, expected S_OK.\n", i
, hr
);
11376 hr
= IPersistStream_IsDirty(persist_stream
);
11377 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
11378 no_off
.QuadPart
= 0;
11379 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
11380 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11381 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11382 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11383 hr
= IPersistStream_GetSizeMax(persist_stream
, &max_size
);
11384 ok(hr
== S_OK
, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i
, hr
);
11385 ok(U(size
).LowPart
+2 == U(max_size
).LowPart
,
11386 "%d) Written data size is %d, max_size %d.\n",
11387 i
, U(size
).LowPart
, U(max_size
).LowPart
);
11389 hr
= IStream_Read(stream
, (void*)dw_data
, sizeof(DWORD
), NULL
);
11390 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11391 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
11392 i
, dw_data
[0]-2, U(size
).LowPart
);
11393 hr
= IStream_Read(stream
, (void*)dw_data
, 6*sizeof(DWORD
), NULL
);
11394 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11395 ok(dw_data
[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[0]);
11396 ok(dw_data
[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[1]);
11397 ok(dw_data
[2] == add_default_flags(test
->create_flags
),
11398 "%d) Incorrect value %x, expected %x (creation flags).\n",
11399 i
, dw_data
[2], add_default_flags(test
->create_flags
));
11400 ok(dw_data
[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[3]);
11401 ok(dw_data
[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[4]);
11402 ok(dw_data
[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[5]);
11405 for(props
=0; props
<=Uri_PROPERTY_DWORD_LAST
; props
++) {
11406 if(!props_order
[props
])
11409 if(props
<= Uri_PROPERTY_STRING_LAST
) {
11410 if(test
->str_props
[props
].expected
== S_OK
)
11413 if(test
->dword_props
[props
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
11417 if(test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTP
11418 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_FTP
11419 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTPS
)
11422 hr
= IStream_Read(stream
, (void*)&props
, sizeof(DWORD
), NULL
);
11423 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11424 ok(props
== props_no
, "%d) Properties no is %d, expected %d.\n", i
, props
, props_no
);
11429 hr
= IStream_Read(stream
, (void*)dw_data
, 2*sizeof(DWORD
), NULL
);
11430 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11432 ok(dw_data
[2]<props_order
[dw_data
[0]],
11433 "%d) Incorrect properties order (%d, %d)\n",
11434 i
, dw_data
[0], dw_data
[3]);
11435 dw_data
[2] = props_order
[dw_data
[0]];
11436 dw_data
[3] = dw_data
[0];
11438 if(dw_data
[0]<=Uri_PROPERTY_STRING_LAST
) {
11439 const uri_str_property
*prop
= test
->str_props
+dw_data
[0];
11440 hr
= IStream_Read(stream
, (void*)str_data
, dw_data
[1], NULL
);
11441 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11442 ok(!strcmp_aw(prop
->value
, str_data
) || broken(prop
->broken_value
&& !strcmp_aw(prop
->broken_value
, str_data
)),
11443 "%d) Expected %s but got %s (%d).\n", i
, prop
->value
, wine_dbgstr_w(str_data
), dw_data
[0]);
11444 } else if(dw_data
[0]>=Uri_PROPERTY_DWORD_START
&& dw_data
[0]<=Uri_PROPERTY_DWORD_LAST
) {
11445 const uri_dword_property
*prop
= test
->dword_props
+dw_data
[0]-Uri_PROPERTY_DWORD_START
;
11446 ok(dw_data
[1] == sizeof(DWORD
), "%d) Size of dword property is %d (%d)\n", i
, dw_data
[1], dw_data
[0]);
11447 hr
= IStream_Read(stream
, (void*)&dw_data
[1], sizeof(DWORD
), NULL
);
11448 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11449 ok(prop
->value
== dw_data
[1], "%d) Expected %d but got %d (%d).\n", i
, prop
->value
, dw_data
[1], dw_data
[0]);
11451 ok(FALSE
, "%d) Incorrect property type (%d)\n", i
, dw_data
[0]);
11455 ok(props
== 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11456 i
, props
, dw_data
[0]);
11460 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11461 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11462 hr
= IPersistStream_GetClassID(persist_stream
, &curi
);
11463 ok(hr
== S_OK
, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i
, hr
);
11464 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetClassID returned incorrect CLSID.\n", i
);
11465 IPersistStream_Release(persist_stream
);
11467 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11468 &IID_IUri
, (void**)&uri
);
11469 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
11470 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
11471 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11472 hr
= IPersistStream_Load(persist_stream
, stream
);
11473 ok(hr
== S_OK
, "%d) Load failed 0x%08x, expected S_OK.\n", i
, hr
);
11474 hr
= IUri_GetRawUri(uri
, &raw_uri
);
11475 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
11476 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
11477 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
11478 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
11479 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
11480 wine_dbgstr_w(raw_uri
));
11481 SysFreeString(raw_uri
);
11482 IPersistStream_Release(persist_stream
);
11484 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
11485 ok(hr
== S_OK
, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i
, hr
);
11486 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11487 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11488 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11489 MSHCTX_DIFFERENTMACHINE
, NULL
, MSHLFLAGS_NORMAL
);
11490 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11491 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11492 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
);
11493 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11494 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11495 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLESTRONG
);
11496 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11497 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11498 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLEWEAK
);
11499 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11500 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11501 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NOPING
);
11502 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11503 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11504 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NORMAL
);
11505 ok(hr
== S_OK
, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11506 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
11507 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
11508 ok(hr
== E_INVALIDARG
, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11509 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
11510 MSHCTX_INPROC
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
11511 ok(hr
== S_OK
, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i
, hr
);
11512 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i
);
11514 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
11515 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11516 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11517 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11518 hr
= IStream_Read(stream
, (void*)dw_data
, 3*sizeof(DWORD
), NULL
);
11519 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11520 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
11521 i
, dw_data
[0]-2, U(size
).LowPart
);
11522 ok(dw_data
[1] == MSHCTX_LOCAL
, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11524 ok(dw_data
[2] == dw_data
[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11525 i
, dw_data
[2], dw_data
[0]-8);
11526 if(!test
->str_props
[Uri_PROPERTY_PATH
].value
[0] &&
11527 (test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTP
11528 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_FTP
11529 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTPS
))
11530 U(max_size
).LowPart
+= 3*sizeof(DWORD
);
11531 ok(dw_data
[2] == U(max_size
).LowPart
, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11532 i
, dw_data
[2], U(max_size
).LowPart
);
11533 IMarshal_Release(marshal
);
11536 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11537 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11538 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11539 &IID_IUri
, (void**)&uri
);
11540 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
11541 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
11542 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11544 hr
= IMarshal_UnmarshalInterface(marshal
, stream
, &IID_IUri
, (void**)&uri
);
11545 ok(hr
== S_OK
, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11546 hr
= IUri_GetRawUri(uri
, &raw_uri
);
11547 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
11548 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
11549 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
11550 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
11551 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
11552 wine_dbgstr_w(raw_uri
));
11553 SysFreeString(raw_uri
);
11555 IMarshal_Release(marshal
);
11556 IStream_Release(stream
);
11562 static void test_UninitializedUri(void)
11565 IUriBuilderFactory
*ubf
;
11566 IPersistStream
*ps
;
11574 hr
= CoCreateInstance(&CLSID_CUri
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11575 &IID_IUri
, (void**)&uri
);
11577 win_skip("Skipping uninitialized Uri tests.\n");
11581 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&ubf
);
11582 ok(hr
== S_OK
, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr
);
11583 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&ps
);
11584 ok(hr
== S_OK
, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr
);
11586 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
11587 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11588 hr
= IUri_GetAbsoluteUri(uri
, &bstr
);
11589 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11590 hr
= IUri_GetAuthority(uri
, &bstr
);
11591 ok(hr
== E_UNEXPECTED
, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr
);
11592 hr
= IUri_GetDisplayUri(uri
, &bstr
);
11593 ok(hr
== E_UNEXPECTED
, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr
);
11594 hr
= IUri_GetDomain(uri
, &bstr
);
11595 ok(hr
== E_UNEXPECTED
, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr
);
11596 hr
= IUri_GetExtension(uri
, &bstr
);
11597 ok(hr
== E_UNEXPECTED
, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr
);
11598 hr
= IUri_GetFragment(uri
, &bstr
);
11599 ok(hr
== E_UNEXPECTED
, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr
);
11600 hr
= IUri_GetHost(uri
, &bstr
);
11601 ok(hr
== E_UNEXPECTED
, "GetHost returned %x, expected E_UNEXPECTED.\n", hr
);
11602 hr
= IUri_GetHostType(uri
, &dword
);
11603 ok(hr
== E_UNEXPECTED
, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr
);
11604 hr
= IUri_GetPassword(uri
, &bstr
);
11605 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11606 hr
= IUri_GetPassword(uri
, &bstr
);
11607 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11608 hr
= IUri_GetPathAndQuery(uri
, &bstr
);
11609 ok(hr
== E_UNEXPECTED
, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11610 hr
= IUri_GetPort(uri
, &dword
);
11611 ok(hr
== E_UNEXPECTED
, "GetPort returned %x, expected E_UNEXPECTED.\n", hr
);
11612 hr
= IUri_GetProperties(uri
, &dword
);
11613 ok(hr
== E_UNEXPECTED
, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr
);
11614 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, &bstr
, 0);
11615 ok(hr
== E_UNEXPECTED
, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr
);
11616 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_PORT
, &dword
, 0);
11617 ok(hr
== E_UNEXPECTED
, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr
);
11618 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_RAW_URI
, &dword
, 0);
11619 ok(hr
== E_UNEXPECTED
, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr
);
11620 hr
= IUri_GetQuery(uri
, &bstr
);
11621 ok(hr
== E_UNEXPECTED
, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11622 hr
= IUri_GetRawUri(uri
, &bstr
);
11623 ok(hr
== E_UNEXPECTED
, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr
);
11624 hr
= IUri_GetScheme(uri
, &dword
);
11625 ok(hr
== E_UNEXPECTED
, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr
);
11626 hr
= IUri_GetSchemeName(uri
, &bstr
);
11627 ok(hr
== E_UNEXPECTED
, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr
);
11628 hr
= IUri_GetUserInfo(uri
, &bstr
);
11629 ok(hr
== E_UNEXPECTED
, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr
);
11630 hr
= IUri_GetUserName(uri
, &bstr
);
11631 ok(hr
== E_UNEXPECTED
, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr
);
11632 hr
= IUri_GetZone(uri
, &dword
);
11633 ok(hr
== E_UNEXPECTED
, "GetZone returned %x, expected E_UNEXPECTED.\n", hr
);
11634 hr
= IUri_IsEqual(uri
, uri
, &eq
);
11635 ok(hr
== E_UNEXPECTED
, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr
);
11637 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(ubf
, 0, 0, &ub
);
11638 ok(hr
== E_UNEXPECTED
, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr
);
11639 hr
= IUriBuilderFactory_CreateIUriBuilder(ubf
, 0, 0, &ub
);
11640 ok(hr
== S_OK
, "CreateIUriBuilder returned %x, expected S_OK.\n", hr
);
11641 IUriBuilder_Release(ub
);
11643 hr
= IPersistStream_GetSizeMax(ps
, &ui
);
11644 ok(hr
== S_OK
, "GetSizeMax returned %x, expected S_OK.\n", hr
);
11645 ok(ui
.u
.LowPart
== 34, "ui.LowPart = %d, expected 34.\n", ui
.u
.LowPart
);
11646 hr
= IPersistStream_IsDirty(ps
);
11647 ok(hr
== S_FALSE
, "IsDirty returned %x, expected S_FALSE.\n", hr
);
11649 IPersistStream_Release(ps
);
11650 IUriBuilderFactory_Release(ubf
);
11657 hurlmon
= GetModuleHandleA("urlmon.dll");
11658 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
11659 pCreateUri
= (void*) GetProcAddress(hurlmon
, "CreateUri");
11660 pCreateUriWithFragment
= (void*) GetProcAddress(hurlmon
, "CreateUriWithFragment");
11661 pCreateIUriBuilder
= (void*) GetProcAddress(hurlmon
, "CreateIUriBuilder");
11662 pCoInternetCombineIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineIUri");
11663 pCoInternetCombineUrlEx
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineUrlEx");
11664 pCoInternetParseIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetParseIUri");
11665 pCreateURLMonikerEx
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx");
11666 pCreateURLMonikerEx2
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx2");
11669 win_skip("CreateUri is not present, skipping tests.\n");
11673 trace("test CreateUri invalid flags...\n");
11674 test_CreateUri_InvalidFlags();
11676 trace("test CreateUri invalid args...\n");
11677 test_CreateUri_InvalidArgs();
11679 trace("test CreateUri invalid URIs...\n");
11680 test_CreateUri_InvalidUri();
11682 trace("test IUri_GetPropertyBSTR...\n");
11683 test_IUri_GetPropertyBSTR();
11685 trace("test IUri_GetPropertyDWORD...\n");
11686 test_IUri_GetPropertyDWORD();
11688 trace("test IUri_GetStrProperties...\n");
11689 test_IUri_GetStrProperties();
11691 trace("test IUri_GetDwordProperties...\n");
11692 test_IUri_GetDwordProperties();
11694 trace("test IUri_GetPropertyLength...\n");
11695 test_IUri_GetPropertyLength();
11697 trace("test IUri_GetProperties...\n");
11698 test_IUri_GetProperties();
11700 trace("test IUri_HasProperty...\n");
11701 test_IUri_HasProperty();
11703 trace("test IUri_IsEqual...\n");
11704 test_IUri_IsEqual();
11706 trace("test CreateUriWithFragment invalid args...\n");
11707 test_CreateUriWithFragment_InvalidArgs();
11709 trace("test CreateUriWithFragment invalid flags...\n");
11710 test_CreateUriWithFragment_InvalidFlags();
11712 trace("test CreateUriWithFragment...\n");
11713 test_CreateUriWithFragment();
11715 trace("test CreateIUriBuilder...\n");
11716 test_CreateIUriBuilder();
11718 trace("test IUriBuilder_CreateInvalidArgs...\n");
11719 test_IUriBuilder_CreateInvalidArgs();
11721 trace("test IUriBuilder...\n");
11722 test_IUriBuilder();
11724 trace("test IUriBuilder_GetInvalidArgs...\n");
11725 test_IUriBuilder_GetInvalidArgs();
11727 trace("test IUriBuilder_HasBeenModified...\n");
11728 test_IUriBuilder_HasBeenModified();
11730 trace("test IUriBuilder_IUriProperty...\n");
11731 test_IUriBuilder_IUriProperty();
11733 trace("test IUriBuilder_RemoveProperties...\n");
11734 test_IUriBuilder_RemoveProperties();
11736 trace("test IUriBuilder miscellaneous...\n");
11737 test_IUriBuilder_Misc();
11739 trace("test IUriBuilderFactory...\n");
11740 test_IUriBuilderFactory();
11742 trace("test CoInternetCombineIUri...\n");
11743 test_CoInternetCombineIUri();
11745 trace("test CoInternetCombineUrlEx...\n");
11746 test_CoInternetCombineUrlEx();
11748 trace("test CoInternetParseIUri Invalid Args...\n");
11749 test_CoInternetParseIUri_InvalidArgs();
11751 trace("test CoInternetParseIUri...\n");
11752 test_CoInternetParseIUri();
11754 register_protocols();
11756 trace("test CoInternetCombineIUri pluggable...\n");
11757 test_CoInternetCombineIUri_Pluggable();
11759 trace("test CoInternetCombineUrlEx Pluggable...\n");
11760 test_CoInternetCombineUrlEx_Pluggable();
11762 trace("test CoInternetParseIUri pluggable...\n");
11763 test_CoInternetParseIUri_Pluggable();
11765 trace("test CreateURLMoniker...\n");
11766 test_CreateURLMoniker();
11768 CoInitialize(NULL
);
11770 trace("test IPersistStream...\n");
11771 test_IPersistStream();
11773 trace("test uninitialized Uri...\n");
11774 test_UninitializedUri();
11777 unregister_protocols();