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 #define WIN32_NO_STATUS
23 #define COM_NO_WINDOWS_H
25 #include <wine/test.h>
31 #define WIN32_LEAN_AND_MEAN
34 //#include "winbase.h"
44 DEFINE_GUID(CLSID_CUri
, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
46 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
47 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
48 #define URI_BUILDER_STR_PROPERTY_COUNT 7
50 #define DEFINE_EXPECT(func) \
51 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
53 #define SET_EXPECT(func) \
54 expect_ ## func = TRUE
56 #define CHECK_EXPECT(func) \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 expect_ ## func = FALSE; \
60 called_ ## func = TRUE; \
63 #define CHECK_EXPECT2(func) \
65 ok(expect_ ##func, "unexpected call " #func "\n"); \
66 called_ ## func = TRUE; \
69 #define CHECK_CALLED(func) \
71 ok(called_ ## func, "expected " #func "\n"); \
72 expect_ ## func = called_ ## func = FALSE; \
75 DEFINE_EXPECT(CombineUrl
);
76 DEFINE_EXPECT(ParseUrl
);
78 static HRESULT (WINAPI
*pCreateUri
)(LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
79 static HRESULT (WINAPI
*pCreateUriWithFragment
)(LPCWSTR
, LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
80 static HRESULT (WINAPI
*pCreateIUriBuilder
)(IUri
*, DWORD
, DWORD_PTR
, IUriBuilder
**);
81 static HRESULT (WINAPI
*pCoInternetCombineIUri
)(IUri
*,IUri
*,DWORD
,IUri
**,DWORD_PTR
);
82 static HRESULT (WINAPI
*pCoInternetGetSession
)(DWORD
,IInternetSession
**,DWORD
);
83 static HRESULT (WINAPI
*pCoInternetCombineUrlEx
)(IUri
*,LPCWSTR
,DWORD
,IUri
**,DWORD_PTR
);
84 static HRESULT (WINAPI
*pCoInternetParseIUri
)(IUri
*,PARSEACTION
,DWORD
,LPWSTR
,DWORD
,DWORD
*,DWORD_PTR
);
85 static HRESULT (WINAPI
*pCreateURLMonikerEx
)(IMoniker
*,LPCWSTR
,IMoniker
**,DWORD
);
86 static HRESULT (WINAPI
*pCreateURLMonikerEx2
)(IMoniker
*,IUri
*,IMoniker
**,DWORD
);
88 static const WCHAR http_urlW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
89 '.','o','r','g','/',0};
90 static const WCHAR http_url_fragW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
91 '.','o','r','g','/','#','F','r','a','g',0};
93 static const WCHAR combine_baseW
[] = {'w','i','n','e','t','e','s','t',':','?','t',
94 'e','s','t','i','n','g',0};
95 static const WCHAR combine_relativeW
[] = {'?','t','e','s','t',0};
96 static const WCHAR combine_resultW
[] = {'z','i','p',':','t','e','s','t',0};
98 static const WCHAR winetestW
[] = {'w','i','n','e','t','e','s','t',0};
100 static const WCHAR parse_urlW
[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
101 static const WCHAR parse_resultW
[] = {'z','i','p',':','t','e','s','t',0};
103 static PARSEACTION parse_action
;
104 static DWORD parse_flags
;
106 typedef struct _uri_create_flag_test
{
109 } uri_create_flag_test
;
111 static const uri_create_flag_test invalid_flag_tests
[] = {
112 /* Set of invalid flag combinations to test for. */
113 {Uri_CREATE_DECODE_EXTRA_INFO
| Uri_CREATE_NO_DECODE_EXTRA_INFO
, E_INVALIDARG
},
114 {Uri_CREATE_CANONICALIZE
| Uri_CREATE_NO_CANONICALIZE
, E_INVALIDARG
},
115 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES
| Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, E_INVALIDARG
},
116 {Uri_CREATE_PRE_PROCESS_HTML_URI
| Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, E_INVALIDARG
},
117 {Uri_CREATE_IE_SETTINGS
| Uri_CREATE_NO_IE_SETTINGS
, E_INVALIDARG
}
120 typedef struct _uri_str_property
{
124 const char* broken_value
;
127 typedef struct _uri_dword_property
{
131 BOOL broken_combine_hres
;
132 } uri_dword_property
;
134 typedef struct _uri_properties
{
137 HRESULT create_expected
;
140 uri_str_property str_props
[URI_STR_PROPERTY_COUNT
];
141 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
144 static const uri_properties uri_tests
[] = {
145 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK
, FALSE
,
147 {"http://www.winehq.org/",S_OK
,FALSE
}, /* ABSOLUTE_URI */
148 {"www.winehq.org",S_OK
,FALSE
}, /* AUTHORITY */
149 {"http://www.winehq.org/",S_OK
,FALSE
}, /* DISPLAY_URI */
150 {"winehq.org",S_OK
,FALSE
}, /* DOMAIN */
151 {"",S_FALSE
,FALSE
}, /* EXTENSION */
152 {"",S_FALSE
,FALSE
}, /* FRAGMENT */
153 {"www.winehq.org",S_OK
,FALSE
}, /* HOST */
154 {"",S_FALSE
,FALSE
}, /* PASSWORD */
155 {"/",S_OK
,FALSE
}, /* PATH */
156 {"/",S_OK
,FALSE
}, /* PATH_AND_QUERY */
157 {"",S_FALSE
,FALSE
}, /* QUERY */
158 {"http://www.winehq.org/tests/../tests/../..",S_OK
,FALSE
}, /* RAW_URI */
159 {"http",S_OK
,FALSE
}, /* SCHEME_NAME */
160 {"",S_FALSE
,FALSE
}, /* USER_INFO */
161 {"",S_FALSE
,FALSE
} /* USER_NAME */
164 {Uri_HOST_DNS
,S_OK
,FALSE
}, /* HOST_TYPE */
165 {80,S_OK
,FALSE
}, /* PORT */
166 {URL_SCHEME_HTTP
,S_OK
,FALSE
}, /* SCHEME */
167 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
} /* ZONE */
170 { "http://winehq.org/tests/.././tests", 0, S_OK
, FALSE
,
172 {"http://winehq.org/tests",S_OK
,FALSE
},
173 {"winehq.org",S_OK
,FALSE
},
174 {"http://winehq.org/tests",S_OK
,FALSE
},
175 {"winehq.org",S_OK
,FALSE
},
178 {"winehq.org",S_OK
,FALSE
},
180 {"/tests",S_OK
,FALSE
},
181 {"/tests",S_OK
,FALSE
},
183 {"http://winehq.org/tests/.././tests",S_OK
,FALSE
},
189 {Uri_HOST_DNS
,S_OK
,FALSE
},
191 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
192 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
195 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
197 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
198 {"www.winehq.org",S_OK
,FALSE
},
199 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
200 {"winehq.org",S_OK
,FALSE
},
203 {"www.winehq.org",S_OK
,FALSE
},
206 {"/?query=x&return=y",S_OK
,FALSE
},
207 {"?query=x&return=y",S_OK
,FALSE
},
208 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
214 {Uri_HOST_DNS
,S_OK
,FALSE
},
216 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
217 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
220 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
222 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
223 {"www.winehq.org",S_OK
,FALSE
},
224 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
225 {"winehq.org",S_OK
,FALSE
},
228 {"www.winehq.org",S_OK
,FALSE
},
231 {"/?query=x&return=y",S_OK
,FALSE
},
232 {"?query=x&return=y",S_OK
,FALSE
},
233 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
234 {"https",S_OK
,FALSE
},
239 {Uri_HOST_DNS
,S_OK
,FALSE
},
241 {URL_SCHEME_HTTPS
,S_OK
,FALSE
},
242 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
245 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK
, FALSE
,
247 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
248 {"usEr%3Ainfo@example.com",S_OK
,FALSE
},
249 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
250 {"example.com",S_OK
,FALSE
},
253 {"example.com",S_OK
,FALSE
},
255 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
256 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
258 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK
,FALSE
},
260 {"usEr%3Ainfo",S_OK
,FALSE
},
261 {"usEr%3Ainfo",S_OK
,FALSE
}
264 {Uri_HOST_DNS
,S_OK
,FALSE
},
266 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
267 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
270 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK
, FALSE
,
272 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
273 {"winepass:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
274 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
275 {"winehq.org",S_OK
,FALSE
},
278 {"ftp.winehq.org",S_OK
,FALSE
},
280 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
281 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
283 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK
,FALSE
},
285 {"winepass:wine",S_OK
,FALSE
},
286 {"winepass",S_OK
,FALSE
}
289 {Uri_HOST_DNS
,S_OK
,FALSE
},
291 {URL_SCHEME_FTP
,S_OK
,FALSE
},
292 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
295 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK
, FALSE
,
297 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
299 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
305 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
306 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
308 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
314 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
316 {URL_SCHEME_FILE
,S_OK
,FALSE
},
317 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
320 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
322 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
324 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
330 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
331 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
333 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
339 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
341 {URL_SCHEME_FILE
,S_OK
,FALSE
},
342 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
345 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK
, FALSE
,
347 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
349 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
355 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
356 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
358 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK
,FALSE
},
364 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
366 {URL_SCHEME_FILE
,S_OK
,FALSE
},
367 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
370 { "file:///z:/test dir/README.txt", 0, S_OK
, FALSE
,
372 {"file:///z:/test%20dir/README.txt",S_OK
},
374 {"file:///z:/test%20dir/README.txt",S_OK
},
380 {"/z:/test%20dir/README.txt",S_OK
},
381 {"/z:/test%20dir/README.txt",S_OK
},
383 {"file:///z:/test dir/README.txt",S_OK
},
389 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
391 {URL_SCHEME_FILE
,S_OK
,FALSE
},
392 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
395 { "file:///z:/test dir/README.txt#hash part", 0, S_OK
, FALSE
,
397 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK
},
399 {"file:///z:/test%20dir/README.txt#hash%20part",S_OK
},
401 {".txt#hash%20part",S_OK
},
405 {"/z:/test%20dir/README.txt#hash%20part",S_OK
},
406 {"/z:/test%20dir/README.txt#hash%20part",S_OK
},
408 {"file:///z:/test dir/README.txt#hash part",S_OK
},
414 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
416 {URL_SCHEME_FILE
,S_OK
,FALSE
},
417 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
420 { "urn:nothing:should:happen here", 0, S_OK
, FALSE
,
422 {"urn:nothing:should:happen here",S_OK
,FALSE
},
424 {"urn:nothing:should:happen here",S_OK
,FALSE
},
430 {"nothing:should:happen here",S_OK
,FALSE
},
431 {"nothing:should:happen here",S_OK
,FALSE
},
433 {"urn:nothing:should:happen here",S_OK
,FALSE
},
439 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
441 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
442 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
445 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK
, FALSE
,
447 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
448 {"127.0.0.1",S_OK
,FALSE
},
449 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
453 {"127.0.0.1",S_OK
,FALSE
},
455 {"/test%20dir/test.txt",S_OK
,FALSE
},
456 {"/test%20dir/test.txt",S_OK
,FALSE
},
458 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK
,FALSE
},
464 {Uri_HOST_IPV4
,S_OK
,FALSE
},
466 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
467 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
470 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK
, FALSE
,
472 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
473 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK
,FALSE
},
474 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
478 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK
,FALSE
},
483 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK
,FALSE
},
489 {Uri_HOST_IPV6
,S_OK
,FALSE
},
491 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
492 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
495 { "ftp://[::13.1.68.3]", 0, S_OK
, FALSE
,
497 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
498 {"[::13.1.68.3]",S_OK
,FALSE
},
499 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
503 {"::13.1.68.3",S_OK
,FALSE
},
508 {"ftp://[::13.1.68.3]",S_OK
,FALSE
},
514 {Uri_HOST_IPV6
,S_OK
,FALSE
},
516 {URL_SCHEME_FTP
,S_OK
,FALSE
},
517 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
520 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK
, FALSE
,
522 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
523 {"[fedc:ba98::3210]",S_OK
,FALSE
},
524 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
528 {"fedc:ba98::3210",S_OK
,FALSE
},
533 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK
,FALSE
},
539 {Uri_HOST_IPV6
,S_OK
,FALSE
},
541 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
542 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
545 { "1234://www.winehq.org", 0, S_OK
, FALSE
,
547 {"1234://www.winehq.org/",S_OK
,FALSE
},
548 {"www.winehq.org",S_OK
,FALSE
},
549 {"1234://www.winehq.org/",S_OK
,FALSE
},
550 {"winehq.org",S_OK
,FALSE
},
553 {"www.winehq.org",S_OK
,FALSE
},
558 {"1234://www.winehq.org",S_OK
,FALSE
},
564 {Uri_HOST_DNS
,S_OK
,FALSE
},
566 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
567 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
570 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
571 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
573 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
575 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
581 {"/C:/test/test.mp3",S_OK
,FALSE
},
582 {"/C:/test/test.mp3",S_OK
,FALSE
},
584 {"C:/test/test.mp3",S_OK
,FALSE
},
590 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
592 {URL_SCHEME_FILE
,S_OK
,FALSE
},
593 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
596 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
597 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
599 {"file://server/test.mp3",S_OK
,FALSE
},
600 {"server",S_OK
,FALSE
},
601 {"file://server/test.mp3",S_OK
,FALSE
},
605 {"server",S_OK
,FALSE
},
607 {"/test.mp3",S_OK
,FALSE
},
608 {"/test.mp3",S_OK
,FALSE
},
610 {"\\\\Server/test.mp3",S_OK
,FALSE
},
616 {Uri_HOST_DNS
,S_OK
,FALSE
},
618 {URL_SCHEME_FILE
,S_OK
,FALSE
},
619 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
622 { "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
,
624 {"file://C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
626 {"file://C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
628 {".mp3#fragment|part",S_OK
,FALSE
},
632 {"C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
633 {"C:\\test\\test.mp3#fragment|part",S_OK
,FALSE
},
635 {"C:/test/test.mp3#fragment|part",S_OK
,FALSE
},
641 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
643 {URL_SCHEME_FILE
,S_OK
,FALSE
},
644 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
647 { "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
,
649 {"file://C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
651 {"file://C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
657 {"C:\\test\\test.mp3",S_OK
,FALSE
},
658 {"C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
659 {"?query|part",S_OK
,FALSE
},
660 {"C:/test/test.mp3?query|part",S_OK
,FALSE
},
666 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
668 {URL_SCHEME_FILE
,S_OK
,FALSE
},
669 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
672 { "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
,
674 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK
,FALSE
},
676 {"file://C:\\test\\test.mp3?query|part#hash|part",S_OK
,FALSE
},
679 {"#hash|part",S_OK
,FALSE
},
682 {"C:\\test\\test.mp3",S_OK
,FALSE
},
683 {"C:\\test\\test.mp3?query|part",S_OK
,FALSE
},
684 {"?query|part",S_OK
,FALSE
},
685 {"C:/test/test.mp3?query|part#hash|part",S_OK
,FALSE
},
691 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
693 {URL_SCHEME_FILE
,S_OK
,FALSE
},
694 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
697 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
699 {"*:www.winehq.org/test",S_OK
,FALSE
},
700 {"www.winehq.org",S_OK
,FALSE
},
701 {"*:www.winehq.org/test",S_OK
,FALSE
},
702 {"winehq.org",S_OK
,FALSE
},
705 {"www.winehq.org",S_OK
,FALSE
},
707 {"/test",S_OK
,FALSE
},
708 {"/test",S_OK
,FALSE
},
710 {"www.winehq.org/test",S_OK
,FALSE
},
716 {Uri_HOST_DNS
,S_OK
,FALSE
},
718 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
719 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
722 /* Valid since the '*' is the only character in the scheme name. */
723 { "*:www.winehq.org/test", 0, S_OK
, FALSE
,
725 {"*:www.winehq.org/test",S_OK
,FALSE
},
726 {"www.winehq.org",S_OK
,FALSE
},
727 {"*:www.winehq.org/test",S_OK
,FALSE
},
728 {"winehq.org",S_OK
,FALSE
},
731 {"www.winehq.org",S_OK
,FALSE
},
733 {"/test",S_OK
,FALSE
},
734 {"/test",S_OK
,FALSE
},
736 {"*:www.winehq.org/test",S_OK
,FALSE
},
742 {Uri_HOST_DNS
,S_OK
,FALSE
},
744 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
745 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
748 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
750 {"/../some dir/test.ext",S_OK
,FALSE
},
752 {"/../some dir/test.ext",S_OK
,FALSE
},
758 {"/../some dir/test.ext",S_OK
,FALSE
},
759 {"/../some dir/test.ext",S_OK
,FALSE
},
761 {"/../some dir/test.ext",S_OK
,FALSE
},
767 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
769 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
770 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
773 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE
|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
775 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
777 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
783 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
784 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
786 {"//implicit/wildcard/uri scheme",S_OK
,FALSE
},
792 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
794 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
795 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
798 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and it's an unknown scheme. */
799 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, S_OK
, FALSE
,
801 {"zip:/.//google.com",S_OK
,FALSE
},
803 {"zip:/.//google.com",S_OK
,FALSE
},
809 {"/.//google.com",S_OK
,FALSE
},
810 {"/.//google.com",S_OK
,FALSE
},
812 {"zip://google.com",S_OK
,FALSE
},
818 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
820 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
821 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
824 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
825 { "ftp://user:pass:word@winehq.org/", 0, S_OK
, FALSE
,
827 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
828 {"user:pass:word@winehq.org",S_OK
,FALSE
},
829 {"ftp://winehq.org/",S_OK
,FALSE
},
830 {"winehq.org",S_OK
,FALSE
},
833 {"winehq.org",S_OK
,FALSE
},
834 {"pass:word",S_OK
,FALSE
},
838 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
840 {"user:pass:word",S_OK
,FALSE
},
844 {Uri_HOST_DNS
,S_OK
,FALSE
},
846 {URL_SCHEME_FTP
,S_OK
,FALSE
},
847 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
850 /* Make sure % encoded unreserved characters are decoded. */
851 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK
, FALSE
,
853 {"ftp://wINe:PASS@ftp.google.com/",S_OK
,FALSE
},
854 {"wINe:PASS@ftp.google.com",S_OK
,FALSE
},
855 {"ftp://ftp.google.com/",S_OK
,FALSE
},
856 {"google.com",S_OK
,FALSE
},
859 {"ftp.google.com",S_OK
,FALSE
},
864 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK
,FALSE
},
866 {"wINe:PASS",S_OK
,FALSE
},
870 {Uri_HOST_DNS
,S_OK
,FALSE
},
872 {URL_SCHEME_FTP
,S_OK
,FALSE
},
873 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
876 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
877 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK
, FALSE
,
879 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
880 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK
,FALSE
},
881 {"ftp://ftp.google.com/",S_OK
,FALSE
},
882 {"google.com",S_OK
,FALSE
},
885 {"ftp.google.com",S_OK
,FALSE
},
886 {"PA%7B%7D",S_OK
,FALSE
},
890 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
892 {"w%5D%5Be:PA%7B%7D",S_OK
,FALSE
},
893 {"w%5D%5Be",S_OK
,FALSE
}
896 {Uri_HOST_DNS
,S_OK
,FALSE
},
898 {URL_SCHEME_FTP
,S_OK
,FALSE
},
899 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
902 /* You're allowed to have an empty password portion in the userinfo section. */
903 { "ftp://empty:@ftp.google.com/", 0, S_OK
, FALSE
,
905 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
906 {"empty:@ftp.google.com",S_OK
,FALSE
},
907 {"ftp://ftp.google.com/",S_OK
,FALSE
},
908 {"google.com",S_OK
,FALSE
},
911 {"ftp.google.com",S_OK
,FALSE
},
916 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
918 {"empty:",S_OK
,FALSE
},
922 {Uri_HOST_DNS
,S_OK
,FALSE
},
924 {URL_SCHEME_FTP
,S_OK
,FALSE
},
925 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
928 /* Make sure forbidden characters in "userinfo" get encoded. */
929 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK
, FALSE
,
931 {"ftp://%22%20%22weird@ftp.google.com/",S_OK
,FALSE
},
932 {"%22%20%22weird@ftp.google.com",S_OK
,FALSE
},
933 {"ftp://ftp.google.com/",S_OK
,FALSE
},
934 {"google.com",S_OK
,FALSE
},
937 {"ftp.google.com",S_OK
,FALSE
},
942 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
944 {"%22%20%22weird",S_OK
,FALSE
},
945 {"%22%20%22weird",S_OK
,FALSE
}
948 {Uri_HOST_DNS
,S_OK
,FALSE
},
950 {URL_SCHEME_FTP
,S_OK
,FALSE
},
951 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
954 /* Make sure the forbidden characters don't get percent encoded. */
955 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
957 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
958 {"\" \"weird@ftp.google.com",S_OK
,FALSE
},
959 {"ftp://ftp.google.com/",S_OK
,FALSE
},
960 {"google.com",S_OK
,FALSE
},
963 {"ftp.google.com",S_OK
,FALSE
},
968 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
970 {"\" \"weird",S_OK
,FALSE
},
971 {"\" \"weird",S_OK
,FALSE
}
974 {Uri_HOST_DNS
,S_OK
,FALSE
},
976 {URL_SCHEME_FTP
,S_OK
,FALSE
},
977 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
980 /* Make sure already percent encoded characters don't get unencoded. */
981 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
983 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
984 {"\"%20\"weird@ftp.google.com",S_OK
,FALSE
},
985 {"ftp://ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
986 {"google.com",S_OK
,FALSE
},
989 {"ftp.google.com",S_OK
,FALSE
},
991 {"/\"%20\"weird",S_OK
,FALSE
},
992 {"/\"%20\"weird",S_OK
,FALSE
},
994 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
996 {"\"%20\"weird",S_OK
,FALSE
},
997 {"\"%20\"weird",S_OK
,FALSE
}
1000 {Uri_HOST_DNS
,S_OK
,FALSE
},
1002 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1003 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1006 /* Allowed to have invalid % encoded because it's an unknown scheme type. */
1007 { "zip://%xy:word@winehq.org/", 0, S_OK
, FALSE
,
1009 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1010 {"%xy:word@winehq.org",S_OK
,FALSE
},
1011 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1012 {"winehq.org",S_OK
,FALSE
},
1015 {"winehq.org",S_OK
,FALSE
},
1016 {"word",S_OK
,FALSE
},
1020 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
1022 {"%xy:word",S_OK
,FALSE
},
1026 {Uri_HOST_DNS
,S_OK
,FALSE
},
1028 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1029 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1032 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
1035 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK
, FALSE
,
1037 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1038 {"%2E:%52%53ord@winehq.org",S_OK
,FALSE
},
1039 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1040 {"winehq.org",S_OK
,FALSE
},
1043 {"winehq.org",S_OK
,FALSE
},
1044 {"%52%53ord",S_OK
,FALSE
},
1048 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
1050 {"%2E:%52%53ord",S_OK
,FALSE
},
1054 {Uri_HOST_DNS
,S_OK
,FALSE
},
1056 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1057 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1060 { "ftp://[](),'test':word@winehq.org/", 0, S_OK
, FALSE
,
1062 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
1063 {"[](),'test':word@winehq.org",S_OK
,FALSE
},
1064 {"ftp://winehq.org/",S_OK
,FALSE
},
1065 {"winehq.org",S_OK
,FALSE
},
1068 {"winehq.org",S_OK
,FALSE
},
1069 {"word",S_OK
,FALSE
},
1073 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
1075 {"[](),'test':word",S_OK
,FALSE
},
1076 {"[](),'test'",S_OK
,FALSE
}
1079 {Uri_HOST_DNS
,S_OK
,FALSE
},
1081 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1082 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1085 { "ftp://test?:word@winehq.org/", 0, S_OK
, FALSE
,
1087 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
1088 {"test",S_OK
,FALSE
},
1089 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
1093 {"test",S_OK
,FALSE
},
1096 {"/?:word@winehq.org/",S_OK
,FALSE
},
1097 {"?:word@winehq.org/",S_OK
,FALSE
},
1098 {"ftp://test?:word@winehq.org/",S_OK
,FALSE
},
1104 {Uri_HOST_DNS
,S_OK
,FALSE
},
1106 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1107 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1110 { "ftp://test#:word@winehq.org/", 0, S_OK
, FALSE
,
1112 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
1113 {"test",S_OK
,FALSE
},
1114 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
1117 {"#:word@winehq.org/",S_OK
,FALSE
},
1118 {"test",S_OK
,FALSE
},
1123 {"ftp://test#:word@winehq.org/",S_OK
,FALSE
},
1129 {Uri_HOST_DNS
,S_OK
,FALSE
},
1131 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1132 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1135 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1136 { "zip://test\\:word@winehq.org/", 0, S_OK
, FALSE
,
1138 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1139 {"test\\:word@winehq.org",S_OK
,FALSE
},
1140 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1141 {"winehq.org",S_OK
,FALSE
},
1144 {"winehq.org",S_OK
,FALSE
},
1145 {"word",S_OK
,FALSE
},
1149 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1151 {"test\\:word",S_OK
,FALSE
},
1152 {"test\\",S_OK
,FALSE
}
1155 {Uri_HOST_DNS
,S_OK
,FALSE
},
1157 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1158 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1161 /* It normalizes IPv4 addresses correctly. */
1162 { "http://127.000.000.100/", 0, S_OK
, FALSE
,
1164 {"http://127.0.0.100/",S_OK
,FALSE
},
1165 {"127.0.0.100",S_OK
,FALSE
},
1166 {"http://127.0.0.100/",S_OK
,FALSE
},
1170 {"127.0.0.100",S_OK
,FALSE
},
1175 {"http://127.000.000.100/",S_OK
,FALSE
},
1176 {"http",S_OK
,FALSE
},
1181 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1183 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1184 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1187 { "http://127.0.0.1:8000", 0, S_OK
, FALSE
,
1189 {"http://127.0.0.1:8000/",S_OK
},
1190 {"127.0.0.1:8000",S_OK
},
1191 {"http://127.0.0.1:8000/",S_OK
},
1200 {"http://127.0.0.1:8000",S_OK
},
1206 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1208 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1209 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1212 /* Make sure it normalizes partial IPv4 addresses correctly. */
1213 { "http://127.0/", 0, S_OK
, FALSE
,
1215 {"http://127.0.0.0/",S_OK
,FALSE
},
1216 {"127.0.0.0",S_OK
,FALSE
},
1217 {"http://127.0.0.0/",S_OK
,FALSE
},
1221 {"127.0.0.0",S_OK
,FALSE
},
1226 {"http://127.0/",S_OK
,FALSE
},
1227 {"http",S_OK
,FALSE
},
1232 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1234 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1235 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1238 /* Make sure it converts implicit IPv4's correctly. */
1239 { "http://123456/", 0, S_OK
, FALSE
,
1241 {"http://0.1.226.64/",S_OK
,FALSE
},
1242 {"0.1.226.64",S_OK
,FALSE
},
1243 {"http://0.1.226.64/",S_OK
,FALSE
},
1247 {"0.1.226.64",S_OK
,FALSE
},
1252 {"http://123456/",S_OK
,FALSE
},
1253 {"http",S_OK
,FALSE
},
1258 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1260 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1261 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1265 { "http://4294967295/", 0, S_OK
, FALSE
,
1267 {"http://255.255.255.255/",S_OK
,FALSE
},
1268 {"255.255.255.255",S_OK
,FALSE
},
1269 {"http://255.255.255.255/",S_OK
,FALSE
},
1273 {"255.255.255.255",S_OK
,FALSE
},
1278 {"http://4294967295/",S_OK
,FALSE
},
1279 {"http",S_OK
,FALSE
},
1284 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1286 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1287 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1291 { "http://4294967296/", 0, S_OK
, FALSE
,
1293 {"http://4294967296/",S_OK
,FALSE
},
1294 {"4294967296",S_OK
,FALSE
},
1295 {"http://4294967296/",S_OK
,FALSE
},
1299 {"4294967296",S_OK
,FALSE
},
1304 {"http://4294967296/",S_OK
,FALSE
},
1305 {"http",S_OK
,FALSE
},
1310 {Uri_HOST_DNS
,S_OK
,FALSE
},
1312 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1313 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1316 /* Window's doesn't normalize IP address for unknown schemes. */
1317 { "1234://4294967295/", 0, S_OK
, FALSE
,
1319 {"1234://4294967295/",S_OK
,FALSE
},
1320 {"4294967295",S_OK
,FALSE
},
1321 {"1234://4294967295/",S_OK
,FALSE
},
1325 {"4294967295",S_OK
,FALSE
},
1330 {"1234://4294967295/",S_OK
,FALSE
},
1331 {"1234",S_OK
,FALSE
},
1336 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1338 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1339 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1342 /* Window's doesn't normalize IP address for unknown schemes. */
1343 { "1234://127.001/", 0, S_OK
, FALSE
,
1345 {"1234://127.001/",S_OK
,FALSE
},
1346 {"127.001",S_OK
,FALSE
},
1347 {"1234://127.001/",S_OK
,FALSE
},
1351 {"127.001",S_OK
,FALSE
},
1356 {"1234://127.001/",S_OK
,FALSE
},
1357 {"1234",S_OK
,FALSE
},
1362 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1364 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1365 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1368 { "http://[FEDC:BA98::3210]", 0, S_OK
, FALSE
,
1370 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1371 {"[fedc:ba98::3210]",S_OK
,FALSE
},
1372 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1376 {"fedc:ba98::3210",S_OK
,FALSE
},
1381 {"http://[FEDC:BA98::3210]",S_OK
,FALSE
},
1382 {"http",S_OK
,FALSE
},
1387 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1389 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1390 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1393 { "http://[::]", 0, S_OK
, FALSE
,
1395 {"http://[::]/",S_OK
,FALSE
},
1396 {"[::]",S_OK
,FALSE
},
1397 {"http://[::]/",S_OK
,FALSE
},
1406 {"http://[::]",S_OK
,FALSE
},
1407 {"http",S_OK
,FALSE
},
1412 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1414 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1415 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1418 { "http://[FEDC:BA98::]", 0, S_OK
, FALSE
,
1420 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1421 {"[fedc:ba98::]",S_OK
,FALSE
},
1422 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1426 {"fedc:ba98::",S_OK
,FALSE
},
1431 {"http://[FEDC:BA98::]",S_OK
,FALSE
},
1432 {"http",S_OK
,FALSE
},
1437 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1439 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1440 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1443 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1444 { "http://[1::3:4:5:6:7:8]", 0, S_OK
, FALSE
,
1446 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1447 {"[1:0:3:4:5:6:7:8]",S_OK
,FALSE
},
1448 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1452 {"1:0:3:4:5:6:7:8",S_OK
,FALSE
},
1457 {"http://[1::3:4:5:6:7:8]",S_OK
,FALSE
},
1458 {"http",S_OK
,FALSE
},
1463 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1465 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1466 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1469 { "http://[v2.34]/", 0, S_OK
, FALSE
,
1471 {"http://[v2.34]/",S_OK
,FALSE
},
1472 {"[v2.34]",S_OK
,FALSE
},
1473 {"http://[v2.34]/",S_OK
,FALSE
},
1477 {"[v2.34]",S_OK
,FALSE
},
1482 {"http://[v2.34]/",S_OK
,FALSE
},
1483 {"http",S_OK
,FALSE
},
1488 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
1490 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1491 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1494 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1495 { "http://[xyz:12345.com/test", 0, S_OK
, FALSE
,
1497 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1498 {"[xyz:12345.com",S_OK
,FALSE
},
1499 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1500 {"[xyz:12345.com",S_OK
,FALSE
},
1503 {"[xyz:12345.com",S_OK
,FALSE
},
1505 {"/test",S_OK
,FALSE
},
1506 {"/test",S_OK
,FALSE
},
1508 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1509 {"http",S_OK
,FALSE
},
1514 {Uri_HOST_DNS
,S_OK
,FALSE
},
1516 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1517 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1520 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1521 * of the host name (respectively).
1523 { "ftp://www.[works].com/", 0, S_OK
, FALSE
,
1525 {"ftp://www.[works].com/",S_OK
,FALSE
},
1526 {"www.[works].com",S_OK
,FALSE
},
1527 {"ftp://www.[works].com/",S_OK
,FALSE
},
1528 {"[works].com",S_OK
,FALSE
},
1531 {"www.[works].com",S_OK
,FALSE
},
1536 {"ftp://www.[works].com/",S_OK
,FALSE
},
1542 {Uri_HOST_DNS
,S_OK
,FALSE
},
1544 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1545 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1548 /* Considers ':' a delimiter since it appears after the ']'. */
1549 { "http://www.google.com]:12345/", 0, S_OK
, FALSE
,
1551 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1552 {"www.google.com]:12345",S_OK
,FALSE
},
1553 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1554 {"google.com]",S_OK
,FALSE
},
1557 {"www.google.com]",S_OK
,FALSE
},
1562 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1563 {"http",S_OK
,FALSE
},
1568 {Uri_HOST_DNS
,S_OK
,FALSE
},
1570 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1571 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1574 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1575 { "zip://w%XXw%GEw.google.com/", 0, S_OK
, FALSE
,
1577 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1578 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1579 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1580 {"google.com",S_OK
,FALSE
},
1583 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1588 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1594 {Uri_HOST_DNS
,S_OK
,FALSE
},
1596 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1597 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1600 /* Unknown scheme types hostname doesn't get lower cased. */
1601 { "zip://GOOGLE.com/", 0, S_OK
, FALSE
,
1603 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1604 {"GOOGLE.com",S_OK
,FALSE
},
1605 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1606 {"GOOGLE.com",S_OK
,FALSE
},
1609 {"GOOGLE.com",S_OK
,FALSE
},
1614 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1620 {Uri_HOST_DNS
,S_OK
,FALSE
},
1622 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1623 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1626 /* Hostname gets lower-cased for known scheme types. */
1627 { "http://WWW.GOOGLE.com/", 0, S_OK
, FALSE
,
1629 {"http://www.google.com/",S_OK
,FALSE
},
1630 {"www.google.com",S_OK
,FALSE
},
1631 {"http://www.google.com/",S_OK
,FALSE
},
1632 {"google.com",S_OK
,FALSE
},
1635 {"www.google.com",S_OK
,FALSE
},
1640 {"http://WWW.GOOGLE.com/",S_OK
,FALSE
},
1641 {"http",S_OK
,FALSE
},
1646 {Uri_HOST_DNS
,S_OK
,FALSE
},
1648 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1649 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1652 /* Characters that get % encoded in the hostname also have their percent
1653 * encoded forms lower cased.
1655 { "http://www.%7Cgoogle|.com/", 0, S_OK
, FALSE
,
1657 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1658 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1659 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1660 {"%7cgoogle%7c.com",S_OK
,FALSE
},
1663 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1668 {"http://www.%7Cgoogle|.com/",S_OK
,FALSE
},
1669 {"http",S_OK
,FALSE
},
1674 {Uri_HOST_DNS
,S_OK
,FALSE
},
1676 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1677 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1680 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1681 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK
, FALSE
,
1683 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1684 {"[1:2:3:4:5:6::]",S_OK
,FALSE
},
1685 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1689 {"1:2:3:4:5:6::",S_OK
,FALSE
},
1694 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK
,FALSE
},
1695 {"http",S_OK
,FALSE
},
1700 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1702 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1703 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1706 /* IPv4 addresses get normalized. */
1707 { "http://[::001.002.003.000]", 0, S_OK
, FALSE
,
1709 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1710 {"[::1.2.3.0]",S_OK
,FALSE
},
1711 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1715 {"::1.2.3.0",S_OK
,FALSE
},
1720 {"http://[::001.002.003.000]",S_OK
,FALSE
},
1721 {"http",S_OK
,FALSE
},
1726 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1728 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1729 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1732 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1733 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK
, FALSE
,
1735 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1736 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1737 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1741 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK
,FALSE
},
1746 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1752 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1754 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1755 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1758 /* IPv4 address is converted into 2 h16 components. */
1759 { "http://[ffff::192.222.111.32]", 0, S_OK
, FALSE
,
1761 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1762 {"[ffff::c0de:6f20]",S_OK
,FALSE
},
1763 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1767 {"ffff::c0de:6f20",S_OK
,FALSE
},
1772 {"http://[ffff::192.222.111.32]",S_OK
,FALSE
},
1773 {"http",S_OK
,FALSE
},
1778 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1780 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1781 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1784 /* Max value for a port. */
1785 { "http://google.com:65535", 0, S_OK
, FALSE
,
1787 {"http://google.com:65535/",S_OK
,FALSE
},
1788 {"google.com:65535",S_OK
,FALSE
},
1789 {"http://google.com:65535/",S_OK
,FALSE
},
1790 {"google.com",S_OK
,FALSE
},
1793 {"google.com",S_OK
,FALSE
},
1798 {"http://google.com:65535",S_OK
,FALSE
},
1799 {"http",S_OK
,FALSE
},
1804 {Uri_HOST_DNS
,S_OK
,FALSE
},
1806 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1807 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1810 { "zip://google.com:65536", 0, S_OK
, FALSE
,
1812 {"zip://google.com:65536/",S_OK
,FALSE
},
1813 {"google.com:65536",S_OK
,FALSE
},
1814 {"zip://google.com:65536/",S_OK
,FALSE
},
1815 {"google.com:65536",S_OK
,FALSE
},
1818 {"google.com:65536",S_OK
,FALSE
},
1823 {"zip://google.com:65536",S_OK
,FALSE
},
1829 {Uri_HOST_DNS
,S_OK
,FALSE
},
1831 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1832 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1835 { "zip://google.com:65536:25", 0, S_OK
, FALSE
,
1837 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1838 {"google.com:65536:25",S_OK
,FALSE
},
1839 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1840 {"google.com:65536:25",S_OK
,FALSE
},
1843 {"google.com:65536:25",S_OK
,FALSE
},
1848 {"zip://google.com:65536:25",S_OK
,FALSE
},
1854 {Uri_HOST_DNS
,S_OK
,FALSE
},
1856 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1857 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1860 { "zip://[::ffff]:abcd", 0, S_OK
, FALSE
,
1862 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1863 {"[::ffff]:abcd",S_OK
,FALSE
},
1864 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1868 {"[::ffff]:abcd",S_OK
,FALSE
},
1873 {"zip://[::ffff]:abcd",S_OK
,FALSE
},
1879 {Uri_HOST_DNS
,S_OK
,FALSE
},
1881 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1882 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1885 { "zip://127.0.0.1:abcd", 0, S_OK
, FALSE
,
1887 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1888 {"127.0.0.1:abcd",S_OK
,FALSE
},
1889 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1890 {"0.1:abcd",S_OK
,FALSE
},
1893 {"127.0.0.1:abcd",S_OK
,FALSE
},
1898 {"zip://127.0.0.1:abcd",S_OK
,FALSE
},
1904 {Uri_HOST_DNS
,S_OK
,FALSE
},
1906 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1907 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1910 /* Port is just copied over. */
1911 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1913 {"http://google.com:00035",S_OK
,FALSE
},
1914 {"google.com:00035",S_OK
,FALSE
},
1915 {"http://google.com:00035",S_OK
,FALSE
,"http://google.com:35"},
1916 {"google.com",S_OK
,FALSE
},
1919 {"google.com",S_OK
,FALSE
},
1924 {"http://google.com:00035",S_OK
,FALSE
},
1925 {"http",S_OK
,FALSE
},
1930 {Uri_HOST_DNS
,S_OK
,FALSE
},
1932 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1933 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1936 /* Default port is copied over. */
1937 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1939 {"http://google.com:80",S_OK
,FALSE
},
1940 {"google.com:80",S_OK
,FALSE
},
1941 {"http://google.com:80",S_OK
,FALSE
},
1942 {"google.com",S_OK
,FALSE
},
1945 {"google.com",S_OK
,FALSE
},
1950 {"http://google.com:80",S_OK
,FALSE
},
1951 {"http",S_OK
,FALSE
},
1956 {Uri_HOST_DNS
,S_OK
,FALSE
},
1958 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1959 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1962 { "http://google.com.uk", 0, S_OK
, FALSE
,
1964 {"http://google.com.uk/",S_OK
,FALSE
},
1965 {"google.com.uk",S_OK
,FALSE
},
1966 {"http://google.com.uk/",S_OK
,FALSE
},
1967 {"google.com.uk",S_OK
,FALSE
},
1970 {"google.com.uk",S_OK
,FALSE
},
1975 {"http://google.com.uk",S_OK
,FALSE
},
1976 {"http",S_OK
,FALSE
},
1981 {Uri_HOST_DNS
,S_OK
,FALSE
},
1983 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1984 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1987 { "http://google.com.com", 0, S_OK
, FALSE
,
1989 {"http://google.com.com/",S_OK
,FALSE
},
1990 {"google.com.com",S_OK
,FALSE
},
1991 {"http://google.com.com/",S_OK
,FALSE
},
1992 {"com.com",S_OK
,FALSE
},
1995 {"google.com.com",S_OK
,FALSE
},
2000 {"http://google.com.com",S_OK
,FALSE
},
2001 {"http",S_OK
,FALSE
},
2006 {Uri_HOST_DNS
,S_OK
,FALSE
},
2008 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2009 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2012 { "http://google.uk.1", 0, S_OK
, FALSE
,
2014 {"http://google.uk.1/",S_OK
,FALSE
},
2015 {"google.uk.1",S_OK
,FALSE
},
2016 {"http://google.uk.1/",S_OK
,FALSE
},
2017 {"google.uk.1",S_OK
,FALSE
},
2020 {"google.uk.1",S_OK
,FALSE
},
2025 {"http://google.uk.1",S_OK
,FALSE
},
2026 {"http",S_OK
,FALSE
},
2031 {Uri_HOST_DNS
,S_OK
,FALSE
},
2033 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2034 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2037 /* Since foo isn't a recognized 3 character TLD it's considered the domain name. */
2038 { "http://google.foo.uk", 0, S_OK
, FALSE
,
2040 {"http://google.foo.uk/",S_OK
,FALSE
},
2041 {"google.foo.uk",S_OK
,FALSE
},
2042 {"http://google.foo.uk/",S_OK
,FALSE
},
2043 {"foo.uk",S_OK
,FALSE
},
2046 {"google.foo.uk",S_OK
,FALSE
},
2051 {"http://google.foo.uk",S_OK
,FALSE
},
2052 {"http",S_OK
,FALSE
},
2057 {Uri_HOST_DNS
,S_OK
,FALSE
},
2059 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2060 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2063 { "http://.com", 0, S_OK
, FALSE
,
2065 {"http://.com/",S_OK
,FALSE
},
2066 {".com",S_OK
,FALSE
},
2067 {"http://.com/",S_OK
,FALSE
},
2068 {".com",S_OK
,FALSE
},
2071 {".com",S_OK
,FALSE
},
2076 {"http://.com",S_OK
,FALSE
},
2077 {"http",S_OK
,FALSE
},
2082 {Uri_HOST_DNS
,S_OK
,FALSE
},
2084 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2085 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2088 { "http://.uk", 0, S_OK
, FALSE
,
2090 {"http://.uk/",S_OK
,FALSE
},
2092 {"http://.uk/",S_OK
,FALSE
},
2101 {"http://.uk",S_OK
,FALSE
},
2102 {"http",S_OK
,FALSE
},
2107 {Uri_HOST_DNS
,S_OK
,FALSE
},
2109 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2110 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2113 { "http://www.co.google.com.[]", 0, S_OK
, FALSE
,
2115 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
2116 {"www.co.google.com.[]",S_OK
,FALSE
},
2117 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
2118 {"google.com.[]",S_OK
,FALSE
},
2121 {"www.co.google.com.[]",S_OK
,FALSE
},
2126 {"http://www.co.google.com.[]",S_OK
,FALSE
},
2127 {"http",S_OK
,FALSE
},
2132 {Uri_HOST_DNS
,S_OK
,FALSE
},
2134 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2135 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2138 { "http://co.uk", 0, S_OK
, FALSE
,
2140 {"http://co.uk/",S_OK
,FALSE
},
2141 {"co.uk",S_OK
,FALSE
},
2142 {"http://co.uk/",S_OK
,FALSE
},
2146 {"co.uk",S_OK
,FALSE
},
2151 {"http://co.uk",S_OK
,FALSE
},
2152 {"http",S_OK
,FALSE
},
2157 {Uri_HOST_DNS
,S_OK
,FALSE
},
2159 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2160 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2163 { "http://www.co.google.us.test", 0, S_OK
, FALSE
,
2165 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2166 {"www.co.google.us.test",S_OK
,FALSE
},
2167 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2168 {"us.test",S_OK
,FALSE
},
2171 {"www.co.google.us.test",S_OK
,FALSE
},
2176 {"http://www.co.google.us.test",S_OK
,FALSE
},
2177 {"http",S_OK
,FALSE
},
2182 {Uri_HOST_DNS
,S_OK
,FALSE
},
2184 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2185 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2188 { "http://gov.uk", 0, S_OK
, FALSE
,
2190 {"http://gov.uk/",S_OK
,FALSE
},
2191 {"gov.uk",S_OK
,FALSE
},
2192 {"http://gov.uk/",S_OK
,FALSE
},
2196 {"gov.uk",S_OK
,FALSE
},
2201 {"http://gov.uk",S_OK
,FALSE
},
2202 {"http",S_OK
,FALSE
},
2207 {Uri_HOST_DNS
,S_OK
,FALSE
},
2209 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2210 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2213 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2215 {"zip://www.google.com\\test",S_OK
,FALSE
},
2216 {"www.google.com\\test",S_OK
,FALSE
},
2217 {"zip://www.google.com\\test",S_OK
,FALSE
},
2218 {"google.com\\test",S_OK
,FALSE
},
2221 {"www.google.com\\test",S_OK
,FALSE
},
2226 {"zip://www.google.com\\test",S_OK
,FALSE
},
2232 {Uri_HOST_DNS
,S_OK
,FALSE
},
2234 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2235 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2238 { "urn:excepts:bad:%XY:encoded", 0, S_OK
, FALSE
,
2240 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2242 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2248 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2249 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2251 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2257 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2259 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2260 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2263 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2264 * are decoded and all '%' are encoded.
2266 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK
, FALSE
,
2268 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2270 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2272 {".mp3",S_OK
,FALSE
},
2276 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2277 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2279 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK
,FALSE
},
2280 {"file",S_OK
,FALSE
},
2285 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2287 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2288 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2291 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2292 * is decoded and only %'s in front of invalid hex digits are encoded.
2294 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK
, FALSE
,
2296 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2298 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2300 {".mp3",S_OK
,FALSE
},
2304 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2305 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2307 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK
,FALSE
},
2308 {"file",S_OK
,FALSE
},
2313 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2315 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2316 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2319 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2320 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK
, FALSE
,
2322 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2323 {"[::1.2.3.0]",S_OK
,FALSE
},
2324 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2328 {"::1.2.3.0",S_OK
,FALSE
},
2330 {"/%3F%23.T/test",S_OK
,FALSE
},
2331 {"/%3F%23.T/test",S_OK
,FALSE
},
2333 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK
,FALSE
},
2334 {"http",S_OK
,FALSE
},
2339 {Uri_HOST_IPV6
,S_OK
,FALSE
},
2341 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2342 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2345 /* Forbidden characters are always encoded for file URIs. */
2346 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2348 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2350 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2352 {".mp3",S_OK
,FALSE
},
2356 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2357 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2359 {"file:///C:/\"test\"/test.mp3",S_OK
,FALSE
},
2360 {"file",S_OK
,FALSE
},
2365 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2367 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2368 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2371 /* Forbidden characters are never encoded for unknown scheme types. */
2372 { "1234://4294967295/<|>\" test<|>", 0, S_OK
, FALSE
,
2374 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2375 {"4294967295",S_OK
,FALSE
},
2376 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2380 {"4294967295",S_OK
,FALSE
},
2382 {"/<|>\" test<|>",S_OK
,FALSE
},
2383 {"/<|>\" test<|>",S_OK
,FALSE
},
2385 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2386 {"1234",S_OK
,FALSE
},
2391 {Uri_HOST_IPV4
,S_OK
,FALSE
},
2393 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2394 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2397 /* Make sure forbidden characters are percent encoded. */
2398 { "http://gov.uk/<|> test<|>", 0, S_OK
, FALSE
,
2400 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2401 {"gov.uk",S_OK
,FALSE
},
2402 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2406 {"gov.uk",S_OK
,FALSE
},
2408 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2409 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2411 {"http://gov.uk/<|> test<|>",S_OK
,FALSE
},
2412 {"http",S_OK
,FALSE
},
2417 {Uri_HOST_DNS
,S_OK
,FALSE
},
2419 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2420 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2423 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK
, FALSE
,
2425 {"http://gov.uk/",S_OK
,FALSE
},
2426 {"gov.uk",S_OK
,FALSE
},
2427 {"http://gov.uk/",S_OK
,FALSE
},
2431 {"gov.uk",S_OK
,FALSE
},
2436 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK
,FALSE
},
2437 {"http",S_OK
,FALSE
},
2442 {Uri_HOST_DNS
,S_OK
,FALSE
},
2444 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2445 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2448 { "http://gov.uk/test/test2/../../..", 0, S_OK
, FALSE
,
2450 {"http://gov.uk/",S_OK
,FALSE
},
2451 {"gov.uk",S_OK
,FALSE
},
2452 {"http://gov.uk/",S_OK
,FALSE
},
2456 {"gov.uk",S_OK
,FALSE
},
2461 {"http://gov.uk/test/test2/../../..",S_OK
,FALSE
},
2462 {"http",S_OK
,FALSE
},
2467 {Uri_HOST_DNS
,S_OK
,FALSE
},
2469 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2470 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2473 { "http://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2475 {"http://gov.uk/",S_OK
,FALSE
},
2476 {"gov.uk",S_OK
,FALSE
},
2477 {"http://gov.uk/",S_OK
,FALSE
},
2481 {"gov.uk",S_OK
,FALSE
},
2486 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2487 {"http",S_OK
,FALSE
},
2492 {Uri_HOST_DNS
,S_OK
,FALSE
},
2494 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2495 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2498 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK
, FALSE
,
2500 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2502 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2504 {".mp3",S_OK
,FALSE
},
2508 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2509 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2511 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK
,FALSE
},
2512 {"file",S_OK
,FALSE
},
2517 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2519 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2520 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2523 /* Dot removal happens for unknown scheme types. */
2524 { "zip://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2526 {"zip://gov.uk/",S_OK
,FALSE
},
2527 {"gov.uk",S_OK
,FALSE
},
2528 {"zip://gov.uk/",S_OK
,FALSE
},
2532 {"gov.uk",S_OK
,FALSE
},
2537 {"zip://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2543 {Uri_HOST_DNS
,S_OK
,FALSE
},
2545 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2546 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2549 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2550 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2552 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2553 {"gov.uk",S_OK
,FALSE
},
2554 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2558 {"gov.uk",S_OK
,FALSE
},
2560 {"/test/test2/../../.",S_OK
,FALSE
},
2561 {"/test/test2/../../.",S_OK
,FALSE
},
2563 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2564 {"http",S_OK
,FALSE
},
2569 {Uri_HOST_DNS
,S_OK
,FALSE
},
2571 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2572 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2575 /* Dot removal doesn't happen for wildcard scheme types. */
2576 { "*:gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2578 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2579 {"gov.uk",S_OK
,FALSE
},
2580 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2584 {"gov.uk",S_OK
,FALSE
},
2586 {"/test/test2/../../.",S_OK
,FALSE
},
2587 {"/test/test2/../../.",S_OK
,FALSE
},
2589 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2595 {Uri_HOST_DNS
,S_OK
,FALSE
},
2597 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
2598 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2601 /* Forbidden characters are encoded for opaque known scheme types. */
2602 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK
, FALSE
,
2604 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2606 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2608 {".com%22",S_OK
,FALSE
},
2612 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2613 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2615 {"mailto:\"acco<|>unt@example.com\"",S_OK
,FALSE
},
2616 {"mailto",S_OK
,FALSE
},
2621 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2623 {URL_SCHEME_MAILTO
,S_OK
,FALSE
},
2624 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2627 { "news:test.tes<|>t.com", 0, S_OK
, FALSE
,
2629 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2631 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2633 {".com",S_OK
,FALSE
},
2637 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2638 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2640 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2641 {"news",S_OK
,FALSE
},
2646 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2648 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2649 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2652 /* Don't encode forbidden characters. */
2653 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2655 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2657 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2659 {".com",S_OK
,FALSE
},
2663 {"test.tes<|>t.com",S_OK
,FALSE
},
2664 {"test.tes<|>t.com",S_OK
,FALSE
},
2666 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2667 {"news",S_OK
,FALSE
},
2672 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2674 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2675 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2678 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2679 { "urn:test.tes<|>t.com", 0, S_OK
, FALSE
,
2681 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2683 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2685 {".com",S_OK
,FALSE
},
2689 {"test.tes<|>t.com",S_OK
,FALSE
},
2690 {"test.tes<|>t.com",S_OK
,FALSE
},
2692 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2698 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2700 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2701 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2704 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2705 { "news:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2707 {"news:test.test.com",S_OK
,FALSE
},
2709 {"news:test.test.com",S_OK
,FALSE
},
2711 {".com",S_OK
,FALSE
},
2715 {"test.test.com",S_OK
,FALSE
},
2716 {"test.test.com",S_OK
,FALSE
},
2718 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2719 {"news",S_OK
,FALSE
},
2724 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2726 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2727 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2730 /* Percent encoded characters are still decoded for known scheme types. */
2731 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2733 {"news:test.test.com",S_OK
,FALSE
},
2735 {"news:test.test.com",S_OK
,FALSE
},
2737 {".com",S_OK
,FALSE
},
2741 {"test.test.com",S_OK
,FALSE
},
2742 {"test.test.com",S_OK
,FALSE
},
2744 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2745 {"news",S_OK
,FALSE
},
2750 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2752 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2753 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2756 /* Percent encoded characters aren't decoded for unknown scheme types. */
2757 { "urn:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2759 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2761 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2763 {".com",S_OK
,FALSE
},
2767 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2768 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2770 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2776 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2778 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2779 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2782 /* Unknown scheme types can have invalid % encoded data in query string. */
2783 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK
, FALSE
,
2785 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2786 {"www.winehq.org",S_OK
,FALSE
},
2787 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2788 {"winehq.org",S_OK
,FALSE
},
2791 {"www.winehq.org",S_OK
,FALSE
},
2794 {"/?query=%xx&return=y",S_OK
,FALSE
},
2795 {"?query=%xx&return=y",S_OK
,FALSE
},
2796 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2802 {Uri_HOST_DNS
,S_OK
,FALSE
},
2804 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2805 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2808 /* Known scheme types can have invalid % encoded data with the right flags. */
2809 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2811 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2812 {"www.winehq.org",S_OK
,FALSE
},
2813 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2814 {"winehq.org",S_OK
,FALSE
},
2817 {"www.winehq.org",S_OK
,FALSE
},
2820 {"/?query=%xx&return=y",S_OK
,FALSE
},
2821 {"?query=%xx&return=y",S_OK
,FALSE
},
2822 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2823 {"http",S_OK
,FALSE
},
2828 {Uri_HOST_DNS
,S_OK
,FALSE
},
2830 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2831 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2834 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2835 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2837 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2838 {"www.winehq.org",S_OK
,FALSE
},
2839 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2840 {"winehq.org",S_OK
,FALSE
},
2843 {"www.winehq.org",S_OK
,FALSE
},
2846 {"/?query=<|>&return=y",S_OK
,FALSE
},
2847 {"?query=<|>&return=y",S_OK
,FALSE
},
2848 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2849 {"http",S_OK
,FALSE
},
2854 {Uri_HOST_DNS
,S_OK
,FALSE
},
2856 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2857 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2860 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2861 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2863 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2864 {"www.winehq.org",S_OK
,FALSE
},
2865 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2866 {"winehq.org",S_OK
,FALSE
},
2869 {"www.winehq.org",S_OK
,FALSE
},
2872 {"/?query=<|>&return=y",S_OK
,FALSE
},
2873 {"?query=<|>&return=y",S_OK
,FALSE
},
2874 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2875 {"http",S_OK
,FALSE
},
2880 {Uri_HOST_DNS
,S_OK
,FALSE
},
2882 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2883 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2886 /* Forbidden characters are encoded for known scheme types. */
2887 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2889 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2890 {"www.winehq.org",S_OK
,FALSE
},
2891 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2892 {"winehq.org",S_OK
,FALSE
},
2895 {"www.winehq.org",S_OK
,FALSE
},
2898 {"/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2899 {"?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2900 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2901 {"http",S_OK
,FALSE
},
2906 {Uri_HOST_DNS
,S_OK
,FALSE
},
2908 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2909 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2912 /* Forbidden characters are not encoded for unknown scheme types. */
2913 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2915 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2916 {"www.winehq.org",S_OK
,FALSE
},
2917 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2918 {"winehq.org",S_OK
,FALSE
},
2921 {"www.winehq.org",S_OK
,FALSE
},
2924 {"/?query=<|>&return=y",S_OK
,FALSE
},
2925 {"?query=<|>&return=y",S_OK
,FALSE
},
2926 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2932 {Uri_HOST_DNS
,S_OK
,FALSE
},
2934 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2935 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2938 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2939 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2941 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2942 {"www.winehq.org",S_OK
,FALSE
},
2943 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2944 {"winehq.org",S_OK
,FALSE
},
2947 {"www.winehq.org",S_OK
,FALSE
},
2950 {"/?query=01&return=y",S_OK
,FALSE
},
2951 {"?query=01&return=y",S_OK
,FALSE
},
2952 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2953 {"http",S_OK
,FALSE
},
2958 {Uri_HOST_DNS
,S_OK
,FALSE
},
2960 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2961 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2964 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2965 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2967 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2968 {"www.winehq.org",S_OK
,FALSE
},
2969 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2970 {"winehq.org",S_OK
,FALSE
},
2973 {"www.winehq.org",S_OK
,FALSE
},
2976 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2977 {"?query=%30%31&return=y",S_OK
,FALSE
},
2978 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2984 {Uri_HOST_DNS
,S_OK
,FALSE
},
2986 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2987 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2990 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2991 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2993 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2994 {"www.winehq.org",S_OK
,FALSE
},
2995 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2996 {"winehq.org",S_OK
,FALSE
},
2999 {"www.winehq.org",S_OK
,FALSE
},
3002 {"/?query=%30%31&return=y",S_OK
,FALSE
},
3003 {"?query=%30%31&return=y",S_OK
,FALSE
},
3004 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
3005 {"http",S_OK
,FALSE
},
3010 {Uri_HOST_DNS
,S_OK
,FALSE
},
3012 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3013 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3016 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3018 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3019 {"www.winehq.org",S_OK
,FALSE
},
3020 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3021 {"winehq.org",S_OK
,FALSE
},
3024 {"www.winehq.org",S_OK
,FALSE
},
3027 {"?query=12&return=y",S_OK
,FALSE
},
3028 {"?query=12&return=y",S_OK
,FALSE
},
3029 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
3030 {"http",S_OK
,FALSE
},
3035 {Uri_HOST_DNS
,S_OK
,FALSE
},
3037 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3038 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3041 /* Unknown scheme types can have invalid % encoded data in fragments. */
3042 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK
, FALSE
,
3044 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3045 {"www.winehq.org",S_OK
,FALSE
},
3046 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3047 {"winehq.org",S_OK
,FALSE
},
3049 {"#Te%xx",S_OK
,FALSE
},
3050 {"www.winehq.org",S_OK
,FALSE
},
3052 {"/tests/",S_OK
,FALSE
},
3053 {"/tests/",S_OK
,FALSE
},
3055 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
3061 {Uri_HOST_DNS
,S_OK
,FALSE
},
3063 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3064 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3067 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
3068 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
3070 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3071 {"www.winehq.org",S_OK
,FALSE
},
3072 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3073 {"winehq.org",S_OK
,FALSE
},
3075 {"#Te<|>",S_OK
,FALSE
},
3076 {"www.winehq.org",S_OK
,FALSE
},
3078 {"/tests/",S_OK
,FALSE
},
3079 {"/tests/",S_OK
,FALSE
},
3081 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3087 {Uri_HOST_DNS
,S_OK
,FALSE
},
3089 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3090 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3093 /* Forbidden characters in the fragment are percent encoded for known schemes. */
3094 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
3096 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
3097 {"www.winehq.org",S_OK
,FALSE
},
3098 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
3099 {"winehq.org",S_OK
,FALSE
},
3101 {"#Te%3C%7C%3E",S_OK
,FALSE
},
3102 {"www.winehq.org",S_OK
,FALSE
},
3104 {"/tests/",S_OK
,FALSE
},
3105 {"/tests/",S_OK
,FALSE
},
3107 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3108 {"http",S_OK
,FALSE
},
3113 {Uri_HOST_DNS
,S_OK
,FALSE
},
3115 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3116 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3119 /* Forbidden characters aren't encoded in the fragment with this flag. */
3120 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3122 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3123 {"www.winehq.org",S_OK
,FALSE
},
3124 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3125 {"winehq.org",S_OK
,FALSE
},
3127 {"#Te<|>",S_OK
,FALSE
},
3128 {"www.winehq.org",S_OK
,FALSE
},
3130 {"/tests/",S_OK
,FALSE
},
3131 {"/tests/",S_OK
,FALSE
},
3133 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3134 {"http",S_OK
,FALSE
},
3139 {Uri_HOST_DNS
,S_OK
,FALSE
},
3141 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3142 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3145 /* Forbidden characters aren't encoded in the fragment with this flag. */
3146 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
3148 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3149 {"www.winehq.org",S_OK
,FALSE
},
3150 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3151 {"winehq.org",S_OK
,FALSE
},
3153 {"#Te<|>",S_OK
,FALSE
},
3154 {"www.winehq.org",S_OK
,FALSE
},
3156 {"/tests/",S_OK
,FALSE
},
3157 {"/tests/",S_OK
,FALSE
},
3159 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3160 {"http",S_OK
,FALSE
},
3165 {Uri_HOST_DNS
,S_OK
,FALSE
},
3167 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3168 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3171 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3172 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3174 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3175 {"www.winehq.org",S_OK
,FALSE
},
3176 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3177 {"winehq.org",S_OK
,FALSE
},
3179 {"#Te%30%31%32",S_OK
,FALSE
},
3180 {"www.winehq.org",S_OK
,FALSE
},
3182 {"/tests/",S_OK
,FALSE
},
3183 {"/tests/",S_OK
,FALSE
},
3185 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3191 {Uri_HOST_DNS
,S_OK
,FALSE
},
3193 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3194 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3197 /* Percent encoded, unreserved characters are decoded for known schemes. */
3198 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3200 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3201 {"www.winehq.org",S_OK
,FALSE
},
3202 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3203 {"winehq.org",S_OK
,FALSE
},
3205 {"#Te012",S_OK
,FALSE
},
3206 {"www.winehq.org",S_OK
,FALSE
},
3208 {"/tests/",S_OK
,FALSE
},
3209 {"/tests/",S_OK
,FALSE
},
3211 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3212 {"http",S_OK
,FALSE
},
3217 {Uri_HOST_DNS
,S_OK
,FALSE
},
3219 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3220 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3223 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3224 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3226 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3227 {"www.winehq.org",S_OK
,FALSE
},
3228 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3229 {"winehq.org",S_OK
,FALSE
},
3231 {"#Te012",S_OK
,FALSE
},
3232 {"www.winehq.org",S_OK
,FALSE
},
3234 {"/tests/",S_OK
,FALSE
},
3235 {"/tests/",S_OK
,FALSE
},
3237 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3238 {"http",S_OK
,FALSE
},
3243 {Uri_HOST_DNS
,S_OK
,FALSE
},
3245 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3246 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3249 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3250 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3252 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3253 {"www.winehq.org",S_OK
,FALSE
},
3254 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3255 {"winehq.org",S_OK
,FALSE
},
3257 {"#Te%30%31%32",S_OK
,FALSE
},
3258 {"www.winehq.org",S_OK
,FALSE
},
3260 {"/tests/",S_OK
,FALSE
},
3261 {"/tests/",S_OK
,FALSE
},
3263 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3264 {"http",S_OK
,FALSE
},
3269 {Uri_HOST_DNS
,S_OK
,FALSE
},
3271 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3272 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3275 /* Leading/Trailing whitespace is removed. */
3276 { " http://google.com/ ", 0, S_OK
, FALSE
,
3278 {"http://google.com/",S_OK
,FALSE
},
3279 {"google.com",S_OK
,FALSE
},
3280 {"http://google.com/",S_OK
,FALSE
},
3281 {"google.com",S_OK
,FALSE
},
3284 {"google.com",S_OK
,FALSE
},
3289 {"http://google.com/",S_OK
,FALSE
},
3290 {"http",S_OK
,FALSE
},
3295 {Uri_HOST_DNS
,S_OK
,FALSE
},
3297 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3298 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3301 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK
, FALSE
,
3303 {"http://google.com/",S_OK
,FALSE
},
3304 {"google.com",S_OK
,FALSE
},
3305 {"http://google.com/",S_OK
,FALSE
},
3306 {"google.com",S_OK
,FALSE
},
3309 {"google.com",S_OK
,FALSE
},
3314 {"http://google.com/",S_OK
,FALSE
},
3315 {"http",S_OK
,FALSE
},
3320 {Uri_HOST_DNS
,S_OK
,FALSE
},
3322 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3323 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3326 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3328 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3329 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3330 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3331 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3334 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3336 {"/%0A%0A%0A",S_OK
,FALSE
},
3337 {"/%0A%0A%0A",S_OK
,FALSE
},
3339 {"http://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3340 {"http",S_OK
,FALSE
},
3345 {Uri_HOST_DNS
,S_OK
,FALSE
},
3347 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3348 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3351 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3353 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3354 {"g\noogle.co\rm",S_OK
,FALSE
},
3355 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3356 {"g\noogle.co\rm",S_OK
,FALSE
},
3359 {"g\noogle.co\rm",S_OK
,FALSE
},
3361 {"/\n\n\n",S_OK
,FALSE
},
3362 {"/\n\n\n",S_OK
,FALSE
},
3364 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3370 {Uri_HOST_DNS
,S_OK
,FALSE
},
3372 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3373 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3376 /* Since file URLs are usually hierarchical, it returns an empty string
3377 * for the absolute URI property since it was declared as an opaque URI.
3379 { "file:index.html", 0, S_OK
, FALSE
,
3383 {"file:index.html",S_OK
,FALSE
},
3385 {".html",S_OK
,FALSE
},
3389 {"index.html",S_OK
,FALSE
},
3390 {"index.html",S_OK
,FALSE
},
3392 {"file:index.html",S_OK
,FALSE
},
3393 {"file",S_OK
,FALSE
},
3398 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3400 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3401 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3404 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3405 { "http:test.com/index.html", 0, S_OK
, FALSE
,
3409 {"http:test.com/index.html",S_OK
,FALSE
},
3411 {".html",S_OK
,FALSE
},
3415 {"test.com/index.html",S_OK
,FALSE
},
3416 {"test.com/index.html",S_OK
,FALSE
},
3418 {"http:test.com/index.html",S_OK
,FALSE
},
3419 {"http",S_OK
,FALSE
},
3424 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3426 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3427 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3430 { "ftp:test.com/index.html", 0, S_OK
, FALSE
,
3434 {"ftp:test.com/index.html",S_OK
,FALSE
},
3436 {".html",S_OK
,FALSE
},
3440 {"test.com/index.html",S_OK
,FALSE
},
3441 {"test.com/index.html",S_OK
,FALSE
},
3443 {"ftp:test.com/index.html",S_OK
,FALSE
},
3449 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3451 {URL_SCHEME_FTP
,S_OK
,FALSE
},
3452 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3455 { "file://C|/test.mp3", 0, S_OK
, FALSE
,
3457 {"file:///C:/test.mp3",S_OK
,FALSE
},
3459 {"file:///C:/test.mp3",S_OK
,FALSE
},
3461 {".mp3",S_OK
,FALSE
},
3465 {"/C:/test.mp3",S_OK
,FALSE
},
3466 {"/C:/test.mp3",S_OK
,FALSE
},
3468 {"file://C|/test.mp3",S_OK
,FALSE
},
3469 {"file",S_OK
,FALSE
},
3474 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3476 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3477 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3480 { "file:///C|/test.mp3", 0, S_OK
, FALSE
,
3482 {"file:///C:/test.mp3",S_OK
,FALSE
},
3484 {"file:///C:/test.mp3",S_OK
,FALSE
},
3486 {".mp3",S_OK
,FALSE
},
3490 {"/C:/test.mp3",S_OK
,FALSE
},
3491 {"/C:/test.mp3",S_OK
,FALSE
},
3493 {"file:///C|/test.mp3",S_OK
,FALSE
},
3494 {"file",S_OK
,FALSE
},
3499 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3501 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3502 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3505 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3508 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3510 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3512 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3514 {".html",S_OK
,FALSE
},
3518 {"c:\\dir\\index.html",S_OK
,FALSE
},
3519 {"c:\\dir\\index.html",S_OK
,FALSE
},
3521 {"file://c:/dir/index.html",S_OK
,FALSE
},
3522 {"file",S_OK
,FALSE
},
3527 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3529 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3530 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3533 /* Extra '/' after "file://" is removed. */
3534 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3536 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3538 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3540 {".html",S_OK
,FALSE
},
3544 {"c:\\dir\\index.html",S_OK
,FALSE
},
3545 {"c:\\dir\\index.html",S_OK
,FALSE
},
3547 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3548 {"file",S_OK
,FALSE
},
3553 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3555 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3556 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3559 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3560 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3562 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3564 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3566 {".html",S_OK
,FALSE
},
3570 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3571 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3573 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK
,FALSE
},
3574 {"file",S_OK
,FALSE
},
3579 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3581 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3582 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3585 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3587 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3589 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3591 {".html",S_OK
,FALSE
},
3595 {"c:\\dir\\index.html",S_OK
,FALSE
},
3596 {"c:\\dir\\index.html",S_OK
,FALSE
},
3598 {"file://c|/dir\\index.html",S_OK
,FALSE
},
3599 {"file",S_OK
,FALSE
},
3604 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3606 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3607 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3610 /* The backslashes after the scheme name are converted to forward slashes. */
3611 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3613 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3615 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3617 {".html",S_OK
,FALSE
},
3621 {"c:\\dir\\index.html",S_OK
,FALSE
},
3622 {"c:\\dir\\index.html",S_OK
,FALSE
},
3624 {"file:\\\\c:\\dir\\index.html",S_OK
,FALSE
},
3625 {"file",S_OK
,FALSE
},
3630 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3632 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3633 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3636 { "file:\\\\c:/dir/index.html", 0, S_OK
, FALSE
,
3638 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3640 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3642 {".html",S_OK
,FALSE
},
3646 {"/c:/dir/index.html",S_OK
,FALSE
},
3647 {"/c:/dir/index.html",S_OK
,FALSE
},
3649 {"file:\\\\c:/dir/index.html",S_OK
,FALSE
},
3650 {"file",S_OK
,FALSE
},
3655 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3657 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3658 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3661 { "http:\\\\google.com", 0, S_OK
, FALSE
,
3663 {"http://google.com/",S_OK
,FALSE
},
3664 {"google.com",S_OK
,FALSE
},
3665 {"http://google.com/",S_OK
,FALSE
},
3666 {"google.com",S_OK
,FALSE
},
3669 {"google.com",S_OK
,FALSE
},
3674 {"http:\\\\google.com",S_OK
,FALSE
},
3675 {"http",S_OK
,FALSE
},
3680 {Uri_HOST_DNS
,S_OK
,FALSE
},
3682 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3683 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3686 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3687 { "zip:\\\\google.com", 0, S_OK
, FALSE
,
3689 {"zip:\\\\google.com",S_OK
,FALSE
},
3691 {"zip:\\\\google.com",S_OK
,FALSE
},
3693 {".com",S_OK
,FALSE
},
3697 {"\\\\google.com",S_OK
,FALSE
},
3698 {"\\\\google.com",S_OK
,FALSE
},
3700 {"zip:\\\\google.com",S_OK
,FALSE
},
3706 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3708 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3709 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3712 /* Dot segments aren't removed. */
3713 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3715 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3717 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3719 {".html",S_OK
,FALSE
},
3723 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3724 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3726 {"file://c:\\dir\\../..\\./index.html",S_OK
,FALSE
},
3727 {"file",S_OK
,FALSE
},
3732 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3734 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3735 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3738 /* Forbidden characters aren't percent encoded. */
3739 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3741 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3743 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3745 {".html",S_OK
,FALSE
},
3749 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3750 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3752 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3753 {"file",S_OK
,FALSE
},
3758 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3760 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3761 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3764 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3765 { "file:c:\\dir\\../..\\index.html", 0, S_OK
, FALSE
,
3769 {"file:c:/dir/../../index.html",S_OK
,FALSE
},
3771 {".html",S_OK
,FALSE
},
3775 {"c:/dir/../../index.html",S_OK
,FALSE
},
3776 {"c:/dir/../../index.html",S_OK
,FALSE
},
3778 {"file:c:\\dir\\../..\\index.html",S_OK
,FALSE
},
3779 {"file",S_OK
,FALSE
},
3784 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3786 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3787 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3790 /* '/' are still converted to '\' even though it's an opaque URI. */
3791 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3795 {"file:c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3797 {".html",S_OK
,FALSE
},
3801 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3802 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3804 {"file:c:/dir\\../..\\index.html",S_OK
,FALSE
},
3805 {"file",S_OK
,FALSE
},
3810 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3812 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3813 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3816 /* Forbidden characters aren't percent encoded. */
3817 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3821 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3823 {".html",S_OK
,FALSE
},
3827 {"c:\\in^|dex.html",S_OK
,FALSE
},
3828 {"c:\\in^|dex.html",S_OK
,FALSE
},
3830 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3831 {"file",S_OK
,FALSE
},
3836 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3838 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3839 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3842 /* Doesn't have a UserName since the ':' appears at the beginning of the
3845 { "http://:password@gov.uk", 0, S_OK
, FALSE
,
3847 {"http://:password@gov.uk/",S_OK
,FALSE
},
3848 {":password@gov.uk",S_OK
,FALSE
},
3849 {"http://gov.uk/",S_OK
,FALSE
},
3853 {"gov.uk",S_OK
,FALSE
},
3854 {"password",S_OK
,FALSE
},
3858 {"http://:password@gov.uk",S_OK
,FALSE
},
3859 {"http",S_OK
,FALSE
},
3860 {":password",S_OK
,FALSE
},
3864 {Uri_HOST_DNS
,S_OK
,FALSE
},
3866 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3867 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3870 /* Has a UserName since the userinfo section doesn't contain a password. */
3871 { "http://@gov.uk", 0, S_OK
, FALSE
,
3873 {"http://gov.uk/",S_OK
,FALSE
,"http://@gov.uk/"},
3874 {"@gov.uk",S_OK
,FALSE
},
3875 {"http://gov.uk/",S_OK
,FALSE
},
3879 {"gov.uk",S_OK
,FALSE
},
3884 {"http://@gov.uk",S_OK
,FALSE
},
3885 {"http",S_OK
,FALSE
},
3890 {Uri_HOST_DNS
,S_OK
,FALSE
},
3892 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3893 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3896 /* ":@" not included in the absolute URI. */
3897 { "http://:@gov.uk", 0, S_OK
, FALSE
,
3899 {"http://gov.uk/",S_OK
,FALSE
,"http://:@gov.uk/"},
3900 {":@gov.uk",S_OK
,FALSE
},
3901 {"http://gov.uk/",S_OK
,FALSE
},
3905 {"gov.uk",S_OK
,FALSE
},
3910 {"http://:@gov.uk",S_OK
,FALSE
},
3911 {"http",S_OK
,FALSE
},
3916 {Uri_HOST_DNS
,S_OK
,FALSE
},
3918 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3919 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3922 /* '@' is included because it's an unknown scheme type. */
3923 { "zip://@gov.uk", 0, S_OK
, FALSE
,
3925 {"zip://@gov.uk/",S_OK
,FALSE
},
3926 {"@gov.uk",S_OK
,FALSE
},
3927 {"zip://@gov.uk/",S_OK
,FALSE
},
3931 {"gov.uk",S_OK
,FALSE
},
3936 {"zip://@gov.uk",S_OK
,FALSE
},
3942 {Uri_HOST_DNS
,S_OK
,FALSE
},
3944 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3945 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3948 /* ":@" are included because it's an unknown scheme type. */
3949 { "zip://:@gov.uk", 0, S_OK
, FALSE
,
3951 {"zip://:@gov.uk/",S_OK
,FALSE
},
3952 {":@gov.uk",S_OK
,FALSE
},
3953 {"zip://:@gov.uk/",S_OK
,FALSE
},
3957 {"gov.uk",S_OK
,FALSE
},
3962 {"zip://:@gov.uk",S_OK
,FALSE
},
3968 {Uri_HOST_DNS
,S_OK
,FALSE
},
3970 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3971 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3974 { "about:blank", 0, S_OK
, FALSE
,
3976 {"about:blank",S_OK
,FALSE
},
3978 {"about:blank",S_OK
,FALSE
},
3984 {"blank",S_OK
,FALSE
},
3985 {"blank",S_OK
,FALSE
},
3987 {"about:blank",S_OK
,FALSE
},
3988 {"about",S_OK
,FALSE
},
3993 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3995 {URL_SCHEME_ABOUT
,S_OK
,FALSE
},
3996 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3999 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK
,FALSE
,
4001 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4003 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4005 {".htm",S_OK
,FALSE
},
4009 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4010 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4012 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
4018 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4020 {URL_SCHEME_MK
,S_OK
,FALSE
},
4021 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4024 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK
,FALSE
,
4026 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4028 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4030 {".htm",S_OK
,FALSE
},
4034 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4035 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4037 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
4043 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4045 {URL_SCHEME_MK
,S_OK
,FALSE
},
4046 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4049 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
4050 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
4052 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
4053 {"server",S_OK
,FALSE
},
4054 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
4056 {".html",S_OK
,FALSE
},
4058 {"server",S_OK
,FALSE
},
4060 {"\\dir\\index.html",S_OK
,FALSE
},
4061 {"\\dir\\index.html",S_OK
,FALSE
},
4063 {"file://server/dir/index.html",S_OK
,FALSE
},
4064 {"file",S_OK
,FALSE
},
4069 {Uri_HOST_DNS
,S_OK
,FALSE
},
4071 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4072 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4075 /* When CreateUri generates an IUri, it still displays the default port in the
4078 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4080 {"http://google.com:80/",S_OK
,FALSE
},
4081 {"google.com:80",S_OK
,FALSE
},
4082 {"http://google.com:80/",S_OK
,FALSE
},
4083 {"google.com",S_OK
,FALSE
},
4086 {"google.com",S_OK
,FALSE
},
4091 {"http://google.com:80/",S_OK
,FALSE
},
4092 {"http",S_OK
,FALSE
},
4097 {Uri_HOST_DNS
,S_OK
,FALSE
},
4099 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
4100 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4103 /* For res URIs the host is everything up until the first '/'. */
4104 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK
, FALSE
,
4106 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4107 {"C:\\dir\\file.exe",S_OK
,FALSE
},
4108 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4110 {".html",S_OK
,FALSE
},
4112 {"C:\\dir\\file.exe",S_OK
,FALSE
},
4114 {"/DATA/test.html",S_OK
,FALSE
},
4115 {"/DATA/test.html",S_OK
,FALSE
},
4117 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
4123 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4125 {URL_SCHEME_RES
,S_OK
,FALSE
},
4126 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4129 /* Res URI can contain a '|' in the host name. */
4130 { "res://c:\\di|r\\file.exe/test", 0, S_OK
, FALSE
,
4132 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4133 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4134 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4138 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4140 {"/test",S_OK
,FALSE
},
4141 {"/test",S_OK
,FALSE
},
4143 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4149 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4151 {URL_SCHEME_RES
,S_OK
,FALSE
},
4152 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4155 /* Res URIs can have invalid percent encoded values. */
4156 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK
, FALSE
,
4158 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4159 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4160 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4164 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4166 {"/test",S_OK
,FALSE
},
4167 {"/test",S_OK
,FALSE
},
4169 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4175 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4177 {URL_SCHEME_RES
,S_OK
,FALSE
},
4178 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4181 /* Res doesn't get forbidden characters percent encoded in its path. */
4182 { "res://c:\\test/tes<|>t", 0, S_OK
, FALSE
,
4184 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4185 {"c:\\test",S_OK
,FALSE
},
4186 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4190 {"c:\\test",S_OK
,FALSE
},
4192 {"/tes<|>t",S_OK
,FALSE
},
4193 {"/tes<|>t",S_OK
,FALSE
},
4195 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4201 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4203 {URL_SCHEME_RES
,S_OK
,FALSE
},
4204 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4207 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4209 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4211 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4213 {".jpg",S_OK
,FALSE
},
4217 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4218 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4220 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4226 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4228 {URL_SCHEME_MK
,S_OK
,FALSE
},
4229 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4232 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4234 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4236 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4238 {".jpg",S_OK
,FALSE
},
4242 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4243 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4245 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4251 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4253 {URL_SCHEME_MK
,S_OK
,FALSE
},
4254 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4257 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4259 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4261 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4263 {".jpg",S_OK
,FALSE
},
4267 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4268 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4270 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4276 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4278 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4279 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4282 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4284 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4286 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4288 {".jpg",S_OK
,FALSE
},
4292 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4293 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4295 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4301 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4303 {URL_SCHEME_MK
,S_OK
,FALSE
},
4304 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4307 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4309 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4311 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4313 {".jpg",S_OK
,FALSE
},
4317 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4318 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4320 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4326 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4328 {URL_SCHEME_MK
,S_OK
,FALSE
},
4329 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4332 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK
, FALSE
,
4334 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4336 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4338 {".jpg",S_OK
,FALSE
},
4342 {"images/xxx.jpg",S_OK
,FALSE
},
4343 {"images/xxx.jpg",S_OK
,FALSE
},
4345 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK
,FALSE
},
4351 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4353 {URL_SCHEME_MK
,S_OK
,FALSE
},
4354 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4357 { "", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4376 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4378 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4379 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4382 { " \t ", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4401 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4403 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4404 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4407 { "javascript:void", 0, S_OK
, FALSE
,
4409 {"javascript:void",S_OK
},
4411 {"javascript:void",S_OK
},
4420 {"javascript:void",S_OK
},
4421 {"javascript",S_OK
},
4426 {Uri_HOST_UNKNOWN
,S_OK
},
4428 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4429 {URLZONE_INVALID
,E_NOTIMPL
}
4432 { "javascript://undefined", 0, S_OK
, FALSE
,
4434 {"javascript://undefined",S_OK
},
4436 {"javascript://undefined",S_OK
},
4442 {"//undefined",S_OK
},
4443 {"//undefined",S_OK
},
4445 {"javascript://undefined",S_OK
},
4446 {"javascript",S_OK
},
4451 {Uri_HOST_UNKNOWN
,S_OK
},
4453 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4454 {URLZONE_INVALID
,E_NOTIMPL
}
4457 { "JavaSCript:escape('/\\?#?')", 0, S_OK
, FALSE
,
4459 {"javascript:escape('/\\?#?')",S_OK
},
4461 {"javascript:escape('/\\?#?')",S_OK
},
4467 {"escape('/\\?#?')",S_OK
},
4468 {"escape('/\\?#?')",S_OK
},
4470 {"JavaSCript:escape('/\\?#?')",S_OK
},
4471 {"javascript",S_OK
},
4476 {Uri_HOST_UNKNOWN
,S_OK
},
4478 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4479 {URLZONE_INVALID
,E_NOTIMPL
}
4482 { "*://google.com", 0, S_OK
, FALSE
,
4484 {"*:google.com/",S_OK
,FALSE
},
4485 {"google.com",S_OK
},
4486 {"*:google.com/",S_OK
,FALSE
},
4487 {"google.com",S_OK
,FALSE
},
4490 {"google.com",S_OK
,FALSE
},
4495 {"*://google.com",S_OK
,FALSE
},
4501 {Uri_HOST_DNS
,S_OK
,FALSE
},
4503 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
4504 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4507 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK
,FALSE
,
4509 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4511 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4517 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4518 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4520 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4526 {Uri_HOST_UNKNOWN
,S_OK
},
4528 {URL_SCHEME_MK
,S_OK
},
4529 {URLZONE_INVALID
,E_NOTIMPL
}
4532 { "gopher://test.winehq.org:151/file.txt",0,S_OK
,FALSE
,
4534 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4535 {"test.winehq.org:151",S_OK
},
4536 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4537 {"winehq.org",S_OK
},
4540 {"test.winehq.org",S_OK
},
4545 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4551 {Uri_HOST_DNS
,S_OK
},
4553 {URL_SCHEME_GOPHER
,S_OK
},
4554 {URLZONE_INVALID
,E_NOTIMPL
}
4557 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4559 {"//host.com/path/file.txt?query",S_OK
},
4561 {"//host.com/path/file.txt?query",S_OK
},
4567 {"/path/file.txt",S_OK
},
4568 {"/path/file.txt?query",S_OK
},
4570 {"//host.com/path/file.txt?query",S_OK
},
4576 {Uri_HOST_DNS
,S_OK
},
4578 {URL_SCHEME_UNKNOWN
,S_OK
},
4579 {URLZONE_INVALID
,E_NOTIMPL
}
4582 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4584 {"//host/path/file.txt?query",S_OK
},
4586 {"//host/path/file.txt?query",S_OK
},
4592 {"/path/file.txt",S_OK
},
4593 {"/path/file.txt?query",S_OK
},
4595 {"//host/path/file.txt?query",S_OK
},
4601 {Uri_HOST_DNS
,S_OK
},
4603 {URL_SCHEME_UNKNOWN
,S_OK
},
4604 {URLZONE_INVALID
,E_NOTIMPL
}
4607 { "//host", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4626 {Uri_HOST_DNS
,S_OK
},
4628 {URL_SCHEME_UNKNOWN
,S_OK
},
4629 {URLZONE_INVALID
,E_NOTIMPL
}
4632 { "mailto://", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4645 {"mailto://",S_OK
,FALSE
,"mailto:"},
4651 {Uri_HOST_UNKNOWN
,S_OK
},
4653 {URL_SCHEME_MAILTO
,S_OK
},
4654 {URLZONE_INVALID
,E_NOTIMPL
}
4657 { "mailto://a@b.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4659 {"mailto:a@b.com",S_OK
},
4661 {"mailto:a@b.com",S_OK
},
4670 {"mailto://a@b.com",S_OK
,FALSE
,"mailto:a@b.com"},
4676 {Uri_HOST_UNKNOWN
,S_OK
},
4678 {URL_SCHEME_MAILTO
,S_OK
},
4679 {URLZONE_INVALID
,E_NOTIMPL
}
4682 { "c:\\test file.html", Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4684 {"file://c:\\test file.html",S_OK
,FALSE
},
4686 {"file://c:\\test file.html",S_OK
,FALSE
},
4688 {".html",S_OK
,FALSE
},
4692 {"c:\\test file.html",S_OK
,FALSE
},
4693 {"c:\\test file.html",S_OK
,FALSE
},
4695 {"c:\\test file.html",S_OK
,FALSE
},
4696 {"file",S_OK
,FALSE
},
4701 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4703 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4704 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4707 { "c:\\test%20file.html", Uri_CREATE_FILE_USE_DOS_PATH
|Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4709 {"file://c:\\test%20file.html",S_OK
,FALSE
},
4711 {"file://c:\\test%20file.html",S_OK
,FALSE
},
4713 {".html",S_OK
,FALSE
},
4717 {"c:\\test%20file.html",S_OK
,FALSE
},
4718 {"c:\\test%20file.html",S_OK
,FALSE
},
4720 {"c:\\test%20file.html",S_OK
,FALSE
},
4721 {"file",S_OK
,FALSE
},
4726 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4728 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4729 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4732 { "c:\\test file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4734 {"file:///c:/test%20file.html",S_OK
,FALSE
},
4736 {"file:///c:/test%20file.html",S_OK
,FALSE
},
4738 {".html",S_OK
,FALSE
},
4742 {"/c:/test%20file.html",S_OK
,FALSE
},
4743 {"/c:/test%20file.html",S_OK
,FALSE
},
4745 {"c:\\test file.html",S_OK
,FALSE
},
4746 {"file",S_OK
,FALSE
},
4751 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4753 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4754 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4757 { "c:\\test%20file.html", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
4759 {"file:///c:/test%2520file.html",S_OK
,FALSE
},
4761 {"file:///c:/test%2520file.html",S_OK
,FALSE
},
4763 {".html",S_OK
,FALSE
},
4767 {"/c:/test%2520file.html",S_OK
,FALSE
},
4768 {"/c:/test%2520file.html",S_OK
,FALSE
},
4770 {"c:\\test%20file.html",S_OK
,FALSE
},
4771 {"file",S_OK
,FALSE
},
4776 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4778 {URL_SCHEME_FILE
,S_OK
,FALSE
},
4779 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4784 typedef struct _invalid_uri
{
4790 static const invalid_uri invalid_uri_tests
[] = {
4791 /* Has to have a scheme name. */
4792 {"://www.winehq.org",0,FALSE
},
4793 /* Windows doesn't like URIs which are implicitly file paths without the
4794 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4796 {"C:/test/test.mp3",0,FALSE
},
4797 {"\\\\Server/test/test.mp3",0,FALSE
},
4798 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
,FALSE
},
4799 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE
,FALSE
},
4800 /* Invalid schemes. */
4801 {"*abcd://not.valid.com",0,FALSE
},
4802 {"*a*b*c*d://not.valid.com",0,FALSE
},
4803 /* Not allowed to have invalid % encoded data. */
4804 {"ftp://google.co%XX/",0,FALSE
},
4805 /* Too many h16 components. */
4806 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE
},
4807 /* Not enough room for IPv4 address. */
4808 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE
},
4809 /* Not enough h16 components. */
4810 {"http://[1:2:3:4]",0,FALSE
},
4811 /* Not enough components including IPv4. */
4812 {"http://[1:192.0.1.0]",0,FALSE
},
4813 /* Not allowed to have partial IPv4 in IPv6. */
4814 {"http://[::192.0]",0,FALSE
},
4815 /* Can't have elision of 1 h16 at beginning of address. */
4816 {"http://[::2:3:4:5:6:7:8]",0,FALSE
},
4817 /* Expects a valid IP Literal. */
4818 {"ftp://[not.valid.uri]/",0,FALSE
},
4819 /* Expects valid port for a known scheme type. */
4820 {"ftp://www.winehq.org:123fgh",0,FALSE
},
4821 /* Port exceeds USHORT_MAX for known scheme type. */
4822 {"ftp://www.winehq.org:65536",0,FALSE
},
4823 /* Invalid port with IPv4 address. */
4824 {"http://www.winehq.org:1abcd",0,FALSE
},
4825 /* Invalid port with IPv6 address. */
4826 {"http://[::ffff]:32xy",0,FALSE
},
4827 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4828 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE
,FALSE
},
4829 /* Not allowed to have invalid % encoded data in opaque URI path. */
4830 {"news:test%XX",0,FALSE
},
4831 {"mailto:wine@winehq%G8.com",0,FALSE
},
4832 /* Known scheme types can't have invalid % encoded data in query string. */
4833 {"http://google.com/?query=te%xx",0,FALSE
},
4834 /* Invalid % encoded data in fragment of know scheme type. */
4835 {"ftp://google.com/#Test%xx",0,FALSE
},
4836 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4837 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4838 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4839 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4840 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4841 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4842 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4843 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4844 /* res URIs aren't allowed to have forbidden dos path characters in the
4847 {"res://c:\\te<st\\test/test",0,FALSE
},
4848 {"res://c:\\te>st\\test/test",0,FALSE
},
4849 {"res://c:\\te\"st\\test/test",0,FALSE
},
4850 {"res://c:\\test/te%xxst",0,FALSE
}
4853 typedef struct _uri_equality
{
4855 DWORD create_flags_a
;
4857 DWORD create_flags_b
;
4862 static const uri_equality equality_tests
[] = {
4864 "HTTP://www.winehq.org/test dir/./",0,
4865 "http://www.winehq.org/test dir/../test dir/",0,
4869 /* http://www.winehq.org/test%20dir */
4870 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4871 "http://www.winehq.org/test dir",0,
4875 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
4876 "file:///c:/test.mp3",0,
4880 "ftp://ftp.winehq.org/",0,
4881 "ftp://ftp.winehq.org",0,
4885 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4886 "ftp://ftp.winehq.org/t%45stB/",0,
4890 "http://google.com/TEST",0,
4891 "http://google.com/test",0,
4895 "http://GOOGLE.com/",0,
4896 "http://google.com/",0,
4899 /* Performs case insensitive compare of host names (for known scheme types). */
4901 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE
,
4902 "ftp://google.com/",0,
4906 "zip://GOOGLE.com/",0,
4907 "zip://google.com/",0,
4911 "file:///c:/TEST/TeST/",0,
4912 "file:///c:/test/test/",0,
4916 "file:///server/TEST",0,
4917 "file:///SERVER/TEST",0,
4921 "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
4922 "http://google.com/",0,
4926 "ftp://google.com:21/",0,
4927 "ftp://google.com/",0,
4931 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE
,
4932 "http://google.com/",0,
4936 "http://google.com:70/",0,
4937 "http://google.com:71/",0,
4941 "file:///c:/dir/file.txt", 0,
4942 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4946 "file:///c:/dir/file.txt", 0,
4947 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4951 "file:///c:/dir/file.txt", 0,
4952 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4956 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4957 "file:///c:/%20dir/file.txt", 0,
4961 "file:///c:/Dir/file.txt", 0,
4962 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH
,
4966 "file:///c:/dir/file.txt", 0,
4967 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4971 "file:///c:/dir/file.txt#a", 0,
4972 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH
,
4975 /* Tests of an empty hash/fragment part */
4977 "http://google.com/test",0,
4978 "http://google.com/test#",0,
4982 "ftp://ftp.winehq.org/",0,
4983 "ftp://ftp.winehq.org/#",0,
4987 "file:///c:/dir/file.txt#", 0,
4988 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4993 typedef struct _uri_with_fragment
{
4995 const char* fragment
;
4997 HRESULT create_expected
;
5000 const char* expected_uri
;
5002 } uri_with_fragment
;
5004 static const uri_with_fragment uri_fragment_tests
[] = {
5006 "http://google.com/","#fragment",0,S_OK
,FALSE
,
5007 "http://google.com/#fragment",FALSE
5010 "http://google.com/","fragment",0,S_OK
,FALSE
,
5011 "http://google.com/#fragment",FALSE
5014 "zip://test.com/","?test",0,S_OK
,FALSE
,
5015 "zip://test.com/#?test",FALSE
5017 /* The fragment can be empty. */
5019 "ftp://ftp.google.com/","",0,S_OK
,FALSE
,
5020 "ftp://ftp.google.com/#",FALSE
5024 typedef struct _uri_builder_property
{
5027 const char *expected_value
;
5028 Uri_PROPERTY property
;
5031 } uri_builder_property
;
5033 typedef struct _uri_builder_port
{
5041 typedef struct _uri_builder_str_property
{
5042 const char* expected
;
5045 } uri_builder_str_property
;
5047 typedef struct _uri_builder_dword_property
{
5051 } uri_builder_dword_property
;
5053 typedef struct _uri_builder_test
{
5056 HRESULT create_builder_expected
;
5057 BOOL create_builder_todo
;
5059 uri_builder_property properties
[URI_BUILDER_STR_PROPERTY_COUNT
];
5061 uri_builder_port port_prop
;
5067 DWORD uri_simple_encode_flags
;
5068 HRESULT uri_simple_hres
;
5069 BOOL uri_simple_todo
;
5071 DWORD uri_with_flags
;
5072 DWORD uri_with_builder_flags
;
5073 DWORD uri_with_encode_flags
;
5074 HRESULT uri_with_hres
;
5077 uri_builder_str_property expected_str_props
[URI_STR_PROPERTY_COUNT
];
5078 uri_builder_dword_property expected_dword_props
[URI_DWORD_PROPERTY_COUNT
];
5081 static const uri_builder_test uri_builder_tests
[] = {
5082 { "http://google.com/",0,S_OK
,FALSE
,
5084 {TRUE
,"#fragment",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
5085 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
},
5086 {TRUE
,"?query=x",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5087 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5094 {"http://username:password@google.com/?query=x#fragment",S_OK
},
5095 {"username:password@google.com",S_OK
},
5096 {"http://google.com/?query=x#fragment",S_OK
},
5097 {"google.com",S_OK
},
5100 {"google.com",S_OK
},
5105 {"http://username:password@google.com/?query=x#fragment",S_OK
},
5107 {"username:password",S_OK
},
5111 {Uri_HOST_DNS
,S_OK
},
5113 {URL_SCHEME_HTTP
,S_OK
},
5114 {URLZONE_INVALID
,E_NOTIMPL
}
5117 { "http://google.com/",0,S_OK
,FALSE
,
5119 {TRUE
,"test",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5121 {TRUE
,TRUE
,120,S_OK
,FALSE
},
5126 {"test://google.com:120/",S_OK
},
5127 {"google.com:120",S_OK
},
5128 {"test://google.com:120/",S_OK
},
5129 {"google.com",S_OK
},
5132 {"google.com",S_OK
},
5137 {"test://google.com:120/",S_OK
},
5143 {Uri_HOST_DNS
,S_OK
},
5145 {URL_SCHEME_UNKNOWN
,S_OK
},
5146 {URLZONE_INVALID
,E_NOTIMPL
}
5149 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5151 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5152 {TRUE
,"::192.2.3.4",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5153 {TRUE
,NULL
,NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5160 {"http://[::192.2.3.4]/",S_OK
},
5161 {"[::192.2.3.4]",S_OK
},
5162 {"http://[::192.2.3.4]/",S_OK
},
5166 {"::192.2.3.4",S_OK
},
5171 {"http://[::192.2.3.4]/",S_OK
},
5177 {Uri_HOST_IPV6
,S_OK
},
5179 {URL_SCHEME_HTTP
,S_OK
},
5180 {URLZONE_INVALID
,E_NOTIMPL
}
5183 { "http://google.com/",0,S_OK
,FALSE
,
5185 {TRUE
,"Frag","#Frag",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5192 {"http://google.com/#Frag",S_OK
},
5193 {"google.com",S_OK
},
5194 {"http://google.com/#Frag",S_OK
},
5195 {"google.com",S_OK
},
5198 {"google.com",S_OK
},
5203 {"http://google.com/#Frag",S_OK
},
5209 {Uri_HOST_DNS
,S_OK
},
5211 {URL_SCHEME_HTTP
,S_OK
},
5212 {URLZONE_INVALID
,E_NOTIMPL
}
5215 { "http://google.com/",0,S_OK
,FALSE
,
5217 {TRUE
,"","#",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
5224 {"http://google.com/#",S_OK
},
5225 {"google.com",S_OK
},
5226 {"http://google.com/#",S_OK
},
5227 {"google.com",S_OK
},
5230 {"google.com",S_OK
},
5235 {"http://google.com/#",S_OK
},
5241 {Uri_HOST_DNS
,S_OK
},
5243 {URL_SCHEME_HTTP
,S_OK
},
5244 {URLZONE_INVALID
,E_NOTIMPL
}
5247 { "http://google.com/",0,S_OK
,FALSE
,
5249 {TRUE
,":password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5256 {"http://::password@google.com/",S_OK
},
5257 {"::password@google.com",S_OK
},
5258 {"http://google.com/",S_OK
},
5259 {"google.com",S_OK
},
5262 {"google.com",S_OK
},
5267 {"http://::password@google.com/",S_OK
},
5269 {"::password",S_OK
},
5273 {Uri_HOST_DNS
,S_OK
},
5275 {URL_SCHEME_HTTP
,S_OK
},
5276 {URLZONE_INVALID
,E_NOTIMPL
}
5279 { "test/test",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5281 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5284 Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
5286 Uri_CREATE_ALLOW_RELATIVE
,0,0,S_OK
,FALSE
,
5288 {":password@test/test",S_OK
},
5289 {":password@",S_OK
},
5290 {":password@test/test",S_OK
},
5299 {":password@test/test",S_OK
},
5305 {Uri_HOST_UNKNOWN
,S_OK
},
5307 {URL_SCHEME_UNKNOWN
,S_OK
},
5308 {URLZONE_INVALID
,E_NOTIMPL
}
5311 { "http://google.com/",0,S_OK
,FALSE
,
5313 {TRUE
,"test/test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5320 {"http://google.com/test/test",S_OK
},
5321 {"google.com",S_OK
},
5322 {"http://google.com/test/test",S_OK
},
5323 {"google.com",S_OK
},
5326 {"google.com",S_OK
},
5328 {"/test/test",S_OK
},
5329 {"/test/test",S_OK
},
5331 {"http://google.com/test/test",S_OK
},
5337 {Uri_HOST_DNS
,S_OK
},
5339 {URL_SCHEME_HTTP
,S_OK
},
5340 {URLZONE_INVALID
,E_NOTIMPL
}
5343 { "zip:testing/test",0,S_OK
,FALSE
,
5345 {TRUE
,"test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5369 {Uri_HOST_UNKNOWN
,S_OK
},
5371 {URL_SCHEME_UNKNOWN
,S_OK
},
5372 {URLZONE_INVALID
,E_NOTIMPL
}
5375 { "http://google.com/",0,S_OK
,FALSE
,
5379 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5380 {TRUE
,FALSE
,555,S_OK
,FALSE
},
5385 {"http://google.com/",S_OK
},
5386 {"google.com",S_OK
},
5387 {"http://google.com/",S_OK
},
5388 {"google.com",S_OK
},
5391 {"google.com",S_OK
},
5396 {"http://google.com/",S_OK
},
5402 {Uri_HOST_DNS
,S_OK
},
5403 /* Still returns 80, even though earlier the port was disabled. */
5405 {URL_SCHEME_HTTP
,S_OK
},
5406 {URLZONE_INVALID
,E_NOTIMPL
}
5409 { "http://google.com/",0,S_OK
,FALSE
,
5413 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5414 * you'll get 122345 instead.
5416 {TRUE
,122345,222,S_OK
,FALSE
},
5421 {"http://google.com:222/",S_OK
},
5422 {"google.com:222",S_OK
},
5423 {"http://google.com:222/",S_OK
},
5424 {"google.com",S_OK
},
5427 {"google.com",S_OK
},
5432 {"http://google.com:222/",S_OK
},
5438 {Uri_HOST_DNS
,S_OK
},
5440 {URL_SCHEME_HTTP
,S_OK
},
5441 {URLZONE_INVALID
,E_NOTIMPL
}
5444 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5445 { "http://google.com/",0,S_OK
,FALSE
,
5449 {TRUE
,TRUE
,999999,S_OK
,FALSE
},
5454 {"http://google.com:999999/",S_OK
},
5455 {"google.com:999999",S_OK
},
5456 {"http://google.com:999999/",S_OK
},
5457 {"google.com",S_OK
},
5460 {"google.com",S_OK
},
5465 {"http://google.com:999999/",S_OK
},
5471 {Uri_HOST_DNS
,S_OK
},
5473 {URL_SCHEME_HTTP
,S_OK
},
5474 {URLZONE_INVALID
,E_NOTIMPL
}
5477 { "http://google.com/",0,S_OK
,FALSE
,
5479 {TRUE
,"test","?test",Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5487 {"http://google.com/?test",S_OK
},
5488 {"google.com",S_OK
},
5489 {"http://google.com/?test",S_OK
},
5490 {"google.com",S_OK
},
5493 {"google.com",S_OK
},
5498 {"http://google.com/?test",S_OK
},
5504 {Uri_HOST_DNS
,S_OK
},
5506 {URL_SCHEME_HTTP
,S_OK
},
5507 {URLZONE_INVALID
,E_NOTIMPL
}
5510 { "http://:password@google.com/",0,S_OK
,FALSE
,
5519 {"http://:password@google.com/",S_OK
},
5520 {":password@google.com",S_OK
},
5521 {"http://google.com/",S_OK
},
5522 {"google.com",S_OK
},
5525 {"google.com",S_OK
},
5530 {"http://:password@google.com/",S_OK
},
5536 {Uri_HOST_DNS
,S_OK
},
5538 {URL_SCHEME_HTTP
,S_OK
},
5539 {URLZONE_INVALID
,E_NOTIMPL
}
5542 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5543 { NULL
,0,S_OK
,FALSE
,
5545 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5546 {TRUE
,"google.com",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5553 {"http://google.com/",S_OK
},
5554 {"google.com",S_OK
},
5555 {"http://google.com/",S_OK
},
5556 {"google.com",S_OK
},
5559 {"google.com",S_OK
},
5564 {"http://google.com/",S_OK
},
5570 {Uri_HOST_DNS
,S_OK
},
5572 {URL_SCHEME_HTTP
,S_OK
},
5573 {URLZONE_INVALID
,E_NOTIMPL
}
5576 /* Can't set the scheme name to NULL. */
5577 { "zip://google.com/",0,S_OK
,FALSE
,
5579 {TRUE
,NULL
,"zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5586 {"zip://google.com/",S_OK
},
5587 {"google.com",S_OK
},
5588 {"zip://google.com/",S_OK
},
5589 {"google.com",S_OK
},
5592 {"google.com",S_OK
},
5597 {"zip://google.com/",S_OK
},
5603 {Uri_HOST_DNS
,S_OK
},
5605 {URL_SCHEME_UNKNOWN
,S_OK
},
5606 {URLZONE_INVALID
,E_NOTIMPL
}
5609 /* Can't set the scheme name to an empty string. */
5610 { "zip://google.com/",0,S_OK
,FALSE
,
5612 {TRUE
,"","zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5619 {"zip://google.com/",S_OK
},
5620 {"google.com",S_OK
},
5621 {"zip://google.com/",S_OK
},
5622 {"google.com",S_OK
},
5625 {"google.com",S_OK
},
5630 {"zip://google.com/",S_OK
},
5636 {Uri_HOST_DNS
,S_OK
},
5638 {URL_SCHEME_UNKNOWN
,S_OK
},
5639 {URLZONE_INVALID
,E_NOTIMPL
}
5642 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5643 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5645 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE
,S_OK
,FALSE
,
5650 0,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5652 {"http://google.com/../../",S_OK
},
5653 {"google.com",S_OK
},
5654 {"http://google.com/../../",S_OK
},
5655 {"google.com",S_OK
},
5658 {"google.com",S_OK
},
5663 {"http://google.com/../../",S_OK
},
5669 {Uri_HOST_DNS
,S_OK
},
5671 {URL_SCHEME_HTTP
,S_OK
},
5672 {URLZONE_INVALID
,E_NOTIMPL
}
5675 { "http://google.com/",0,S_OK
,FALSE
,
5677 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5682 Uri_CREATE_NO_DECODE_EXTRA_INFO
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5684 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5685 {"google.com",S_OK
},
5686 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5687 {"google.com",S_OK
},
5689 {"#Fr%3C%7C%3Eg",S_OK
},
5690 {"google.com",S_OK
},
5695 {"http://google.com/#Fr<|>g",S_OK
},
5701 {Uri_HOST_DNS
,S_OK
},
5703 {URL_SCHEME_HTTP
,S_OK
},
5704 {URLZONE_INVALID
,E_NOTIMPL
}
5707 { "http://google.com/",0,S_OK
,FALSE
,
5709 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5712 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,E_INVALIDARG
,FALSE
,
5714 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5716 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5717 {"google.com",S_OK
},
5718 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5719 {"google.com",S_OK
},
5721 {"#Fr%3C%7C%3Eg",S_OK
},
5722 {"google.com",S_OK
},
5727 {"http://google.com/#Fr<|>g",S_OK
},
5733 {Uri_HOST_DNS
,S_OK
},
5735 {URL_SCHEME_HTTP
,S_OK
},
5736 {URLZONE_INVALID
,E_NOTIMPL
}
5739 { NULL
,0,S_OK
,FALSE
,
5741 {TRUE
,"/test/test/",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5742 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5745 0,INET_E_INVALID_URL
,FALSE
,
5746 0,INET_E_INVALID_URL
,FALSE
,
5747 0,0,0,INET_E_INVALID_URL
,FALSE
5749 { "http://google.com/",0,S_OK
,FALSE
,
5751 {TRUE
,"ht%xxtp",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5754 0,INET_E_INVALID_URL
,FALSE
,
5755 0,INET_E_INVALID_URL
,FALSE
,
5756 0,0,0,INET_E_INVALID_URL
,FALSE
5758 /* File scheme's can't have a username set. */
5759 { "file://google.com/",0,S_OK
,FALSE
,
5761 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5764 0,INET_E_INVALID_URL
,FALSE
,
5765 0,INET_E_INVALID_URL
,FALSE
,
5766 0,0,0,INET_E_INVALID_URL
,FALSE
5768 /* File schemes can't have a password set. */
5769 { "file://google.com/",0,S_OK
,FALSE
,
5771 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5774 0,INET_E_INVALID_URL
,FALSE
,
5775 0,INET_E_INVALID_URL
,FALSE
,
5776 0,0,0,INET_E_INVALID_URL
,FALSE
5778 /* UserName can't contain any character that is a delimeter for another
5779 * component that appears after it in a normal URI.
5781 { "http://google.com/",0,S_OK
,FALSE
,
5783 {TRUE
,"user:pass",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5786 0,INET_E_INVALID_URL
,FALSE
,
5787 0,INET_E_INVALID_URL
,FALSE
,
5788 0,0,0,INET_E_INVALID_URL
,FALSE
5790 { "http://google.com/",0,S_OK
,FALSE
,
5792 {TRUE
,"user@google.com",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5795 0,INET_E_INVALID_URL
,FALSE
,
5796 0,INET_E_INVALID_URL
,FALSE
,
5797 0,0,0,INET_E_INVALID_URL
,FALSE
5799 { "http://google.com/",0,S_OK
,FALSE
,
5801 {TRUE
,"user/path",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5804 0,INET_E_INVALID_URL
,FALSE
,
5805 0,INET_E_INVALID_URL
,FALSE
,
5806 0,0,0,INET_E_INVALID_URL
,FALSE
5808 { "http://google.com/",0,S_OK
,FALSE
,
5810 {TRUE
,"user?Query",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5813 0,INET_E_INVALID_URL
,FALSE
,
5814 0,INET_E_INVALID_URL
,FALSE
,
5815 0,0,0,INET_E_INVALID_URL
,FALSE
5817 { "http://google.com/",0,S_OK
,FALSE
,
5819 {TRUE
,"user#Frag",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5822 0,INET_E_INVALID_URL
,FALSE
,
5823 0,INET_E_INVALID_URL
,FALSE
,
5824 0,0,0,INET_E_INVALID_URL
,FALSE
5826 { "http://google.com/",0,S_OK
,FALSE
,
5828 {TRUE
,"pass@google.com",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5831 0,INET_E_INVALID_URL
,FALSE
,
5832 0,INET_E_INVALID_URL
,FALSE
,
5833 0,0,0,INET_E_INVALID_URL
,FALSE
5835 { "http://google.com/",0,S_OK
,FALSE
,
5837 {TRUE
,"pass/path",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5840 0,INET_E_INVALID_URL
,FALSE
,
5841 0,INET_E_INVALID_URL
,FALSE
,
5842 0,0,0,INET_E_INVALID_URL
,FALSE
5844 { "http://google.com/",0,S_OK
,FALSE
,
5846 {TRUE
,"pass?query",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5849 0,INET_E_INVALID_URL
,FALSE
,
5850 0,INET_E_INVALID_URL
,FALSE
,
5851 0,0,0,INET_E_INVALID_URL
,FALSE
5853 { "http://google.com/",0,S_OK
,FALSE
,
5855 {TRUE
,"pass#frag",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5858 0,INET_E_INVALID_URL
,FALSE
,
5859 0,INET_E_INVALID_URL
,FALSE
,
5860 0,0,0,INET_E_INVALID_URL
,FALSE
5862 { "http://google.com/",0,S_OK
,FALSE
,
5864 {TRUE
,"winehq.org/test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5867 0,INET_E_INVALID_URL
,FALSE
,
5868 0,INET_E_INVALID_URL
,FALSE
,
5869 0,0,0,INET_E_INVALID_URL
,FALSE
5871 { "http://google.com/",0,S_OK
,FALSE
,
5873 {TRUE
,"winehq.org?test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5876 0,INET_E_INVALID_URL
,FALSE
,
5877 0,INET_E_INVALID_URL
,FALSE
,
5878 0,0,0,INET_E_INVALID_URL
,FALSE
5880 { "http://google.com/",0,S_OK
,FALSE
,
5882 {TRUE
,"winehq.org#test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5885 0,INET_E_INVALID_URL
,FALSE
,
5886 0,INET_E_INVALID_URL
,FALSE
,
5887 0,0,0,INET_E_INVALID_URL
,FALSE
5889 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5890 { "http://google.com/",0,S_OK
,FALSE
,
5892 {TRUE
,"winehq.org:test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5899 {"http://winehq.org:test/",S_OK
},
5900 {"winehq.org:test",S_OK
},
5901 {"http://winehq.org:test/",S_OK
},
5902 {"winehq.org:test",S_OK
},
5905 {"winehq.org:test",S_OK
},
5910 {"http://winehq.org:test/",S_OK
},
5916 {Uri_HOST_DNS
,S_OK
},
5918 {URL_SCHEME_HTTP
,S_OK
},
5919 {URLZONE_INVALID
,E_NOTIMPL
}
5922 /* Can't set the host name to NULL. */
5923 { "http://google.com/",0,S_OK
,FALSE
,
5925 {TRUE
,NULL
,"google.com",Uri_PROPERTY_HOST
,E_INVALIDARG
,FALSE
}
5932 {"http://google.com/",S_OK
},
5933 {"google.com",S_OK
},
5934 {"http://google.com/",S_OK
},
5935 {"google.com",S_OK
},
5938 {"google.com",S_OK
},
5943 {"http://google.com/",S_OK
},
5949 {Uri_HOST_DNS
,S_OK
},
5951 {URL_SCHEME_HTTP
,S_OK
},
5952 {URLZONE_INVALID
,E_NOTIMPL
}
5955 /* Can set the host name to an empty string. */
5956 { "http://google.com/",0,S_OK
,FALSE
,
5958 {TRUE
,"",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5982 {Uri_HOST_UNKNOWN
,S_OK
},
5984 {URL_SCHEME_HTTP
,S_OK
},
5985 {URLZONE_INVALID
,E_NOTIMPL
}
5988 { "http://google.com/",0,S_OK
,FALSE
,
5990 {TRUE
,"/path?query",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5993 0,INET_E_INVALID_URL
,FALSE
,
5994 0,INET_E_INVALID_URL
,FALSE
,
5995 0,0,0,INET_E_INVALID_URL
,FALSE
5997 { "http://google.com/",0,S_OK
,FALSE
,
5999 {TRUE
,"/path#test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
6002 0,INET_E_INVALID_URL
,FALSE
,
6003 0,INET_E_INVALID_URL
,FALSE
,
6004 0,0,0,INET_E_INVALID_URL
,FALSE
6006 { "http://google.com/",0,S_OK
,FALSE
,
6008 {TRUE
,"?path#test",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
}
6011 0,INET_E_INVALID_URL
,FALSE
,
6012 0,INET_E_INVALID_URL
,FALSE
,
6013 0,0,0,INET_E_INVALID_URL
,FALSE
6015 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
6017 {TRUE
,NULL
,NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
6024 {"file:///c:/dir/file.html",S_OK
},
6026 {"file:///c:/dir/file.html",S_OK
},
6032 {"/c:/dir/file.html",S_OK
},
6033 {"/c:/dir/file.html",S_OK
},
6035 {"file:///c:/dir/file.html",S_OK
},
6041 {Uri_HOST_UNKNOWN
,S_OK
},
6043 {URL_SCHEME_FILE
,S_OK
},
6044 {URLZONE_INVALID
,E_NOTIMPL
}
6047 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
6049 {TRUE
,"#",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
6056 {"file:///c:/dir/file.html#",S_OK
},
6058 {"file:///c:/dir/file.html#",S_OK
},
6064 {"/c:/dir/file.html",S_OK
},
6065 {"/c:/dir/file.html",S_OK
},
6067 {"file:///c:/dir/file.html#",S_OK
},
6073 {Uri_HOST_UNKNOWN
,S_OK
},
6075 {URL_SCHEME_FILE
,S_OK
},
6076 {URLZONE_INVALID
,E_NOTIMPL
}
6081 typedef struct _uri_builder_remove_test
{
6084 HRESULT create_builder_expected
;
6085 BOOL create_builder_todo
;
6087 DWORD remove_properties
;
6088 HRESULT remove_expected
;
6091 const char *expected_uri
;
6092 DWORD expected_flags
;
6093 HRESULT expected_hres
;
6095 } uri_builder_remove_test
;
6097 static const uri_builder_remove_test uri_builder_remove_tests
[] = {
6098 { "http://google.com/test?test=y#Frag",0,S_OK
,FALSE
,
6099 Uri_HAS_FRAGMENT
|Uri_HAS_PATH
|Uri_HAS_QUERY
,S_OK
,FALSE
,
6100 "http://google.com/",0,S_OK
,FALSE
6102 { "http://user:pass@winehq.org/",0,S_OK
,FALSE
,
6103 Uri_HAS_USER_NAME
|Uri_HAS_PASSWORD
,S_OK
,FALSE
,
6104 "http://winehq.org/",0,S_OK
,FALSE
6106 { "zip://google.com?Test=x",0,S_OK
,FALSE
,
6107 Uri_HAS_HOST
,S_OK
,FALSE
,
6108 "zip:/?Test=x",0,S_OK
,FALSE
6110 /* Doesn't remove the whole userinfo component. */
6111 { "http://username:pass@google.com/",0,S_OK
,FALSE
,
6112 Uri_HAS_USER_INFO
,S_OK
,FALSE
,
6113 "http://username:pass@google.com/",0,S_OK
,FALSE
6115 /* Doesn't remove the domain. */
6116 { "http://google.com/",0,S_OK
,FALSE
,
6117 Uri_HAS_DOMAIN
,S_OK
,FALSE
,
6118 "http://google.com/",0,S_OK
,FALSE
6120 { "http://google.com:120/",0,S_OK
,FALSE
,
6121 Uri_HAS_AUTHORITY
,S_OK
,FALSE
,
6122 "http://google.com:120/",0,S_OK
,FALSE
6124 { "http://google.com/test.com/",0,S_OK
,FALSE
,
6125 Uri_HAS_EXTENSION
,S_OK
,FALSE
,
6126 "http://google.com/test.com/",0,S_OK
,FALSE
6128 { "http://google.com/?test=x",0,S_OK
,FALSE
,
6129 Uri_HAS_PATH_AND_QUERY
,S_OK
,FALSE
,
6130 "http://google.com/?test=x",0,S_OK
,FALSE
6132 /* Can't remove the scheme name. */
6133 { "http://google.com/?test=x",0,S_OK
,FALSE
,
6134 Uri_HAS_SCHEME_NAME
|Uri_HAS_QUERY
,E_INVALIDARG
,FALSE
,
6135 "http://google.com/?test=x",0,S_OK
,FALSE
6139 typedef struct _uri_combine_str_property
{
6143 const char *broken_value
;
6144 const char *value_ex
;
6145 } uri_combine_str_property
;
6147 typedef struct _uri_combine_test
{
6148 const char *base_uri
;
6149 DWORD base_create_flags
;
6150 const char *relative_uri
;
6151 DWORD relative_create_flags
;
6152 DWORD combine_flags
;
6156 uri_combine_str_property str_props
[URI_STR_PROPERTY_COUNT
];
6157 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
6160 static const uri_combine_test uri_combine_tests
[] = {
6161 { "http://google.com/fun/stuff",0,
6162 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE
,
6165 {"http://google.com/not/fun/stuff",S_OK
},
6166 {"google.com",S_OK
},
6167 {"http://google.com/not/fun/stuff",S_OK
},
6168 {"google.com",S_OK
},
6171 {"google.com",S_OK
},
6173 {"/not/fun/stuff",S_OK
},
6174 {"/not/fun/stuff",S_OK
},
6176 {"http://google.com/not/fun/stuff",S_OK
},
6182 {Uri_HOST_DNS
,S_OK
},
6184 {URL_SCHEME_HTTP
,S_OK
},
6185 {URLZONE_INVALID
,E_NOTIMPL
}
6188 { "http://google.com/test",0,
6189 "zip://test.com/cool",0,
6192 {"zip://test.com/cool",S_OK
},
6194 {"zip://test.com/cool",S_OK
},
6203 {"zip://test.com/cool",S_OK
},
6209 {Uri_HOST_DNS
,S_OK
},
6211 {URL_SCHEME_UNKNOWN
,S_OK
},
6212 {URLZONE_INVALID
,E_NOTIMPL
}
6215 { "http://google.com/use/base/path",0,
6216 "?relative",Uri_CREATE_ALLOW_RELATIVE
,
6219 {"http://google.com/use/base/path?relative",S_OK
},
6220 {"google.com",S_OK
},
6221 {"http://google.com/use/base/path?relative",S_OK
},
6222 {"google.com",S_OK
},
6225 {"google.com",S_OK
},
6227 {"/use/base/path",S_OK
},
6228 {"/use/base/path?relative",S_OK
},
6230 {"http://google.com/use/base/path?relative",S_OK
},
6236 {Uri_HOST_DNS
,S_OK
},
6238 {URL_SCHEME_HTTP
,S_OK
},
6239 {URLZONE_INVALID
,E_NOTIMPL
}
6242 { "http://google.com/path",0,
6243 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
6246 {"http://google.com/testing",S_OK
},
6247 {"google.com",S_OK
},
6248 {"http://google.com/testing",S_OK
},
6249 {"google.com",S_OK
},
6252 {"google.com",S_OK
},
6257 {"http://google.com/testing",S_OK
},
6263 {Uri_HOST_DNS
,S_OK
},
6265 {URL_SCHEME_HTTP
,S_OK
},
6266 {URLZONE_INVALID
,E_NOTIMPL
}
6269 { "http://google.com/path",0,
6270 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
6271 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6273 {"http://google.com:80/test/../test/.././testing",S_OK
},
6274 {"google.com",S_OK
},
6275 {"http://google.com:80/test/../test/.././testing",S_OK
},
6276 {"google.com",S_OK
},
6279 {"google.com",S_OK
},
6281 {"/test/../test/.././testing",S_OK
},
6282 {"/test/../test/.././testing",S_OK
},
6284 {"http://google.com:80/test/../test/.././testing",S_OK
},
6290 {Uri_HOST_DNS
,S_OK
},
6292 {URL_SCHEME_HTTP
,S_OK
},
6293 {URLZONE_INVALID
,E_NOTIMPL
}
6296 { "http://winehq.org/test/abc",0,
6297 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6300 {"http://winehq.org/test/testing/test",S_OK
},
6301 {"winehq.org",S_OK
},
6302 {"http://winehq.org/test/testing/test",S_OK
},
6303 {"winehq.org",S_OK
},
6306 {"winehq.org",S_OK
},
6308 {"/test/testing/test",S_OK
},
6309 {"/test/testing/test",S_OK
},
6311 {"http://winehq.org/test/testing/test",S_OK
},
6317 {Uri_HOST_DNS
,S_OK
},
6319 {URL_SCHEME_HTTP
,S_OK
},
6320 {URLZONE_INVALID
,E_NOTIMPL
}
6323 { "http://winehq.org/test/abc",0,
6324 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6325 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6327 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6328 /* Default port is hidden in the authority. */
6329 {"winehq.org",S_OK
},
6330 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6331 {"winehq.org",S_OK
},
6334 {"winehq.org",S_OK
},
6336 {"/test/testing/abc/../test",S_OK
},
6337 {"/test/testing/abc/../test",S_OK
},
6339 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6345 {Uri_HOST_DNS
,S_OK
},
6347 {URL_SCHEME_HTTP
,S_OK
},
6348 {URLZONE_INVALID
,E_NOTIMPL
}
6351 { "http://winehq.org/test?query",0,
6352 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6355 {"http://winehq.org/testing",S_OK
},
6356 {"winehq.org",S_OK
},
6357 {"http://winehq.org/testing",S_OK
},
6358 {"winehq.org",S_OK
},
6361 {"winehq.org",S_OK
},
6366 {"http://winehq.org/testing",S_OK
},
6372 {Uri_HOST_DNS
,S_OK
},
6374 {URL_SCHEME_HTTP
,S_OK
},
6375 {URLZONE_INVALID
,E_NOTIMPL
}
6378 { "http://winehq.org/test#frag",0,
6379 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6382 {"http://winehq.org/testing",S_OK
},
6383 {"winehq.org",S_OK
},
6384 {"http://winehq.org/testing",S_OK
},
6385 {"winehq.org",S_OK
},
6388 {"winehq.org",S_OK
},
6393 {"http://winehq.org/testing",S_OK
},
6399 {Uri_HOST_DNS
,S_OK
},
6401 {URL_SCHEME_HTTP
,S_OK
},
6402 {URLZONE_INVALID
,E_NOTIMPL
}
6405 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE
,
6406 "test",Uri_CREATE_ALLOW_RELATIVE
,
6426 {Uri_HOST_UNKNOWN
,S_OK
},
6428 {URL_SCHEME_UNKNOWN
,S_OK
},
6429 {URLZONE_INVALID
,E_NOTIMPL
}
6432 { "file:///c:/test/test",0,
6433 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6434 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6436 {"file://c:\\testing.mp3",S_OK
},
6438 {"file://c:\\testing.mp3",S_OK
},
6444 {"c:\\testing.mp3",S_OK
},
6445 {"c:\\testing.mp3",S_OK
},
6447 {"file://c:\\testing.mp3",S_OK
},
6453 {Uri_HOST_UNKNOWN
,S_OK
},
6455 {URL_SCHEME_FILE
,S_OK
},
6456 {URLZONE_INVALID
,E_NOTIMPL
}
6459 { "file:///c:/test/test",0,
6460 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6463 {"file:///c:/testing.mp3",S_OK
},
6465 {"file:///c:/testing.mp3",S_OK
},
6471 {"/c:/testing.mp3",S_OK
},
6472 {"/c:/testing.mp3",S_OK
},
6474 {"file:///c:/testing.mp3",S_OK
},
6480 {Uri_HOST_UNKNOWN
,S_OK
},
6482 {URL_SCHEME_FILE
,S_OK
},
6483 {URLZONE_INVALID
,E_NOTIMPL
}
6486 { "file://test.com/test/test",0,
6487 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6488 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6490 {"file://\\\\test.com\\testing.mp3",S_OK
},
6492 {"file://\\\\test.com\\testing.mp3",S_OK
},
6498 {"\\testing.mp3",S_OK
},
6499 {"\\testing.mp3",S_OK
},
6501 {"file://\\\\test.com\\testing.mp3",S_OK
},
6507 {Uri_HOST_DNS
,S_OK
},
6509 {URL_SCHEME_FILE
,S_OK
},
6510 {URLZONE_INVALID
,E_NOTIMPL
}
6513 /* URL_DONT_SIMPLIFY has no effect. */
6514 { "http://google.com/test",0,
6515 "zip://test.com/cool/../cool/test",0,
6516 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6518 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6520 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6526 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6527 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6529 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6530 * On IE 7 it reduces the path in the Raw URI.
6532 {"zip://test.com/cool/../cool/test",S_OK
,FALSE
,"zip://test.com/cool/test"},
6538 {Uri_HOST_DNS
,S_OK
},
6540 {URL_SCHEME_UNKNOWN
,S_OK
},
6541 {URLZONE_INVALID
,E_NOTIMPL
}
6544 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6545 * resulting URI is converted into a dos path.
6547 { "http://google.com/test",0,
6548 "file:///c:/test/",0,
6549 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6551 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6553 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6559 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6560 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6562 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6568 {Uri_HOST_UNKNOWN
,S_OK
},
6570 {URL_SCHEME_FILE
,S_OK
},
6571 {URLZONE_INVALID
,E_NOTIMPL
}
6574 { "http://google.com/test",0,
6575 "http://test.com/test#%30test",0,
6576 URL_DONT_UNESCAPE_EXTRA_INFO
,S_OK
,FALSE
,
6578 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6580 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6583 {"#0test",S_OK
,FALSE
,NULL
,"#%30test"},
6589 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6590 {"http://test.com/test#%30test",S_OK
,FALSE
,"http://test.com/test#0test"},
6596 {Uri_HOST_DNS
,S_OK
},
6598 {URL_SCHEME_HTTP
,S_OK
},
6599 {URLZONE_INVALID
,E_NOTIMPL
}
6602 /* Windows validates the path component from the relative Uri. */
6603 { "http://google.com/test",0,
6604 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE
,
6605 0,E_INVALIDARG
,FALSE
6607 /* Windows doesn't validate the query from the relative Uri. */
6608 { "http://google.com/test",0,
6609 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6612 {"http://google.com/test?Tes%XXt",S_OK
},
6613 {"google.com",S_OK
},
6614 {"http://google.com/test?Tes%XXt",S_OK
},
6615 {"google.com",S_OK
},
6618 {"google.com",S_OK
},
6621 {"/test?Tes%XXt",S_OK
},
6623 {"http://google.com/test?Tes%XXt",S_OK
},
6629 {Uri_HOST_DNS
,S_OK
},
6631 {URL_SCHEME_HTTP
,S_OK
},
6632 {URLZONE_INVALID
,E_NOTIMPL
}
6635 /* Windows doesn't validate the fragment from the relative Uri. */
6636 { "http://google.com/test",0,
6637 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6640 {"http://google.com/test#Tes%XXt",S_OK
},
6641 {"google.com",S_OK
},
6642 {"http://google.com/test#Tes%XXt",S_OK
},
6643 {"google.com",S_OK
},
6646 {"google.com",S_OK
},
6651 {"http://google.com/test#Tes%XXt",S_OK
},
6657 {Uri_HOST_DNS
,S_OK
},
6659 {URL_SCHEME_HTTP
,S_OK
},
6660 {URLZONE_INVALID
,E_NOTIMPL
}
6663 /* Creates an IUri which contains an invalid dos path char. */
6664 { "file:///c:/test",0,
6665 "/test<ing",Uri_CREATE_ALLOW_RELATIVE
,
6666 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6668 {"file://c:\\test<ing",S_OK
},
6670 {"file://c:\\test<ing",S_OK
},
6676 {"c:\\test<ing",S_OK
},
6677 {"c:\\test<ing",S_OK
},
6679 {"file://c:\\test<ing",S_OK
},
6685 {Uri_HOST_UNKNOWN
,S_OK
},
6687 {URL_SCHEME_FILE
,S_OK
},
6688 {URLZONE_INVALID
,E_NOTIMPL
}
6691 /* Appends the path after the drive letter (if any). */
6692 { "file:///c:/test",0,
6693 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE
,
6696 {"file:///c:/c:/testing",S_OK
},
6698 {"file:///c:/c:/testing",S_OK
},
6704 {"/c:/c:/testing",S_OK
},
6705 {"/c:/c:/testing",S_OK
},
6707 {"file:///c:/c:/testing",S_OK
},
6713 {Uri_HOST_UNKNOWN
,S_OK
},
6715 {URL_SCHEME_FILE
,S_OK
},
6716 {URLZONE_INVALID
,E_NOTIMPL
}
6719 /* A '/' is added if the base URI doesn't have a path and the
6720 * relative URI doesn't contain a path (since the base URI is
6723 { "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
6724 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6727 {"http://google.com/?test",S_OK
},
6728 {"google.com",S_OK
},
6729 {"http://google.com/?test",S_OK
},
6730 {"google.com",S_OK
},
6733 {"google.com",S_OK
},
6738 {"http://google.com/?test",S_OK
},
6744 {Uri_HOST_DNS
,S_OK
},
6746 {URL_SCHEME_HTTP
,S_OK
},
6747 {URLZONE_INVALID
,E_NOTIMPL
}
6750 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE
,
6751 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6754 {"zip://google.com/?test",S_OK
},
6755 {"google.com",S_OK
},
6756 {"zip://google.com/?test",S_OK
},
6757 {"google.com",S_OK
},
6760 {"google.com",S_OK
},
6765 {"zip://google.com/?test",S_OK
},
6771 {Uri_HOST_DNS
,S_OK
},
6773 {URL_SCHEME_UNKNOWN
,S_OK
},
6774 {URLZONE_INVALID
,E_NOTIMPL
}
6777 /* No path is appended since the base URI is opaque. */
6779 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6799 {Uri_HOST_UNKNOWN
,S_OK
},
6801 {URL_SCHEME_UNKNOWN
,S_OK
},
6802 {URLZONE_INVALID
,E_NOTIMPL
}
6806 "../testing/test",Uri_CREATE_ALLOW_RELATIVE
,
6809 {"file:///c:/testing/test",S_OK
},
6811 {"file:///c:/testing/test",S_OK
},
6817 {"/c:/testing/test",S_OK
},
6818 {"/c:/testing/test",S_OK
},
6820 {"file:///c:/testing/test",S_OK
},
6826 {Uri_HOST_UNKNOWN
,S_OK
},
6828 {URL_SCHEME_FILE
,S_OK
},
6829 {URLZONE_INVALID
,E_NOTIMPL
}
6832 { "http://winehq.org/dir/testfile",0,
6833 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6836 {"http://winehq.org/dir/test?querystring",S_OK
},
6837 {"winehq.org",S_OK
},
6838 {"http://winehq.org/dir/test?querystring",S_OK
},
6839 {"winehq.org",S_OK
},
6842 {"winehq.org",S_OK
},
6845 {"/dir/test?querystring",S_OK
},
6846 {"?querystring",S_OK
},
6847 {"http://winehq.org/dir/test?querystring",S_OK
},
6853 {Uri_HOST_DNS
,S_OK
},
6855 {URL_SCHEME_HTTP
,S_OK
},
6856 {URLZONE_INVALID
,E_NOTIMPL
}
6859 { "http://winehq.org/dir/test",0,
6860 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6863 {"http://winehq.org/dir/test?querystring",S_OK
},
6864 {"winehq.org",S_OK
},
6865 {"http://winehq.org/dir/test?querystring",S_OK
},
6866 {"winehq.org",S_OK
},
6869 {"winehq.org",S_OK
},
6872 {"/dir/test?querystring",S_OK
},
6873 {"?querystring",S_OK
},
6874 {"http://winehq.org/dir/test?querystring",S_OK
},
6880 {Uri_HOST_DNS
,S_OK
},
6882 {URL_SCHEME_HTTP
,S_OK
},
6883 {URLZONE_INVALID
,E_NOTIMPL
}
6886 { "http://winehq.org/dir/test?querystring",0,
6887 "#hash",Uri_CREATE_ALLOW_RELATIVE
,
6890 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6891 {"winehq.org",S_OK
},
6892 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6893 {"winehq.org",S_OK
},
6896 {"winehq.org",S_OK
},
6899 {"/dir/test?querystring",S_OK
},
6900 {"?querystring",S_OK
},
6901 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6907 {Uri_HOST_DNS
,S_OK
},
6909 {URL_SCHEME_HTTP
,S_OK
},
6910 {URLZONE_INVALID
,E_NOTIMPL
}
6913 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6914 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6917 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6919 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6925 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6926 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6928 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6934 {Uri_HOST_UNKNOWN
,S_OK
},
6936 {URL_SCHEME_MK
,S_OK
},
6937 {URLZONE_INVALID
,E_NOTIMPL
}
6940 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6941 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6944 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6946 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6952 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6953 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6955 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6961 {Uri_HOST_UNKNOWN
,S_OK
},
6963 {URL_SCHEME_MK
,S_OK
},
6964 {URLZONE_INVALID
,E_NOTIMPL
}
6967 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6968 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6971 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6973 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6979 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6980 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6982 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6988 {Uri_HOST_UNKNOWN
,S_OK
},
6990 {URL_SCHEME_MK
,S_OK
},
6991 {URLZONE_INVALID
,E_NOTIMPL
}
6994 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
6995 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6998 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7000 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7006 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7007 {"@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7009 {"mk:@MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7015 {Uri_HOST_UNKNOWN
,S_OK
},
7017 {URL_SCHEME_MK
,S_OK
},
7018 {URLZONE_INVALID
,E_NOTIMPL
}
7021 { "mk:MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7022 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7025 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7027 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7033 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7034 {"MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7036 {"mk:MSITSTORE:C:\\dir\\file.chm::/relative/path.txt",S_OK
},
7042 {Uri_HOST_UNKNOWN
,S_OK
},
7044 {URL_SCHEME_MK
,S_OK
},
7045 {URLZONE_INVALID
,E_NOTIMPL
}
7048 { "mk:@MSITSTORE:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7049 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7052 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7054 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7060 {"@MSITSTORE:/relative/path.txt",S_OK
},
7061 {"@MSITSTORE:/relative/path.txt",S_OK
},
7063 {"mk:@MSITSTORE:/relative/path.txt",S_OK
},
7069 {Uri_HOST_UNKNOWN
,S_OK
},
7071 {URL_SCHEME_MK
,S_OK
},
7072 {URLZONE_INVALID
,E_NOTIMPL
}
7075 { "mk:@xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7076 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7079 {"mk:@xxx:/relative/path.txt",S_OK
},
7081 {"mk:@xxx:/relative/path.txt",S_OK
},
7087 {"@xxx:/relative/path.txt",S_OK
},
7088 {"@xxx:/relative/path.txt",S_OK
},
7090 {"mk:@xxx:/relative/path.txt",S_OK
},
7096 {Uri_HOST_UNKNOWN
,S_OK
},
7098 {URL_SCHEME_MK
,S_OK
},
7099 {URLZONE_INVALID
,E_NOTIMPL
}
7102 { "mk:xxx:C:\\dir\\file.chm::/subdir/../../file.txt",0,
7103 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7106 {"mk:/relative/path.txt",S_OK
},
7108 {"mk:/relative/path.txt",S_OK
},
7114 {"/relative/path.txt",S_OK
},
7115 {"/relative/path.txt",S_OK
},
7117 {"mk:/relative/path.txt",S_OK
},
7123 {Uri_HOST_UNKNOWN
,S_OK
},
7125 {URL_SCHEME_MK
,S_OK
},
7126 {URLZONE_INVALID
,E_NOTIMPL
}
7129 { "ml:@MSITSTORE:C:\\dir\\file.chm::/subdir/file.txt",0,
7130 "/relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
7133 {"ml:/relative/path.txt",S_OK
},
7135 {"ml:/relative/path.txt",S_OK
},
7141 {"/relative/path.txt",S_OK
},
7142 {"/relative/path.txt",S_OK
},
7144 {"ml:/relative/path.txt",S_OK
},
7150 {Uri_HOST_UNKNOWN
,S_OK
},
7152 {URL_SCHEME_UNKNOWN
,S_OK
},
7153 {URLZONE_INVALID
,E_NOTIMPL
}
7156 { "http://winehq.org/dir/test?querystring",0,
7157 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE
,
7160 {"http://winehq.com/#hash",S_OK
},
7161 {"winehq.com",S_OK
},
7162 {"http://winehq.com/#hash",S_OK
},
7163 {"winehq.com",S_OK
},
7166 {"winehq.com",S_OK
},
7171 {"http://winehq.com/#hash",S_OK
},
7177 {Uri_HOST_DNS
,S_OK
},
7178 {80,S_OK
,FALSE
,TRUE
},
7179 {URL_SCHEME_HTTP
,S_OK
},
7180 {URLZONE_INVALID
,E_NOTIMPL
}
7183 { "http://winehq.org/dir/test?querystring",0,
7184 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE
,
7187 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7188 {"winehq.com",S_OK
},
7189 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7190 {"winehq.com",S_OK
},
7193 {"winehq.com",S_OK
},
7195 {"/dir/file.txt",S_OK
},
7196 {"/dir/file.txt?query",S_OK
},
7198 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
7204 {Uri_HOST_DNS
,S_OK
},
7205 {80,S_OK
,FALSE
,TRUE
},
7206 {URL_SCHEME_HTTP
,S_OK
},
7207 {URLZONE_INVALID
,E_NOTIMPL
}
7210 { "http://google.com/test",0,
7211 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
7214 {"file:///c:/test/",S_OK
},
7216 {"file:///c:/test/",S_OK
},
7225 {"c:\\test\\",S_OK
,FALSE
,"file:///c:/test/"},
7231 {Uri_HOST_UNKNOWN
,S_OK
},
7233 {URL_SCHEME_FILE
,S_OK
},
7234 {URLZONE_INVALID
,E_NOTIMPL
}
7237 { "http://google.com/test",0,
7238 "c:\\test\\", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
7241 {"file:///c:/test/",S_OK
},
7243 {"file:///c:/test/",S_OK
},
7252 {"c:\\test\\",S_OK
,FALSE
,"file:///c:/test/"},
7258 {Uri_HOST_UNKNOWN
,S_OK
},
7260 {URL_SCHEME_FILE
,S_OK
},
7261 {URLZONE_INVALID
,E_NOTIMPL
}
7264 { "http://winehq.org",0,
7265 "mailto://",Uri_CREATE_NO_CANONICALIZE
,
7279 {"mailto://",S_OK
,FALSE
,"mailto:"},
7285 {Uri_HOST_UNKNOWN
,S_OK
},
7287 {URL_SCHEME_MAILTO
,S_OK
},
7288 {URLZONE_INVALID
,E_NOTIMPL
}
7291 { "http://winehq.org",0,
7292 "mailto://a@b.com",Uri_CREATE_NO_CANONICALIZE
,
7295 {"mailto:a@b.com",S_OK
},
7297 {"mailto:a@b.com",S_OK
},
7306 {"mailto://a@b.com",S_OK
,FALSE
,"mailto:a@b.com"},
7312 {Uri_HOST_UNKNOWN
,S_OK
},
7314 {URL_SCHEME_MAILTO
,S_OK
},
7315 {URLZONE_INVALID
,E_NOTIMPL
}
7320 typedef struct _uri_parse_test
{
7325 const char *property
;
7330 static const uri_parse_test uri_parse_tests
[] = {
7331 /* PARSE_CANONICALIZE tests. */
7332 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"zip://google.com/test<|>",S_OK
,FALSE
},
7333 {"http://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"http://google.com/test%3C%7C%3E",S_OK
,FALSE
},
7334 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE
,URL_UNESCAPE
,"http://google.com/0#?",S_OK
,FALSE
},
7335 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_UNSAFE
,"test %3C%7C%3E",S_OK
,FALSE
},
7336 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_SPACES_ONLY
,"test%20<|>",S_OK
,FALSE
},
7337 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_UNESCAPE
|URL_ESCAPE_UNSAFE
,"test%20%3C%7C%3E",S_OK
,FALSE
},
7338 {"http://google.com/%20",0,PARSE_CANONICALIZE
,URL_ESCAPE_PERCENT
,"http://google.com/%2520",S_OK
,FALSE
},
7339 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"http://google.com/test/../",S_OK
,FALSE
},
7340 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_NO_META
,"http://google.com/test/../",S_OK
,FALSE
},
7341 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"http://google.com/",S_OK
,FALSE
},
7342 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"zip://google.com/",S_OK
,FALSE
},
7343 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"file:///c:/test/../test",S_OK
,FALSE
},
7345 /* PARSE_FRIENDLY tests. */
7346 {"http://test@google.com/test#test",0,PARSE_FRIENDLY
,0,"http://google.com/test#test",S_OK
,FALSE
},
7347 {"zip://test@google.com/test",0,PARSE_FRIENDLY
,0,"zip://test@google.com/test",S_OK
,FALSE
},
7349 /* PARSE_ROOTDOCUMENT tests. */
7350 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT
,0,"http://google.com:200/",S_OK
,FALSE
},
7351 {"http://google.com",Uri_CREATE_NO_CANONICALIZE
,PARSE_ROOTDOCUMENT
,0,"http://google.com/",S_OK
,FALSE
},
7352 {"zip://google.com/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7353 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7354 {"file://server/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7355 {"zip:test/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
7357 /* PARSE_DOCUMENT tests. */
7358 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT
,0,"http://test@google.com/test?query",S_OK
,FALSE
},
7359 {"http:testing#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7360 {"file:///c:/test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7361 {"zip://google.com/#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7362 {"zip:test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7363 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
7365 /* PARSE_PATH_FROM_URL tests. */
7366 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
,FALSE
},
7367 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\t<|>est.mp3",S_OK
,FALSE
},
7368 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL
,0,"c:\\te%XX t\\",S_OK
,FALSE
},
7369 {"file://server/test",0,PARSE_PATH_FROM_URL
,0,"\\\\server\\test",S_OK
,FALSE
},
7370 {"http://google.com/",0,PARSE_PATH_FROM_URL
,0,"",E_INVALIDARG
,FALSE
},
7372 /* PARSE_URL_FROM_PATH tests. */
7373 /* This function almost seems to useless (just returns the absolute uri). */
7374 {"test.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"test.com",S_OK
,FALSE
},
7375 {"/test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"/test/test",S_OK
,FALSE
},
7376 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH
,PARSE_URL_FROM_PATH
,0,"file://c:\\test\\test",S_OK
,FALSE
},
7377 {"file:c:/test",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
7378 {"http:google.com/",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
7380 /* PARSE_SCHEMA tests. */
7381 {"http://google.com/test",0,PARSE_SCHEMA
,0,"http",S_OK
,FALSE
},
7382 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SCHEMA
,0,"",S_OK
,FALSE
},
7384 /* PARSE_SITE tests. */
7385 {"http://google.uk.com/",0,PARSE_SITE
,0,"google.uk.com",S_OK
,FALSE
},
7386 {"http://google.com.com/",0,PARSE_SITE
,0,"google.com.com",S_OK
,FALSE
},
7387 {"google.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SITE
,0,"",S_OK
,FALSE
},
7388 {"file://server/test",0,PARSE_SITE
,0,"server",S_OK
,FALSE
},
7390 /* PARSE_DOMAIN tests. */
7391 {"http://google.com.uk/",0,PARSE_DOMAIN
,0,"google.com.uk",S_OK
,FALSE
},
7392 {"http://google.com.com/",0,PARSE_DOMAIN
,0,"com.com",S_OK
,FALSE
},
7393 {"test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
7394 {"file://server/test",0,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
7396 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
7397 {"http://google.com/test#Test",0,PARSE_ANCHOR
,0,"#Test",S_OK
,FALSE
},
7398 {"http://google.com/test#Test",0,PARSE_LOCATION
,0,"#Test",S_OK
,FALSE
},
7399 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_ANCHOR
,0,"",S_OK
,FALSE
},
7400 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_LOCATION
,0,"",S_OK
,FALSE
}
7403 static inline LPWSTR
a2w(LPCSTR str
) {
7407 DWORD len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
7408 ret
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
7409 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
7415 static inline BOOL
heap_free(void* mem
) {
7416 return HeapFree(GetProcessHeap(), 0, mem
);
7419 static inline DWORD
strcmp_aw(LPCSTR strA
, LPCWSTR strB
) {
7420 LPWSTR strAW
= a2w(strA
);
7421 DWORD ret
= lstrcmpW(strAW
, strB
);
7426 static inline ULONG
get_refcnt(IUri
*uri
) {
7428 return IUri_Release(uri
);
7431 static void change_property(IUriBuilder
*builder
, const uri_builder_property
*prop
,
7436 valueW
= a2w(prop
->value
);
7437 switch(prop
->property
) {
7438 case Uri_PROPERTY_FRAGMENT
:
7439 hr
= IUriBuilder_SetFragment(builder
, valueW
);
7442 ok(hr
== prop
->expected
,
7443 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7444 hr
, prop
->expected
, test_index
);
7447 ok(hr
== prop
->expected
,
7448 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7449 hr
, prop
->expected
, test_index
);
7452 case Uri_PROPERTY_HOST
:
7453 hr
= IUriBuilder_SetHost(builder
, valueW
);
7456 ok(hr
== prop
->expected
,
7457 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7458 hr
, prop
->expected
, test_index
);
7461 ok(hr
== prop
->expected
,
7462 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7463 hr
, prop
->expected
, test_index
);
7466 case Uri_PROPERTY_PASSWORD
:
7467 hr
= IUriBuilder_SetPassword(builder
, valueW
);
7470 ok(hr
== prop
->expected
,
7471 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7472 hr
, prop
->expected
, test_index
);
7475 ok(hr
== prop
->expected
,
7476 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7477 hr
, prop
->expected
, test_index
);
7480 case Uri_PROPERTY_PATH
:
7481 hr
= IUriBuilder_SetPath(builder
, valueW
);
7484 ok(hr
== prop
->expected
,
7485 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7486 hr
, prop
->expected
, test_index
);
7489 ok(hr
== prop
->expected
,
7490 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7491 hr
, prop
->expected
, test_index
);
7494 case Uri_PROPERTY_QUERY
:
7495 hr
= IUriBuilder_SetQuery(builder
, valueW
);
7498 ok(hr
== prop
->expected
,
7499 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7500 hr
, prop
->expected
, test_index
);
7503 ok(hr
== prop
->expected
,
7504 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7505 hr
, prop
->expected
, test_index
);
7508 case Uri_PROPERTY_SCHEME_NAME
:
7509 hr
= IUriBuilder_SetSchemeName(builder
, valueW
);
7512 ok(hr
== prop
->expected
,
7513 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7514 hr
, prop
->expected
, test_index
);
7517 ok(hr
== prop
->expected
,
7518 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7519 hr
, prop
->expected
, test_index
);
7522 case Uri_PROPERTY_USER_NAME
:
7523 hr
= IUriBuilder_SetUserName(builder
, valueW
);
7526 ok(hr
== prop
->expected
,
7527 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7528 hr
, prop
->expected
, test_index
);
7531 ok(hr
== prop
->expected
,
7532 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7533 hr
, prop
->expected
, test_index
);
7537 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop
->property
, test_index
);
7544 * Simple tests to make sure the CreateUri function handles invalid flag combinations
7547 static void test_CreateUri_InvalidFlags(void) {
7550 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
7552 IUri
*uri
= (void*) 0xdeadbeef;
7554 hr
= pCreateUri(http_urlW
, invalid_flag_tests
[i
].flags
, 0, &uri
);
7555 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
7556 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
7557 ok(uri
== NULL
, "Error: expected the IUri to be NULL, but it was %p instead\n", uri
);
7561 static void test_CreateUri_InvalidArgs(void) {
7563 IUri
*uri
= (void*) 0xdeadbeef;
7565 const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
7566 static const WCHAR emptyW
[] = {0};
7568 hr
= pCreateUri(http_urlW
, 0, 0, NULL
);
7569 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7571 hr
= pCreateUri(NULL
, 0, 0, &uri
);
7572 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7573 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7575 uri
= (void*) 0xdeadbeef;
7576 hr
= pCreateUri(invalidW
, 0, 0, &uri
);
7577 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7578 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7580 uri
= (void*) 0xdeadbeef;
7581 hr
= pCreateUri(emptyW
, 0, 0, &uri
);
7582 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7583 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7586 static void test_CreateUri_InvalidUri(void) {
7589 for(i
= 0; i
< sizeof(invalid_uri_tests
)/sizeof(invalid_uri_tests
[0]); ++i
) {
7590 invalid_uri test
= invalid_uri_tests
[i
];
7595 uriW
= a2w(test
.uri
);
7596 hr
= pCreateUri(uriW
, test
.flags
, 0, &uri
);
7599 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7600 hr
, E_INVALIDARG
, i
);
7603 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7604 hr
, E_INVALIDARG
, i
);
7606 if(uri
) IUri_Release(uri
);
7612 static void test_IUri_GetPropertyBSTR(void) {
7617 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7618 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7619 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7621 BSTR received
= NULL
;
7623 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, NULL
, 0);
7624 ok(hr
== E_POINTER
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7626 /* Make sure it handles an invalid Uri_PROPERTY correctly. */
7627 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_PORT
, &received
, 0);
7628 ok(hr
== E_INVALIDARG
/* IE10 */ || broken(hr
== S_OK
), "Error: GetPropertyBSTR returned 0x%08x, expected E_INVALIDARG or S_OK.\n", hr
);
7630 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7631 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7632 SysFreeString(received
);
7634 ok(!received
, "received = %s\n", wine_dbgstr_w(received
));
7637 /* Make sure it handles the ZONE property correctly. */
7639 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_ZONE
, &received
, 0);
7640 ok(hr
== S_FALSE
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_FALSE
);
7641 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7642 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7643 SysFreeString(received
);
7645 if(uri
) IUri_Release(uri
);
7647 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7648 uri_properties test
= uri_tests
[i
];
7652 uriW
= a2w(test
.uri
);
7653 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7654 if(test
.create_todo
) {
7656 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7657 hr
, test
.create_expected
, i
);
7660 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7661 hr
, test
.create_expected
, i
);
7667 /* Checks all the string properties of the uri. */
7668 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7669 BSTR received
= NULL
;
7670 uri_str_property prop
= test
.str_props
[j
];
7672 hr
= IUri_GetPropertyBSTR(uri
, j
, &received
, 0);
7675 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7676 hr
, prop
.expected
, i
, j
);
7679 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7680 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7681 prop
.value
, wine_dbgstr_w(received
), i
, j
);
7684 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7685 hr
, prop
.expected
, i
, j
);
7686 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7687 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7688 prop
.value
, wine_dbgstr_w(received
), i
, j
);
7691 SysFreeString(received
);
7695 if(uri
) IUri_Release(uri
);
7701 static void test_IUri_GetPropertyDWORD(void) {
7706 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7707 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7709 DWORD received
= 0xdeadbeef;
7711 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_DWORD_START
, NULL
, 0);
7712 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7714 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_ABSOLUTE_URI
, &received
, 0);
7715 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7716 ok(received
== 0, "Error: Expected received=%d but instead received=%d.\n", 0, received
);
7718 if(uri
) IUri_Release(uri
);
7720 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7721 uri_properties test
= uri_tests
[i
];
7725 uriW
= a2w(test
.uri
);
7726 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7727 if(test
.create_todo
) {
7729 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7730 hr
, test
.create_expected
, i
);
7733 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7734 hr
, test
.create_expected
, i
);
7740 /* Checks all the DWORD properties of the uri. */
7741 for(j
= 0; j
< sizeof(test
.dword_props
)/sizeof(test
.dword_props
[0]); ++j
) {
7743 uri_dword_property prop
= test
.dword_props
[j
];
7745 hr
= IUri_GetPropertyDWORD(uri
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
7748 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7749 hr
, prop
.expected
, i
, j
);
7752 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7753 prop
.value
, received
, i
, j
);
7756 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7757 hr
, prop
.expected
, i
, j
);
7758 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7759 prop
.value
, received
, i
, j
);
7764 if(uri
) IUri_Release(uri
);
7770 /* Tests all the 'Get*' property functions which deal with strings. */
7771 static void test_IUri_GetStrProperties(void) {
7776 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7777 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7778 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7780 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
7781 ok(hr
== E_POINTER
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7783 hr
= IUri_GetAuthority(uri
, NULL
);
7784 ok(hr
== E_POINTER
, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7786 hr
= IUri_GetDisplayUri(uri
, NULL
);
7787 ok(hr
== E_POINTER
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7789 hr
= IUri_GetDomain(uri
, NULL
);
7790 ok(hr
== E_POINTER
, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7792 hr
= IUri_GetExtension(uri
, NULL
);
7793 ok(hr
== E_POINTER
, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7795 hr
= IUri_GetFragment(uri
, NULL
);
7796 ok(hr
== E_POINTER
, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7798 hr
= IUri_GetHost(uri
, NULL
);
7799 ok(hr
== E_POINTER
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7801 hr
= IUri_GetPassword(uri
, NULL
);
7802 ok(hr
== E_POINTER
, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7804 hr
= IUri_GetPath(uri
, NULL
);
7805 ok(hr
== E_POINTER
, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7807 hr
= IUri_GetPathAndQuery(uri
, NULL
);
7808 ok(hr
== E_POINTER
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7810 hr
= IUri_GetQuery(uri
, NULL
);
7811 ok(hr
== E_POINTER
, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7813 hr
= IUri_GetRawUri(uri
, NULL
);
7814 ok(hr
== E_POINTER
, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7816 hr
= IUri_GetSchemeName(uri
, NULL
);
7817 ok(hr
== E_POINTER
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7819 hr
= IUri_GetUserInfo(uri
, NULL
);
7820 ok(hr
== E_POINTER
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7822 hr
= IUri_GetUserName(uri
, NULL
);
7823 ok(hr
== E_POINTER
, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7825 if(uri
) IUri_Release(uri
);
7827 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7828 uri_properties test
= uri_tests
[i
];
7832 uriW
= a2w(test
.uri
);
7833 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7834 if(test
.create_todo
) {
7836 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7837 hr
, test
.create_expected
, i
);
7840 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7841 hr
, test
.create_expected
, i
);
7845 uri_str_property prop
;
7846 BSTR received
= NULL
;
7848 /* GetAbsoluteUri() tests. */
7849 prop
= test
.str_props
[Uri_PROPERTY_ABSOLUTE_URI
];
7850 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7853 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7854 hr
, prop
.expected
, i
);
7857 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7858 "Error: Expected %s but got %s on uri_tests[%d].\n",
7859 prop
.value
, wine_dbgstr_w(received
), i
);
7862 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7863 hr
, prop
.expected
, i
);
7864 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7865 "Error: Expected %s but got %s on uri_tests[%d].\n",
7866 prop
.value
, wine_dbgstr_w(received
), i
);
7868 SysFreeString(received
);
7871 /* GetAuthority() tests. */
7872 prop
= test
.str_props
[Uri_PROPERTY_AUTHORITY
];
7873 hr
= IUri_GetAuthority(uri
, &received
);
7876 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7877 hr
, prop
.expected
, i
);
7880 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7881 prop
.value
, wine_dbgstr_w(received
), i
);
7884 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7885 hr
, prop
.expected
, i
);
7886 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7887 prop
.value
, wine_dbgstr_w(received
), i
);
7889 SysFreeString(received
);
7892 /* GetDisplayUri() tests. */
7893 prop
= test
.str_props
[Uri_PROPERTY_DISPLAY_URI
];
7894 hr
= IUri_GetDisplayUri(uri
, &received
);
7897 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7898 hr
, prop
.expected
, i
);
7901 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7902 "Error: Expected %s but got %s on uri_test[%d].\n",
7903 prop
.value
, wine_dbgstr_w(received
), i
);
7906 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7907 hr
, prop
.expected
, i
);
7908 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7909 "Error: Expected %s but got %s on uri_tests[%d].\n",
7910 prop
.value
, wine_dbgstr_w(received
), i
);
7912 SysFreeString(received
);
7915 /* GetDomain() tests. */
7916 prop
= test
.str_props
[Uri_PROPERTY_DOMAIN
];
7917 hr
= IUri_GetDomain(uri
, &received
);
7920 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7921 hr
, prop
.expected
, i
);
7924 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7925 prop
.value
, wine_dbgstr_w(received
), i
);
7928 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7929 hr
, prop
.expected
, i
);
7930 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7931 prop
.value
, wine_dbgstr_w(received
), i
);
7933 SysFreeString(received
);
7936 /* GetExtension() tests. */
7937 prop
= test
.str_props
[Uri_PROPERTY_EXTENSION
];
7938 hr
= IUri_GetExtension(uri
, &received
);
7941 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7942 hr
, prop
.expected
, i
);
7945 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7946 prop
.value
, wine_dbgstr_w(received
), i
);
7949 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7950 hr
, prop
.expected
, i
);
7951 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7952 prop
.value
, wine_dbgstr_w(received
), i
);
7954 SysFreeString(received
);
7957 /* GetFragment() tests. */
7958 prop
= test
.str_props
[Uri_PROPERTY_FRAGMENT
];
7959 hr
= IUri_GetFragment(uri
, &received
);
7962 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7963 hr
, prop
.expected
, i
);
7966 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7967 prop
.value
, wine_dbgstr_w(received
), i
);
7970 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7971 hr
, prop
.expected
, i
);
7972 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7973 prop
.value
, wine_dbgstr_w(received
), i
);
7975 SysFreeString(received
);
7978 /* GetHost() tests. */
7979 prop
= test
.str_props
[Uri_PROPERTY_HOST
];
7980 hr
= IUri_GetHost(uri
, &received
);
7983 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7984 hr
, prop
.expected
, i
);
7987 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7988 prop
.value
, wine_dbgstr_w(received
), i
);
7991 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7992 hr
, prop
.expected
, i
);
7993 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7994 prop
.value
, wine_dbgstr_w(received
), i
);
7996 SysFreeString(received
);
7999 /* GetPassword() tests. */
8000 prop
= test
.str_props
[Uri_PROPERTY_PASSWORD
];
8001 hr
= IUri_GetPassword(uri
, &received
);
8004 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8005 hr
, prop
.expected
, i
);
8008 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8009 prop
.value
, wine_dbgstr_w(received
), i
);
8012 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8013 hr
, prop
.expected
, i
);
8014 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8015 prop
.value
, wine_dbgstr_w(received
), i
);
8017 SysFreeString(received
);
8020 /* GetPath() tests. */
8021 prop
= test
.str_props
[Uri_PROPERTY_PATH
];
8022 hr
= IUri_GetPath(uri
, &received
);
8025 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8026 hr
, prop
.expected
, i
);
8029 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8030 prop
.value
, wine_dbgstr_w(received
), i
);
8033 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8034 hr
, prop
.expected
, i
);
8035 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8036 prop
.value
, wine_dbgstr_w(received
), i
);
8038 SysFreeString(received
);
8041 /* GetPathAndQuery() tests. */
8042 prop
= test
.str_props
[Uri_PROPERTY_PATH_AND_QUERY
];
8043 hr
= IUri_GetPathAndQuery(uri
, &received
);
8046 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8047 hr
, prop
.expected
, i
);
8050 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8051 prop
.value
, wine_dbgstr_w(received
), i
);
8054 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8055 hr
, prop
.expected
, i
);
8056 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8057 prop
.value
, wine_dbgstr_w(received
), i
);
8059 SysFreeString(received
);
8062 /* GetQuery() tests. */
8063 prop
= test
.str_props
[Uri_PROPERTY_QUERY
];
8064 hr
= IUri_GetQuery(uri
, &received
);
8067 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8068 hr
, prop
.expected
, i
);
8071 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8072 prop
.value
, wine_dbgstr_w(received
), i
);
8075 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8076 hr
, prop
.expected
, i
);
8077 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8078 prop
.value
, wine_dbgstr_w(received
), i
);
8080 SysFreeString(received
);
8083 /* GetRawUri() tests. */
8084 prop
= test
.str_props
[Uri_PROPERTY_RAW_URI
];
8085 hr
= IUri_GetRawUri(uri
, &received
);
8088 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8089 hr
, prop
.expected
, i
);
8092 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8093 prop
.value
, wine_dbgstr_w(received
), i
);
8096 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8097 hr
, prop
.expected
, i
);
8098 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8099 prop
.value
, wine_dbgstr_w(received
), i
);
8101 SysFreeString(received
);
8104 /* GetSchemeName() tests. */
8105 prop
= test
.str_props
[Uri_PROPERTY_SCHEME_NAME
];
8106 hr
= IUri_GetSchemeName(uri
, &received
);
8109 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8110 hr
, prop
.expected
, i
);
8113 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8114 prop
.value
, wine_dbgstr_w(received
), i
);
8117 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8118 hr
, prop
.expected
, i
);
8119 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8120 prop
.value
, wine_dbgstr_w(received
), i
);
8122 SysFreeString(received
);
8125 /* GetUserInfo() tests. */
8126 prop
= test
.str_props
[Uri_PROPERTY_USER_INFO
];
8127 hr
= IUri_GetUserInfo(uri
, &received
);
8130 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8131 hr
, prop
.expected
, i
);
8134 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8135 prop
.value
, wine_dbgstr_w(received
), i
);
8138 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8139 hr
, prop
.expected
, i
);
8140 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8141 prop
.value
, wine_dbgstr_w(received
), i
);
8143 SysFreeString(received
);
8146 /* GetUserName() tests. */
8147 prop
= test
.str_props
[Uri_PROPERTY_USER_NAME
];
8148 hr
= IUri_GetUserName(uri
, &received
);
8151 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8152 hr
, prop
.expected
, i
);
8155 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8156 prop
.value
, wine_dbgstr_w(received
), i
);
8159 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8160 hr
, prop
.expected
, i
);
8161 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
8162 prop
.value
, wine_dbgstr_w(received
), i
);
8164 SysFreeString(received
);
8167 if(uri
) IUri_Release(uri
);
8173 static void test_IUri_GetDwordProperties(void) {
8178 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
8179 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8180 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8182 hr
= IUri_GetHostType(uri
, NULL
);
8183 ok(hr
== E_INVALIDARG
, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8185 hr
= IUri_GetPort(uri
, NULL
);
8186 ok(hr
== E_INVALIDARG
, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8188 hr
= IUri_GetScheme(uri
, NULL
);
8189 ok(hr
== E_INVALIDARG
, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8191 hr
= IUri_GetZone(uri
, NULL
);
8192 ok(hr
== E_INVALIDARG
, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8194 if(uri
) IUri_Release(uri
);
8196 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
8197 uri_properties test
= uri_tests
[i
];
8201 uriW
= a2w(test
.uri
);
8202 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8203 if(test
.create_todo
) {
8205 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8206 hr
, test
.create_expected
, i
);
8209 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8210 hr
, test
.create_expected
, i
);
8214 uri_dword_property prop
;
8217 /* Assign an insane value so tests don't accidentally pass when
8220 received
= -9999999;
8222 /* GetHostType() tests. */
8223 prop
= test
.dword_props
[Uri_PROPERTY_HOST_TYPE
-Uri_PROPERTY_DWORD_START
];
8224 hr
= IUri_GetHostType(uri
, &received
);
8227 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8228 hr
, prop
.expected
, i
);
8231 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8234 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8235 hr
, prop
.expected
, i
);
8236 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8238 received
= -9999999;
8240 /* GetPort() tests. */
8241 prop
= test
.dword_props
[Uri_PROPERTY_PORT
-Uri_PROPERTY_DWORD_START
];
8242 hr
= IUri_GetPort(uri
, &received
);
8245 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8246 hr
, prop
.expected
, i
);
8249 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8252 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8253 hr
, prop
.expected
, i
);
8254 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8256 received
= -9999999;
8258 /* GetScheme() tests. */
8259 prop
= test
.dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
];
8260 hr
= IUri_GetScheme(uri
, &received
);
8263 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8264 hr
, prop
.expected
, i
);
8267 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8270 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8271 hr
, prop
.expected
, i
);
8272 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8274 received
= -9999999;
8276 /* GetZone() tests. */
8277 prop
= test
.dword_props
[Uri_PROPERTY_ZONE
-Uri_PROPERTY_DWORD_START
];
8278 hr
= IUri_GetZone(uri
, &received
);
8281 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8282 hr
, prop
.expected
, i
);
8285 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8288 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8289 hr
, prop
.expected
, i
);
8290 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
8294 if(uri
) IUri_Release(uri
);
8300 static void test_IUri_GetPropertyLength(void) {
8305 /* Make sure it handles invalid args correctly. */
8306 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8307 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8309 DWORD received
= 0xdeadbeef;
8311 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_STRING_START
, NULL
, 0);
8312 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8314 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_DWORD_START
, &received
, 0);
8315 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8316 ok(received
== 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received
);
8318 if(uri
) IUri_Release(uri
);
8320 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
8321 uri_properties test
= uri_tests
[i
];
8325 uriW
= a2w(test
.uri
);
8326 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8327 if(test
.create_todo
) {
8329 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
8330 hr
, test
.create_expected
, i
);
8333 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
8334 hr
, test
.create_expected
, i
);
8340 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
8341 DWORD expectedLen
, receivedLen
;
8342 uri_str_property prop
= test
.str_props
[j
];
8344 expectedLen
= lstrlenA(prop
.value
);
8346 /* This won't be necessary once GetPropertyLength is implemented. */
8349 hr
= IUri_GetPropertyLength(uri
, j
, &receivedLen
, 0);
8352 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8353 hr
, prop
.expected
, i
, j
);
8356 ok(receivedLen
== expectedLen
|| broken(prop
.broken_value
&& receivedLen
== lstrlenA(prop
.broken_value
)),
8357 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8358 expectedLen
, receivedLen
, i
, j
);
8361 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
8362 hr
, prop
.expected
, i
, j
);
8363 ok(receivedLen
== expectedLen
|| broken(prop
.broken_value
&& receivedLen
== lstrlenA(prop
.broken_value
)),
8364 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
8365 expectedLen
, receivedLen
, i
, j
);
8370 if(uri
) IUri_Release(uri
);
8376 static DWORD
compute_expected_props(uri_properties
*test
)
8380 for(i
=Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_STRING_LAST
; i
++) {
8381 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
== S_OK
)
8385 for(i
=Uri_PROPERTY_DWORD_START
; i
<= Uri_PROPERTY_DWORD_LAST
; i
++) {
8386 if(test
->dword_props
[i
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
8393 static void test_IUri_GetProperties(void) {
8398 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8399 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8401 hr
= IUri_GetProperties(uri
, NULL
);
8402 ok(hr
== E_INVALIDARG
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8404 if(uri
) IUri_Release(uri
);
8406 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
8407 uri_properties test
= uri_tests
[i
];
8411 uriW
= a2w(test
.uri
);
8412 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8413 if(test
.create_todo
) {
8415 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8418 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8422 DWORD received
= 0, expected_props
;
8425 hr
= IUri_GetProperties(uri
, &received
);
8426 ok(hr
== S_OK
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8428 expected_props
= compute_expected_props(&test
);
8430 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
8431 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
8432 if(expected_props
& (1 << j
))
8433 ok(received
& (1 << j
), "Error: Expected flag for property %d on uri_tests[%d].\n", j
, i
);
8435 ok(!(received
& (1 << j
)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j
, i
);
8439 if(uri
) IUri_Release(uri
);
8445 static void test_IUri_HasProperty(void) {
8450 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8451 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8453 hr
= IUri_HasProperty(uri
, Uri_PROPERTY_RAW_URI
, NULL
);
8454 ok(hr
== E_INVALIDARG
, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8456 if(uri
) IUri_Release(uri
);
8458 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
8459 uri_properties test
= uri_tests
[i
];
8463 uriW
= a2w(test
.uri
);
8465 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
8466 if(test
.create_todo
) {
8468 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8471 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
8475 DWORD expected_props
, j
;
8477 expected_props
= compute_expected_props(&test
);
8479 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
8480 /* Assign -1, then explicitly test for TRUE or FALSE later. */
8483 hr
= IUri_HasProperty(uri
, j
, &received
);
8484 ok(hr
== S_OK
, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
8487 if(expected_props
& (1 << j
)) {
8488 ok(received
== TRUE
, "Error: Expected to have property %d on uri_tests[%d].\n", j
, i
);
8490 ok(received
== FALSE
, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j
, i
);
8495 if(uri
) IUri_Release(uri
);
8501 static void test_IUri_IsEqual(void) {
8509 /* Make sure IsEqual handles invalid args correctly. */
8510 hres
= pCreateUri(http_urlW
, 0, 0, &uriA
);
8511 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8512 hres
= pCreateUri(http_urlW
, 0, 0, &uriB
);
8513 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8516 hres
= IUri_IsEqual(uriA
, NULL
, &equal
);
8517 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
8518 ok(!equal
, "Error: Expected equal to be FALSE, but was %d instead.\n", equal
);
8520 hres
= IUri_IsEqual(uriA
, uriB
, NULL
);
8521 ok(hres
== E_POINTER
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, E_POINTER
);
8526 for(i
= 0; i
< sizeof(equality_tests
)/sizeof(equality_tests
[0]); ++i
) {
8527 uri_equality test
= equality_tests
[i
];
8528 LPWSTR uriA_W
, uriB_W
;
8532 uriA_W
= a2w(test
.a
);
8533 uriB_W
= a2w(test
.b
);
8535 hres
= pCreateUri(uriA_W
, test
.create_flags_a
, 0, &uriA
);
8536 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres
, S_OK
, i
);
8538 hres
= pCreateUri(uriB_W
, test
.create_flags_b
, 0, &uriB
);
8539 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres
, S_OK
, i
);
8542 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
8543 if(test
.todo
) todo_wine
{
8544 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
8545 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
8547 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
8548 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
8550 if(uriA
) IUri_Release(uriA
);
8551 if(uriB
) IUri_Release(uriB
);
8558 static void test_CreateUriWithFragment_InvalidArgs(void) {
8560 IUri
*uri
= (void*) 0xdeadbeef;
8561 const WCHAR fragmentW
[] = {'#','f','r','a','g','m','e','n','t',0};
8563 hr
= pCreateUriWithFragment(NULL
, fragmentW
, 0, 0, &uri
);
8564 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8565 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8567 hr
= pCreateUriWithFragment(http_urlW
, fragmentW
, 0, 0, NULL
);
8568 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8570 /* Original URI can't already contain a fragment component. */
8571 uri
= (void*) 0xdeadbeef;
8572 hr
= pCreateUriWithFragment(http_url_fragW
, fragmentW
, 0, 0, &uri
);
8573 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8574 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8577 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8578 static void test_CreateUriWithFragment_InvalidFlags(void) {
8581 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
8583 IUri
*uri
= (void*) 0xdeadbeef;
8585 hr
= pCreateUriWithFragment(http_urlW
, NULL
, invalid_flag_tests
[i
].flags
, 0, &uri
);
8586 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8587 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
8588 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8592 static void test_CreateUriWithFragment(void) {
8595 for(i
= 0; i
< sizeof(uri_fragment_tests
)/sizeof(uri_fragment_tests
[0]); ++i
) {
8599 uri_with_fragment test
= uri_fragment_tests
[i
];
8601 uriW
= a2w(test
.uri
);
8602 fragW
= a2w(test
.fragment
);
8604 hr
= pCreateUriWithFragment(uriW
, fragW
, test
.create_flags
, 0, &uri
);
8605 if(test
.expected_todo
) {
8607 ok(hr
== test
.create_expected
,
8608 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8609 hr
, test
.create_expected
, i
);
8612 ok(hr
== test
.create_expected
,
8613 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8614 hr
, test
.create_expected
, i
);
8617 BSTR received
= NULL
;
8619 hr
= IUri_GetAbsoluteUri(uri
, &received
);
8620 if(test
.expected_todo
) {
8623 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8627 ok(!strcmp_aw(test
.expected_uri
, received
),
8628 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8629 test
.expected_uri
, wine_dbgstr_w(received
), i
);
8632 ok(hr
== S_OK
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8634 ok(!strcmp_aw(test
.expected_uri
, received
), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8635 test
.expected_uri
, wine_dbgstr_w(received
), i
);
8638 SysFreeString(received
);
8641 if(uri
) IUri_Release(uri
);
8647 static void test_CreateIUriBuilder(void) {
8649 IUriBuilder
*builder
= NULL
;
8652 hr
= pCreateIUriBuilder(NULL
, 0, 0, NULL
);
8653 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8656 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8657 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8658 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8660 ULONG cur_count
, orig_count
;
8662 orig_count
= get_refcnt(uri
);
8663 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
8664 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8665 ok(builder
!= NULL
, "Error: Expecting builder not to be NULL\n");
8667 cur_count
= get_refcnt(uri
);
8668 ok(cur_count
== orig_count
+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
+1, cur_count
);
8670 if(builder
) IUriBuilder_Release(builder
);
8671 cur_count
= get_refcnt(uri
);
8672 ok(cur_count
== orig_count
, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
, cur_count
);
8674 if(uri
) IUri_Release(uri
);
8677 static void test_IUriBuilder_CreateUri(IUriBuilder
*builder
, const uri_builder_test
*test
,
8682 hr
= IUriBuilder_CreateUri(builder
, test
->uri_flags
, 0, 0, &uri
);
8683 if(test
->uri_todo
) {
8685 ok(hr
== test
->uri_hres
,
8686 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8687 hr
, test
->uri_hres
, test_index
);
8690 ok(hr
== test
->uri_hres
,
8691 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8692 hr
, test
->uri_hres
, test_index
);
8698 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8699 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8700 BSTR received
= NULL
;
8702 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8705 ok(hr
== prop
.result
,
8706 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8707 hr
, prop
.result
, test_index
, i
);
8710 ok(hr
== prop
.result
,
8711 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8712 hr
, prop
.result
, test_index
, i
);
8717 ok(!strcmp_aw(prop
.expected
, received
),
8718 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8719 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8722 ok(!strcmp_aw(prop
.expected
, received
),
8723 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8724 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8727 SysFreeString(received
);
8730 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8731 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8732 DWORD received
= -2;
8734 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8737 ok(hr
== prop
.result
,
8738 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8739 hr
, prop
.result
, test_index
, i
);
8742 ok(hr
== prop
.result
,
8743 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8744 hr
, prop
.result
, test_index
, i
);
8749 ok(received
== prop
.expected
,
8750 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8751 prop
.expected
, received
, test_index
, i
);
8754 ok(received
== prop
.expected
,
8755 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8756 prop
.expected
, received
, test_index
, i
);
8761 if(uri
) IUri_Release(uri
);
8764 static void test_IUriBuilder_CreateUriSimple(IUriBuilder
*builder
, const uri_builder_test
*test
,
8769 hr
= IUriBuilder_CreateUriSimple(builder
, test
->uri_simple_encode_flags
, 0, &uri
);
8770 if(test
->uri_simple_todo
) {
8772 ok(hr
== test
->uri_simple_hres
,
8773 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8774 hr
, test
->uri_simple_hres
, test_index
);
8777 ok(hr
== test
->uri_simple_hres
,
8778 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8779 hr
, test
->uri_simple_hres
, test_index
);
8785 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8786 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8787 BSTR received
= NULL
;
8789 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8792 ok(hr
== prop
.result
,
8793 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8794 hr
, prop
.result
, test_index
, i
);
8797 ok(hr
== prop
.result
,
8798 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8799 hr
, prop
.result
, test_index
, i
);
8804 ok(!strcmp_aw(prop
.expected
, received
),
8805 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8806 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8809 ok(!strcmp_aw(prop
.expected
, received
),
8810 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8811 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8814 SysFreeString(received
);
8817 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8818 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8819 DWORD received
= -2;
8821 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8824 ok(hr
== prop
.result
,
8825 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8826 hr
, prop
.result
, test_index
, i
);
8829 ok(hr
== prop
.result
,
8830 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8831 hr
, prop
.result
, test_index
, i
);
8836 ok(received
== prop
.expected
,
8837 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8838 prop
.expected
, received
, test_index
, i
);
8841 ok(received
== prop
.expected
,
8842 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8843 prop
.expected
, received
, test_index
, i
);
8848 if(uri
) IUri_Release(uri
);
8851 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder
*builder
, const uri_builder_test
*test
,
8856 hr
= IUriBuilder_CreateUriWithFlags(builder
, test
->uri_with_flags
, test
->uri_with_builder_flags
,
8857 test
->uri_with_encode_flags
, 0, &uri
);
8858 if(test
->uri_with_todo
) {
8860 ok(hr
== test
->uri_with_hres
,
8861 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8862 hr
, test
->uri_with_hres
, test_index
);
8865 ok(hr
== test
->uri_with_hres
,
8866 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8867 hr
, test
->uri_with_hres
, test_index
);
8873 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8874 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8875 BSTR received
= NULL
;
8877 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8880 ok(hr
== prop
.result
,
8881 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8882 hr
, prop
.result
, test_index
, i
);
8885 ok(hr
== prop
.result
,
8886 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8887 hr
, prop
.result
, test_index
, i
);
8892 ok(!strcmp_aw(prop
.expected
, received
),
8893 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8894 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8897 ok(!strcmp_aw(prop
.expected
, received
),
8898 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8899 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8902 SysFreeString(received
);
8905 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8906 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8907 DWORD received
= -2;
8909 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8912 ok(hr
== prop
.result
,
8913 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8914 hr
, prop
.result
, test_index
, i
);
8917 ok(hr
== prop
.result
,
8918 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8919 hr
, prop
.result
, test_index
, i
);
8924 ok(received
== prop
.expected
,
8925 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8926 prop
.expected
, received
, test_index
, i
);
8929 ok(received
== prop
.expected
,
8930 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8931 prop
.expected
, received
, test_index
, i
);
8936 if(uri
) IUri_Release(uri
);
8939 static void test_IUriBuilder_CreateInvalidArgs(void) {
8940 IUriBuilder
*builder
;
8943 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8944 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8946 IUri
*test
= NULL
, *uri
= (void*) 0xdeadbeef;
8948 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8949 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, NULL
);
8950 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8952 uri
= (void*) 0xdeadbeef;
8953 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8954 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_NOTIMPL
);
8955 ok(uri
== NULL
, "Error: expected uri to be NULL, but was %p instead.\n", uri
);
8957 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, NULL
);
8958 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8961 uri
= (void*) 0xdeadbeef;
8962 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8963 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8965 ok(!uri
, "Error: Expected uri to NULL, but was %p instead.\n", uri
);
8967 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, NULL
);
8968 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8971 uri
= (void*) 0xdeadbeef;
8972 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8973 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8975 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8977 hr
= pCreateUri(http_urlW
, 0, 0, &test
);
8978 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8980 hr
= IUriBuilder_SetIUri(builder
, test
);
8981 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8983 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8985 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8986 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8987 ok(uri
!= NULL
, "Error: The uri was NULL.\n");
8988 if(uri
) IUri_Release(uri
);
8991 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8992 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8994 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8995 if(uri
) IUri_Release(uri
);
8998 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &uri
);
8999 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9001 ok(uri
!= NULL
, "Error: uri was NULL.\n");
9002 if(uri
) IUri_Release(uri
);
9004 hr
= IUriBuilder_SetFragment(builder
, NULL
);
9005 ok(hr
== S_OK
, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9007 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
9008 uri
= (void*) 0xdeadbeef;
9009 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9010 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9011 ok(!uri
, "Error: Expected uri to be NULL but was %p instead.\n", uri
);
9013 uri
= (void*) 0xdeadbeef;
9014 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
9015 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
9017 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
9019 uri
= (void*) 0xdeadbeef;
9020 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
9021 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9023 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
9025 if(test
) IUri_Release(test
);
9027 if(builder
) IUriBuilder_Release(builder
);
9030 /* Tests invalid args to the "Get*" functions. */
9031 static void test_IUriBuilder_GetInvalidArgs(void) {
9032 IUriBuilder
*builder
= NULL
;
9035 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9036 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9038 LPCWSTR received
= (void*) 0xdeadbeef;
9039 DWORD len
= -1, port
= -1;
9042 hr
= IUriBuilder_GetFragment(builder
, NULL
, NULL
);
9043 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9045 hr
= IUriBuilder_GetFragment(builder
, NULL
, &received
);
9046 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9048 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9049 hr
= IUriBuilder_GetFragment(builder
, &len
, NULL
);
9050 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
9052 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9054 hr
= IUriBuilder_GetHost(builder
, NULL
, NULL
);
9055 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9057 received
= (void*) 0xdeadbeef;
9058 hr
= IUriBuilder_GetHost(builder
, NULL
, &received
);
9059 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9061 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9063 hr
= IUriBuilder_GetHost(builder
, &len
, NULL
);
9064 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
9066 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9068 hr
= IUriBuilder_GetPassword(builder
, NULL
, NULL
);
9069 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9071 received
= (void*) 0xdeadbeef;
9072 hr
= IUriBuilder_GetPassword(builder
, NULL
, &received
);
9073 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9075 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9077 hr
= IUriBuilder_GetPassword(builder
, &len
, NULL
);
9078 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
9080 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9082 hr
= IUriBuilder_GetPath(builder
, NULL
, NULL
);
9083 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9085 received
= (void*) 0xdeadbeef;
9086 hr
= IUriBuilder_GetPath(builder
, NULL
, &received
);
9087 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9089 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9091 hr
= IUriBuilder_GetPath(builder
, &len
, NULL
);
9092 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
9094 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9096 hr
= IUriBuilder_GetPort(builder
, NULL
, NULL
);
9097 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9099 hr
= IUriBuilder_GetPort(builder
, NULL
, &port
);
9100 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9102 ok(!port
, "Error: Expected port to be 0, but was %d instead.\n", port
);
9103 hr
= IUriBuilder_GetPort(builder
, &set
, NULL
);
9104 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
9106 ok(!set
, "Error: Expected set to be FALSE, but was %d instead.\n", set
);
9108 hr
= IUriBuilder_GetQuery(builder
, NULL
, NULL
);
9109 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9111 received
= (void*) 0xdeadbeef;
9112 hr
= IUriBuilder_GetQuery(builder
, NULL
, &received
);
9113 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9115 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9117 hr
= IUriBuilder_GetQuery(builder
, &len
, NULL
);
9118 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
9120 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9122 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, NULL
);
9123 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9125 received
= (void*) 0xdeadbeef;
9126 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, &received
);
9127 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9129 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9131 hr
= IUriBuilder_GetSchemeName(builder
, &len
, NULL
);
9132 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
9134 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9136 hr
= IUriBuilder_GetUserName(builder
, NULL
, NULL
);
9137 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9139 received
= (void*) 0xdeadbeef;
9140 hr
= IUriBuilder_GetUserName(builder
, NULL
, &received
);
9141 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9143 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
9145 hr
= IUriBuilder_GetUserName(builder
, &len
, NULL
);
9146 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
9148 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
9150 if(builder
) IUriBuilder_Release(builder
);
9153 static void test_IUriBuilder_GetFragment(IUriBuilder
*builder
, const uri_builder_test
*test
,
9157 LPCWSTR received
= NULL
;
9159 const uri_builder_property
*prop
= NULL
;
9161 /* Check if the property was set earlier. */
9162 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9163 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_FRAGMENT
)
9164 prop
= &(test
->properties
[i
]);
9168 /* Use expected_value unless it's NULL, then use value. */
9169 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9170 DWORD expected_len
= expected
? strlen(expected
) : 0;
9171 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9174 ok(hr
== (expected
? S_OK
: S_FALSE
),
9175 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9176 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9180 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9181 expected
, wine_dbgstr_w(received
), test_index
);
9184 ok(expected_len
== len
,
9185 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9186 expected_len
, len
, test_index
);
9190 ok(hr
== (expected
? S_OK
: S_FALSE
),
9191 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9192 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9193 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9194 expected
, wine_dbgstr_w(received
), test_index
);
9195 ok(expected_len
== len
,
9196 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9197 expected_len
, len
, test_index
);
9200 /* The property wasn't set earlier, so it should return whatever
9201 * the base IUri contains (if anything).
9204 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9206 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9207 hr
, S_OK
, test_index
);
9210 received
= (void*) 0xdeadbeef;
9213 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9215 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9216 hr
, S_FALSE
, test_index
);
9218 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9220 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9221 received
, test_index
);
9224 BOOL has_prop
= FALSE
;
9225 BSTR expected
= NULL
;
9227 hr
= IUri_GetFragment(uri
, &expected
);
9229 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9231 has_prop
= hr
== S_OK
;
9233 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
9236 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9237 hr
, S_OK
, test_index
);
9239 ok(!lstrcmpW(expected
, received
),
9240 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9241 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9242 ok(lstrlenW(expected
) == len
,
9243 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9244 lstrlenW(expected
), len
, test_index
);
9248 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9249 hr
, S_FALSE
, test_index
);
9251 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9252 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9256 SysFreeString(expected
);
9259 if(uri
) IUri_Release(uri
);
9263 static void test_IUriBuilder_GetHost(IUriBuilder
*builder
, const uri_builder_test
*test
,
9267 LPCWSTR received
= NULL
;
9269 const uri_builder_property
*prop
= NULL
;
9271 /* Check if the property was set earlier. */
9272 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9273 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_HOST
)
9274 prop
= &(test
->properties
[i
]);
9278 /* Use expected_value unless it's NULL, then use value. */
9279 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9280 DWORD expected_len
= expected
? strlen(expected
) : 0;
9281 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9284 ok(hr
== (expected
? S_OK
: S_FALSE
),
9285 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9286 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9290 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9291 expected
, wine_dbgstr_w(received
), test_index
);
9294 ok(expected_len
== len
,
9295 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9296 expected_len
, len
, test_index
);
9300 ok(hr
== (expected
? S_OK
: S_FALSE
),
9301 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9302 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9303 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9304 expected
, wine_dbgstr_w(received
), test_index
);
9305 ok(expected_len
== len
,
9306 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9307 expected_len
, len
, test_index
);
9310 /* The property wasn't set earlier, so it should return whatever
9311 * the base IUri contains (if anything).
9314 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9316 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9317 hr
, S_OK
, test_index
);
9320 received
= (void*) 0xdeadbeef;
9323 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9325 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9326 hr
, S_FALSE
, test_index
);
9328 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9330 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9331 received
, test_index
);
9334 BOOL has_prop
= FALSE
;
9335 BSTR expected
= NULL
;
9337 hr
= IUri_GetHost(uri
, &expected
);
9339 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9341 has_prop
= hr
== S_OK
;
9343 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
9346 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9347 hr
, S_OK
, test_index
);
9349 ok(!lstrcmpW(expected
, received
),
9350 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9351 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9352 ok(lstrlenW(expected
) == len
,
9353 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9354 lstrlenW(expected
), len
, test_index
);
9358 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9359 hr
, S_FALSE
, test_index
);
9361 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9362 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9366 SysFreeString(expected
);
9369 if(uri
) IUri_Release(uri
);
9373 static void test_IUriBuilder_GetPassword(IUriBuilder
*builder
, const uri_builder_test
*test
,
9377 LPCWSTR received
= NULL
;
9379 const uri_builder_property
*prop
= NULL
;
9381 /* Check if the property was set earlier. */
9382 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9383 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PASSWORD
)
9384 prop
= &(test
->properties
[i
]);
9388 /* Use expected_value unless it's NULL, then use value. */
9389 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9390 DWORD expected_len
= expected
? strlen(expected
) : 0;
9391 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9394 ok(hr
== (expected
? S_OK
: S_FALSE
),
9395 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9396 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9400 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9401 expected
, wine_dbgstr_w(received
), test_index
);
9404 ok(expected_len
== len
,
9405 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9406 expected_len
, len
, test_index
);
9410 ok(hr
== (expected
? S_OK
: S_FALSE
),
9411 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9412 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9413 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9414 expected
, wine_dbgstr_w(received
), test_index
);
9415 ok(expected_len
== len
,
9416 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9417 expected_len
, len
, test_index
);
9420 /* The property wasn't set earlier, so it should return whatever
9421 * the base IUri contains (if anything).
9424 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9426 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9427 hr
, S_OK
, test_index
);
9430 received
= (void*) 0xdeadbeef;
9433 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9435 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9436 hr
, S_FALSE
, test_index
);
9438 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9440 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9441 received
, test_index
);
9444 BOOL has_prop
= FALSE
;
9445 BSTR expected
= NULL
;
9447 hr
= IUri_GetPassword(uri
, &expected
);
9449 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9451 has_prop
= hr
== S_OK
;
9453 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
9456 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9457 hr
, S_OK
, test_index
);
9459 ok(!lstrcmpW(expected
, received
),
9460 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9461 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9462 ok(lstrlenW(expected
) == len
,
9463 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9464 lstrlenW(expected
), len
, test_index
);
9468 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9469 hr
, S_FALSE
, test_index
);
9471 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9472 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9476 SysFreeString(expected
);
9479 if(uri
) IUri_Release(uri
);
9483 static void test_IUriBuilder_GetPath(IUriBuilder
*builder
, const uri_builder_test
*test
,
9487 LPCWSTR received
= NULL
;
9489 const uri_builder_property
*prop
= NULL
;
9491 /* Check if the property was set earlier. */
9492 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9493 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PATH
)
9494 prop
= &(test
->properties
[i
]);
9498 /* Use expected_value unless it's NULL, then use value. */
9499 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9500 DWORD expected_len
= expected
? strlen(expected
) : 0;
9501 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9504 ok(hr
== (expected
? S_OK
: S_FALSE
),
9505 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9506 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9510 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9511 expected
, wine_dbgstr_w(received
), test_index
);
9514 ok(expected_len
== len
,
9515 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9516 expected_len
, len
, test_index
);
9520 ok(hr
== (expected
? S_OK
: S_FALSE
),
9521 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9522 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9523 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9524 expected
, wine_dbgstr_w(received
), test_index
);
9525 ok(expected_len
== len
,
9526 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9527 expected_len
, len
, test_index
);
9530 /* The property wasn't set earlier, so it should return whatever
9531 * the base IUri contains (if anything).
9534 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9536 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9537 hr
, S_OK
, test_index
);
9540 received
= (void*) 0xdeadbeef;
9543 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9545 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9546 hr
, S_FALSE
, test_index
);
9548 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9550 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9551 received
, test_index
);
9554 BOOL has_prop
= FALSE
;
9555 BSTR expected
= NULL
;
9557 hr
= IUri_GetPath(uri
, &expected
);
9559 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9561 has_prop
= hr
== S_OK
;
9563 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
9566 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9567 hr
, S_OK
, test_index
);
9569 ok(!lstrcmpW(expected
, received
),
9570 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9571 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9572 ok(lstrlenW(expected
) == len
,
9573 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9574 lstrlenW(expected
), len
, test_index
);
9578 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9579 hr
, S_FALSE
, test_index
);
9581 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9582 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9586 SysFreeString(expected
);
9589 if(uri
) IUri_Release(uri
);
9593 static void test_IUriBuilder_GetPort(IUriBuilder
*builder
, const uri_builder_test
*test
,
9596 BOOL has_port
= FALSE
;
9597 DWORD received
= -1;
9599 if(test
->port_prop
.change
) {
9600 DWORD expected
= test
->port_prop
.value
;
9602 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9603 if(test
->port_prop
.todo
) {
9606 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9607 hr
, S_OK
, test_index
);
9611 ok(has_port
== test
->port_prop
.set
,
9612 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9613 test
->port_prop
.set
, has_port
, test_index
);
9616 ok(received
== expected
,
9617 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9618 expected
, received
, test_index
);
9623 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9624 hr
, S_OK
, test_index
);
9625 ok(has_port
== test
->port_prop
.set
,
9626 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9627 test
->port_prop
.set
, has_port
, test_index
);
9628 ok(received
== test
->port_prop
.value
,
9629 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9630 test
->port_prop
.value
, received
, test_index
);
9635 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9637 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9638 hr
, S_OK
, test_index
);
9641 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9643 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9644 hr
, S_OK
, test_index
);
9646 ok(has_port
== FALSE
,
9647 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9648 has_port
, test_index
);
9649 ok(!received
, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9650 received
, test_index
);
9655 hr
= IUri_GetPort(uri
, &expected
);
9657 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9660 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9662 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9663 hr
, S_OK
, test_index
);
9666 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9668 ok(received
== expected
,
9669 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9670 expected
, received
, test_index
);
9674 if(uri
) IUri_Release(uri
);
9678 static void test_IUriBuilder_GetQuery(IUriBuilder
*builder
, const uri_builder_test
*test
,
9682 LPCWSTR received
= NULL
;
9684 const uri_builder_property
*prop
= NULL
;
9686 /* Check if the property was set earlier. */
9687 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9688 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_QUERY
)
9689 prop
= &(test
->properties
[i
]);
9693 /* Use expected_value unless it's NULL, then use value. */
9694 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9695 DWORD expected_len
= expected
? strlen(expected
) : 0;
9696 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9699 ok(hr
== (expected
? S_OK
: S_FALSE
),
9700 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9701 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9705 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9706 expected
, wine_dbgstr_w(received
), test_index
);
9709 ok(expected_len
== len
,
9710 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9711 expected_len
, len
, test_index
);
9715 ok(hr
== (expected
? S_OK
: S_FALSE
),
9716 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9717 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9718 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9719 expected
, wine_dbgstr_w(received
), test_index
);
9720 ok(expected_len
== len
,
9721 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9722 expected_len
, len
, test_index
);
9725 /* The property wasn't set earlier, so it should return whatever
9726 * the base IUri contains (if anything).
9729 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9731 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9732 hr
, S_OK
, test_index
);
9735 received
= (void*) 0xdeadbeef;
9738 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9740 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9741 hr
, S_FALSE
, test_index
);
9743 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9745 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9746 received
, test_index
);
9749 BOOL has_prop
= FALSE
;
9750 BSTR expected
= NULL
;
9752 hr
= IUri_GetQuery(uri
, &expected
);
9754 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9756 has_prop
= hr
== S_OK
;
9758 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9761 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9762 hr
, S_OK
, test_index
);
9764 ok(!lstrcmpW(expected
, received
),
9765 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9766 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9767 ok(lstrlenW(expected
) == len
,
9768 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9769 lstrlenW(expected
), len
, test_index
);
9773 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9774 hr
, S_FALSE
, test_index
);
9776 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9777 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9781 SysFreeString(expected
);
9784 if(uri
) IUri_Release(uri
);
9788 static void test_IUriBuilder_GetSchemeName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9792 LPCWSTR received
= NULL
;
9794 const uri_builder_property
*prop
= NULL
;
9796 /* Check if the property was set earlier. */
9797 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9798 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_SCHEME_NAME
)
9799 prop
= &(test
->properties
[i
]);
9803 /* Use expected_value unless it's NULL, then use value. */
9804 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9805 DWORD expected_len
= expected
? strlen(expected
) : 0;
9806 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9809 ok(hr
== (expected
? S_OK
: S_FALSE
),
9810 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9811 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9815 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9816 expected
, wine_dbgstr_w(received
), test_index
);
9819 ok(expected_len
== len
,
9820 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9821 expected_len
, len
, test_index
);
9825 ok(hr
== (expected
? S_OK
: S_FALSE
),
9826 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9827 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9828 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9829 expected
, wine_dbgstr_w(received
), test_index
);
9830 ok(expected_len
== len
,
9831 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9832 expected_len
, len
, test_index
);
9835 /* The property wasn't set earlier, so it should return whatever
9836 * the base IUri contains (if anything).
9839 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9841 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9842 hr
, S_OK
, test_index
);
9845 received
= (void*) 0xdeadbeef;
9848 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9850 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9851 hr
, S_FALSE
, test_index
);
9853 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9855 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9856 received
, test_index
);
9859 BOOL has_prop
= FALSE
;
9860 BSTR expected
= NULL
;
9862 hr
= IUri_GetSchemeName(uri
, &expected
);
9864 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9866 has_prop
= hr
== S_OK
;
9868 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9871 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9872 hr
, S_OK
, test_index
);
9874 ok(!lstrcmpW(expected
, received
),
9875 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9876 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9877 ok(lstrlenW(expected
) == len
,
9878 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9879 lstrlenW(expected
), len
, test_index
);
9883 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9884 hr
, S_FALSE
, test_index
);
9886 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9887 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9891 SysFreeString(expected
);
9894 if(uri
) IUri_Release(uri
);
9898 static void test_IUriBuilder_GetUserName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9902 LPCWSTR received
= NULL
;
9904 const uri_builder_property
*prop
= NULL
;
9906 /* Check if the property was set earlier. */
9907 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9908 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_USER_NAME
)
9909 prop
= &(test
->properties
[i
]);
9912 if(prop
&& prop
->value
&& *prop
->value
) {
9913 /* Use expected_value unless it's NULL, then use value. */
9914 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9915 DWORD expected_len
= expected
? strlen(expected
) : 0;
9916 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9919 ok(hr
== (expected
? S_OK
: S_FALSE
),
9920 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9921 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9925 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9926 expected
, wine_dbgstr_w(received
), test_index
);
9929 ok(expected_len
== len
,
9930 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9931 expected_len
, len
, test_index
);
9935 ok(hr
== (expected
? S_OK
: S_FALSE
),
9936 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9937 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9938 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9939 expected
, wine_dbgstr_w(received
), test_index
);
9940 ok(expected_len
== len
,
9941 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9942 expected_len
, len
, test_index
);
9945 /* The property wasn't set earlier, so it should return whatever
9946 * the base IUri contains (if anything).
9949 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9951 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9952 hr
, S_OK
, test_index
);
9955 received
= (void*) 0xdeadbeef;
9958 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9960 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9961 hr
, S_FALSE
, test_index
);
9963 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9965 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9966 received
, test_index
);
9969 BSTR expected
= NULL
;
9970 BOOL has_prop
= FALSE
;
9972 hr
= IUri_GetUserName(uri
, &expected
);
9974 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9976 has_prop
= hr
== S_OK
;
9978 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9981 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9982 hr
, S_OK
, test_index
);
9984 ok(!lstrcmpW(expected
, received
),
9985 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9986 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9987 ok(lstrlenW(expected
) == len
,
9988 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9989 lstrlenW(expected
), len
, test_index
);
9993 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9994 hr
, S_FALSE
, test_index
);
9996 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9997 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
10001 SysFreeString(expected
);
10004 if(uri
) IUri_Release(uri
);
10008 /* Tests IUriBuilder functions. */
10009 static void test_IUriBuilder(void) {
10011 IUriBuilder
*builder
;
10014 for(i
= 0; i
< sizeof(uri_builder_tests
)/sizeof(uri_builder_tests
[0]); ++i
) {
10016 uri_builder_test test
= uri_builder_tests
[i
];
10017 LPWSTR uriW
= NULL
;
10020 uriW
= a2w(test
.uri
);
10021 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
10022 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10024 if(FAILED(hr
)) continue;
10026 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10027 if(test
.create_builder_todo
) {
10029 ok(hr
== test
.create_builder_expected
,
10030 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10031 hr
, test
.create_builder_expected
, i
);
10034 ok(hr
== test
.create_builder_expected
,
10035 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10036 hr
, test
.create_builder_expected
, i
);
10038 if(SUCCEEDED(hr
)) {
10040 BOOL modified
= FALSE
, received
= FALSE
;
10042 /* Perform all the string property changes. */
10043 for(j
= 0; j
< URI_BUILDER_STR_PROPERTY_COUNT
; ++j
) {
10044 uri_builder_property prop
= test
.properties
[j
];
10046 change_property(builder
, &prop
, i
);
10047 if(prop
.property
!= Uri_PROPERTY_SCHEME_NAME
&&
10048 prop
.property
!= Uri_PROPERTY_HOST
)
10050 else if(prop
.value
&& *prop
.value
)
10052 else if(prop
.value
&& !*prop
.value
&& prop
.property
== Uri_PROPERTY_HOST
)
10053 /* Host name property can't be NULL, but it can be empty. */
10058 if(test
.port_prop
.change
) {
10059 hr
= IUriBuilder_SetPort(builder
, test
.port_prop
.set
, test
.port_prop
.value
);
10061 if(test
.port_prop
.todo
) {
10063 ok(hr
== test
.port_prop
.expected
,
10064 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10065 hr
, test
.port_prop
.expected
, i
);
10068 ok(hr
== test
.port_prop
.expected
,
10069 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10070 hr
, test
.port_prop
.expected
, i
);
10074 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10076 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
10079 ok(received
== modified
,
10080 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
10081 modified
, received
, i
);
10083 /* Test the "Get*" functions. */
10084 test_IUriBuilder_GetFragment(builder
, &test
, i
);
10085 test_IUriBuilder_GetHost(builder
, &test
, i
);
10086 test_IUriBuilder_GetPassword(builder
, &test
, i
);
10087 test_IUriBuilder_GetPath(builder
, &test
, i
);
10088 test_IUriBuilder_GetPort(builder
, &test
, i
);
10089 test_IUriBuilder_GetQuery(builder
, &test
, i
);
10090 test_IUriBuilder_GetSchemeName(builder
, &test
, i
);
10091 test_IUriBuilder_GetUserName(builder
, &test
, i
);
10093 test_IUriBuilder_CreateUri(builder
, &test
, i
);
10094 test_IUriBuilder_CreateUriSimple(builder
, &test
, i
);
10095 test_IUriBuilder_CreateUriWithFlags(builder
, &test
, i
);
10097 if(builder
) IUriBuilder_Release(builder
);
10098 if(uri
) IUri_Release(uri
);
10103 static void test_IUriBuilder_HasBeenModified(void) {
10105 IUriBuilder
*builder
= NULL
;
10107 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10108 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10109 if(SUCCEEDED(hr
)) {
10110 static const WCHAR hostW
[] = {'g','o','o','g','l','e','.','c','o','m',0};
10114 hr
= IUriBuilder_HasBeenModified(builder
, NULL
);
10115 ok(hr
== E_POINTER
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10118 hr
= IUriBuilder_SetHost(builder
, hostW
);
10119 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
10122 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10123 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10126 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10128 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10129 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10130 if(SUCCEEDED(hr
)) {
10134 hr
= IUriBuilder_SetIUri(builder
, uri
);
10135 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
10138 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10139 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10142 ok(received
== FALSE
, "Error: Expected received to be FALSE.\n");
10144 /* Test what happens with you call SetIUri with the same IUri again. */
10145 hr
= IUriBuilder_SetHost(builder
, hostW
);
10146 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10148 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10149 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10152 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10154 hr
= IUriBuilder_SetIUri(builder
, uri
);
10155 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10157 /* IUriBuilder already had 'uri' as its IUri property and so Windows doesn't
10158 * reset any of the changes that were made to the IUriBuilder.
10160 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10161 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10163 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10165 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
10166 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10167 if(SUCCEEDED(hr
)) {
10168 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
10169 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
10170 ok(len
== lstrlenW(hostW
), "Error: Expected len to be %d, but was %d instead.\n",
10171 lstrlenW(hostW
), len
);
10174 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10175 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10177 hr
= IUriBuilder_SetHost(builder
, hostW
);
10178 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10179 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10180 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10183 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10185 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10186 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr
, S_OK
);
10188 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
10189 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
10192 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
10194 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
10195 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10196 if(SUCCEEDED(hr
)) {
10197 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
10198 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
10199 ok(len
== lstrlenW(hostW
), "Error: Expected len to %d, but was %d instead.\n",
10200 lstrlenW(hostW
), len
);
10203 if(uri
) IUri_Release(uri
);
10205 if(builder
) IUriBuilder_Release(builder
);
10208 /* Test IUriBuilder {Get,Set}IUri functions. */
10209 static void test_IUriBuilder_IUriProperty(void) {
10210 IUriBuilder
*builder
= NULL
;
10213 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10214 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10215 if(SUCCEEDED(hr
)) {
10218 hr
= IUriBuilder_GetIUri(builder
, NULL
);
10219 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
10222 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10223 if(SUCCEEDED(hr
)) {
10225 ULONG cur_count
, orig_count
;
10227 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
10228 orig_count
= get_refcnt(uri
);
10229 hr
= IUriBuilder_SetIUri(builder
, uri
);
10230 cur_count
= get_refcnt(uri
);
10232 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10233 orig_count
+1, cur_count
);
10235 hr
= IUriBuilder_SetIUri(builder
, NULL
);
10236 cur_count
= get_refcnt(uri
);
10238 ok(cur_count
== orig_count
, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10239 orig_count
, cur_count
);
10241 /* CreateUri* functions will return back the same IUri if nothing has changed. */
10242 hr
= IUriBuilder_SetIUri(builder
, uri
);
10243 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10244 orig_count
= get_refcnt(uri
);
10246 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, &test
);
10247 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10248 if(SUCCEEDED(hr
)) {
10249 cur_count
= get_refcnt(uri
);
10250 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10251 orig_count
+1, cur_count
);
10252 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n",
10255 if(test
) IUri_Release(test
);
10258 hr
= IUriBuilder_CreateUri(builder
, -1, 0, 0, &test
);
10259 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10260 if(SUCCEEDED(hr
)) {
10261 cur_count
= get_refcnt(uri
);
10262 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10263 orig_count
+1, cur_count
);
10264 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10266 if(test
) IUri_Release(test
);
10268 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10272 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, &test
);
10273 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10275 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
10277 if(test
) IUri_Release(test
);
10279 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10280 * explicitly set (because it's a default flag).
10283 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, &test
);
10284 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10285 if(SUCCEEDED(hr
)) {
10286 cur_count
= get_refcnt(uri
);
10287 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10288 orig_count
+1, cur_count
);
10289 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
10291 if(test
) IUri_Release(test
);
10294 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, &test
);
10295 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10296 if(SUCCEEDED(hr
)) {
10297 cur_count
= get_refcnt(uri
);
10298 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10299 orig_count
+1, cur_count
);
10300 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10302 if(test
) IUri_Release(test
);
10305 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &test
);
10306 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
10308 if(SUCCEEDED(hr
)) {
10309 cur_count
= get_refcnt(uri
);
10310 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10311 orig_count
+1, cur_count
);
10312 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
10314 if(test
) IUri_Release(test
);
10316 /* Doesn't return the same IUri, if the flag combination is different then the one that created
10320 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, 0, &test
);
10321 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10323 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
10325 if(test
) IUri_Release(test
);
10327 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
10328 * explicitly set (because it's a default flag).
10331 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, 0, &test
);
10332 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10333 if(SUCCEEDED(hr
)) {
10334 cur_count
= get_refcnt(uri
);
10335 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
10336 orig_count
+1, cur_count
);
10337 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
10339 if(test
) IUri_Release(test
);
10341 if(uri
) IUri_Release(uri
);
10343 if(builder
) IUriBuilder_Release(builder
);
10346 static void test_IUriBuilder_RemoveProperties(void) {
10347 IUriBuilder
*builder
= NULL
;
10351 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
10352 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10353 if(SUCCEEDED(hr
)) {
10354 /* Properties that can't be removed. */
10355 const DWORD invalid
= Uri_HAS_ABSOLUTE_URI
|Uri_HAS_DISPLAY_URI
|Uri_HAS_RAW_URI
|Uri_HAS_HOST_TYPE
|
10356 Uri_HAS_SCHEME
|Uri_HAS_ZONE
;
10358 for(i
= Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_DWORD_LAST
; ++i
) {
10359 hr
= IUriBuilder_RemoveProperties(builder
, i
<< 1);
10360 if((i
<< 1) & invalid
) {
10361 ok(hr
== E_INVALIDARG
,
10362 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10363 hr
, E_INVALIDARG
, i
);
10366 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
10371 /* Also doesn't accept anything that's outside the range of the
10374 hr
= IUriBuilder_RemoveProperties(builder
, (Uri_PROPERTY_DWORD_LAST
+1) << 1);
10375 ok(hr
== E_INVALIDARG
, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
10378 if(builder
) IUriBuilder_Release(builder
);
10380 for(i
= 0; i
< sizeof(uri_builder_remove_tests
)/sizeof(uri_builder_remove_tests
[0]); ++i
) {
10381 uri_builder_remove_test test
= uri_builder_remove_tests
[i
];
10385 uriW
= a2w(test
.uri
);
10386 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
10387 if(SUCCEEDED(hr
)) {
10390 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10391 if(test
.create_builder_todo
) {
10393 ok(hr
== test
.create_builder_expected
,
10394 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10395 hr
, test
.create_builder_expected
, i
);
10398 ok(hr
== test
.create_builder_expected
,
10399 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10400 hr
, test
.create_builder_expected
, i
);
10402 if(SUCCEEDED(hr
)) {
10403 hr
= IUriBuilder_RemoveProperties(builder
, test
.remove_properties
);
10404 if(test
.remove_todo
) {
10406 ok(hr
== test
.remove_expected
,
10407 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
10408 hr
, test
.remove_expected
, i
);
10411 ok(hr
== test
.remove_expected
,
10412 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
10413 hr
, test
.remove_expected
, i
);
10415 if(SUCCEEDED(hr
)) {
10416 IUri
*result
= NULL
;
10418 hr
= IUriBuilder_CreateUri(builder
, test
.expected_flags
, 0, 0, &result
);
10419 if(test
.expected_todo
) {
10421 ok(hr
== test
.expected_hres
,
10422 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10423 hr
, test
.expected_hres
, i
);
10426 ok(hr
== test
.expected_hres
,
10427 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
10428 hr
, test
.expected_hres
, i
);
10430 if(SUCCEEDED(hr
)) {
10431 BSTR received
= NULL
;
10433 hr
= IUri_GetAbsoluteUri(result
, &received
);
10434 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10435 ok(!strcmp_aw(test
.expected_uri
, received
),
10436 "Error: Expected %s but got %s instead on test %d.\n",
10437 test
.expected_uri
, wine_dbgstr_w(received
), i
);
10438 SysFreeString(received
);
10440 if(result
) IUri_Release(result
);
10443 if(builder
) IUriBuilder_Release(builder
);
10445 if(uri
) IUri_Release(uri
);
10450 static void test_IUriBuilder_Misc(void) {
10454 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10455 if(SUCCEEDED(hr
)) {
10456 IUriBuilder
*builder
;
10458 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
10459 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10460 if(SUCCEEDED(hr
)) {
10464 hr
= IUriBuilder_GetPort(builder
, &has
, &port
);
10465 ok(hr
== S_OK
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10466 if(SUCCEEDED(hr
)) {
10467 /* 'has' will be set to FALSE, even though uri had a port. */
10468 ok(has
== FALSE
, "Error: Expected 'has' to be FALSE, was %d instead.\n", has
);
10469 /* Still sets 'port' to 80. */
10470 ok(port
== 80, "Error: Expected the port to be 80, but, was %d instead.\n", port
);
10473 if(builder
) IUriBuilder_Release(builder
);
10475 if(uri
) IUri_Release(uri
);
10478 static void test_IUriBuilderFactory(void) {
10481 IUriBuilderFactory
*factory
;
10482 IUriBuilder
*builder
;
10484 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10485 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10486 if(SUCCEEDED(hr
)) {
10488 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&factory
);
10489 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x.\n", hr
);
10490 ok(factory
!= NULL
, "Error: Expected 'factory' to not be NULL.\n");
10492 if(SUCCEEDED(hr
)) {
10493 builder
= (void*) 0xdeadbeef;
10494 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 10, 0, &builder
);
10495 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10497 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10499 builder
= (void*) 0xdeadbeef;
10500 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 10, &builder
);
10501 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10503 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10505 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, NULL
);
10506 ok(hr
== E_POINTER
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10510 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, &builder
);
10511 ok(hr
== S_OK
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10513 if(SUCCEEDED(hr
)) {
10514 IUri
*tmp
= (void*) 0xdeadbeef;
10518 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
10519 ok(hr
== S_OK
, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
10521 ok(!tmp
, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp
);
10523 hr
= IUriBuilder_GetHost(builder
, &result_len
, &result
);
10524 ok(hr
== S_FALSE
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
10527 if(builder
) IUriBuilder_Release(builder
);
10529 builder
= (void*) 0xdeadbeef;
10530 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 10, 0, &builder
);
10531 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10533 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10535 builder
= (void*) 0xdeadbeef;
10536 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 10, &builder
);
10537 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10539 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
10541 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, NULL
);
10542 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10546 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, &builder
);
10547 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
10549 if(SUCCEEDED(hr
)) {
10552 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
10553 ok(hr
== S_OK
, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
10555 ok(tmp
== uri
, "Error: Expected tmp to be %p, but was %p.\n", uri
, tmp
);
10556 if(uri
) IUri_Release(uri
);
10558 if(builder
) IUriBuilder_Release(builder
);
10560 if(factory
) IUriBuilderFactory_Release(factory
);
10562 if(uri
) IUri_Release(uri
);
10565 static void test_CoInternetCombineIUri(void) {
10567 IUri
*base
, *relative
, *result
;
10571 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10572 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
10573 if(SUCCEEDED(hr
)) {
10574 result
= (void*) 0xdeadbeef;
10575 hr
= pCoInternetCombineIUri(base
, NULL
, 0, &result
, 0);
10576 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10577 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10581 hr
= pCreateUri(http_urlW
, 0, 0, &relative
);
10582 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
10583 if(SUCCEEDED(hr
)) {
10584 result
= (void*) 0xdeadbeef;
10585 hr
= pCoInternetCombineIUri(NULL
, relative
, 0, &result
, 0);
10586 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10587 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10590 hr
= pCoInternetCombineIUri(base
, relative
, 0, NULL
, 0);
10591 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10593 if(base
) IUri_Release(base
);
10594 if(relative
) IUri_Release(relative
);
10596 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10597 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10599 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10600 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10601 if(SUCCEEDED(hr
)) {
10602 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10604 hr
= pCreateUri(relativeW
, uri_combine_tests
[i
].relative_create_flags
, 0, &relative
);
10605 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10606 if(SUCCEEDED(hr
)) {
10609 hr
= pCoInternetCombineIUri(base
, relative
, uri_combine_tests
[i
].combine_flags
, &result
, 0);
10610 if(uri_combine_tests
[i
].todo
) {
10612 ok(hr
== uri_combine_tests
[i
].expected
,
10613 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10614 hr
, uri_combine_tests
[i
].expected
, i
);
10617 ok(hr
== uri_combine_tests
[i
].expected
,
10618 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10619 hr
, uri_combine_tests
[i
]. expected
, i
);
10621 if(SUCCEEDED(hr
)) {
10624 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10625 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10628 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10631 ok(hr
== prop
.expected
,
10632 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10633 hr
, prop
.expected
, i
, j
);
10636 ok(!strcmp_aw(prop
.value
, received
) ||
10637 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10638 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10639 prop
.value
, wine_dbgstr_w(received
), i
, j
);
10642 ok(hr
== prop
.expected
,
10643 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10644 hr
, prop
.expected
, i
, j
);
10645 ok(!strcmp_aw(prop
.value
, received
) ||
10646 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10647 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10648 prop
.value
, wine_dbgstr_w(received
), i
, j
);
10650 SysFreeString(received
);
10653 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10654 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10657 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10660 ok(hr
== prop
.expected
,
10661 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10662 hr
, prop
.expected
, i
, j
);
10665 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10666 prop
.value
, received
, i
, j
);
10669 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10670 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10671 hr
, prop
.expected
, i
, j
);
10672 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10673 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10674 prop
.value
, received
, i
, j
);
10678 if(result
) IUri_Release(result
);
10680 if(relative
) IUri_Release(relative
);
10681 heap_free(relativeW
);
10683 if(base
) IUri_Release(base
);
10688 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
10689 REFIID riid
, void **ppv
)
10691 ok(0, "unexpected call\n");
10692 return E_NOINTERFACE
;
10695 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
10700 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
10705 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
10706 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
10707 DWORD
*pcchResult
, DWORD dwReserved
)
10709 CHECK_EXPECT(ParseUrl
);
10710 ok(!lstrcmpW(pwzUrl
, parse_urlW
), "Error: Expected %s, but got %s instead.\n",
10711 wine_dbgstr_w(parse_urlW
), wine_dbgstr_w(pwzUrl
));
10712 ok(ParseAction
== parse_action
, "Error: Expected %d, but got %d.\n", parse_action
, ParseAction
);
10713 ok(dwParseFlags
== parse_flags
, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags
, dwParseFlags
);
10714 ok(cchResult
== 200, "Error: Got %d.\n", cchResult
);
10716 memcpy(pwzResult
, parse_resultW
, sizeof(parse_resultW
));
10717 *pcchResult
= lstrlenW(parse_resultW
);
10722 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
10723 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
10724 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
10726 CHECK_EXPECT(CombineUrl
);
10727 ok(!lstrcmpW(pwzBaseUrl
, combine_baseW
), "Error: Expected %s, but got %s instead.\n",
10728 wine_dbgstr_w(combine_baseW
), wine_dbgstr_w(pwzBaseUrl
));
10729 ok(!lstrcmpW(pwzRelativeUrl
, combine_relativeW
), "Error: Expected %s, but got %s instead.\n",
10730 wine_dbgstr_w(combine_relativeW
), wine_dbgstr_w(pwzRelativeUrl
));
10731 ok(dwCombineFlags
== (URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
),
10732 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags
);
10733 ok(cchResult
== INTERNET_MAX_URL_LENGTH
+1, "Error: Got %d.\n", cchResult
);
10735 memcpy(pwzResult
, combine_resultW
, sizeof(combine_resultW
));
10736 *pcchResult
= lstrlenW(combine_resultW
);
10741 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
10742 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
10744 ok(0, "unexpected call\n");
10748 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
10749 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
10750 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
10752 ok(0, "unexpected call\n");
10756 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
10757 InternetProtocolInfo_QueryInterface
,
10758 InternetProtocolInfo_AddRef
,
10759 InternetProtocolInfo_Release
,
10760 InternetProtocolInfo_ParseUrl
,
10761 InternetProtocolInfo_CombineUrl
,
10762 InternetProtocolInfo_CompareUrl
,
10763 InternetProtocolInfo_QueryInfo
10766 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
10768 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
10770 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
10771 *ppv
= &protocol_info
;
10775 ok(0, "unexpected call\n");
10776 return E_NOINTERFACE
;
10779 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
10784 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
10789 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
10790 REFIID riid
, void **ppv
)
10792 ok(0, "unexpected call\n");
10796 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
10798 ok(0, "unexpected call\n");
10802 static const IClassFactoryVtbl ClassFactoryVtbl
= {
10803 ClassFactory_QueryInterface
,
10804 ClassFactory_AddRef
,
10805 ClassFactory_Release
,
10806 ClassFactory_CreateInstance
,
10807 ClassFactory_LockServer
10810 static IClassFactory protocol_cf
= { &ClassFactoryVtbl
};
10812 static void register_protocols(void)
10814 IInternetSession
*session
;
10817 hres
= pCoInternetGetSession(0, &session
, 0);
10818 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
10822 hres
= IInternetSession_RegisterNameSpace(session
, &protocol_cf
, &IID_NULL
,
10823 winetestW
, 0, NULL
, 0);
10824 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
10826 IInternetSession_Release(session
);
10829 static void unregister_protocols(void) {
10830 IInternetSession
*session
;
10833 hr
= pCoInternetGetSession(0, &session
, 0);
10834 ok(hr
== S_OK
, "CoInternetGetSession failed: 0x%08x\n", hr
);
10838 hr
= IInternetSession_UnregisterNameSpace(session
, &protocol_cf
, winetestW
);
10839 ok(hr
== S_OK
, "UnregisterNameSpace failed: 0x%08x\n", hr
);
10841 IInternetSession_Release(session
);
10844 static void test_CoInternetCombineIUri_Pluggable(void) {
10848 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10849 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10850 if(SUCCEEDED(hr
)) {
10851 IUri
*relative
= NULL
;
10853 hr
= pCreateUri(combine_relativeW
, Uri_CREATE_ALLOW_RELATIVE
, 0, &relative
);
10854 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10855 if(SUCCEEDED(hr
)) {
10856 IUri
*result
= NULL
;
10858 SET_EXPECT(CombineUrl
);
10860 hr
= pCoInternetCombineIUri(base
, relative
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10862 ok(hr
== S_OK
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10864 CHECK_CALLED(CombineUrl
);
10866 if(SUCCEEDED(hr
)) {
10867 BSTR received
= NULL
;
10868 hr
= IUri_GetAbsoluteUri(result
, &received
);
10869 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10870 if(SUCCEEDED(hr
)) {
10871 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10872 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10874 SysFreeString(received
);
10876 if(result
) IUri_Release(result
);
10878 if(relative
) IUri_Release(relative
);
10880 if(base
) IUri_Release(base
);
10883 static void test_CoInternetCombineUrlEx(void) {
10885 IUri
*base
, *result
;
10889 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10890 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10891 if(SUCCEEDED(hr
)) {
10892 result
= (void*) 0xdeadbeef;
10893 hr
= pCoInternetCombineUrlEx(base
, NULL
, 0, &result
, 0);
10894 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10896 ok(!result
, "Error: Expected 'result' to be NULL was %p instead.\n", result
);
10899 result
= (void*) 0xdeadbeef;
10900 hr
= pCoInternetCombineUrlEx(NULL
, http_urlW
, 0, &result
, 0);
10901 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10903 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10905 result
= (void*) 0xdeadbeef;
10906 hr
= pCoInternetCombineUrlEx(NULL
, NULL
, 0, &result
, 0);
10907 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10909 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10911 hr
= pCoInternetCombineUrlEx(base
, http_urlW
, 0, NULL
, 0);
10912 ok(hr
== E_POINTER
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10914 if(base
) IUri_Release(base
);
10916 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10917 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10919 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10920 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10921 if(SUCCEEDED(hr
)) {
10922 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10924 hr
= pCoInternetCombineUrlEx(base
, relativeW
, uri_combine_tests
[i
].combine_flags
,
10926 if(uri_combine_tests
[i
].todo
) {
10928 ok(hr
== uri_combine_tests
[i
].expected
,
10929 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10930 hr
, uri_combine_tests
[i
].expected
, i
);
10933 ok(hr
== uri_combine_tests
[i
].expected
,
10934 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10935 hr
, uri_combine_tests
[i
]. expected
, i
);
10937 if(SUCCEEDED(hr
)) {
10940 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10941 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10943 LPCSTR value
= (prop
.value_ex
) ? prop
.value_ex
: prop
.value
;
10945 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10948 ok(hr
== prop
.expected
,
10949 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10950 hr
, prop
.expected
, i
, j
);
10953 ok(!strcmp_aw(value
, received
) ||
10954 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10955 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10956 value
, wine_dbgstr_w(received
), i
, j
);
10959 ok(hr
== prop
.expected
,
10960 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10961 hr
, prop
.expected
, i
, j
);
10962 ok(!strcmp_aw(value
, received
) ||
10963 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10964 "Error: Expected \"%s\" but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10965 value
, wine_dbgstr_w(received
), i
, j
);
10967 SysFreeString(received
);
10970 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10971 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10974 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10977 ok(hr
== prop
.expected
,
10978 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10979 hr
, prop
.expected
, i
, j
);
10982 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10983 prop
.value
, received
, i
, j
);
10986 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10987 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10988 hr
, prop
.expected
, i
, j
);
10989 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10990 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10991 prop
.value
, received
, i
, j
);
10995 if(result
) IUri_Release(result
);
10996 heap_free(relativeW
);
10998 if(base
) IUri_Release(base
);
11003 static void test_CoInternetCombineUrlEx_Pluggable(void) {
11007 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
11008 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
11009 if(SUCCEEDED(hr
)) {
11010 IUri
*result
= NULL
;
11012 SET_EXPECT(CombineUrl
);
11014 hr
= pCoInternetCombineUrlEx(base
, combine_relativeW
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
11016 ok(hr
== S_OK
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
11018 CHECK_CALLED(CombineUrl
);
11020 if(SUCCEEDED(hr
)) {
11021 BSTR received
= NULL
;
11022 hr
= IUri_GetAbsoluteUri(result
, &received
);
11023 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
11024 if(SUCCEEDED(hr
)) {
11025 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
11026 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
11028 SysFreeString(received
);
11030 if(result
) IUri_Release(result
);
11032 if(base
) IUri_Release(base
);
11035 static void test_CoInternetParseIUri_InvalidArgs(void) {
11041 hr
= pCoInternetParseIUri(NULL
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
11042 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11044 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11046 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
11047 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
11048 if(SUCCEEDED(hr
)) {
11049 DWORD expected_len
;
11052 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, NULL
, 0, &result
, 0);
11053 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11055 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11057 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, NULL
, 0);
11058 ok(hr
== E_POINTER
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11062 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_URL
, 0, tmp
, 3, &result
, 0);
11063 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
11065 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11068 hr
= pCoInternetParseIUri(uri
, PARSE_MIME
, 0, tmp
, 3, &result
, 0);
11069 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11071 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11074 hr
= pCoInternetParseIUri(uri
, PARSE_SERVER
, 0, tmp
, 3, &result
, 0);
11075 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11077 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11080 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_DOMAIN
, 0, tmp
, 3, &result
, 0);
11081 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11083 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
11085 expected_len
= lstrlenW(http_urlW
);
11087 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
11088 ok(hr
== STRSAFE_E_INSUFFICIENT_BUFFER
,
11089 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
11090 hr
, STRSAFE_E_INSUFFICIENT_BUFFER
);
11091 ok(result
== expected_len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
11092 expected_len
, result
);
11094 if(uri
) IUri_Release(uri
);
11097 static void test_CoInternetParseIUri(void) {
11100 for(i
= 0; i
< sizeof(uri_parse_tests
)/sizeof(uri_parse_tests
[0]); ++i
) {
11104 uri_parse_test test
= uri_parse_tests
[i
];
11106 uriW
= a2w(test
.uri
);
11107 hr
= pCreateUri(uriW
, test
.uri_flags
, 0, &uri
);
11108 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr
, i
);
11109 if(SUCCEEDED(hr
)) {
11110 WCHAR result
[INTERNET_MAX_URL_LENGTH
+1];
11111 DWORD result_len
= -1;
11113 hr
= pCoInternetParseIUri(uri
, test
.action
, test
.flags
, result
, INTERNET_MAX_URL_LENGTH
+1, &result_len
, 0);
11116 ok(hr
== test
.expected
,
11117 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11118 hr
, test
.expected
, i
);
11121 ok(hr
== test
.expected
,
11122 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
11123 hr
, test
.expected
, i
);
11125 if(SUCCEEDED(hr
)) {
11126 DWORD len
= lstrlenA(test
.property
);
11127 ok(!strcmp_aw(test
.property
, result
),
11128 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
11129 test
.property
, wine_dbgstr_w(result
), i
);
11130 ok(len
== result_len
,
11131 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
11132 len
, result_len
, i
);
11135 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
11139 if(uri
) IUri_Release(uri
);
11144 static void test_CoInternetParseIUri_Pluggable(void) {
11148 hr
= pCreateUri(parse_urlW
, 0, 0, &uri
);
11149 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr
);
11150 if(SUCCEEDED(hr
)) {
11154 SET_EXPECT(ParseUrl
);
11156 parse_action
= PARSE_CANONICALIZE
;
11157 parse_flags
= URL_UNESCAPE
|URL_ESCAPE_UNSAFE
;
11159 hr
= pCoInternetParseIUri(uri
, parse_action
, parse_flags
, result
, 200, &result_len
, 0);
11160 ok(hr
== S_OK
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
11162 CHECK_CALLED(ParseUrl
);
11164 if(SUCCEEDED(hr
)) {
11165 ok(result_len
== lstrlenW(parse_resultW
), "Error: Expected %d, but got %d.\n",
11166 lstrlenW(parse_resultW
), result_len
);
11167 ok(!lstrcmpW(result
, parse_resultW
), "Error: Expected %s, but got %s.\n",
11168 wine_dbgstr_w(parse_resultW
), wine_dbgstr_w(result
));
11171 if(uri
) IUri_Release(uri
);
11177 const char *base_url
;
11178 DWORD base_uri_flags
;
11179 const char *legacy_url
;
11180 const char *uniform_url
;
11181 const char *no_canon_url
;
11182 const char *uri_url
;
11183 } create_urlmon_test_t
;
11185 static const create_urlmon_test_t create_urlmon_tests
[] = {
11187 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE
,
11189 "http://www.winehq.org/",
11190 "http://www.winehq.org/",
11191 "http://www.winehq.org",
11192 "http://www.winehq.org"
11195 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE
,
11197 "file://c:\\dir\\file.txt",
11198 "file:///c:/dir/file.txt",
11199 "file:///c:/dir/file.txt",
11200 "file:///c:/dir/file.txt"
11203 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH
,
11205 "file://c:\\dir\\file.txt",
11206 "file:///c:/dir/file.txt",
11207 "file:///c:/dir/file.txt",
11208 "file://c:\\dir\\file.txt"
11211 "dat%61",Uri_CREATE_ALLOW_RELATIVE
,
11212 "http://www.winehq.org",0,
11213 "http://www.winehq.org/data",
11214 "http://www.winehq.org/data",
11215 "http://www.winehq.org:80/data",
11218 "file.txt",Uri_CREATE_ALLOW_RELATIVE
,
11219 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE
,
11220 "file://c:\\dir\\file.txt",
11221 "file:///c:/dir/file.txt",
11222 "file:///c:/dir/file.txt",
11225 "",Uri_CREATE_ALLOW_RELATIVE
,
11233 "test",Uri_CREATE_ALLOW_RELATIVE
,
11241 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
11243 "file://c:\\dir\\file.txt",
11244 "file:///c:/dir/file.txt",
11245 "file:///c:/dir/file.txt",
11246 "file:///c:/dir/file.txt",
11249 "c:\\dir\\file.txt#frag|part",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
11251 "file://c:\\dir\\file.txt#frag|part",
11252 "file:///c:/dir/file.txt#frag%7Cpart",
11253 "file:///c:/dir/file.txt#frag%7Cpart",
11254 "file:///c:/dir/file.txt#frag%7Cpart",
11258 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
11259 static void _test_urlmon_display_name(unsigned line
, IMoniker
*mon
, const char *exurl
)
11261 WCHAR
*display_name
;
11264 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
11265 ok_(__FILE__
,line
)(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
11266 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_name
), "unexpected display name: %s, expected %s\n",
11267 wine_dbgstr_w(display_name
), exurl
);
11269 CoTaskMemFree(display_name
);
11272 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
11273 static void _test_display_uri(unsigned line
, IMoniker
*mon
, const char *exurl
)
11275 IUriContainer
*uri_container
;
11280 hres
= IMoniker_QueryInterface(mon
, &IID_IUriContainer
, (void**)&uri_container
);
11281 ok(hres
== S_OK
, "Could not get IUriContainer iface: %08x\n", hres
);
11284 hres
= IUriContainer_GetIUri(uri_container
, &uri
);
11285 IUriContainer_Release(uri_container
);
11286 ok(hres
== S_OK
, "GetIUri failed: %08x\n", hres
);
11287 ok(uri
!= NULL
, "uri == NULL\n");
11289 hres
= IUri_GetDisplayUri(uri
, &display_uri
);
11291 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
11292 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_uri
), "unexpected display uri: %s, expected %s\n",
11293 wine_dbgstr_w(display_uri
), exurl
);
11294 SysFreeString(display_uri
);
11297 static void test_CreateURLMoniker(void)
11299 const create_urlmon_test_t
*test
;
11300 IMoniker
*mon
, *base_mon
;
11301 WCHAR
*url
, *base_url
;
11302 IUri
*uri
, *base_uri
;
11305 for(test
= create_urlmon_tests
; test
< create_urlmon_tests
+ sizeof(create_urlmon_tests
)/sizeof(*create_urlmon_tests
); test
++) {
11306 url
= a2w(test
->url
);
11307 base_url
= a2w(test
->base_url
);
11310 hres
= pCreateUri(base_url
, test
->base_uri_flags
, 0, &base_uri
);
11311 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
11313 hres
= pCreateURLMonikerEx2(NULL
, base_uri
, &base_mon
, URL_MK_NO_CANONICALIZE
);
11314 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11320 hres
= CreateURLMoniker(base_mon
, url
, &mon
);
11321 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11322 test_urlmon_display_name(mon
, test
->legacy_url
);
11323 test_display_uri(mon
, test
->legacy_url
);
11324 IMoniker_Release(mon
);
11326 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_LEGACY
);
11327 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11328 test_urlmon_display_name(mon
, test
->legacy_url
);
11329 test_display_uri(mon
, test
->legacy_url
);
11330 IMoniker_Release(mon
);
11332 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_UNIFORM
);
11333 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11334 test_urlmon_display_name(mon
, test
->uniform_url
);
11335 test_display_uri(mon
, test
->uniform_url
);
11336 IMoniker_Release(mon
);
11338 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_NO_CANONICALIZE
);
11339 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
11340 test_urlmon_display_name(mon
, test
->no_canon_url
);
11341 test_display_uri(mon
, test
->no_canon_url
);
11342 IMoniker_Release(mon
);
11344 hres
= pCreateUri(url
, test
->uri_flags
, 0, &uri
);
11345 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
11347 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_LEGACY
);
11348 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11349 test_urlmon_display_name(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
11350 test_display_uri(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
11351 IMoniker_Release(mon
);
11353 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_UNIFORM
);
11354 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11355 test_urlmon_display_name(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
11356 test_display_uri(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
11357 IMoniker_Release(mon
);
11359 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_NO_CANONICALIZE
);
11360 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
11361 test_urlmon_display_name(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
11362 test_display_uri(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
11363 IMoniker_Release(mon
);
11367 heap_free(base_url
);
11369 IUri_Release(base_uri
);
11371 IMoniker_Release(base_mon
);
11375 static int add_default_flags(DWORD flags
) {
11376 if(!(flags
& Uri_CREATE_NO_CANONICALIZE
))
11377 flags
|= Uri_CREATE_CANONICALIZE
;
11378 if(!(flags
& Uri_CREATE_NO_DECODE_EXTRA_INFO
))
11379 flags
|= Uri_CREATE_DECODE_EXTRA_INFO
;
11380 if(!(flags
& Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
))
11381 flags
|= Uri_CREATE_CRACK_UNKNOWN_SCHEMES
;
11382 if(!(flags
& Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
11383 flags
|= Uri_CREATE_PRE_PROCESS_HTML_URI
;
11384 if(!(flags
& Uri_CREATE_IE_SETTINGS
))
11385 flags
|= Uri_CREATE_NO_IE_SETTINGS
;
11390 static void test_IPersistStream(void)
11392 int i
, props_order
[Uri_PROPERTY_DWORD_LAST
+1] = { 0 };
11394 props_order
[Uri_PROPERTY_RAW_URI
] = 1;
11395 props_order
[Uri_PROPERTY_FRAGMENT
] = 2;
11396 props_order
[Uri_PROPERTY_HOST
] = 3;
11397 props_order
[Uri_PROPERTY_PASSWORD
] = 4;
11398 props_order
[Uri_PROPERTY_PATH
] = 5;
11399 props_order
[Uri_PROPERTY_PORT
] = 6;
11400 props_order
[Uri_PROPERTY_QUERY
] = 7;
11401 props_order
[Uri_PROPERTY_SCHEME_NAME
] = 8;
11402 props_order
[Uri_PROPERTY_USER_NAME
] = 9;
11404 for(i
=0; i
<sizeof(uri_tests
)/sizeof(*uri_tests
); i
++) {
11405 const uri_properties
*test
= uri_tests
+i
;
11408 IPersistStream
*persist_stream
;
11411 DWORD props
, props_no
, dw_data
[6];
11412 WCHAR str_data
[1024];
11413 ULARGE_INTEGER size
, max_size
;
11414 LARGE_INTEGER no_off
;
11419 if(test
->create_todo
|| test
->create_expected
!=S_OK
)
11422 uriW
= a2w(test
->uri
);
11423 hr
= pCreateUri(uriW
, test
->create_flags
, 0, &uri
);
11424 ok(hr
== S_OK
, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i
, hr
);
11426 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
11427 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11429 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
11430 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed 0x%08x.\n", hr
);
11431 hr
= IPersistStream_IsDirty(persist_stream
);
11432 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
11433 hr
= IPersistStream_Save(persist_stream
, stream
, FALSE
);
11434 ok(hr
== S_OK
, "%d) Save failed 0x%08x, expected S_OK.\n", i
, hr
);
11435 hr
= IPersistStream_IsDirty(persist_stream
);
11436 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
11437 no_off
.QuadPart
= 0;
11438 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
11439 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11440 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11441 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11442 hr
= IPersistStream_GetSizeMax(persist_stream
, &max_size
);
11443 ok(hr
== S_OK
, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i
, hr
);
11444 ok(U(size
).LowPart
+2 == U(max_size
).LowPart
,
11445 "%d) Written data size is %d, max_size %d.\n",
11446 i
, U(size
).LowPart
, U(max_size
).LowPart
);
11448 hr
= IStream_Read(stream
, (void*)dw_data
, sizeof(DWORD
), NULL
);
11449 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11450 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
11451 i
, dw_data
[0]-2, U(size
).LowPart
);
11452 hr
= IStream_Read(stream
, (void*)dw_data
, 6*sizeof(DWORD
), NULL
);
11453 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11454 ok(dw_data
[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[0]);
11455 ok(dw_data
[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[1]);
11456 ok(dw_data
[2] == add_default_flags(test
->create_flags
),
11457 "%d) Incorrect value %x, expected %x (creation flags).\n",
11458 i
, dw_data
[2], add_default_flags(test
->create_flags
));
11459 ok(dw_data
[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[3]);
11460 ok(dw_data
[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[4]);
11461 ok(dw_data
[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[5]);
11464 for(props
=0; props
<=Uri_PROPERTY_DWORD_LAST
; props
++) {
11465 if(!props_order
[props
])
11468 if(props
<= Uri_PROPERTY_STRING_LAST
) {
11469 if(test
->str_props
[props
].expected
== S_OK
)
11472 if(test
->dword_props
[props
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
11476 if(test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTP
11477 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_FTP
11478 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTPS
)
11481 hr
= IStream_Read(stream
, (void*)&props
, sizeof(DWORD
), NULL
);
11482 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11483 ok(props
== props_no
, "%d) Properties no is %d, expected %d.\n", i
, props
, props_no
);
11488 hr
= IStream_Read(stream
, (void*)dw_data
, 2*sizeof(DWORD
), NULL
);
11489 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11491 ok(dw_data
[2]<props_order
[dw_data
[0]],
11492 "%d) Incorrect properties order (%d, %d)\n",
11493 i
, dw_data
[0], dw_data
[3]);
11494 dw_data
[2] = props_order
[dw_data
[0]];
11495 dw_data
[3] = dw_data
[0];
11497 if(dw_data
[0]<=Uri_PROPERTY_STRING_LAST
) {
11498 const uri_str_property
*prop
= test
->str_props
+dw_data
[0];
11499 hr
= IStream_Read(stream
, (void*)str_data
, dw_data
[1], NULL
);
11500 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11501 ok(!strcmp_aw(prop
->value
, str_data
) || broken(prop
->broken_value
&& !strcmp_aw(prop
->broken_value
, str_data
)),
11502 "%d) Expected %s but got %s (%d).\n", i
, prop
->value
, wine_dbgstr_w(str_data
), dw_data
[0]);
11503 } else if(dw_data
[0]>=Uri_PROPERTY_DWORD_START
&& dw_data
[0]<=Uri_PROPERTY_DWORD_LAST
) {
11504 const uri_dword_property
*prop
= test
->dword_props
+dw_data
[0]-Uri_PROPERTY_DWORD_START
;
11505 ok(dw_data
[1] == sizeof(DWORD
), "%d) Size of dword property is %d (%d)\n", i
, dw_data
[1], dw_data
[0]);
11506 hr
= IStream_Read(stream
, (void*)&dw_data
[1], sizeof(DWORD
), NULL
);
11507 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11508 ok(prop
->value
== dw_data
[1], "%d) Expected %d but got %d (%d).\n", i
, prop
->value
, dw_data
[1], dw_data
[0]);
11510 ok(FALSE
, "%d) Incorrect property type (%d)\n", i
, dw_data
[0]);
11514 ok(props
== 0, "%d) Not all properties were processed %d. Next property type: %d\n",
11515 i
, props
, dw_data
[0]);
11519 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11520 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11521 hr
= IPersistStream_GetClassID(persist_stream
, &curi
);
11522 ok(hr
== S_OK
, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i
, hr
);
11523 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetClassID returned incorrect CLSID.\n", i
);
11524 IPersistStream_Release(persist_stream
);
11526 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11527 &IID_IUri
, (void**)&uri
);
11528 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
11529 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
11530 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11531 hr
= IPersistStream_Load(persist_stream
, stream
);
11532 ok(hr
== S_OK
, "%d) Load failed 0x%08x, expected S_OK.\n", i
, hr
);
11533 hr
= IUri_GetRawUri(uri
, &raw_uri
);
11534 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
11535 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
11536 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
11537 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
11538 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
11539 wine_dbgstr_w(raw_uri
));
11540 SysFreeString(raw_uri
);
11541 IPersistStream_Release(persist_stream
);
11543 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
11544 ok(hr
== S_OK
, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i
, hr
);
11545 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11546 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11547 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11548 MSHCTX_DIFFERENTMACHINE
, NULL
, MSHLFLAGS_NORMAL
);
11549 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11550 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11551 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
);
11552 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11553 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11554 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLESTRONG
);
11555 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11556 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11557 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLEWEAK
);
11558 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11559 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11560 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NOPING
);
11561 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11562 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
11563 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NORMAL
);
11564 ok(hr
== S_OK
, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11565 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
11566 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
11567 ok(hr
== E_INVALIDARG
, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
11568 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
11569 MSHCTX_INPROC
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
11570 ok(hr
== S_OK
, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i
, hr
);
11571 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i
);
11573 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
11574 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11575 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11576 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11577 hr
= IStream_Read(stream
, (void*)dw_data
, 3*sizeof(DWORD
), NULL
);
11578 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
11579 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
11580 i
, dw_data
[0]-2, U(size
).LowPart
);
11581 ok(dw_data
[1] == MSHCTX_LOCAL
, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
11583 ok(dw_data
[2] == dw_data
[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11584 i
, dw_data
[2], dw_data
[0]-8);
11585 if(!test
->str_props
[Uri_PROPERTY_PATH
].value
[0] &&
11586 (test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTP
11587 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_FTP
11588 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTPS
))
11589 U(max_size
).LowPart
+= 3*sizeof(DWORD
);
11590 ok(dw_data
[2] == U(max_size
).LowPart
, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11591 i
, dw_data
[2], U(max_size
).LowPart
);
11592 IMarshal_Release(marshal
);
11595 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11596 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11597 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11598 &IID_IUri
, (void**)&uri
);
11599 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
11600 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
11601 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11602 hr
= IMarshal_UnmarshalInterface(marshal
, stream
, &IID_IUri
, (void**)&uri
);
11603 ok(hr
== S_OK
, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11604 hr
= IUri_GetRawUri(uri
, &raw_uri
);
11605 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
11606 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
11607 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
11608 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
11609 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
11610 wine_dbgstr_w(raw_uri
));
11611 SysFreeString(raw_uri
);
11613 IMarshal_Release(marshal
);
11614 IStream_Release(stream
);
11620 static void test_UninitializedUri(void)
11623 IUriBuilderFactory
*ubf
;
11624 IPersistStream
*ps
;
11632 hr
= CoCreateInstance(&CLSID_CUri
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11633 &IID_IUri
, (void**)&uri
);
11635 win_skip("Skipping uninitialized Uri tests.\n");
11639 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&ubf
);
11640 ok(hr
== S_OK
, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr
);
11641 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&ps
);
11642 ok(hr
== S_OK
, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr
);
11644 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
11645 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11646 hr
= IUri_GetAbsoluteUri(uri
, &bstr
);
11647 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11648 hr
= IUri_GetAuthority(uri
, &bstr
);
11649 ok(hr
== E_UNEXPECTED
, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr
);
11650 hr
= IUri_GetDisplayUri(uri
, &bstr
);
11651 ok(hr
== E_UNEXPECTED
, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr
);
11652 hr
= IUri_GetDomain(uri
, &bstr
);
11653 ok(hr
== E_UNEXPECTED
, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr
);
11654 hr
= IUri_GetExtension(uri
, &bstr
);
11655 ok(hr
== E_UNEXPECTED
, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr
);
11656 hr
= IUri_GetFragment(uri
, &bstr
);
11657 ok(hr
== E_UNEXPECTED
, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr
);
11658 hr
= IUri_GetHost(uri
, &bstr
);
11659 ok(hr
== E_UNEXPECTED
, "GetHost returned %x, expected E_UNEXPECTED.\n", hr
);
11660 hr
= IUri_GetHostType(uri
, &dword
);
11661 ok(hr
== E_UNEXPECTED
, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr
);
11662 hr
= IUri_GetPassword(uri
, &bstr
);
11663 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11664 hr
= IUri_GetPassword(uri
, &bstr
);
11665 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11666 hr
= IUri_GetPathAndQuery(uri
, &bstr
);
11667 ok(hr
== E_UNEXPECTED
, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11668 hr
= IUri_GetPort(uri
, &dword
);
11669 ok(hr
== E_UNEXPECTED
, "GetPort returned %x, expected E_UNEXPECTED.\n", hr
);
11670 hr
= IUri_GetProperties(uri
, &dword
);
11671 ok(hr
== E_UNEXPECTED
, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr
);
11672 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, &bstr
, 0);
11673 ok(hr
== E_UNEXPECTED
, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr
);
11674 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_PORT
, &dword
, 0);
11675 ok(hr
== E_UNEXPECTED
, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr
);
11676 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_RAW_URI
, &dword
, 0);
11677 ok(hr
== E_UNEXPECTED
, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr
);
11678 hr
= IUri_GetQuery(uri
, &bstr
);
11679 ok(hr
== E_UNEXPECTED
, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11680 hr
= IUri_GetRawUri(uri
, &bstr
);
11681 ok(hr
== E_UNEXPECTED
, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr
);
11682 hr
= IUri_GetScheme(uri
, &dword
);
11683 ok(hr
== E_UNEXPECTED
, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr
);
11684 hr
= IUri_GetSchemeName(uri
, &bstr
);
11685 ok(hr
== E_UNEXPECTED
, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr
);
11686 hr
= IUri_GetUserInfo(uri
, &bstr
);
11687 ok(hr
== E_UNEXPECTED
, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr
);
11688 hr
= IUri_GetUserName(uri
, &bstr
);
11689 ok(hr
== E_UNEXPECTED
, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr
);
11690 hr
= IUri_GetZone(uri
, &dword
);
11691 ok(hr
== E_UNEXPECTED
, "GetZone returned %x, expected E_UNEXPECTED.\n", hr
);
11692 hr
= IUri_IsEqual(uri
, uri
, &eq
);
11693 ok(hr
== E_UNEXPECTED
, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr
);
11695 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(ubf
, 0, 0, &ub
);
11696 ok(hr
== E_UNEXPECTED
, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr
);
11697 hr
= IUriBuilderFactory_CreateIUriBuilder(ubf
, 0, 0, &ub
);
11698 ok(hr
== S_OK
, "CreateIUriBuilder returned %x, expected S_OK.\n", hr
);
11699 IUriBuilder_Release(ub
);
11701 hr
= IPersistStream_GetSizeMax(ps
, &ui
);
11702 ok(hr
== S_OK
, "GetSizeMax returned %x, expected S_OK.\n", hr
);
11703 ok(ui
.u
.LowPart
== 34, "ui.LowPart = %d, expected 34.\n", ui
.u
.LowPart
);
11704 hr
= IPersistStream_IsDirty(ps
);
11705 ok(hr
== S_FALSE
, "IsDirty returned %x, expected S_FALSE.\n", hr
);
11707 IPersistStream_Release(ps
);
11708 IUriBuilderFactory_Release(ubf
);
11715 hurlmon
= GetModuleHandleA("urlmon.dll");
11716 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
11717 pCreateUri
= (void*) GetProcAddress(hurlmon
, "CreateUri");
11718 pCreateUriWithFragment
= (void*) GetProcAddress(hurlmon
, "CreateUriWithFragment");
11719 pCreateIUriBuilder
= (void*) GetProcAddress(hurlmon
, "CreateIUriBuilder");
11720 pCoInternetCombineIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineIUri");
11721 pCoInternetCombineUrlEx
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineUrlEx");
11722 pCoInternetParseIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetParseIUri");
11723 pCreateURLMonikerEx
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx");
11724 pCreateURLMonikerEx2
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx2");
11727 win_skip("CreateUri is not present, skipping tests.\n");
11731 trace("test CreateUri invalid flags...\n");
11732 test_CreateUri_InvalidFlags();
11734 trace("test CreateUri invalid args...\n");
11735 test_CreateUri_InvalidArgs();
11737 trace("test CreateUri invalid URIs...\n");
11738 test_CreateUri_InvalidUri();
11740 trace("test IUri_GetPropertyBSTR...\n");
11741 test_IUri_GetPropertyBSTR();
11743 trace("test IUri_GetPropertyDWORD...\n");
11744 test_IUri_GetPropertyDWORD();
11746 trace("test IUri_GetStrProperties...\n");
11747 test_IUri_GetStrProperties();
11749 trace("test IUri_GetDwordProperties...\n");
11750 test_IUri_GetDwordProperties();
11752 trace("test IUri_GetPropertyLength...\n");
11753 test_IUri_GetPropertyLength();
11755 trace("test IUri_GetProperties...\n");
11756 test_IUri_GetProperties();
11758 trace("test IUri_HasProperty...\n");
11759 test_IUri_HasProperty();
11761 trace("test IUri_IsEqual...\n");
11762 test_IUri_IsEqual();
11764 trace("test CreateUriWithFragment invalid args...\n");
11765 test_CreateUriWithFragment_InvalidArgs();
11767 trace("test CreateUriWithFragment invalid flags...\n");
11768 test_CreateUriWithFragment_InvalidFlags();
11770 trace("test CreateUriWithFragment...\n");
11771 test_CreateUriWithFragment();
11773 trace("test CreateIUriBuilder...\n");
11774 test_CreateIUriBuilder();
11776 trace("test IUriBuilder_CreateInvalidArgs...\n");
11777 test_IUriBuilder_CreateInvalidArgs();
11779 trace("test IUriBuilder...\n");
11780 test_IUriBuilder();
11782 trace("test IUriBuilder_GetInvalidArgs...\n");
11783 test_IUriBuilder_GetInvalidArgs();
11785 trace("test IUriBuilder_HasBeenModified...\n");
11786 test_IUriBuilder_HasBeenModified();
11788 trace("test IUriBuilder_IUriProperty...\n");
11789 test_IUriBuilder_IUriProperty();
11791 trace("test IUriBuilder_RemoveProperties...\n");
11792 test_IUriBuilder_RemoveProperties();
11794 trace("test IUriBuilder miscellaneous...\n");
11795 test_IUriBuilder_Misc();
11797 trace("test IUriBuilderFactory...\n");
11798 test_IUriBuilderFactory();
11800 trace("test CoInternetCombineIUri...\n");
11801 test_CoInternetCombineIUri();
11803 trace("test CoInternetCombineUrlEx...\n");
11804 test_CoInternetCombineUrlEx();
11806 trace("test CoInternetParseIUri Invalid Args...\n");
11807 test_CoInternetParseIUri_InvalidArgs();
11809 trace("test CoInternetParseIUri...\n");
11810 test_CoInternetParseIUri();
11812 register_protocols();
11814 trace("test CoInternetCombineIUri pluggable...\n");
11815 test_CoInternetCombineIUri_Pluggable();
11817 trace("test CoInternetCombineUrlEx Pluggable...\n");
11818 test_CoInternetCombineUrlEx_Pluggable();
11820 trace("test CoInternetParseIUri pluggable...\n");
11821 test_CoInternetParseIUri_Pluggable();
11823 trace("test CreateURLMoniker...\n");
11824 test_CreateURLMoniker();
11826 CoInitialize(NULL
);
11828 trace("test IPersistStream...\n");
11829 test_IPersistStream();
11831 trace("test uninitialized Uri...\n");
11832 test_UninitializedUri();
11835 unregister_protocols();