4 * Copyright 2010 Thomas Mullaly
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <wine/test.h>
27 #define WIN32_LEAN_AND_MEAN
37 DEFINE_GUID(CLSID_CUri
, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
39 #define URI_STR_PROPERTY_COUNT Uri_PROPERTY_STRING_LAST+1
40 #define URI_DWORD_PROPERTY_COUNT (Uri_PROPERTY_DWORD_LAST - Uri_PROPERTY_DWORD_START)+1
41 #define URI_BUILDER_STR_PROPERTY_COUNT 7
43 #define DEFINE_EXPECT(func) \
44 static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
46 #define SET_EXPECT(func) \
47 expect_ ## func = TRUE
49 #define CHECK_EXPECT(func) \
51 ok(expect_ ##func, "unexpected call " #func "\n"); \
52 expect_ ## func = FALSE; \
53 called_ ## func = TRUE; \
56 #define CHECK_EXPECT2(func) \
58 ok(expect_ ##func, "unexpected call " #func "\n"); \
59 called_ ## func = TRUE; \
62 #define CHECK_CALLED(func) \
64 ok(called_ ## func, "expected " #func "\n"); \
65 expect_ ## func = called_ ## func = FALSE; \
68 DEFINE_EXPECT(CombineUrl
);
69 DEFINE_EXPECT(ParseUrl
);
71 static HRESULT (WINAPI
*pCreateUri
)(LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
72 static HRESULT (WINAPI
*pCreateUriWithFragment
)(LPCWSTR
, LPCWSTR
, DWORD
, DWORD_PTR
, IUri
**);
73 static HRESULT (WINAPI
*pCreateIUriBuilder
)(IUri
*, DWORD
, DWORD_PTR
, IUriBuilder
**);
74 static HRESULT (WINAPI
*pCoInternetCombineIUri
)(IUri
*,IUri
*,DWORD
,IUri
**,DWORD_PTR
);
75 static HRESULT (WINAPI
*pCoInternetGetSession
)(DWORD
,IInternetSession
**,DWORD
);
76 static HRESULT (WINAPI
*pCoInternetCombineUrlEx
)(IUri
*,LPCWSTR
,DWORD
,IUri
**,DWORD_PTR
);
77 static HRESULT (WINAPI
*pCoInternetParseIUri
)(IUri
*,PARSEACTION
,DWORD
,LPWSTR
,DWORD
,DWORD
*,DWORD_PTR
);
78 static HRESULT (WINAPI
*pCreateURLMonikerEx
)(IMoniker
*,LPCWSTR
,IMoniker
**,DWORD
);
79 static HRESULT (WINAPI
*pCreateURLMonikerEx2
)(IMoniker
*,IUri
*,IMoniker
**,DWORD
);
81 static const WCHAR http_urlW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
82 '.','o','r','g','/',0};
83 static const WCHAR http_url_fragW
[] = { 'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
84 '.','o','r','g','/','#','F','r','a','g',0};
86 static const WCHAR combine_baseW
[] = {'w','i','n','e','t','e','s','t',':','?','t',
87 'e','s','t','i','n','g',0};
88 static const WCHAR combine_relativeW
[] = {'?','t','e','s','t',0};
89 static const WCHAR combine_resultW
[] = {'z','i','p',':','t','e','s','t',0};
91 static const WCHAR winetestW
[] = {'w','i','n','e','t','e','s','t',0};
93 static const WCHAR parse_urlW
[] = {'w','i','n','e','t','e','s','t',':','t','e','s','t',0};
94 static const WCHAR parse_resultW
[] = {'z','i','p',':','t','e','s','t',0};
96 static PARSEACTION parse_action
;
97 static DWORD parse_flags
;
99 typedef struct _uri_create_flag_test
{
102 } uri_create_flag_test
;
104 static const uri_create_flag_test invalid_flag_tests
[] = {
105 /* Set of invalid flag combinations to test for. */
106 {Uri_CREATE_DECODE_EXTRA_INFO
| Uri_CREATE_NO_DECODE_EXTRA_INFO
, E_INVALIDARG
},
107 {Uri_CREATE_CANONICALIZE
| Uri_CREATE_NO_CANONICALIZE
, E_INVALIDARG
},
108 {Uri_CREATE_CRACK_UNKNOWN_SCHEMES
| Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, E_INVALIDARG
},
109 {Uri_CREATE_PRE_PROCESS_HTML_URI
| Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, E_INVALIDARG
},
110 {Uri_CREATE_IE_SETTINGS
| Uri_CREATE_NO_IE_SETTINGS
, E_INVALIDARG
}
113 typedef struct _uri_str_property
{
117 const char* broken_value
;
120 typedef struct _uri_dword_property
{
124 } uri_dword_property
;
126 typedef struct _uri_properties
{
129 HRESULT create_expected
;
132 uri_str_property str_props
[URI_STR_PROPERTY_COUNT
];
133 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
136 static const uri_properties uri_tests
[] = {
137 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK
, FALSE
,
139 {"http://www.winehq.org/",S_OK
,FALSE
}, /* ABSOLUTE_URI */
140 {"www.winehq.org",S_OK
,FALSE
}, /* AUTHORITY */
141 {"http://www.winehq.org/",S_OK
,FALSE
}, /* DISPLAY_URI */
142 {"winehq.org",S_OK
,FALSE
}, /* DOMAIN */
143 {"",S_FALSE
,FALSE
}, /* EXTENSION */
144 {"",S_FALSE
,FALSE
}, /* FRAGMENT */
145 {"www.winehq.org",S_OK
,FALSE
}, /* HOST */
146 {"",S_FALSE
,FALSE
}, /* PASSWORD */
147 {"/",S_OK
,FALSE
}, /* PATH */
148 {"/",S_OK
,FALSE
}, /* PATH_AND_QUERY */
149 {"",S_FALSE
,FALSE
}, /* QUERY */
150 {"http://www.winehq.org/tests/../tests/../..",S_OK
,FALSE
}, /* RAW_URI */
151 {"http",S_OK
,FALSE
}, /* SCHEME_NAME */
152 {"",S_FALSE
,FALSE
}, /* USER_INFO */
153 {"",S_FALSE
,FALSE
} /* USER_NAME */
156 {Uri_HOST_DNS
,S_OK
,FALSE
}, /* HOST_TYPE */
157 {80,S_OK
,FALSE
}, /* PORT */
158 {URL_SCHEME_HTTP
,S_OK
,FALSE
}, /* SCHEME */
159 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
} /* ZONE */
162 { "http://winehq.org/tests/.././tests", 0, S_OK
, FALSE
,
164 {"http://winehq.org/tests",S_OK
,FALSE
},
165 {"winehq.org",S_OK
,FALSE
},
166 {"http://winehq.org/tests",S_OK
,FALSE
},
167 {"winehq.org",S_OK
,FALSE
},
170 {"winehq.org",S_OK
,FALSE
},
172 {"/tests",S_OK
,FALSE
},
173 {"/tests",S_OK
,FALSE
},
175 {"http://winehq.org/tests/.././tests",S_OK
,FALSE
},
181 {Uri_HOST_DNS
,S_OK
,FALSE
},
183 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
184 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
187 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
189 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
190 {"www.winehq.org",S_OK
,FALSE
},
191 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
192 {"winehq.org",S_OK
,FALSE
},
195 {"www.winehq.org",S_OK
,FALSE
},
198 {"/?query=x&return=y",S_OK
,FALSE
},
199 {"?query=x&return=y",S_OK
,FALSE
},
200 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
206 {Uri_HOST_DNS
,S_OK
,FALSE
},
208 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
209 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
212 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
214 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
215 {"www.winehq.org",S_OK
,FALSE
},
216 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
217 {"winehq.org",S_OK
,FALSE
},
220 {"www.winehq.org",S_OK
,FALSE
},
223 {"/?query=x&return=y",S_OK
,FALSE
},
224 {"?query=x&return=y",S_OK
,FALSE
},
225 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
226 {"https",S_OK
,FALSE
},
231 {Uri_HOST_DNS
,S_OK
,FALSE
},
233 {URL_SCHEME_HTTPS
,S_OK
,FALSE
},
234 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
237 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK
, FALSE
,
239 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
240 {"usEr%3Ainfo@example.com",S_OK
,FALSE
},
241 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
242 {"example.com",S_OK
,FALSE
},
245 {"example.com",S_OK
,FALSE
},
247 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
248 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
250 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK
,FALSE
},
252 {"usEr%3Ainfo",S_OK
,FALSE
},
253 {"usEr%3Ainfo",S_OK
,FALSE
}
256 {Uri_HOST_DNS
,S_OK
,FALSE
},
258 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
259 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
262 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK
, FALSE
,
264 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
265 {"winepass:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
266 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
267 {"winehq.org",S_OK
,FALSE
},
270 {"ftp.winehq.org",S_OK
,FALSE
},
272 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
273 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
275 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK
,FALSE
},
277 {"winepass:wine",S_OK
,FALSE
},
278 {"winepass",S_OK
,FALSE
}
281 {Uri_HOST_DNS
,S_OK
,FALSE
},
283 {URL_SCHEME_FTP
,S_OK
,FALSE
},
284 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
287 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK
, FALSE
,
289 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
291 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
297 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
298 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
300 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
306 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
308 {URL_SCHEME_FILE
,S_OK
,FALSE
},
309 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
312 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
314 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
316 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
322 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
323 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
325 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
331 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
333 {URL_SCHEME_FILE
,S_OK
,FALSE
},
334 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
337 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK
, FALSE
,
339 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
341 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
347 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
348 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
350 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK
,FALSE
},
356 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
358 {URL_SCHEME_FILE
,S_OK
,FALSE
},
359 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
362 { "urn:nothing:should:happen here", 0, S_OK
, FALSE
,
364 {"urn:nothing:should:happen here",S_OK
,FALSE
},
366 {"urn:nothing:should:happen here",S_OK
,FALSE
},
372 {"nothing:should:happen here",S_OK
,FALSE
},
373 {"nothing:should:happen here",S_OK
,FALSE
},
375 {"urn:nothing:should:happen here",S_OK
,FALSE
},
381 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
383 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
384 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
387 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK
, FALSE
,
389 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
390 {"127.0.0.1",S_OK
,FALSE
},
391 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
395 {"127.0.0.1",S_OK
,FALSE
},
397 {"/test%20dir/test.txt",S_OK
,FALSE
},
398 {"/test%20dir/test.txt",S_OK
,FALSE
},
400 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK
,FALSE
},
406 {Uri_HOST_IPV4
,S_OK
,FALSE
},
408 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
409 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
412 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK
, FALSE
,
414 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
415 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK
,FALSE
},
416 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
420 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK
,FALSE
},
425 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK
,FALSE
},
431 {Uri_HOST_IPV6
,S_OK
,FALSE
},
433 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
434 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
437 { "ftp://[::13.1.68.3]", 0, S_OK
, FALSE
,
439 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
440 {"[::13.1.68.3]",S_OK
,FALSE
},
441 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
445 {"::13.1.68.3",S_OK
,FALSE
},
450 {"ftp://[::13.1.68.3]",S_OK
,FALSE
},
456 {Uri_HOST_IPV6
,S_OK
,FALSE
},
458 {URL_SCHEME_FTP
,S_OK
,FALSE
},
459 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
462 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK
, FALSE
,
464 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
465 {"[fedc:ba98::3210]",S_OK
,FALSE
},
466 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
470 {"fedc:ba98::3210",S_OK
,FALSE
},
475 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK
,FALSE
},
481 {Uri_HOST_IPV6
,S_OK
,FALSE
},
483 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
484 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
487 { "1234://www.winehq.org", 0, S_OK
, FALSE
,
489 {"1234://www.winehq.org/",S_OK
,FALSE
},
490 {"www.winehq.org",S_OK
,FALSE
},
491 {"1234://www.winehq.org/",S_OK
,FALSE
},
492 {"winehq.org",S_OK
,FALSE
},
495 {"www.winehq.org",S_OK
,FALSE
},
500 {"1234://www.winehq.org",S_OK
,FALSE
},
506 {Uri_HOST_DNS
,S_OK
,FALSE
},
508 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
509 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
512 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
513 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
515 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
517 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
523 {"/C:/test/test.mp3",S_OK
,FALSE
},
524 {"/C:/test/test.mp3",S_OK
,FALSE
},
526 {"C:/test/test.mp3",S_OK
,FALSE
},
532 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
534 {URL_SCHEME_FILE
,S_OK
,FALSE
},
535 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
538 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
539 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
541 {"file://server/test.mp3",S_OK
,FALSE
},
542 {"server",S_OK
,FALSE
},
543 {"file://server/test.mp3",S_OK
,FALSE
},
547 {"server",S_OK
,FALSE
},
549 {"/test.mp3",S_OK
,FALSE
},
550 {"/test.mp3",S_OK
,FALSE
},
552 {"\\\\Server/test.mp3",S_OK
,FALSE
},
558 {Uri_HOST_DNS
,S_OK
,FALSE
},
560 {URL_SCHEME_FILE
,S_OK
,FALSE
},
561 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
564 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
566 {"*:www.winehq.org/test",S_OK
,FALSE
},
567 {"www.winehq.org",S_OK
,FALSE
},
568 {"*:www.winehq.org/test",S_OK
,FALSE
},
569 {"winehq.org",S_OK
,FALSE
},
572 {"www.winehq.org",S_OK
,FALSE
},
574 {"/test",S_OK
,FALSE
},
575 {"/test",S_OK
,FALSE
},
577 {"www.winehq.org/test",S_OK
,FALSE
},
583 {Uri_HOST_DNS
,S_OK
,FALSE
},
585 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
586 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
589 /* Valid since the '*' is the only character in the scheme name. */
590 { "*:www.winehq.org/test", 0, S_OK
, FALSE
,
592 {"*:www.winehq.org/test",S_OK
,FALSE
},
593 {"www.winehq.org",S_OK
,FALSE
},
594 {"*:www.winehq.org/test",S_OK
,FALSE
},
595 {"winehq.org",S_OK
,FALSE
},
598 {"www.winehq.org",S_OK
,FALSE
},
600 {"/test",S_OK
,FALSE
},
601 {"/test",S_OK
,FALSE
},
603 {"*:www.winehq.org/test",S_OK
,FALSE
},
609 {Uri_HOST_DNS
,S_OK
,FALSE
},
611 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
612 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
615 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
617 {"/../some dir/test.ext",S_OK
,FALSE
},
619 {"/../some dir/test.ext",S_OK
,FALSE
},
625 {"/../some dir/test.ext",S_OK
,FALSE
},
626 {"/../some dir/test.ext",S_OK
,FALSE
},
628 {"/../some dir/test.ext",S_OK
,FALSE
},
634 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
636 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
637 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
640 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE
|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
642 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
644 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
650 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
651 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
653 {"//implicit/wildcard/uri scheme",S_OK
,FALSE
},
659 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
661 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
662 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
665 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
666 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, S_OK
, FALSE
,
668 {"zip:/.//google.com",S_OK
,FALSE
},
670 {"zip:/.//google.com",S_OK
,FALSE
},
676 {"/.//google.com",S_OK
,FALSE
},
677 {"/.//google.com",S_OK
,FALSE
},
679 {"zip://google.com",S_OK
,FALSE
},
685 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
687 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
688 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
691 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
692 { "ftp://user:pass:word@winehq.org/", 0, S_OK
, FALSE
,
694 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
695 {"user:pass:word@winehq.org",S_OK
,FALSE
},
696 {"ftp://winehq.org/",S_OK
,FALSE
},
697 {"winehq.org",S_OK
,FALSE
},
700 {"winehq.org",S_OK
,FALSE
},
701 {"pass:word",S_OK
,FALSE
},
705 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
707 {"user:pass:word",S_OK
,FALSE
},
711 {Uri_HOST_DNS
,S_OK
,FALSE
},
713 {URL_SCHEME_FTP
,S_OK
,FALSE
},
714 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
717 /* Make sure % encoded unreserved characters are decoded. */
718 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK
, FALSE
,
720 {"ftp://wINe:PASS@ftp.google.com/",S_OK
,FALSE
},
721 {"wINe:PASS@ftp.google.com",S_OK
,FALSE
},
722 {"ftp://ftp.google.com/",S_OK
,FALSE
},
723 {"google.com",S_OK
,FALSE
},
726 {"ftp.google.com",S_OK
,FALSE
},
731 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK
,FALSE
},
733 {"wINe:PASS",S_OK
,FALSE
},
737 {Uri_HOST_DNS
,S_OK
,FALSE
},
739 {URL_SCHEME_FTP
,S_OK
,FALSE
},
740 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
743 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
744 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK
, FALSE
,
746 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
747 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK
,FALSE
},
748 {"ftp://ftp.google.com/",S_OK
,FALSE
},
749 {"google.com",S_OK
,FALSE
},
752 {"ftp.google.com",S_OK
,FALSE
},
753 {"PA%7B%7D",S_OK
,FALSE
},
757 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
759 {"w%5D%5Be:PA%7B%7D",S_OK
,FALSE
},
760 {"w%5D%5Be",S_OK
,FALSE
}
763 {Uri_HOST_DNS
,S_OK
,FALSE
},
765 {URL_SCHEME_FTP
,S_OK
,FALSE
},
766 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
769 /* You're allowed to have an empty password portion in the userinfo section. */
770 { "ftp://empty:@ftp.google.com/", 0, S_OK
, FALSE
,
772 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
773 {"empty:@ftp.google.com",S_OK
,FALSE
},
774 {"ftp://ftp.google.com/",S_OK
,FALSE
},
775 {"google.com",S_OK
,FALSE
},
778 {"ftp.google.com",S_OK
,FALSE
},
783 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
785 {"empty:",S_OK
,FALSE
},
789 {Uri_HOST_DNS
,S_OK
,FALSE
},
791 {URL_SCHEME_FTP
,S_OK
,FALSE
},
792 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
795 /* Make sure forbidden characters in "userinfo" get encoded. */
796 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK
, FALSE
,
798 {"ftp://%22%20%22weird@ftp.google.com/",S_OK
,FALSE
},
799 {"%22%20%22weird@ftp.google.com",S_OK
,FALSE
},
800 {"ftp://ftp.google.com/",S_OK
,FALSE
},
801 {"google.com",S_OK
,FALSE
},
804 {"ftp.google.com",S_OK
,FALSE
},
809 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
811 {"%22%20%22weird",S_OK
,FALSE
},
812 {"%22%20%22weird",S_OK
,FALSE
}
815 {Uri_HOST_DNS
,S_OK
,FALSE
},
817 {URL_SCHEME_FTP
,S_OK
,FALSE
},
818 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
821 /* Make sure the forbidden characters don't get percent encoded. */
822 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
824 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
825 {"\" \"weird@ftp.google.com",S_OK
,FALSE
},
826 {"ftp://ftp.google.com/",S_OK
,FALSE
},
827 {"google.com",S_OK
,FALSE
},
830 {"ftp.google.com",S_OK
,FALSE
},
835 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
837 {"\" \"weird",S_OK
,FALSE
},
838 {"\" \"weird",S_OK
,FALSE
}
841 {Uri_HOST_DNS
,S_OK
,FALSE
},
843 {URL_SCHEME_FTP
,S_OK
,FALSE
},
844 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
847 /* Make sure already percent encoded characters don't get unencoded. */
848 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
850 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
851 {"\"%20\"weird@ftp.google.com",S_OK
,FALSE
},
852 {"ftp://ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
853 {"google.com",S_OK
,FALSE
},
856 {"ftp.google.com",S_OK
,FALSE
},
858 {"/\"%20\"weird",S_OK
,FALSE
},
859 {"/\"%20\"weird",S_OK
,FALSE
},
861 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
863 {"\"%20\"weird",S_OK
,FALSE
},
864 {"\"%20\"weird",S_OK
,FALSE
}
867 {Uri_HOST_DNS
,S_OK
,FALSE
},
869 {URL_SCHEME_FTP
,S_OK
,FALSE
},
870 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
873 /* Allowed to have invalid % encoded because its an unknown scheme type. */
874 { "zip://%xy:word@winehq.org/", 0, S_OK
, FALSE
,
876 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
877 {"%xy:word@winehq.org",S_OK
,FALSE
},
878 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
879 {"winehq.org",S_OK
,FALSE
},
882 {"winehq.org",S_OK
,FALSE
},
887 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
889 {"%xy:word",S_OK
,FALSE
},
893 {Uri_HOST_DNS
,S_OK
,FALSE
},
895 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
896 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
899 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
902 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK
, FALSE
,
904 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
905 {"%2E:%52%53ord@winehq.org",S_OK
,FALSE
},
906 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
907 {"winehq.org",S_OK
,FALSE
},
910 {"winehq.org",S_OK
,FALSE
},
911 {"%52%53ord",S_OK
,FALSE
},
915 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
917 {"%2E:%52%53ord",S_OK
,FALSE
},
921 {Uri_HOST_DNS
,S_OK
,FALSE
},
923 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
924 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
927 { "ftp://[](),'test':word@winehq.org/", 0, S_OK
, FALSE
,
929 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
930 {"[](),'test':word@winehq.org",S_OK
,FALSE
},
931 {"ftp://winehq.org/",S_OK
,FALSE
},
932 {"winehq.org",S_OK
,FALSE
},
935 {"winehq.org",S_OK
,FALSE
},
940 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
942 {"[](),'test':word",S_OK
,FALSE
},
943 {"[](),'test'",S_OK
,FALSE
}
946 {Uri_HOST_DNS
,S_OK
,FALSE
},
948 {URL_SCHEME_FTP
,S_OK
,FALSE
},
949 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
952 { "ftp://test?:word@winehq.org/", 0, S_OK
, FALSE
,
954 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
956 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
963 {"/?:word@winehq.org/",S_OK
,FALSE
},
964 {"?:word@winehq.org/",S_OK
,FALSE
},
965 {"ftp://test?:word@winehq.org/",S_OK
,FALSE
},
971 {Uri_HOST_DNS
,S_OK
,FALSE
},
973 {URL_SCHEME_FTP
,S_OK
,FALSE
},
974 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
977 { "ftp://test#:word@winehq.org/", 0, S_OK
, FALSE
,
979 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
981 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
984 {"#:word@winehq.org/",S_OK
,FALSE
},
990 {"ftp://test#:word@winehq.org/",S_OK
,FALSE
},
996 {Uri_HOST_DNS
,S_OK
,FALSE
},
998 {URL_SCHEME_FTP
,S_OK
,FALSE
},
999 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1002 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1003 { "zip://test\\:word@winehq.org/", 0, S_OK
, FALSE
,
1005 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1006 {"test\\:word@winehq.org",S_OK
,FALSE
},
1007 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1008 {"winehq.org",S_OK
,FALSE
},
1011 {"winehq.org",S_OK
,FALSE
},
1012 {"word",S_OK
,FALSE
},
1016 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1018 {"test\\:word",S_OK
,FALSE
},
1019 {"test\\",S_OK
,FALSE
}
1022 {Uri_HOST_DNS
,S_OK
,FALSE
},
1024 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1025 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1028 /* It normalizes IPv4 addresses correctly. */
1029 { "http://127.000.000.100/", 0, S_OK
, FALSE
,
1031 {"http://127.0.0.100/",S_OK
,FALSE
},
1032 {"127.0.0.100",S_OK
,FALSE
},
1033 {"http://127.0.0.100/",S_OK
,FALSE
},
1037 {"127.0.0.100",S_OK
,FALSE
},
1042 {"http://127.000.000.100/",S_OK
,FALSE
},
1043 {"http",S_OK
,FALSE
},
1048 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1050 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1051 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1054 { "http://127.0.0.1:8000", 0, S_OK
, FALSE
,
1056 {"http://127.0.0.1:8000/",S_OK
},
1057 {"127.0.0.1:8000",S_OK
},
1058 {"http://127.0.0.1:8000/",S_OK
},
1067 {"http://127.0.0.1:8000",S_OK
},
1073 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1075 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1076 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1079 /* Make sure it normalizes partial IPv4 addresses correctly. */
1080 { "http://127.0/", 0, S_OK
, FALSE
,
1082 {"http://127.0.0.0/",S_OK
,FALSE
},
1083 {"127.0.0.0",S_OK
,FALSE
},
1084 {"http://127.0.0.0/",S_OK
,FALSE
},
1088 {"127.0.0.0",S_OK
,FALSE
},
1093 {"http://127.0/",S_OK
,FALSE
},
1094 {"http",S_OK
,FALSE
},
1099 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1101 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1102 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1105 /* Make sure it converts implicit IPv4's correctly. */
1106 { "http://123456/", 0, S_OK
, FALSE
,
1108 {"http://0.1.226.64/",S_OK
,FALSE
},
1109 {"0.1.226.64",S_OK
,FALSE
},
1110 {"http://0.1.226.64/",S_OK
,FALSE
},
1114 {"0.1.226.64",S_OK
,FALSE
},
1119 {"http://123456/",S_OK
,FALSE
},
1120 {"http",S_OK
,FALSE
},
1125 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1127 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1128 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1132 { "http://4294967295/", 0, S_OK
, FALSE
,
1134 {"http://255.255.255.255/",S_OK
,FALSE
},
1135 {"255.255.255.255",S_OK
,FALSE
},
1136 {"http://255.255.255.255/",S_OK
,FALSE
},
1140 {"255.255.255.255",S_OK
,FALSE
},
1145 {"http://4294967295/",S_OK
,FALSE
},
1146 {"http",S_OK
,FALSE
},
1151 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1153 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1154 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1158 { "http://4294967296/", 0, S_OK
, FALSE
,
1160 {"http://4294967296/",S_OK
,FALSE
},
1161 {"4294967296",S_OK
,FALSE
},
1162 {"http://4294967296/",S_OK
,FALSE
},
1166 {"4294967296",S_OK
,FALSE
},
1171 {"http://4294967296/",S_OK
,FALSE
},
1172 {"http",S_OK
,FALSE
},
1177 {Uri_HOST_DNS
,S_OK
,FALSE
},
1179 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1180 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1183 /* Window's doesn't normalize IP address for unknown schemes. */
1184 { "1234://4294967295/", 0, S_OK
, FALSE
,
1186 {"1234://4294967295/",S_OK
,FALSE
},
1187 {"4294967295",S_OK
,FALSE
},
1188 {"1234://4294967295/",S_OK
,FALSE
},
1192 {"4294967295",S_OK
,FALSE
},
1197 {"1234://4294967295/",S_OK
,FALSE
},
1198 {"1234",S_OK
,FALSE
},
1203 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1205 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1206 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1209 /* Window's doesn't normalize IP address for unknown schemes. */
1210 { "1234://127.001/", 0, S_OK
, FALSE
,
1212 {"1234://127.001/",S_OK
,FALSE
},
1213 {"127.001",S_OK
,FALSE
},
1214 {"1234://127.001/",S_OK
,FALSE
},
1218 {"127.001",S_OK
,FALSE
},
1223 {"1234://127.001/",S_OK
,FALSE
},
1224 {"1234",S_OK
,FALSE
},
1229 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1231 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1232 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1235 { "http://[FEDC:BA98::3210]", 0, S_OK
, FALSE
,
1237 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1238 {"[fedc:ba98::3210]",S_OK
,FALSE
},
1239 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1243 {"fedc:ba98::3210",S_OK
,FALSE
},
1248 {"http://[FEDC:BA98::3210]",S_OK
,FALSE
},
1249 {"http",S_OK
,FALSE
},
1254 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1256 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1257 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1260 { "http://[::]", 0, S_OK
, FALSE
,
1262 {"http://[::]/",S_OK
,FALSE
},
1263 {"[::]",S_OK
,FALSE
},
1264 {"http://[::]/",S_OK
,FALSE
},
1273 {"http://[::]",S_OK
,FALSE
},
1274 {"http",S_OK
,FALSE
},
1279 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1281 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1282 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1285 { "http://[FEDC:BA98::]", 0, S_OK
, FALSE
,
1287 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1288 {"[fedc:ba98::]",S_OK
,FALSE
},
1289 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1293 {"fedc:ba98::",S_OK
,FALSE
},
1298 {"http://[FEDC:BA98::]",S_OK
,FALSE
},
1299 {"http",S_OK
,FALSE
},
1304 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1306 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1307 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1310 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1311 { "http://[1::3:4:5:6:7:8]", 0, S_OK
, FALSE
,
1313 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1314 {"[1:0:3:4:5:6:7:8]",S_OK
,FALSE
},
1315 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1319 {"1:0:3:4:5:6:7:8",S_OK
,FALSE
},
1324 {"http://[1::3:4:5:6:7:8]",S_OK
,FALSE
},
1325 {"http",S_OK
,FALSE
},
1330 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1332 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1333 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1336 { "http://[v2.34]/", 0, S_OK
, FALSE
,
1338 {"http://[v2.34]/",S_OK
,FALSE
},
1339 {"[v2.34]",S_OK
,FALSE
},
1340 {"http://[v2.34]/",S_OK
,FALSE
},
1344 {"[v2.34]",S_OK
,FALSE
},
1349 {"http://[v2.34]/",S_OK
,FALSE
},
1350 {"http",S_OK
,FALSE
},
1355 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
1357 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1358 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1361 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1362 { "http://[xyz:12345.com/test", 0, S_OK
, FALSE
,
1364 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1365 {"[xyz:12345.com",S_OK
,FALSE
},
1366 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1367 {"[xyz:12345.com",S_OK
,FALSE
},
1370 {"[xyz:12345.com",S_OK
,FALSE
},
1372 {"/test",S_OK
,FALSE
},
1373 {"/test",S_OK
,FALSE
},
1375 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1376 {"http",S_OK
,FALSE
},
1381 {Uri_HOST_DNS
,S_OK
,FALSE
},
1383 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1384 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1387 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1388 * of the host name (respectively).
1390 { "ftp://www.[works].com/", 0, S_OK
, FALSE
,
1392 {"ftp://www.[works].com/",S_OK
,FALSE
},
1393 {"www.[works].com",S_OK
,FALSE
},
1394 {"ftp://www.[works].com/",S_OK
,FALSE
},
1395 {"[works].com",S_OK
,FALSE
},
1398 {"www.[works].com",S_OK
,FALSE
},
1403 {"ftp://www.[works].com/",S_OK
,FALSE
},
1409 {Uri_HOST_DNS
,S_OK
,FALSE
},
1411 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1412 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1415 /* Considers ':' a delimiter since it appears after the ']'. */
1416 { "http://www.google.com]:12345/", 0, S_OK
, FALSE
,
1418 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1419 {"www.google.com]:12345",S_OK
,FALSE
},
1420 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1421 {"google.com]",S_OK
,FALSE
},
1424 {"www.google.com]",S_OK
,FALSE
},
1429 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1430 {"http",S_OK
,FALSE
},
1435 {Uri_HOST_DNS
,S_OK
,FALSE
},
1437 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1438 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1441 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1442 { "zip://w%XXw%GEw.google.com/", 0, S_OK
, FALSE
,
1444 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1445 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1446 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1447 {"google.com",S_OK
,FALSE
},
1450 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1455 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1461 {Uri_HOST_DNS
,S_OK
,FALSE
},
1463 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1464 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1467 /* Unknown scheme types hostname doesn't get lower cased. */
1468 { "zip://GOOGLE.com/", 0, S_OK
, FALSE
,
1470 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1471 {"GOOGLE.com",S_OK
,FALSE
},
1472 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1473 {"GOOGLE.com",S_OK
,FALSE
},
1476 {"GOOGLE.com",S_OK
,FALSE
},
1481 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1487 {Uri_HOST_DNS
,S_OK
,FALSE
},
1489 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1490 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1493 /* Hostname gets lower-cased for known scheme types. */
1494 { "http://WWW.GOOGLE.com/", 0, S_OK
, FALSE
,
1496 {"http://www.google.com/",S_OK
,FALSE
},
1497 {"www.google.com",S_OK
,FALSE
},
1498 {"http://www.google.com/",S_OK
,FALSE
},
1499 {"google.com",S_OK
,FALSE
},
1502 {"www.google.com",S_OK
,FALSE
},
1507 {"http://WWW.GOOGLE.com/",S_OK
,FALSE
},
1508 {"http",S_OK
,FALSE
},
1513 {Uri_HOST_DNS
,S_OK
,FALSE
},
1515 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1516 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1519 /* Characters that get % encoded in the hostname also have their percent
1520 * encoded forms lower cased.
1522 { "http://www.%7Cgoogle|.com/", 0, S_OK
, FALSE
,
1524 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1525 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1526 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1527 {"%7cgoogle%7c.com",S_OK
,FALSE
},
1530 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1535 {"http://www.%7Cgoogle|.com/",S_OK
,FALSE
},
1536 {"http",S_OK
,FALSE
},
1541 {Uri_HOST_DNS
,S_OK
,FALSE
},
1543 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1544 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1547 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1548 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK
, FALSE
,
1550 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1551 {"[1:2:3:4:5:6::]",S_OK
,FALSE
},
1552 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1556 {"1:2:3:4:5:6::",S_OK
,FALSE
},
1561 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK
,FALSE
},
1562 {"http",S_OK
,FALSE
},
1567 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1569 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1570 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1573 /* IPv4 addresses get normalized. */
1574 { "http://[::001.002.003.000]", 0, S_OK
, FALSE
,
1576 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1577 {"[::1.2.3.0]",S_OK
,FALSE
},
1578 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1582 {"::1.2.3.0",S_OK
,FALSE
},
1587 {"http://[::001.002.003.000]",S_OK
,FALSE
},
1588 {"http",S_OK
,FALSE
},
1593 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1595 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1596 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1599 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1600 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK
, FALSE
,
1602 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1603 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1604 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1608 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK
,FALSE
},
1613 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1619 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1621 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1622 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1625 /* IPv4 address is converted into 2 h16 components. */
1626 { "http://[ffff::192.222.111.32]", 0, S_OK
, FALSE
,
1628 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1629 {"[ffff::c0de:6f20]",S_OK
,FALSE
},
1630 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1634 {"ffff::c0de:6f20",S_OK
,FALSE
},
1639 {"http://[ffff::192.222.111.32]",S_OK
,FALSE
},
1640 {"http",S_OK
,FALSE
},
1645 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1647 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1648 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1651 /* Max value for a port. */
1652 { "http://google.com:65535", 0, S_OK
, FALSE
,
1654 {"http://google.com:65535/",S_OK
,FALSE
},
1655 {"google.com:65535",S_OK
,FALSE
},
1656 {"http://google.com:65535/",S_OK
,FALSE
},
1657 {"google.com",S_OK
,FALSE
},
1660 {"google.com",S_OK
,FALSE
},
1665 {"http://google.com:65535",S_OK
,FALSE
},
1666 {"http",S_OK
,FALSE
},
1671 {Uri_HOST_DNS
,S_OK
,FALSE
},
1673 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1674 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1677 { "zip://google.com:65536", 0, S_OK
, FALSE
,
1679 {"zip://google.com:65536/",S_OK
,FALSE
},
1680 {"google.com:65536",S_OK
,FALSE
},
1681 {"zip://google.com:65536/",S_OK
,FALSE
},
1682 {"google.com:65536",S_OK
,FALSE
},
1685 {"google.com:65536",S_OK
,FALSE
},
1690 {"zip://google.com:65536",S_OK
,FALSE
},
1696 {Uri_HOST_DNS
,S_OK
,FALSE
},
1698 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1699 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1702 { "zip://google.com:65536:25", 0, S_OK
, FALSE
,
1704 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1705 {"google.com:65536:25",S_OK
,FALSE
},
1706 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1707 {"google.com:65536:25",S_OK
,FALSE
},
1710 {"google.com:65536:25",S_OK
,FALSE
},
1715 {"zip://google.com:65536:25",S_OK
,FALSE
},
1721 {Uri_HOST_DNS
,S_OK
,FALSE
},
1723 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1724 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1727 { "zip://[::ffff]:abcd", 0, S_OK
, FALSE
,
1729 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1730 {"[::ffff]:abcd",S_OK
,FALSE
},
1731 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1735 {"[::ffff]:abcd",S_OK
,FALSE
},
1740 {"zip://[::ffff]:abcd",S_OK
,FALSE
},
1746 {Uri_HOST_DNS
,S_OK
,FALSE
},
1748 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1749 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1752 { "zip://127.0.0.1:abcd", 0, S_OK
, FALSE
,
1754 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1755 {"127.0.0.1:abcd",S_OK
,FALSE
},
1756 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1757 {"0.1:abcd",S_OK
,FALSE
},
1760 {"127.0.0.1:abcd",S_OK
,FALSE
},
1765 {"zip://127.0.0.1:abcd",S_OK
,FALSE
},
1771 {Uri_HOST_DNS
,S_OK
,FALSE
},
1773 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1774 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1777 /* Port is just copied over. */
1778 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1780 {"http://google.com:00035",S_OK
,FALSE
},
1781 {"google.com:00035",S_OK
,FALSE
},
1782 {"http://google.com:00035",S_OK
,FALSE
,"http://google.com:35"},
1783 {"google.com",S_OK
,FALSE
},
1786 {"google.com",S_OK
,FALSE
},
1791 {"http://google.com:00035",S_OK
,FALSE
},
1792 {"http",S_OK
,FALSE
},
1797 {Uri_HOST_DNS
,S_OK
,FALSE
},
1799 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1800 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1803 /* Default port is copied over. */
1804 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1806 {"http://google.com:80",S_OK
,FALSE
},
1807 {"google.com:80",S_OK
,FALSE
},
1808 {"http://google.com:80",S_OK
,FALSE
},
1809 {"google.com",S_OK
,FALSE
},
1812 {"google.com",S_OK
,FALSE
},
1817 {"http://google.com:80",S_OK
,FALSE
},
1818 {"http",S_OK
,FALSE
},
1823 {Uri_HOST_DNS
,S_OK
,FALSE
},
1825 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1826 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1829 { "http://google.com.uk", 0, S_OK
, FALSE
,
1831 {"http://google.com.uk/",S_OK
,FALSE
},
1832 {"google.com.uk",S_OK
,FALSE
},
1833 {"http://google.com.uk/",S_OK
,FALSE
},
1834 {"google.com.uk",S_OK
,FALSE
},
1837 {"google.com.uk",S_OK
,FALSE
},
1842 {"http://google.com.uk",S_OK
,FALSE
},
1843 {"http",S_OK
,FALSE
},
1848 {Uri_HOST_DNS
,S_OK
,FALSE
},
1850 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1851 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1854 { "http://google.com.com", 0, S_OK
, FALSE
,
1856 {"http://google.com.com/",S_OK
,FALSE
},
1857 {"google.com.com",S_OK
,FALSE
},
1858 {"http://google.com.com/",S_OK
,FALSE
},
1859 {"com.com",S_OK
,FALSE
},
1862 {"google.com.com",S_OK
,FALSE
},
1867 {"http://google.com.com",S_OK
,FALSE
},
1868 {"http",S_OK
,FALSE
},
1873 {Uri_HOST_DNS
,S_OK
,FALSE
},
1875 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1876 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1879 { "http://google.uk.1", 0, S_OK
, FALSE
,
1881 {"http://google.uk.1/",S_OK
,FALSE
},
1882 {"google.uk.1",S_OK
,FALSE
},
1883 {"http://google.uk.1/",S_OK
,FALSE
},
1884 {"google.uk.1",S_OK
,FALSE
},
1887 {"google.uk.1",S_OK
,FALSE
},
1892 {"http://google.uk.1",S_OK
,FALSE
},
1893 {"http",S_OK
,FALSE
},
1898 {Uri_HOST_DNS
,S_OK
,FALSE
},
1900 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1901 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1904 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1905 { "http://google.foo.uk", 0, S_OK
, FALSE
,
1907 {"http://google.foo.uk/",S_OK
,FALSE
},
1908 {"google.foo.uk",S_OK
,FALSE
},
1909 {"http://google.foo.uk/",S_OK
,FALSE
},
1910 {"foo.uk",S_OK
,FALSE
},
1913 {"google.foo.uk",S_OK
,FALSE
},
1918 {"http://google.foo.uk",S_OK
,FALSE
},
1919 {"http",S_OK
,FALSE
},
1924 {Uri_HOST_DNS
,S_OK
,FALSE
},
1926 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1927 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1930 { "http://.com", 0, S_OK
, FALSE
,
1932 {"http://.com/",S_OK
,FALSE
},
1933 {".com",S_OK
,FALSE
},
1934 {"http://.com/",S_OK
,FALSE
},
1935 {".com",S_OK
,FALSE
},
1938 {".com",S_OK
,FALSE
},
1943 {"http://.com",S_OK
,FALSE
},
1944 {"http",S_OK
,FALSE
},
1949 {Uri_HOST_DNS
,S_OK
,FALSE
},
1951 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1952 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1955 { "http://.uk", 0, S_OK
, FALSE
,
1957 {"http://.uk/",S_OK
,FALSE
},
1959 {"http://.uk/",S_OK
,FALSE
},
1968 {"http://.uk",S_OK
,FALSE
},
1969 {"http",S_OK
,FALSE
},
1974 {Uri_HOST_DNS
,S_OK
,FALSE
},
1976 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1977 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1980 { "http://www.co.google.com.[]", 0, S_OK
, FALSE
,
1982 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1983 {"www.co.google.com.[]",S_OK
,FALSE
},
1984 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1985 {"google.com.[]",S_OK
,FALSE
},
1988 {"www.co.google.com.[]",S_OK
,FALSE
},
1993 {"http://www.co.google.com.[]",S_OK
,FALSE
},
1994 {"http",S_OK
,FALSE
},
1999 {Uri_HOST_DNS
,S_OK
,FALSE
},
2001 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2002 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2005 { "http://co.uk", 0, S_OK
, FALSE
,
2007 {"http://co.uk/",S_OK
,FALSE
},
2008 {"co.uk",S_OK
,FALSE
},
2009 {"http://co.uk/",S_OK
,FALSE
},
2013 {"co.uk",S_OK
,FALSE
},
2018 {"http://co.uk",S_OK
,FALSE
},
2019 {"http",S_OK
,FALSE
},
2024 {Uri_HOST_DNS
,S_OK
,FALSE
},
2026 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2027 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2030 { "http://www.co.google.us.test", 0, S_OK
, FALSE
,
2032 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2033 {"www.co.google.us.test",S_OK
,FALSE
},
2034 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2035 {"us.test",S_OK
,FALSE
},
2038 {"www.co.google.us.test",S_OK
,FALSE
},
2043 {"http://www.co.google.us.test",S_OK
,FALSE
},
2044 {"http",S_OK
,FALSE
},
2049 {Uri_HOST_DNS
,S_OK
,FALSE
},
2051 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2052 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2055 { "http://gov.uk", 0, S_OK
, FALSE
,
2057 {"http://gov.uk/",S_OK
,FALSE
},
2058 {"gov.uk",S_OK
,FALSE
},
2059 {"http://gov.uk/",S_OK
,FALSE
},
2063 {"gov.uk",S_OK
,FALSE
},
2068 {"http://gov.uk",S_OK
,FALSE
},
2069 {"http",S_OK
,FALSE
},
2074 {Uri_HOST_DNS
,S_OK
,FALSE
},
2076 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2077 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2080 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2082 {"zip://www.google.com\\test",S_OK
,FALSE
},
2083 {"www.google.com\\test",S_OK
,FALSE
},
2084 {"zip://www.google.com\\test",S_OK
,FALSE
},
2085 {"google.com\\test",S_OK
,FALSE
},
2088 {"www.google.com\\test",S_OK
,FALSE
},
2093 {"zip://www.google.com\\test",S_OK
,FALSE
},
2099 {Uri_HOST_DNS
,S_OK
,FALSE
},
2101 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2102 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2105 { "urn:excepts:bad:%XY:encoded", 0, S_OK
, FALSE
,
2107 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2109 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2115 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2116 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2118 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2124 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2126 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2127 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2130 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2131 * are decoded and all '%' are encoded.
2133 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK
, FALSE
,
2135 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2137 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2139 {".mp3",S_OK
,FALSE
},
2143 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2144 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2146 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK
,FALSE
},
2147 {"file",S_OK
,FALSE
},
2152 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2154 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2155 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2158 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2159 * is decoded and only %'s in front of invalid hex digits are encoded.
2161 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK
, FALSE
,
2163 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2165 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2167 {".mp3",S_OK
,FALSE
},
2171 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2172 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2174 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK
,FALSE
},
2175 {"file",S_OK
,FALSE
},
2180 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2182 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2183 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2186 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2187 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK
, FALSE
,
2189 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2190 {"[::1.2.3.0]",S_OK
,FALSE
},
2191 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2195 {"::1.2.3.0",S_OK
,FALSE
},
2197 {"/%3F%23.T/test",S_OK
,FALSE
},
2198 {"/%3F%23.T/test",S_OK
,FALSE
},
2200 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK
,FALSE
},
2201 {"http",S_OK
,FALSE
},
2206 {Uri_HOST_IPV6
,S_OK
,FALSE
},
2208 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2209 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2212 /* Forbidden characters are always encoded for file URIs. */
2213 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2215 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2217 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2219 {".mp3",S_OK
,FALSE
},
2223 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2224 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2226 {"file:///C:/\"test\"/test.mp3",S_OK
,FALSE
},
2227 {"file",S_OK
,FALSE
},
2232 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2234 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2235 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2238 /* Forbidden characters are never encoded for unknown scheme types. */
2239 { "1234://4294967295/<|>\" test<|>", 0, S_OK
, FALSE
,
2241 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2242 {"4294967295",S_OK
,FALSE
},
2243 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2247 {"4294967295",S_OK
,FALSE
},
2249 {"/<|>\" test<|>",S_OK
,FALSE
},
2250 {"/<|>\" test<|>",S_OK
,FALSE
},
2252 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2253 {"1234",S_OK
,FALSE
},
2258 {Uri_HOST_IPV4
,S_OK
,FALSE
},
2260 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2261 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2264 /* Make sure forbidden characters are percent encoded. */
2265 { "http://gov.uk/<|> test<|>", 0, S_OK
, FALSE
,
2267 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2268 {"gov.uk",S_OK
,FALSE
},
2269 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2273 {"gov.uk",S_OK
,FALSE
},
2275 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2276 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2278 {"http://gov.uk/<|> test<|>",S_OK
,FALSE
},
2279 {"http",S_OK
,FALSE
},
2284 {Uri_HOST_DNS
,S_OK
,FALSE
},
2286 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2287 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2290 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK
, FALSE
,
2292 {"http://gov.uk/",S_OK
,FALSE
},
2293 {"gov.uk",S_OK
,FALSE
},
2294 {"http://gov.uk/",S_OK
,FALSE
},
2298 {"gov.uk",S_OK
,FALSE
},
2303 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK
,FALSE
},
2304 {"http",S_OK
,FALSE
},
2309 {Uri_HOST_DNS
,S_OK
,FALSE
},
2311 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2312 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2315 { "http://gov.uk/test/test2/../../..", 0, S_OK
, FALSE
,
2317 {"http://gov.uk/",S_OK
,FALSE
},
2318 {"gov.uk",S_OK
,FALSE
},
2319 {"http://gov.uk/",S_OK
,FALSE
},
2323 {"gov.uk",S_OK
,FALSE
},
2328 {"http://gov.uk/test/test2/../../..",S_OK
,FALSE
},
2329 {"http",S_OK
,FALSE
},
2334 {Uri_HOST_DNS
,S_OK
,FALSE
},
2336 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2337 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2340 { "http://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2342 {"http://gov.uk/",S_OK
,FALSE
},
2343 {"gov.uk",S_OK
,FALSE
},
2344 {"http://gov.uk/",S_OK
,FALSE
},
2348 {"gov.uk",S_OK
,FALSE
},
2353 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2354 {"http",S_OK
,FALSE
},
2359 {Uri_HOST_DNS
,S_OK
,FALSE
},
2361 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2362 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2365 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK
, FALSE
,
2367 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2369 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2371 {".mp3",S_OK
,FALSE
},
2375 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2376 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2378 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK
,FALSE
},
2379 {"file",S_OK
,FALSE
},
2384 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2386 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2387 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2390 /* Dot removal happens for unknown scheme types. */
2391 { "zip://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2393 {"zip://gov.uk/",S_OK
,FALSE
},
2394 {"gov.uk",S_OK
,FALSE
},
2395 {"zip://gov.uk/",S_OK
,FALSE
},
2399 {"gov.uk",S_OK
,FALSE
},
2404 {"zip://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2410 {Uri_HOST_DNS
,S_OK
,FALSE
},
2412 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2413 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2416 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2417 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2419 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2420 {"gov.uk",S_OK
,FALSE
},
2421 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2425 {"gov.uk",S_OK
,FALSE
},
2427 {"/test/test2/../../.",S_OK
,FALSE
},
2428 {"/test/test2/../../.",S_OK
,FALSE
},
2430 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2431 {"http",S_OK
,FALSE
},
2436 {Uri_HOST_DNS
,S_OK
,FALSE
},
2438 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2439 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2442 /* Dot removal doesn't happen for wildcard scheme types. */
2443 { "*:gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2445 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2446 {"gov.uk",S_OK
,FALSE
},
2447 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2451 {"gov.uk",S_OK
,FALSE
},
2453 {"/test/test2/../../.",S_OK
,FALSE
},
2454 {"/test/test2/../../.",S_OK
,FALSE
},
2456 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2462 {Uri_HOST_DNS
,S_OK
,FALSE
},
2464 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
2465 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2468 /* Forbidden characters are encoded for opaque known scheme types. */
2469 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK
, FALSE
,
2471 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2473 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2475 {".com%22",S_OK
,FALSE
},
2479 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2480 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2482 {"mailto:\"acco<|>unt@example.com\"",S_OK
,FALSE
},
2483 {"mailto",S_OK
,FALSE
},
2488 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2490 {URL_SCHEME_MAILTO
,S_OK
,FALSE
},
2491 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2494 { "news:test.tes<|>t.com", 0, S_OK
, FALSE
,
2496 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2498 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2500 {".com",S_OK
,FALSE
},
2504 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2505 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2507 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2508 {"news",S_OK
,FALSE
},
2513 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2515 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2516 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2519 /* Don't encode forbidden characters. */
2520 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2522 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2524 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2526 {".com",S_OK
,FALSE
},
2530 {"test.tes<|>t.com",S_OK
,FALSE
},
2531 {"test.tes<|>t.com",S_OK
,FALSE
},
2533 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2534 {"news",S_OK
,FALSE
},
2539 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2541 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2542 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2545 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2546 { "urn:test.tes<|>t.com", 0, S_OK
, FALSE
,
2548 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2550 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2552 {".com",S_OK
,FALSE
},
2556 {"test.tes<|>t.com",S_OK
,FALSE
},
2557 {"test.tes<|>t.com",S_OK
,FALSE
},
2559 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2565 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2567 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2568 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2571 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2572 { "news:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2574 {"news:test.test.com",S_OK
,FALSE
},
2576 {"news:test.test.com",S_OK
,FALSE
},
2578 {".com",S_OK
,FALSE
},
2582 {"test.test.com",S_OK
,FALSE
},
2583 {"test.test.com",S_OK
,FALSE
},
2585 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2586 {"news",S_OK
,FALSE
},
2591 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2593 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2594 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2597 /* Percent encoded characters are still decoded for known scheme types. */
2598 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2600 {"news:test.test.com",S_OK
,FALSE
},
2602 {"news:test.test.com",S_OK
,FALSE
},
2604 {".com",S_OK
,FALSE
},
2608 {"test.test.com",S_OK
,FALSE
},
2609 {"test.test.com",S_OK
,FALSE
},
2611 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2612 {"news",S_OK
,FALSE
},
2617 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2619 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2620 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2623 /* Percent encoded characters aren't decoded for unknown scheme types. */
2624 { "urn:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2626 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2628 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2630 {".com",S_OK
,FALSE
},
2634 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2635 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2637 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2643 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2645 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2646 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2649 /* Unknown scheme types can have invalid % encoded data in query string. */
2650 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK
, FALSE
,
2652 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2653 {"www.winehq.org",S_OK
,FALSE
},
2654 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2655 {"winehq.org",S_OK
,FALSE
},
2658 {"www.winehq.org",S_OK
,FALSE
},
2661 {"/?query=%xx&return=y",S_OK
,FALSE
},
2662 {"?query=%xx&return=y",S_OK
,FALSE
},
2663 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2669 {Uri_HOST_DNS
,S_OK
,FALSE
},
2671 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2672 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2675 /* Known scheme types can have invalid % encoded data with the right flags. */
2676 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2678 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2679 {"www.winehq.org",S_OK
,FALSE
},
2680 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2681 {"winehq.org",S_OK
,FALSE
},
2684 {"www.winehq.org",S_OK
,FALSE
},
2687 {"/?query=%xx&return=y",S_OK
,FALSE
},
2688 {"?query=%xx&return=y",S_OK
,FALSE
},
2689 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2690 {"http",S_OK
,FALSE
},
2695 {Uri_HOST_DNS
,S_OK
,FALSE
},
2697 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2698 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2701 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2702 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2704 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2705 {"www.winehq.org",S_OK
,FALSE
},
2706 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2707 {"winehq.org",S_OK
,FALSE
},
2710 {"www.winehq.org",S_OK
,FALSE
},
2713 {"/?query=<|>&return=y",S_OK
,FALSE
},
2714 {"?query=<|>&return=y",S_OK
,FALSE
},
2715 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2716 {"http",S_OK
,FALSE
},
2721 {Uri_HOST_DNS
,S_OK
,FALSE
},
2723 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2724 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2727 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2728 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2730 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2731 {"www.winehq.org",S_OK
,FALSE
},
2732 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2733 {"winehq.org",S_OK
,FALSE
},
2736 {"www.winehq.org",S_OK
,FALSE
},
2739 {"/?query=<|>&return=y",S_OK
,FALSE
},
2740 {"?query=<|>&return=y",S_OK
,FALSE
},
2741 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2742 {"http",S_OK
,FALSE
},
2747 {Uri_HOST_DNS
,S_OK
,FALSE
},
2749 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2750 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2753 /* Forbidden characters are encoded for known scheme types. */
2754 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2756 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2757 {"www.winehq.org",S_OK
,FALSE
},
2758 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2759 {"winehq.org",S_OK
,FALSE
},
2762 {"www.winehq.org",S_OK
,FALSE
},
2765 {"/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2766 {"?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2767 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2768 {"http",S_OK
,FALSE
},
2773 {Uri_HOST_DNS
,S_OK
,FALSE
},
2775 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2776 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2779 /* Forbidden characters are not encoded for unknown scheme types. */
2780 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2782 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2783 {"www.winehq.org",S_OK
,FALSE
},
2784 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2785 {"winehq.org",S_OK
,FALSE
},
2788 {"www.winehq.org",S_OK
,FALSE
},
2791 {"/?query=<|>&return=y",S_OK
,FALSE
},
2792 {"?query=<|>&return=y",S_OK
,FALSE
},
2793 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2799 {Uri_HOST_DNS
,S_OK
,FALSE
},
2801 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2802 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2805 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2806 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2808 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2809 {"www.winehq.org",S_OK
,FALSE
},
2810 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2811 {"winehq.org",S_OK
,FALSE
},
2814 {"www.winehq.org",S_OK
,FALSE
},
2817 {"/?query=01&return=y",S_OK
,FALSE
},
2818 {"?query=01&return=y",S_OK
,FALSE
},
2819 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2820 {"http",S_OK
,FALSE
},
2825 {Uri_HOST_DNS
,S_OK
,FALSE
},
2827 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2828 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2831 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2832 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2834 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2835 {"www.winehq.org",S_OK
,FALSE
},
2836 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2837 {"winehq.org",S_OK
,FALSE
},
2840 {"www.winehq.org",S_OK
,FALSE
},
2843 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2844 {"?query=%30%31&return=y",S_OK
,FALSE
},
2845 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2851 {Uri_HOST_DNS
,S_OK
,FALSE
},
2853 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2854 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2857 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2858 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2860 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2861 {"www.winehq.org",S_OK
,FALSE
},
2862 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2863 {"winehq.org",S_OK
,FALSE
},
2866 {"www.winehq.org",S_OK
,FALSE
},
2869 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2870 {"?query=%30%31&return=y",S_OK
,FALSE
},
2871 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2872 {"http",S_OK
,FALSE
},
2877 {Uri_HOST_DNS
,S_OK
,FALSE
},
2879 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2880 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2883 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2885 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2886 {"www.winehq.org",S_OK
,FALSE
},
2887 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2888 {"winehq.org",S_OK
,FALSE
},
2891 {"www.winehq.org",S_OK
,FALSE
},
2894 {"?query=12&return=y",S_OK
,FALSE
},
2895 {"?query=12&return=y",S_OK
,FALSE
},
2896 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2897 {"http",S_OK
,FALSE
},
2902 {Uri_HOST_DNS
,S_OK
,FALSE
},
2904 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2905 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2908 /* Unknown scheme types can have invalid % encoded data in fragments. */
2909 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK
, FALSE
,
2911 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2912 {"www.winehq.org",S_OK
,FALSE
},
2913 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2914 {"winehq.org",S_OK
,FALSE
},
2916 {"#Te%xx",S_OK
,FALSE
},
2917 {"www.winehq.org",S_OK
,FALSE
},
2919 {"/tests/",S_OK
,FALSE
},
2920 {"/tests/",S_OK
,FALSE
},
2922 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2928 {Uri_HOST_DNS
,S_OK
,FALSE
},
2930 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2931 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2934 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2935 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2937 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2938 {"www.winehq.org",S_OK
,FALSE
},
2939 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2940 {"winehq.org",S_OK
,FALSE
},
2942 {"#Te<|>",S_OK
,FALSE
},
2943 {"www.winehq.org",S_OK
,FALSE
},
2945 {"/tests/",S_OK
,FALSE
},
2946 {"/tests/",S_OK
,FALSE
},
2948 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2954 {Uri_HOST_DNS
,S_OK
,FALSE
},
2956 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2957 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2960 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2961 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2963 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2964 {"www.winehq.org",S_OK
,FALSE
},
2965 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2966 {"winehq.org",S_OK
,FALSE
},
2968 {"#Te%3C%7C%3E",S_OK
,FALSE
},
2969 {"www.winehq.org",S_OK
,FALSE
},
2971 {"/tests/",S_OK
,FALSE
},
2972 {"/tests/",S_OK
,FALSE
},
2974 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2975 {"http",S_OK
,FALSE
},
2980 {Uri_HOST_DNS
,S_OK
,FALSE
},
2982 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2983 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2986 /* Forbidden characters aren't encoded in the fragment with this flag. */
2987 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2989 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2990 {"www.winehq.org",S_OK
,FALSE
},
2991 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2992 {"winehq.org",S_OK
,FALSE
},
2994 {"#Te<|>",S_OK
,FALSE
},
2995 {"www.winehq.org",S_OK
,FALSE
},
2997 {"/tests/",S_OK
,FALSE
},
2998 {"/tests/",S_OK
,FALSE
},
3000 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3001 {"http",S_OK
,FALSE
},
3006 {Uri_HOST_DNS
,S_OK
,FALSE
},
3008 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3009 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3012 /* Forbidden characters aren't encoded in the fragment with this flag. */
3013 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
3015 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3016 {"www.winehq.org",S_OK
,FALSE
},
3017 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3018 {"winehq.org",S_OK
,FALSE
},
3020 {"#Te<|>",S_OK
,FALSE
},
3021 {"www.winehq.org",S_OK
,FALSE
},
3023 {"/tests/",S_OK
,FALSE
},
3024 {"/tests/",S_OK
,FALSE
},
3026 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3027 {"http",S_OK
,FALSE
},
3032 {Uri_HOST_DNS
,S_OK
,FALSE
},
3034 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3035 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3038 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3039 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3041 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3042 {"www.winehq.org",S_OK
,FALSE
},
3043 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3044 {"winehq.org",S_OK
,FALSE
},
3046 {"#Te%30%31%32",S_OK
,FALSE
},
3047 {"www.winehq.org",S_OK
,FALSE
},
3049 {"/tests/",S_OK
,FALSE
},
3050 {"/tests/",S_OK
,FALSE
},
3052 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3058 {Uri_HOST_DNS
,S_OK
,FALSE
},
3060 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3061 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3064 /* Percent encoded, unreserved characters are decoded for known schemes. */
3065 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3067 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3068 {"www.winehq.org",S_OK
,FALSE
},
3069 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3070 {"winehq.org",S_OK
,FALSE
},
3072 {"#Te012",S_OK
,FALSE
},
3073 {"www.winehq.org",S_OK
,FALSE
},
3075 {"/tests/",S_OK
,FALSE
},
3076 {"/tests/",S_OK
,FALSE
},
3078 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3079 {"http",S_OK
,FALSE
},
3084 {Uri_HOST_DNS
,S_OK
,FALSE
},
3086 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3087 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3090 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3091 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3093 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3094 {"www.winehq.org",S_OK
,FALSE
},
3095 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3096 {"winehq.org",S_OK
,FALSE
},
3098 {"#Te012",S_OK
,FALSE
},
3099 {"www.winehq.org",S_OK
,FALSE
},
3101 {"/tests/",S_OK
,FALSE
},
3102 {"/tests/",S_OK
,FALSE
},
3104 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3105 {"http",S_OK
,FALSE
},
3110 {Uri_HOST_DNS
,S_OK
,FALSE
},
3112 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3113 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3116 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3117 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3119 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3120 {"www.winehq.org",S_OK
,FALSE
},
3121 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3122 {"winehq.org",S_OK
,FALSE
},
3124 {"#Te%30%31%32",S_OK
,FALSE
},
3125 {"www.winehq.org",S_OK
,FALSE
},
3127 {"/tests/",S_OK
,FALSE
},
3128 {"/tests/",S_OK
,FALSE
},
3130 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3131 {"http",S_OK
,FALSE
},
3136 {Uri_HOST_DNS
,S_OK
,FALSE
},
3138 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3139 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3142 /* Leading/Trailing whitespace is removed. */
3143 { " http://google.com/ ", 0, S_OK
, FALSE
,
3145 {"http://google.com/",S_OK
,FALSE
},
3146 {"google.com",S_OK
,FALSE
},
3147 {"http://google.com/",S_OK
,FALSE
},
3148 {"google.com",S_OK
,FALSE
},
3151 {"google.com",S_OK
,FALSE
},
3156 {"http://google.com/",S_OK
,FALSE
},
3157 {"http",S_OK
,FALSE
},
3162 {Uri_HOST_DNS
,S_OK
,FALSE
},
3164 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3165 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3168 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK
, FALSE
,
3170 {"http://google.com/",S_OK
,FALSE
},
3171 {"google.com",S_OK
,FALSE
},
3172 {"http://google.com/",S_OK
,FALSE
},
3173 {"google.com",S_OK
,FALSE
},
3176 {"google.com",S_OK
,FALSE
},
3181 {"http://google.com/",S_OK
,FALSE
},
3182 {"http",S_OK
,FALSE
},
3187 {Uri_HOST_DNS
,S_OK
,FALSE
},
3189 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3190 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3193 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3195 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3196 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3197 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3198 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3201 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3203 {"/%0A%0A%0A",S_OK
,FALSE
},
3204 {"/%0A%0A%0A",S_OK
,FALSE
},
3206 {"http://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3207 {"http",S_OK
,FALSE
},
3212 {Uri_HOST_DNS
,S_OK
,FALSE
},
3214 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3215 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3218 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3220 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3221 {"g\noogle.co\rm",S_OK
,FALSE
},
3222 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3223 {"g\noogle.co\rm",S_OK
,FALSE
},
3226 {"g\noogle.co\rm",S_OK
,FALSE
},
3228 {"/\n\n\n",S_OK
,FALSE
},
3229 {"/\n\n\n",S_OK
,FALSE
},
3231 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3237 {Uri_HOST_DNS
,S_OK
,FALSE
},
3239 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3240 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3243 /* Since file URLs are usually hierarchical, it returns an empty string
3244 * for the absolute URI property since it was declared as an opaque URI.
3246 { "file:index.html", 0, S_OK
, FALSE
,
3250 {"file:index.html",S_OK
,FALSE
},
3252 {".html",S_OK
,FALSE
},
3256 {"index.html",S_OK
,FALSE
},
3257 {"index.html",S_OK
,FALSE
},
3259 {"file:index.html",S_OK
,FALSE
},
3260 {"file",S_OK
,FALSE
},
3265 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3267 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3268 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3271 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3272 { "http:test.com/index.html", 0, S_OK
, FALSE
,
3276 {"http:test.com/index.html",S_OK
,FALSE
},
3278 {".html",S_OK
,FALSE
},
3282 {"test.com/index.html",S_OK
,FALSE
},
3283 {"test.com/index.html",S_OK
,FALSE
},
3285 {"http:test.com/index.html",S_OK
,FALSE
},
3286 {"http",S_OK
,FALSE
},
3291 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3293 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3294 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3297 { "ftp:test.com/index.html", 0, S_OK
, FALSE
,
3301 {"ftp:test.com/index.html",S_OK
,FALSE
},
3303 {".html",S_OK
,FALSE
},
3307 {"test.com/index.html",S_OK
,FALSE
},
3308 {"test.com/index.html",S_OK
,FALSE
},
3310 {"ftp:test.com/index.html",S_OK
,FALSE
},
3316 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3318 {URL_SCHEME_FTP
,S_OK
,FALSE
},
3319 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3322 { "file://C|/test.mp3", 0, S_OK
, FALSE
,
3324 {"file:///C:/test.mp3",S_OK
,FALSE
},
3326 {"file:///C:/test.mp3",S_OK
,FALSE
},
3328 {".mp3",S_OK
,FALSE
},
3332 {"/C:/test.mp3",S_OK
,FALSE
},
3333 {"/C:/test.mp3",S_OK
,FALSE
},
3335 {"file://C|/test.mp3",S_OK
,FALSE
},
3336 {"file",S_OK
,FALSE
},
3341 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3343 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3344 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3347 { "file:///C|/test.mp3", 0, S_OK
, FALSE
,
3349 {"file:///C:/test.mp3",S_OK
,FALSE
},
3351 {"file:///C:/test.mp3",S_OK
,FALSE
},
3353 {".mp3",S_OK
,FALSE
},
3357 {"/C:/test.mp3",S_OK
,FALSE
},
3358 {"/C:/test.mp3",S_OK
,FALSE
},
3360 {"file:///C|/test.mp3",S_OK
,FALSE
},
3361 {"file",S_OK
,FALSE
},
3366 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3368 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3369 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3372 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3375 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3377 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3379 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3381 {".html",S_OK
,FALSE
},
3385 {"c:\\dir\\index.html",S_OK
,FALSE
},
3386 {"c:\\dir\\index.html",S_OK
,FALSE
},
3388 {"file://c:/dir/index.html",S_OK
,FALSE
},
3389 {"file",S_OK
,FALSE
},
3394 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3396 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3397 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3400 /* Extra '/' after "file://" is removed. */
3401 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3403 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3405 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3407 {".html",S_OK
,FALSE
},
3411 {"c:\\dir\\index.html",S_OK
,FALSE
},
3412 {"c:\\dir\\index.html",S_OK
,FALSE
},
3414 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3415 {"file",S_OK
,FALSE
},
3420 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3422 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3423 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3426 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3427 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3429 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3431 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3433 {".html",S_OK
,FALSE
},
3437 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3438 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3440 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK
,FALSE
},
3441 {"file",S_OK
,FALSE
},
3446 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3448 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3449 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3452 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3454 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3456 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3458 {".html",S_OK
,FALSE
},
3462 {"c:\\dir\\index.html",S_OK
,FALSE
},
3463 {"c:\\dir\\index.html",S_OK
,FALSE
},
3465 {"file://c|/dir\\index.html",S_OK
,FALSE
},
3466 {"file",S_OK
,FALSE
},
3471 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3473 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3474 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3477 /* The backslashes after the scheme name are converted to forward slashes. */
3478 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3480 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3482 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3484 {".html",S_OK
,FALSE
},
3488 {"c:\\dir\\index.html",S_OK
,FALSE
},
3489 {"c:\\dir\\index.html",S_OK
,FALSE
},
3491 {"file:\\\\c:\\dir\\index.html",S_OK
,FALSE
},
3492 {"file",S_OK
,FALSE
},
3497 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3499 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3500 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3503 { "file:\\\\c:/dir/index.html", 0, S_OK
, FALSE
,
3505 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3507 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3509 {".html",S_OK
,FALSE
},
3513 {"/c:/dir/index.html",S_OK
,FALSE
},
3514 {"/c:/dir/index.html",S_OK
,FALSE
},
3516 {"file:\\\\c:/dir/index.html",S_OK
,FALSE
},
3517 {"file",S_OK
,FALSE
},
3522 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3524 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3525 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3528 { "http:\\\\google.com", 0, S_OK
, FALSE
,
3530 {"http://google.com/",S_OK
,FALSE
},
3531 {"google.com",S_OK
,FALSE
},
3532 {"http://google.com/",S_OK
,FALSE
},
3533 {"google.com",S_OK
,FALSE
},
3536 {"google.com",S_OK
,FALSE
},
3541 {"http:\\\\google.com",S_OK
,FALSE
},
3542 {"http",S_OK
,FALSE
},
3547 {Uri_HOST_DNS
,S_OK
,FALSE
},
3549 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3550 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3553 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3554 { "zip:\\\\google.com", 0, S_OK
, FALSE
,
3556 {"zip:\\\\google.com",S_OK
,FALSE
},
3558 {"zip:\\\\google.com",S_OK
,FALSE
},
3560 {".com",S_OK
,FALSE
},
3564 {"\\\\google.com",S_OK
,FALSE
},
3565 {"\\\\google.com",S_OK
,FALSE
},
3567 {"zip:\\\\google.com",S_OK
,FALSE
},
3573 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3575 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3576 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3579 /* Dot segments aren't removed. */
3580 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3582 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3584 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3586 {".html",S_OK
,FALSE
},
3590 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3591 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3593 {"file://c:\\dir\\../..\\./index.html",S_OK
,FALSE
},
3594 {"file",S_OK
,FALSE
},
3599 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3601 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3602 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3605 /* Forbidden characters aren't percent encoded. */
3606 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3608 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3610 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3612 {".html",S_OK
,FALSE
},
3616 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3617 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3619 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3620 {"file",S_OK
,FALSE
},
3625 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3627 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3628 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3631 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3632 { "file:c:\\dir\\../..\\index.html", 0, S_OK
, FALSE
,
3636 {"file:c:/dir/../../index.html",S_OK
,FALSE
},
3638 {".html",S_OK
,FALSE
},
3642 {"c:/dir/../../index.html",S_OK
,FALSE
},
3643 {"c:/dir/../../index.html",S_OK
,FALSE
},
3645 {"file:c:\\dir\\../..\\index.html",S_OK
,FALSE
},
3646 {"file",S_OK
,FALSE
},
3651 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3653 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3654 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3657 /* '/' are still converted to '\' even though it's an opaque URI. */
3658 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3662 {"file:c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3664 {".html",S_OK
,FALSE
},
3668 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3669 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3671 {"file:c:/dir\\../..\\index.html",S_OK
,FALSE
},
3672 {"file",S_OK
,FALSE
},
3677 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3679 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3680 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3683 /* Forbidden characters aren't percent encoded. */
3684 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3688 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3690 {".html",S_OK
,FALSE
},
3694 {"c:\\in^|dex.html",S_OK
,FALSE
},
3695 {"c:\\in^|dex.html",S_OK
,FALSE
},
3697 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3698 {"file",S_OK
,FALSE
},
3703 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3705 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3706 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3709 /* Doesn't have a UserName since the ':' appears at the beginning of the
3712 { "http://:password@gov.uk", 0, S_OK
, FALSE
,
3714 {"http://:password@gov.uk/",S_OK
,FALSE
},
3715 {":password@gov.uk",S_OK
,FALSE
},
3716 {"http://gov.uk/",S_OK
,FALSE
},
3720 {"gov.uk",S_OK
,FALSE
},
3721 {"password",S_OK
,FALSE
},
3725 {"http://:password@gov.uk",S_OK
,FALSE
},
3726 {"http",S_OK
,FALSE
},
3727 {":password",S_OK
,FALSE
},
3731 {Uri_HOST_DNS
,S_OK
,FALSE
},
3733 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3734 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3737 /* Has a UserName since the userinfo section doesn't contain a password. */
3738 { "http://@gov.uk", 0, S_OK
, FALSE
,
3740 {"http://gov.uk/",S_OK
,FALSE
,"http://@gov.uk/"},
3741 {"@gov.uk",S_OK
,FALSE
},
3742 {"http://gov.uk/",S_OK
,FALSE
},
3746 {"gov.uk",S_OK
,FALSE
},
3751 {"http://@gov.uk",S_OK
,FALSE
},
3752 {"http",S_OK
,FALSE
},
3757 {Uri_HOST_DNS
,S_OK
,FALSE
},
3759 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3760 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3763 /* ":@" not included in the absolute URI. */
3764 { "http://:@gov.uk", 0, S_OK
, FALSE
,
3766 {"http://gov.uk/",S_OK
,FALSE
,"http://:@gov.uk/"},
3767 {":@gov.uk",S_OK
,FALSE
},
3768 {"http://gov.uk/",S_OK
,FALSE
},
3772 {"gov.uk",S_OK
,FALSE
},
3777 {"http://:@gov.uk",S_OK
,FALSE
},
3778 {"http",S_OK
,FALSE
},
3783 {Uri_HOST_DNS
,S_OK
,FALSE
},
3785 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3786 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3789 /* '@' is included because it's an unknown scheme type. */
3790 { "zip://@gov.uk", 0, S_OK
, FALSE
,
3792 {"zip://@gov.uk/",S_OK
,FALSE
},
3793 {"@gov.uk",S_OK
,FALSE
},
3794 {"zip://@gov.uk/",S_OK
,FALSE
},
3798 {"gov.uk",S_OK
,FALSE
},
3803 {"zip://@gov.uk",S_OK
,FALSE
},
3809 {Uri_HOST_DNS
,S_OK
,FALSE
},
3811 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3812 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3815 /* ":@" are included because it's an unknown scheme type. */
3816 { "zip://:@gov.uk", 0, S_OK
, FALSE
,
3818 {"zip://:@gov.uk/",S_OK
,FALSE
},
3819 {":@gov.uk",S_OK
,FALSE
},
3820 {"zip://:@gov.uk/",S_OK
,FALSE
},
3824 {"gov.uk",S_OK
,FALSE
},
3829 {"zip://:@gov.uk",S_OK
,FALSE
},
3835 {Uri_HOST_DNS
,S_OK
,FALSE
},
3837 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3838 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3841 { "about:blank", 0, S_OK
, FALSE
,
3843 {"about:blank",S_OK
,FALSE
},
3845 {"about:blank",S_OK
,FALSE
},
3851 {"blank",S_OK
,FALSE
},
3852 {"blank",S_OK
,FALSE
},
3854 {"about:blank",S_OK
,FALSE
},
3855 {"about",S_OK
,FALSE
},
3860 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3862 {URL_SCHEME_ABOUT
,S_OK
,FALSE
},
3863 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3866 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK
,FALSE
,
3868 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3870 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3872 {".htm",S_OK
,FALSE
},
3876 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3877 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3879 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3885 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3887 {URL_SCHEME_MK
,S_OK
,FALSE
},
3888 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3891 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK
,FALSE
,
3893 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3895 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3897 {".htm",S_OK
,FALSE
},
3901 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3902 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3904 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3910 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3912 {URL_SCHEME_MK
,S_OK
,FALSE
},
3913 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3916 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3917 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3919 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3920 {"server",S_OK
,FALSE
},
3921 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3923 {".html",S_OK
,FALSE
},
3925 {"server",S_OK
,FALSE
},
3927 {"\\dir\\index.html",S_OK
,FALSE
},
3928 {"\\dir\\index.html",S_OK
,FALSE
},
3930 {"file://server/dir/index.html",S_OK
,FALSE
},
3931 {"file",S_OK
,FALSE
},
3936 {Uri_HOST_DNS
,S_OK
,FALSE
},
3938 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3939 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3942 /* When CreateUri generates an IUri, it still displays the default port in the
3945 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3947 {"http://google.com:80/",S_OK
,FALSE
},
3948 {"google.com:80",S_OK
,FALSE
},
3949 {"http://google.com:80/",S_OK
,FALSE
},
3950 {"google.com",S_OK
,FALSE
},
3953 {"google.com",S_OK
,FALSE
},
3958 {"http://google.com:80/",S_OK
,FALSE
},
3959 {"http",S_OK
,FALSE
},
3964 {Uri_HOST_DNS
,S_OK
,FALSE
},
3966 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3967 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3970 /* For res URIs the host is everything up until the first '/'. */
3971 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK
, FALSE
,
3973 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3974 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3975 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3977 {".html",S_OK
,FALSE
},
3979 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3981 {"/DATA/test.html",S_OK
,FALSE
},
3982 {"/DATA/test.html",S_OK
,FALSE
},
3984 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3990 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3992 {URL_SCHEME_RES
,S_OK
,FALSE
},
3993 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3996 /* Res URI can contain a '|' in the host name. */
3997 { "res://c:\\di|r\\file.exe/test", 0, S_OK
, FALSE
,
3999 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4000 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4001 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4005 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4007 {"/test",S_OK
,FALSE
},
4008 {"/test",S_OK
,FALSE
},
4010 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4016 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4018 {URL_SCHEME_RES
,S_OK
,FALSE
},
4019 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4022 /* Res URIs can have invalid percent encoded values. */
4023 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK
, FALSE
,
4025 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4026 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4027 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4031 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4033 {"/test",S_OK
,FALSE
},
4034 {"/test",S_OK
,FALSE
},
4036 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4042 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4044 {URL_SCHEME_RES
,S_OK
,FALSE
},
4045 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4048 /* Res doesn't get forbidden characters percent encoded in it's path. */
4049 { "res://c:\\test/tes<|>t", 0, S_OK
, FALSE
,
4051 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4052 {"c:\\test",S_OK
,FALSE
},
4053 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4057 {"c:\\test",S_OK
,FALSE
},
4059 {"/tes<|>t",S_OK
,FALSE
},
4060 {"/tes<|>t",S_OK
,FALSE
},
4062 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4068 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4070 {URL_SCHEME_RES
,S_OK
,FALSE
},
4071 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4074 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4076 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4078 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4080 {".jpg",S_OK
,FALSE
},
4084 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4085 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4087 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4093 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4095 {URL_SCHEME_MK
,S_OK
,FALSE
},
4096 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4099 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4101 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4103 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4105 {".jpg",S_OK
,FALSE
},
4109 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4110 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4112 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4118 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4120 {URL_SCHEME_MK
,S_OK
,FALSE
},
4121 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4124 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4126 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4128 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4130 {".jpg",S_OK
,FALSE
},
4134 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4135 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4137 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4143 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4145 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4146 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4149 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4151 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4153 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4155 {".jpg",S_OK
,FALSE
},
4159 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4160 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4162 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4168 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4170 {URL_SCHEME_MK
,S_OK
,FALSE
},
4171 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4174 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4176 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4178 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4180 {".jpg",S_OK
,FALSE
},
4184 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4185 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4187 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4193 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4195 {URL_SCHEME_MK
,S_OK
,FALSE
},
4196 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4199 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK
, FALSE
,
4201 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4203 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4205 {".jpg",S_OK
,FALSE
},
4209 {"images/xxx.jpg",S_OK
,FALSE
},
4210 {"images/xxx.jpg",S_OK
,FALSE
},
4212 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK
,FALSE
},
4218 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4220 {URL_SCHEME_MK
,S_OK
,FALSE
},
4221 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4224 { "", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4243 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4245 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4246 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4249 { " \t ", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4268 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4270 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4271 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4274 { "javascript:void", 0, S_OK
, FALSE
,
4276 {"javascript:void",S_OK
},
4278 {"javascript:void",S_OK
},
4287 {"javascript:void",S_OK
},
4288 {"javascript",S_OK
},
4293 {Uri_HOST_UNKNOWN
,S_OK
},
4295 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4296 {URLZONE_INVALID
,E_NOTIMPL
}
4299 { "javascript://undefined", 0, S_OK
, FALSE
,
4301 {"javascript://undefined",S_OK
},
4303 {"javascript://undefined",S_OK
},
4309 {"//undefined",S_OK
},
4310 {"//undefined",S_OK
},
4312 {"javascript://undefined",S_OK
},
4313 {"javascript",S_OK
},
4318 {Uri_HOST_UNKNOWN
,S_OK
},
4320 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4321 {URLZONE_INVALID
,E_NOTIMPL
}
4324 { "JavaSCript:escape('/\\?#?')", 0, S_OK
, FALSE
,
4326 {"javascript:escape('/\\?#?')",S_OK
},
4328 {"javascript:escape('/\\?#?')",S_OK
},
4334 {"escape('/\\?#?')",S_OK
},
4335 {"escape('/\\?#?')",S_OK
},
4337 {"JavaSCript:escape('/\\?#?')",S_OK
},
4338 {"javascript",S_OK
},
4343 {Uri_HOST_UNKNOWN
,S_OK
},
4345 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4346 {URLZONE_INVALID
,E_NOTIMPL
}
4349 { "*://google.com", 0, S_OK
, FALSE
,
4351 {"*:google.com/",S_OK
,FALSE
},
4352 {"google.com",S_OK
},
4353 {"*:google.com/",S_OK
,FALSE
},
4354 {"google.com",S_OK
,FALSE
},
4357 {"google.com",S_OK
,FALSE
},
4362 {"*://google.com",S_OK
,FALSE
},
4368 {Uri_HOST_DNS
,S_OK
,FALSE
},
4370 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
4371 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4374 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK
,FALSE
,
4376 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4378 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4384 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4385 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4387 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4393 {Uri_HOST_UNKNOWN
,S_OK
},
4395 {URL_SCHEME_MK
,S_OK
},
4396 {URLZONE_INVALID
,E_NOTIMPL
}
4399 { "gopher://test.winehq.org:151/file.txt",0,S_OK
,FALSE
,
4401 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4402 {"test.winehq.org:151",S_OK
},
4403 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4404 {"winehq.org",S_OK
},
4407 {"test.winehq.org",S_OK
},
4412 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4418 {Uri_HOST_DNS
,S_OK
},
4420 {URL_SCHEME_GOPHER
,S_OK
},
4421 {URLZONE_INVALID
,E_NOTIMPL
}
4426 typedef struct _invalid_uri
{
4432 static const invalid_uri invalid_uri_tests
[] = {
4433 /* Has to have a scheme name. */
4434 {"://www.winehq.org",0,FALSE
},
4435 /* Window's doesn't like URI's which are implicitly file paths without the
4436 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4438 {"C:/test/test.mp3",0,FALSE
},
4439 {"\\\\Server/test/test.mp3",0,FALSE
},
4440 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
,FALSE
},
4441 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE
,FALSE
},
4442 /* Invalid schemes. */
4443 {"*abcd://not.valid.com",0,FALSE
},
4444 {"*a*b*c*d://not.valid.com",0,FALSE
},
4445 /* Not allowed to have invalid % encoded data. */
4446 {"ftp://google.co%XX/",0,FALSE
},
4447 /* To many h16 components. */
4448 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE
},
4449 /* Not enough room for IPv4 address. */
4450 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE
},
4451 /* Not enough h16 components. */
4452 {"http://[1:2:3:4]",0,FALSE
},
4453 /* Not enough components including IPv4. */
4454 {"http://[1:192.0.1.0]",0,FALSE
},
4455 /* Not allowed to have partial IPv4 in IPv6. */
4456 {"http://[::192.0]",0,FALSE
},
4457 /* Can't have elision of 1 h16 at beginning of address. */
4458 {"http://[::2:3:4:5:6:7:8]",0,FALSE
},
4459 /* Can't have elision of 1 h16 at end of address. */
4460 {"http://[1:2:3:4:5:6:7::]",0,FALSE
},
4461 /* Expects a valid IP Literal. */
4462 {"ftp://[not.valid.uri]/",0,FALSE
},
4463 /* Expects valid port for a known scheme type. */
4464 {"ftp://www.winehq.org:123fgh",0,FALSE
},
4465 /* Port exceeds USHORT_MAX for known scheme type. */
4466 {"ftp://www.winehq.org:65536",0,FALSE
},
4467 /* Invalid port with IPv4 address. */
4468 {"http://www.winehq.org:1abcd",0,FALSE
},
4469 /* Invalid port with IPv6 address. */
4470 {"http://[::ffff]:32xy",0,FALSE
},
4471 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4472 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE
,FALSE
},
4473 /* Not allowed to have invalid % encoded data in opaque URI path. */
4474 {"news:test%XX",0,FALSE
},
4475 {"mailto:wine@winehq%G8.com",0,FALSE
},
4476 /* Known scheme types can't have invalid % encoded data in query string. */
4477 {"http://google.com/?query=te%xx",0,FALSE
},
4478 /* Invalid % encoded data in fragment of know scheme type. */
4479 {"ftp://google.com/#Test%xx",0,FALSE
},
4480 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4481 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4482 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4483 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4484 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4485 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4486 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4487 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4488 /* res URIs aren't allowed to have forbidden dos path characters in the
4491 {"res://c:\\te<st\\test/test",0,FALSE
},
4492 {"res://c:\\te>st\\test/test",0,FALSE
},
4493 {"res://c:\\te\"st\\test/test",0,FALSE
},
4494 {"res://c:\\test/te%xxst",0,FALSE
}
4497 typedef struct _uri_equality
{
4499 DWORD create_flags_a
;
4501 DWORD create_flags_b
;
4506 static const uri_equality equality_tests
[] = {
4508 "HTTP://www.winehq.org/test dir/./",0,
4509 "http://www.winehq.org/test dir/../test dir/",0,
4513 /* http://www.winehq.org/test%20dir */
4514 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4515 "http://www.winehq.org/test dir",0,
4519 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
4520 "file:///c:/test.mp3",0,
4524 "ftp://ftp.winehq.org/",0,
4525 "ftp://ftp.winehq.org",0,
4529 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4530 "ftp://ftp.winehq.org/t%45stB/",0,
4534 "http://google.com/TEST",0,
4535 "http://google.com/test",0,
4539 "http://GOOGLE.com/",0,
4540 "http://google.com/",0,
4543 /* Performs case insensitive compare of host names (for known scheme types). */
4545 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE
,
4546 "ftp://google.com/",0,
4550 "zip://GOOGLE.com/",0,
4551 "zip://google.com/",0,
4555 "file:///c:/TEST/TeST/",0,
4556 "file:///c:/test/test/",0,
4560 "file:///server/TEST",0,
4561 "file:///SERVER/TEST",0,
4565 "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
4566 "http://google.com/",0,
4570 "ftp://google.com:21/",0,
4571 "ftp://google.com/",0,
4575 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE
,
4576 "http://google.com/",0,
4580 "http://google.com:70/",0,
4581 "http://google.com:71/",0,
4585 "file:///c:/dir/file.txt", 0,
4586 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4590 "file:///c:/dir/file.txt", 0,
4591 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4595 "file:///c:/dir/file.txt", 0,
4596 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4600 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4601 "file:///c:/%20dir/file.txt", 0,
4605 "file:///c:/Dir/file.txt", 0,
4606 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH
,
4610 "file:///c:/dir/file.txt", 0,
4611 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4615 "file:///c:/dir/file.txt#a", 0,
4616 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH
,
4621 typedef struct _uri_with_fragment
{
4623 const char* fragment
;
4625 HRESULT create_expected
;
4628 const char* expected_uri
;
4630 } uri_with_fragment
;
4632 static const uri_with_fragment uri_fragment_tests
[] = {
4634 "http://google.com/","#fragment",0,S_OK
,FALSE
,
4635 "http://google.com/#fragment",FALSE
4638 "http://google.com/","fragment",0,S_OK
,FALSE
,
4639 "http://google.com/#fragment",FALSE
4642 "zip://test.com/","?test",0,S_OK
,FALSE
,
4643 "zip://test.com/#?test",FALSE
4645 /* The fragment can be empty. */
4647 "ftp://ftp.google.com/","",0,S_OK
,FALSE
,
4648 "ftp://ftp.google.com/#",FALSE
4652 typedef struct _uri_builder_property
{
4655 const char *expected_value
;
4656 Uri_PROPERTY property
;
4659 } uri_builder_property
;
4661 typedef struct _uri_builder_port
{
4669 typedef struct _uri_builder_str_property
{
4670 const char* expected
;
4673 } uri_builder_str_property
;
4675 typedef struct _uri_builder_dword_property
{
4679 } uri_builder_dword_property
;
4681 typedef struct _uri_builder_test
{
4684 HRESULT create_builder_expected
;
4685 BOOL create_builder_todo
;
4687 uri_builder_property properties
[URI_BUILDER_STR_PROPERTY_COUNT
];
4689 uri_builder_port port_prop
;
4695 DWORD uri_simple_encode_flags
;
4696 HRESULT uri_simple_hres
;
4697 BOOL uri_simple_todo
;
4699 DWORD uri_with_flags
;
4700 DWORD uri_with_builder_flags
;
4701 DWORD uri_with_encode_flags
;
4702 HRESULT uri_with_hres
;
4705 uri_builder_str_property expected_str_props
[URI_STR_PROPERTY_COUNT
];
4706 uri_builder_dword_property expected_dword_props
[URI_DWORD_PROPERTY_COUNT
];
4709 static const uri_builder_test uri_builder_tests
[] = {
4710 { "http://google.com/",0,S_OK
,FALSE
,
4712 {TRUE
,"#fragment",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4713 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
},
4714 {TRUE
,"?query=x",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
4715 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
4722 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4723 {"username:password@google.com",S_OK
},
4724 {"http://google.com/?query=x#fragment",S_OK
},
4725 {"google.com",S_OK
},
4728 {"google.com",S_OK
},
4733 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4735 {"username:password",S_OK
},
4739 {Uri_HOST_DNS
,S_OK
},
4741 {URL_SCHEME_HTTP
,S_OK
},
4742 {URLZONE_INVALID
,E_NOTIMPL
}
4745 { "http://google.com/",0,S_OK
,FALSE
,
4747 {TRUE
,"test",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
4749 {TRUE
,TRUE
,120,S_OK
,FALSE
},
4754 {"test://google.com:120/",S_OK
},
4755 {"google.com:120",S_OK
},
4756 {"test://google.com:120/",S_OK
},
4757 {"google.com",S_OK
},
4760 {"google.com",S_OK
},
4765 {"test://google.com:120/",S_OK
},
4771 {Uri_HOST_DNS
,S_OK
},
4773 {URL_SCHEME_UNKNOWN
,S_OK
},
4774 {URLZONE_INVALID
,E_NOTIMPL
}
4777 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4779 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
4780 {TRUE
,"::192.2.3.4",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
4781 {TRUE
,NULL
,NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
4788 {"http://[::192.2.3.4]/",S_OK
},
4789 {"[::192.2.3.4]",S_OK
},
4790 {"http://[::192.2.3.4]/",S_OK
},
4794 {"::192.2.3.4",S_OK
},
4799 {"http://[::192.2.3.4]/",S_OK
},
4805 {Uri_HOST_IPV6
,S_OK
},
4807 {URL_SCHEME_HTTP
,S_OK
},
4808 {URLZONE_INVALID
,E_NOTIMPL
}
4811 { "http://google.com/",0,S_OK
,FALSE
,
4813 {TRUE
,"Frag","#Frag",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
4820 {"http://google.com/#Frag",S_OK
},
4821 {"google.com",S_OK
},
4822 {"http://google.com/#Frag",S_OK
},
4823 {"google.com",S_OK
},
4826 {"google.com",S_OK
},
4831 {"http://google.com/#Frag",S_OK
},
4837 {Uri_HOST_DNS
,S_OK
},
4839 {URL_SCHEME_HTTP
,S_OK
},
4840 {URLZONE_INVALID
,E_NOTIMPL
}
4843 { "http://google.com/",0,S_OK
,FALSE
,
4845 {TRUE
,"","#",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4852 {"http://google.com/#",S_OK
},
4853 {"google.com",S_OK
},
4854 {"http://google.com/#",S_OK
},
4855 {"google.com",S_OK
},
4858 {"google.com",S_OK
},
4863 {"http://google.com/#",S_OK
},
4869 {Uri_HOST_DNS
,S_OK
},
4871 {URL_SCHEME_HTTP
,S_OK
},
4872 {URLZONE_INVALID
,E_NOTIMPL
}
4875 { "http://google.com/",0,S_OK
,FALSE
,
4877 {TRUE
,":password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4884 {"http://::password@google.com/",S_OK
},
4885 {"::password@google.com",S_OK
},
4886 {"http://google.com/",S_OK
},
4887 {"google.com",S_OK
},
4890 {"google.com",S_OK
},
4895 {"http://::password@google.com/",S_OK
},
4897 {"::password",S_OK
},
4901 {Uri_HOST_DNS
,S_OK
},
4903 {URL_SCHEME_HTTP
,S_OK
},
4904 {URLZONE_INVALID
,E_NOTIMPL
}
4907 { "test/test",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4909 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4912 Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4914 Uri_CREATE_ALLOW_RELATIVE
,0,0,S_OK
,FALSE
,
4916 {":password@test/test",S_OK
},
4917 {":password@",S_OK
},
4918 {":password@test/test",S_OK
},
4927 {":password@test/test",S_OK
},
4933 {Uri_HOST_UNKNOWN
,S_OK
},
4935 {URL_SCHEME_UNKNOWN
,S_OK
},
4936 {URLZONE_INVALID
,E_NOTIMPL
}
4939 { "http://google.com/",0,S_OK
,FALSE
,
4941 {TRUE
,"test/test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
4948 {"http://google.com/test/test",S_OK
},
4949 {"google.com",S_OK
},
4950 {"http://google.com/test/test",S_OK
},
4951 {"google.com",S_OK
},
4954 {"google.com",S_OK
},
4956 {"/test/test",S_OK
},
4957 {"/test/test",S_OK
},
4959 {"http://google.com/test/test",S_OK
},
4965 {Uri_HOST_DNS
,S_OK
},
4967 {URL_SCHEME_HTTP
,S_OK
},
4968 {URLZONE_INVALID
,E_NOTIMPL
}
4971 { "zip:testing/test",0,S_OK
,FALSE
,
4973 {TRUE
,"test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
4997 {Uri_HOST_UNKNOWN
,S_OK
},
4999 {URL_SCHEME_UNKNOWN
,S_OK
},
5000 {URLZONE_INVALID
,E_NOTIMPL
}
5003 { "http://google.com/",0,S_OK
,FALSE
,
5007 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5008 {TRUE
,FALSE
,555,S_OK
,FALSE
},
5013 {"http://google.com/",S_OK
},
5014 {"google.com",S_OK
},
5015 {"http://google.com/",S_OK
},
5016 {"google.com",S_OK
},
5019 {"google.com",S_OK
},
5024 {"http://google.com/",S_OK
},
5030 {Uri_HOST_DNS
,S_OK
},
5031 /* Still returns 80, even though earlier the port was disabled. */
5033 {URL_SCHEME_HTTP
,S_OK
},
5034 {URLZONE_INVALID
,E_NOTIMPL
}
5037 { "http://google.com/",0,S_OK
,FALSE
,
5041 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5042 * you'll get 122345 instead.
5044 {TRUE
,122345,222,S_OK
,FALSE
},
5049 {"http://google.com:222/",S_OK
},
5050 {"google.com:222",S_OK
},
5051 {"http://google.com:222/",S_OK
},
5052 {"google.com",S_OK
},
5055 {"google.com",S_OK
},
5060 {"http://google.com:222/",S_OK
},
5066 {Uri_HOST_DNS
,S_OK
},
5068 {URL_SCHEME_HTTP
,S_OK
},
5069 {URLZONE_INVALID
,E_NOTIMPL
}
5072 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5073 { "http://google.com/",0,S_OK
,FALSE
,
5077 {TRUE
,TRUE
,999999,S_OK
,FALSE
},
5082 {"http://google.com:999999/",S_OK
},
5083 {"google.com:999999",S_OK
},
5084 {"http://google.com:999999/",S_OK
},
5085 {"google.com",S_OK
},
5088 {"google.com",S_OK
},
5093 {"http://google.com:999999/",S_OK
},
5099 {Uri_HOST_DNS
,S_OK
},
5101 {URL_SCHEME_HTTP
,S_OK
},
5102 {URLZONE_INVALID
,E_NOTIMPL
}
5105 { "http://google.com/",0,S_OK
,FALSE
,
5107 {TRUE
,"test","?test",Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5115 {"http://google.com/?test",S_OK
},
5116 {"google.com",S_OK
},
5117 {"http://google.com/?test",S_OK
},
5118 {"google.com",S_OK
},
5121 {"google.com",S_OK
},
5126 {"http://google.com/?test",S_OK
},
5132 {Uri_HOST_DNS
,S_OK
},
5134 {URL_SCHEME_HTTP
,S_OK
},
5135 {URLZONE_INVALID
,E_NOTIMPL
}
5138 { "http://:password@google.com/",0,S_OK
,FALSE
,
5147 {"http://:password@google.com/",S_OK
},
5148 {":password@google.com",S_OK
},
5149 {"http://google.com/",S_OK
},
5150 {"google.com",S_OK
},
5153 {"google.com",S_OK
},
5158 {"http://:password@google.com/",S_OK
},
5164 {Uri_HOST_DNS
,S_OK
},
5166 {URL_SCHEME_HTTP
,S_OK
},
5167 {URLZONE_INVALID
,E_NOTIMPL
}
5170 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5171 { NULL
,0,S_OK
,FALSE
,
5173 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5174 {TRUE
,"google.com",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5181 {"http://google.com/",S_OK
},
5182 {"google.com",S_OK
},
5183 {"http://google.com/",S_OK
},
5184 {"google.com",S_OK
},
5187 {"google.com",S_OK
},
5192 {"http://google.com/",S_OK
},
5198 {Uri_HOST_DNS
,S_OK
},
5200 {URL_SCHEME_HTTP
,S_OK
},
5201 {URLZONE_INVALID
,E_NOTIMPL
}
5204 /* Can't set the scheme name to NULL. */
5205 { "zip://google.com/",0,S_OK
,FALSE
,
5207 {TRUE
,NULL
,"zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5214 {"zip://google.com/",S_OK
},
5215 {"google.com",S_OK
},
5216 {"zip://google.com/",S_OK
},
5217 {"google.com",S_OK
},
5220 {"google.com",S_OK
},
5225 {"zip://google.com/",S_OK
},
5231 {Uri_HOST_DNS
,S_OK
},
5233 {URL_SCHEME_UNKNOWN
,S_OK
},
5234 {URLZONE_INVALID
,E_NOTIMPL
}
5237 /* Can't set the scheme name to an empty string. */
5238 { "zip://google.com/",0,S_OK
,FALSE
,
5240 {TRUE
,"","zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5247 {"zip://google.com/",S_OK
},
5248 {"google.com",S_OK
},
5249 {"zip://google.com/",S_OK
},
5250 {"google.com",S_OK
},
5253 {"google.com",S_OK
},
5258 {"zip://google.com/",S_OK
},
5264 {Uri_HOST_DNS
,S_OK
},
5266 {URL_SCHEME_UNKNOWN
,S_OK
},
5267 {URLZONE_INVALID
,E_NOTIMPL
}
5270 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5271 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5273 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE
,S_OK
,FALSE
,
5278 0,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5280 {"http://google.com/../../",S_OK
},
5281 {"google.com",S_OK
},
5282 {"http://google.com/../../",S_OK
},
5283 {"google.com",S_OK
},
5286 {"google.com",S_OK
},
5291 {"http://google.com/../../",S_OK
},
5297 {Uri_HOST_DNS
,S_OK
},
5299 {URL_SCHEME_HTTP
,S_OK
},
5300 {URLZONE_INVALID
,E_NOTIMPL
}
5303 { "http://google.com/",0,S_OK
,FALSE
,
5305 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5310 Uri_CREATE_NO_DECODE_EXTRA_INFO
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5312 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5313 {"google.com",S_OK
},
5314 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5315 {"google.com",S_OK
},
5317 {"#Fr%3C%7C%3Eg",S_OK
},
5318 {"google.com",S_OK
},
5323 {"http://google.com/#Fr<|>g",S_OK
},
5329 {Uri_HOST_DNS
,S_OK
},
5331 {URL_SCHEME_HTTP
,S_OK
},
5332 {URLZONE_INVALID
,E_NOTIMPL
}
5335 { "http://google.com/",0,S_OK
,FALSE
,
5337 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5340 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,E_INVALIDARG
,FALSE
,
5342 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5344 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5345 {"google.com",S_OK
},
5346 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5347 {"google.com",S_OK
},
5349 {"#Fr%3C%7C%3Eg",S_OK
},
5350 {"google.com",S_OK
},
5355 {"http://google.com/#Fr<|>g",S_OK
},
5361 {Uri_HOST_DNS
,S_OK
},
5363 {URL_SCHEME_HTTP
,S_OK
},
5364 {URLZONE_INVALID
,E_NOTIMPL
}
5367 { NULL
,0,S_OK
,FALSE
,
5369 {TRUE
,"/test/test/",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5370 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5373 0,INET_E_INVALID_URL
,FALSE
,
5374 0,INET_E_INVALID_URL
,FALSE
,
5375 0,0,0,INET_E_INVALID_URL
,FALSE
5377 { "http://google.com/",0,S_OK
,FALSE
,
5379 {TRUE
,"ht%xxtp",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5382 0,INET_E_INVALID_URL
,FALSE
,
5383 0,INET_E_INVALID_URL
,FALSE
,
5384 0,0,0,INET_E_INVALID_URL
,FALSE
5386 /* File scheme's can't have a username set. */
5387 { "file://google.com/",0,S_OK
,FALSE
,
5389 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5392 0,INET_E_INVALID_URL
,FALSE
,
5393 0,INET_E_INVALID_URL
,FALSE
,
5394 0,0,0,INET_E_INVALID_URL
,FALSE
5396 /* File schemes can't have a password set. */
5397 { "file://google.com/",0,S_OK
,FALSE
,
5399 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5402 0,INET_E_INVALID_URL
,FALSE
,
5403 0,INET_E_INVALID_URL
,FALSE
,
5404 0,0,0,INET_E_INVALID_URL
,FALSE
5406 /* UserName can't contain any character that is a delimeter for another
5407 * component that appears after it in a normal URI.
5409 { "http://google.com/",0,S_OK
,FALSE
,
5411 {TRUE
,"user:pass",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5414 0,INET_E_INVALID_URL
,FALSE
,
5415 0,INET_E_INVALID_URL
,FALSE
,
5416 0,0,0,INET_E_INVALID_URL
,FALSE
5418 { "http://google.com/",0,S_OK
,FALSE
,
5420 {TRUE
,"user@google.com",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5423 0,INET_E_INVALID_URL
,FALSE
,
5424 0,INET_E_INVALID_URL
,FALSE
,
5425 0,0,0,INET_E_INVALID_URL
,FALSE
5427 { "http://google.com/",0,S_OK
,FALSE
,
5429 {TRUE
,"user/path",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5432 0,INET_E_INVALID_URL
,FALSE
,
5433 0,INET_E_INVALID_URL
,FALSE
,
5434 0,0,0,INET_E_INVALID_URL
,FALSE
5436 { "http://google.com/",0,S_OK
,FALSE
,
5438 {TRUE
,"user?Query",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5441 0,INET_E_INVALID_URL
,FALSE
,
5442 0,INET_E_INVALID_URL
,FALSE
,
5443 0,0,0,INET_E_INVALID_URL
,FALSE
5445 { "http://google.com/",0,S_OK
,FALSE
,
5447 {TRUE
,"user#Frag",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5450 0,INET_E_INVALID_URL
,FALSE
,
5451 0,INET_E_INVALID_URL
,FALSE
,
5452 0,0,0,INET_E_INVALID_URL
,FALSE
5454 { "http://google.com/",0,S_OK
,FALSE
,
5456 {TRUE
,"pass@google.com",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5459 0,INET_E_INVALID_URL
,FALSE
,
5460 0,INET_E_INVALID_URL
,FALSE
,
5461 0,0,0,INET_E_INVALID_URL
,FALSE
5463 { "http://google.com/",0,S_OK
,FALSE
,
5465 {TRUE
,"pass/path",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5468 0,INET_E_INVALID_URL
,FALSE
,
5469 0,INET_E_INVALID_URL
,FALSE
,
5470 0,0,0,INET_E_INVALID_URL
,FALSE
5472 { "http://google.com/",0,S_OK
,FALSE
,
5474 {TRUE
,"pass?query",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5477 0,INET_E_INVALID_URL
,FALSE
,
5478 0,INET_E_INVALID_URL
,FALSE
,
5479 0,0,0,INET_E_INVALID_URL
,FALSE
5481 { "http://google.com/",0,S_OK
,FALSE
,
5483 {TRUE
,"pass#frag",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5486 0,INET_E_INVALID_URL
,FALSE
,
5487 0,INET_E_INVALID_URL
,FALSE
,
5488 0,0,0,INET_E_INVALID_URL
,FALSE
5490 { "http://google.com/",0,S_OK
,FALSE
,
5492 {TRUE
,"winehq.org/test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5495 0,INET_E_INVALID_URL
,FALSE
,
5496 0,INET_E_INVALID_URL
,FALSE
,
5497 0,0,0,INET_E_INVALID_URL
,FALSE
5499 { "http://google.com/",0,S_OK
,FALSE
,
5501 {TRUE
,"winehq.org?test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5504 0,INET_E_INVALID_URL
,FALSE
,
5505 0,INET_E_INVALID_URL
,FALSE
,
5506 0,0,0,INET_E_INVALID_URL
,FALSE
5508 { "http://google.com/",0,S_OK
,FALSE
,
5510 {TRUE
,"winehq.org#test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5513 0,INET_E_INVALID_URL
,FALSE
,
5514 0,INET_E_INVALID_URL
,FALSE
,
5515 0,0,0,INET_E_INVALID_URL
,FALSE
5517 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5518 { "http://google.com/",0,S_OK
,FALSE
,
5520 {TRUE
,"winehq.org:test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5527 {"http://winehq.org:test/",S_OK
},
5528 {"winehq.org:test",S_OK
},
5529 {"http://winehq.org:test/",S_OK
},
5530 {"winehq.org:test",S_OK
},
5533 {"winehq.org:test",S_OK
},
5538 {"http://winehq.org:test/",S_OK
},
5544 {Uri_HOST_DNS
,S_OK
},
5546 {URL_SCHEME_HTTP
,S_OK
},
5547 {URLZONE_INVALID
,E_NOTIMPL
}
5550 /* Can't set the host name to NULL. */
5551 { "http://google.com/",0,S_OK
,FALSE
,
5553 {TRUE
,NULL
,"google.com",Uri_PROPERTY_HOST
,E_INVALIDARG
,FALSE
}
5560 {"http://google.com/",S_OK
},
5561 {"google.com",S_OK
},
5562 {"http://google.com/",S_OK
},
5563 {"google.com",S_OK
},
5566 {"google.com",S_OK
},
5571 {"http://google.com/",S_OK
},
5577 {Uri_HOST_DNS
,S_OK
},
5579 {URL_SCHEME_HTTP
,S_OK
},
5580 {URLZONE_INVALID
,E_NOTIMPL
}
5583 /* Can set the host name to an empty string. */
5584 { "http://google.com/",0,S_OK
,FALSE
,
5586 {TRUE
,"",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5610 {Uri_HOST_UNKNOWN
,S_OK
},
5612 {URL_SCHEME_HTTP
,S_OK
},
5613 {URLZONE_INVALID
,E_NOTIMPL
}
5616 { "http://google.com/",0,S_OK
,FALSE
,
5618 {TRUE
,"/path?query",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5621 0,INET_E_INVALID_URL
,FALSE
,
5622 0,INET_E_INVALID_URL
,FALSE
,
5623 0,0,0,INET_E_INVALID_URL
,FALSE
5625 { "http://google.com/",0,S_OK
,FALSE
,
5627 {TRUE
,"/path#test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5630 0,INET_E_INVALID_URL
,FALSE
,
5631 0,INET_E_INVALID_URL
,FALSE
,
5632 0,0,0,INET_E_INVALID_URL
,FALSE
5634 { "http://google.com/",0,S_OK
,FALSE
,
5636 {TRUE
,"?path#test",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
}
5639 0,INET_E_INVALID_URL
,FALSE
,
5640 0,INET_E_INVALID_URL
,FALSE
,
5641 0,0,0,INET_E_INVALID_URL
,FALSE
5643 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5645 {TRUE
,NULL
,NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5652 {"file:///c:/dir/file.html",S_OK
},
5654 {"file:///c:/dir/file.html",S_OK
},
5660 {"/c:/dir/file.html",S_OK
},
5661 {"/c:/dir/file.html",S_OK
},
5663 {"file:///c:/dir/file.html",S_OK
},
5669 {Uri_HOST_UNKNOWN
,S_OK
},
5671 {URL_SCHEME_FILE
,S_OK
},
5672 {URLZONE_INVALID
,E_NOTIMPL
}
5675 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5677 {TRUE
,"#",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5684 {"file:///c:/dir/file.html#",S_OK
},
5686 {"file:///c:/dir/file.html#",S_OK
},
5692 {"/c:/dir/file.html",S_OK
},
5693 {"/c:/dir/file.html",S_OK
},
5695 {"file:///c:/dir/file.html#",S_OK
},
5701 {Uri_HOST_UNKNOWN
,S_OK
},
5703 {URL_SCHEME_FILE
,S_OK
},
5704 {URLZONE_INVALID
,E_NOTIMPL
}
5709 typedef struct _uri_builder_remove_test
{
5712 HRESULT create_builder_expected
;
5713 BOOL create_builder_todo
;
5715 DWORD remove_properties
;
5716 HRESULT remove_expected
;
5719 const char *expected_uri
;
5720 DWORD expected_flags
;
5721 HRESULT expected_hres
;
5723 } uri_builder_remove_test
;
5725 static const uri_builder_remove_test uri_builder_remove_tests
[] = {
5726 { "http://google.com/test?test=y#Frag",0,S_OK
,FALSE
,
5727 Uri_HAS_FRAGMENT
|Uri_HAS_PATH
|Uri_HAS_QUERY
,S_OK
,FALSE
,
5728 "http://google.com/",0,S_OK
,FALSE
5730 { "http://user:pass@winehq.org/",0,S_OK
,FALSE
,
5731 Uri_HAS_USER_NAME
|Uri_HAS_PASSWORD
,S_OK
,FALSE
,
5732 "http://winehq.org/",0,S_OK
,FALSE
5734 { "zip://google.com?Test=x",0,S_OK
,FALSE
,
5735 Uri_HAS_HOST
,S_OK
,FALSE
,
5736 "zip:/?Test=x",0,S_OK
,FALSE
5738 /* Doesn't remove the whole userinfo component. */
5739 { "http://username:pass@google.com/",0,S_OK
,FALSE
,
5740 Uri_HAS_USER_INFO
,S_OK
,FALSE
,
5741 "http://username:pass@google.com/",0,S_OK
,FALSE
5743 /* Doesn't remove the domain. */
5744 { "http://google.com/",0,S_OK
,FALSE
,
5745 Uri_HAS_DOMAIN
,S_OK
,FALSE
,
5746 "http://google.com/",0,S_OK
,FALSE
5748 { "http://google.com:120/",0,S_OK
,FALSE
,
5749 Uri_HAS_AUTHORITY
,S_OK
,FALSE
,
5750 "http://google.com:120/",0,S_OK
,FALSE
5752 { "http://google.com/test.com/",0,S_OK
,FALSE
,
5753 Uri_HAS_EXTENSION
,S_OK
,FALSE
,
5754 "http://google.com/test.com/",0,S_OK
,FALSE
5756 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5757 Uri_HAS_PATH_AND_QUERY
,S_OK
,FALSE
,
5758 "http://google.com/?test=x",0,S_OK
,FALSE
5760 /* Can't remove the scheme name. */
5761 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5762 Uri_HAS_SCHEME_NAME
|Uri_HAS_QUERY
,E_INVALIDARG
,FALSE
,
5763 "http://google.com/?test=x",0,S_OK
,FALSE
5767 typedef struct _uri_combine_str_property
{
5771 const char *broken_value
;
5772 const char *value_ex
;
5773 } uri_combine_str_property
;
5775 typedef struct _uri_combine_test
{
5776 const char *base_uri
;
5777 DWORD base_create_flags
;
5778 const char *relative_uri
;
5779 DWORD relative_create_flags
;
5780 DWORD combine_flags
;
5784 uri_combine_str_property str_props
[URI_STR_PROPERTY_COUNT
];
5785 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
5788 static const uri_combine_test uri_combine_tests
[] = {
5789 { "http://google.com/fun/stuff",0,
5790 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE
,
5793 {"http://google.com/not/fun/stuff",S_OK
},
5794 {"google.com",S_OK
},
5795 {"http://google.com/not/fun/stuff",S_OK
},
5796 {"google.com",S_OK
},
5799 {"google.com",S_OK
},
5801 {"/not/fun/stuff",S_OK
},
5802 {"/not/fun/stuff",S_OK
},
5804 {"http://google.com/not/fun/stuff",S_OK
},
5810 {Uri_HOST_DNS
,S_OK
},
5812 {URL_SCHEME_HTTP
,S_OK
},
5813 {URLZONE_INVALID
,E_NOTIMPL
}
5816 { "http://google.com/test",0,
5817 "zip://test.com/cool",0,
5820 {"zip://test.com/cool",S_OK
},
5822 {"zip://test.com/cool",S_OK
},
5831 {"zip://test.com/cool",S_OK
},
5837 {Uri_HOST_DNS
,S_OK
},
5839 {URL_SCHEME_UNKNOWN
,S_OK
},
5840 {URLZONE_INVALID
,E_NOTIMPL
}
5843 { "http://google.com/use/base/path",0,
5844 "?relative",Uri_CREATE_ALLOW_RELATIVE
,
5847 {"http://google.com/use/base/path?relative",S_OK
},
5848 {"google.com",S_OK
},
5849 {"http://google.com/use/base/path?relative",S_OK
},
5850 {"google.com",S_OK
},
5853 {"google.com",S_OK
},
5855 {"/use/base/path",S_OK
},
5856 {"/use/base/path?relative",S_OK
},
5858 {"http://google.com/use/base/path?relative",S_OK
},
5864 {Uri_HOST_DNS
,S_OK
},
5866 {URL_SCHEME_HTTP
,S_OK
},
5867 {URLZONE_INVALID
,E_NOTIMPL
}
5870 { "http://google.com/path",0,
5871 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5874 {"http://google.com/testing",S_OK
},
5875 {"google.com",S_OK
},
5876 {"http://google.com/testing",S_OK
},
5877 {"google.com",S_OK
},
5880 {"google.com",S_OK
},
5885 {"http://google.com/testing",S_OK
},
5891 {Uri_HOST_DNS
,S_OK
},
5893 {URL_SCHEME_HTTP
,S_OK
},
5894 {URLZONE_INVALID
,E_NOTIMPL
}
5897 { "http://google.com/path",0,
5898 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5899 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
5901 {"http://google.com:80/test/../test/.././testing",S_OK
},
5902 {"google.com",S_OK
},
5903 {"http://google.com:80/test/../test/.././testing",S_OK
},
5904 {"google.com",S_OK
},
5907 {"google.com",S_OK
},
5909 {"/test/../test/.././testing",S_OK
},
5910 {"/test/../test/.././testing",S_OK
},
5912 {"http://google.com:80/test/../test/.././testing",S_OK
},
5918 {Uri_HOST_DNS
,S_OK
},
5920 {URL_SCHEME_HTTP
,S_OK
},
5921 {URLZONE_INVALID
,E_NOTIMPL
}
5924 { "http://winehq.org/test/abc",0,
5925 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
5928 {"http://winehq.org/test/testing/test",S_OK
},
5929 {"winehq.org",S_OK
},
5930 {"http://winehq.org/test/testing/test",S_OK
},
5931 {"winehq.org",S_OK
},
5934 {"winehq.org",S_OK
},
5936 {"/test/testing/test",S_OK
},
5937 {"/test/testing/test",S_OK
},
5939 {"http://winehq.org/test/testing/test",S_OK
},
5945 {Uri_HOST_DNS
,S_OK
},
5947 {URL_SCHEME_HTTP
,S_OK
},
5948 {URLZONE_INVALID
,E_NOTIMPL
}
5951 { "http://winehq.org/test/abc",0,
5952 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
5953 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
5955 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5956 /* Default port is hidden in the authority. */
5957 {"winehq.org",S_OK
},
5958 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5959 {"winehq.org",S_OK
},
5962 {"winehq.org",S_OK
},
5964 {"/test/testing/abc/../test",S_OK
},
5965 {"/test/testing/abc/../test",S_OK
},
5967 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
5973 {Uri_HOST_DNS
,S_OK
},
5975 {URL_SCHEME_HTTP
,S_OK
},
5976 {URLZONE_INVALID
,E_NOTIMPL
}
5979 { "http://winehq.org/test?query",0,
5980 "testing",Uri_CREATE_ALLOW_RELATIVE
,
5983 {"http://winehq.org/testing",S_OK
},
5984 {"winehq.org",S_OK
},
5985 {"http://winehq.org/testing",S_OK
},
5986 {"winehq.org",S_OK
},
5989 {"winehq.org",S_OK
},
5994 {"http://winehq.org/testing",S_OK
},
6000 {Uri_HOST_DNS
,S_OK
},
6002 {URL_SCHEME_HTTP
,S_OK
},
6003 {URLZONE_INVALID
,E_NOTIMPL
}
6006 { "http://winehq.org/test#frag",0,
6007 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6010 {"http://winehq.org/testing",S_OK
},
6011 {"winehq.org",S_OK
},
6012 {"http://winehq.org/testing",S_OK
},
6013 {"winehq.org",S_OK
},
6016 {"winehq.org",S_OK
},
6021 {"http://winehq.org/testing",S_OK
},
6027 {Uri_HOST_DNS
,S_OK
},
6029 {URL_SCHEME_HTTP
,S_OK
},
6030 {URLZONE_INVALID
,E_NOTIMPL
}
6033 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE
,
6034 "test",Uri_CREATE_ALLOW_RELATIVE
,
6054 {Uri_HOST_UNKNOWN
,S_OK
},
6056 {URL_SCHEME_UNKNOWN
,S_OK
},
6057 {URLZONE_INVALID
,E_NOTIMPL
}
6060 { "file:///c:/test/test",0,
6061 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6062 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6064 {"file://c:\\testing.mp3",S_OK
},
6066 {"file://c:\\testing.mp3",S_OK
},
6072 {"c:\\testing.mp3",S_OK
},
6073 {"c:\\testing.mp3",S_OK
},
6075 {"file://c:\\testing.mp3",S_OK
},
6081 {Uri_HOST_UNKNOWN
,S_OK
},
6083 {URL_SCHEME_FILE
,S_OK
},
6084 {URLZONE_INVALID
,E_NOTIMPL
}
6087 { "file:///c:/test/test",0,
6088 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6091 {"file:///c:/testing.mp3",S_OK
},
6093 {"file:///c:/testing.mp3",S_OK
},
6099 {"/c:/testing.mp3",S_OK
},
6100 {"/c:/testing.mp3",S_OK
},
6102 {"file:///c:/testing.mp3",S_OK
},
6108 {Uri_HOST_UNKNOWN
,S_OK
},
6110 {URL_SCHEME_FILE
,S_OK
},
6111 {URLZONE_INVALID
,E_NOTIMPL
}
6114 { "file://test.com/test/test",0,
6115 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6116 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6118 {"file://\\\\test.com\\testing.mp3",S_OK
},
6120 {"file://\\\\test.com\\testing.mp3",S_OK
},
6126 {"\\testing.mp3",S_OK
},
6127 {"\\testing.mp3",S_OK
},
6129 {"file://\\\\test.com\\testing.mp3",S_OK
},
6135 {Uri_HOST_DNS
,S_OK
},
6137 {URL_SCHEME_FILE
,S_OK
},
6138 {URLZONE_INVALID
,E_NOTIMPL
}
6141 /* URL_DONT_SIMPLIFY has no effect. */
6142 { "http://google.com/test",0,
6143 "zip://test.com/cool/../cool/test",0,
6144 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6146 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6148 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6154 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6155 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6157 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6158 * On IE 7 it reduces the path in the Raw URI.
6160 {"zip://test.com/cool/../cool/test",S_OK
,FALSE
,"zip://test.com/cool/test"},
6166 {Uri_HOST_DNS
,S_OK
},
6168 {URL_SCHEME_UNKNOWN
,S_OK
},
6169 {URLZONE_INVALID
,E_NOTIMPL
}
6172 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6173 * resulting URI is converted into a dos path.
6175 { "http://google.com/test",0,
6176 "file:///c:/test/",0,
6177 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6179 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6181 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6187 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6188 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6190 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6196 {Uri_HOST_UNKNOWN
,S_OK
},
6198 {URL_SCHEME_FILE
,S_OK
},
6199 {URLZONE_INVALID
,E_NOTIMPL
}
6202 { "http://google.com/test",0,
6203 "http://test.com/test#%30test",0,
6204 URL_DONT_UNESCAPE_EXTRA_INFO
,S_OK
,FALSE
,
6206 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6208 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6211 {"#0test",S_OK
,FALSE
,NULL
,"#%30test"},
6217 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6218 {"http://test.com/test#%30test",S_OK
,FALSE
,"http://test.com/test#0test"},
6224 {Uri_HOST_DNS
,S_OK
},
6226 {URL_SCHEME_HTTP
,S_OK
},
6227 {URLZONE_INVALID
,E_NOTIMPL
}
6230 /* Windows validates the path component from the relative Uri. */
6231 { "http://google.com/test",0,
6232 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE
,
6233 0,E_INVALIDARG
,FALSE
6235 /* Windows doesn't validate the query from the relative Uri. */
6236 { "http://google.com/test",0,
6237 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6240 {"http://google.com/test?Tes%XXt",S_OK
},
6241 {"google.com",S_OK
},
6242 {"http://google.com/test?Tes%XXt",S_OK
},
6243 {"google.com",S_OK
},
6246 {"google.com",S_OK
},
6249 {"/test?Tes%XXt",S_OK
},
6251 {"http://google.com/test?Tes%XXt",S_OK
},
6257 {Uri_HOST_DNS
,S_OK
},
6259 {URL_SCHEME_HTTP
,S_OK
},
6260 {URLZONE_INVALID
,E_NOTIMPL
}
6263 /* Windows doesn't validate the fragment from the relative Uri. */
6264 { "http://google.com/test",0,
6265 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6268 {"http://google.com/test#Tes%XXt",S_OK
},
6269 {"google.com",S_OK
},
6270 {"http://google.com/test#Tes%XXt",S_OK
},
6271 {"google.com",S_OK
},
6274 {"google.com",S_OK
},
6279 {"http://google.com/test#Tes%XXt",S_OK
},
6285 {Uri_HOST_DNS
,S_OK
},
6287 {URL_SCHEME_HTTP
,S_OK
},
6288 {URLZONE_INVALID
,E_NOTIMPL
}
6291 /* Creates an IUri which contains an invalid dos path char. */
6292 { "file:///c:/test",0,
6293 "/test<ing",Uri_CREATE_ALLOW_RELATIVE
,
6294 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6296 {"file://c:\\test<ing",S_OK
},
6298 {"file://c:\\test<ing",S_OK
},
6304 {"c:\\test<ing",S_OK
},
6305 {"c:\\test<ing",S_OK
},
6307 {"file://c:\\test<ing",S_OK
},
6313 {Uri_HOST_UNKNOWN
,S_OK
},
6315 {URL_SCHEME_FILE
,S_OK
},
6316 {URLZONE_INVALID
,E_NOTIMPL
}
6319 /* Appends the path after the drive letter (if any). */
6320 { "file:///c:/test",0,
6321 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE
,
6324 {"file:///c:/c:/testing",S_OK
},
6326 {"file:///c:/c:/testing",S_OK
},
6332 {"/c:/c:/testing",S_OK
},
6333 {"/c:/c:/testing",S_OK
},
6335 {"file:///c:/c:/testing",S_OK
},
6341 {Uri_HOST_UNKNOWN
,S_OK
},
6343 {URL_SCHEME_FILE
,S_OK
},
6344 {URLZONE_INVALID
,E_NOTIMPL
}
6347 /* A '/' is added if the base URI doesn't have a path and the
6348 * relative URI doesn't contain a path (since the base URI is
6351 { "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
6352 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6355 {"http://google.com/?test",S_OK
},
6356 {"google.com",S_OK
},
6357 {"http://google.com/?test",S_OK
},
6358 {"google.com",S_OK
},
6361 {"google.com",S_OK
},
6366 {"http://google.com/?test",S_OK
},
6372 {Uri_HOST_DNS
,S_OK
},
6374 {URL_SCHEME_HTTP
,S_OK
},
6375 {URLZONE_INVALID
,E_NOTIMPL
}
6378 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE
,
6379 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6382 {"zip://google.com/?test",S_OK
},
6383 {"google.com",S_OK
},
6384 {"zip://google.com/?test",S_OK
},
6385 {"google.com",S_OK
},
6388 {"google.com",S_OK
},
6393 {"zip://google.com/?test",S_OK
},
6399 {Uri_HOST_DNS
,S_OK
},
6401 {URL_SCHEME_UNKNOWN
,S_OK
},
6402 {URLZONE_INVALID
,E_NOTIMPL
}
6405 /* No path is appended since the base URI is opaque. */
6407 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6427 {Uri_HOST_UNKNOWN
,S_OK
},
6429 {URL_SCHEME_UNKNOWN
,S_OK
},
6430 {URLZONE_INVALID
,E_NOTIMPL
}
6434 "../testing/test",Uri_CREATE_ALLOW_RELATIVE
,
6437 {"file:///c:/testing/test",S_OK
},
6439 {"file:///c:/testing/test",S_OK
},
6445 {"/c:/testing/test",S_OK
},
6446 {"/c:/testing/test",S_OK
},
6448 {"file:///c:/testing/test",S_OK
},
6454 {Uri_HOST_UNKNOWN
,S_OK
},
6456 {URL_SCHEME_FILE
,S_OK
},
6457 {URLZONE_INVALID
,E_NOTIMPL
}
6460 { "http://winehq.org/dir/testfile",0,
6461 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6464 {"http://winehq.org/dir/test?querystring",S_OK
},
6465 {"winehq.org",S_OK
},
6466 {"http://winehq.org/dir/test?querystring",S_OK
},
6467 {"winehq.org",S_OK
},
6470 {"winehq.org",S_OK
},
6473 {"/dir/test?querystring",S_OK
},
6474 {"?querystring",S_OK
},
6475 {"http://winehq.org/dir/test?querystring",S_OK
},
6481 {Uri_HOST_DNS
,S_OK
},
6483 {URL_SCHEME_HTTP
,S_OK
},
6484 {URLZONE_INVALID
,E_NOTIMPL
}
6487 { "http://winehq.org/dir/test",0,
6488 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6491 {"http://winehq.org/dir/test?querystring",S_OK
},
6492 {"winehq.org",S_OK
},
6493 {"http://winehq.org/dir/test?querystring",S_OK
},
6494 {"winehq.org",S_OK
},
6497 {"winehq.org",S_OK
},
6500 {"/dir/test?querystring",S_OK
},
6501 {"?querystring",S_OK
},
6502 {"http://winehq.org/dir/test?querystring",S_OK
},
6508 {Uri_HOST_DNS
,S_OK
},
6510 {URL_SCHEME_HTTP
,S_OK
},
6511 {URLZONE_INVALID
,E_NOTIMPL
}
6514 { "http://winehq.org/dir/test?querystring",0,
6515 "#hash",Uri_CREATE_ALLOW_RELATIVE
,
6518 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6519 {"winehq.org",S_OK
},
6520 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6521 {"winehq.org",S_OK
},
6524 {"winehq.org",S_OK
},
6527 {"/dir/test?querystring",S_OK
},
6528 {"?querystring",S_OK
},
6529 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6535 {Uri_HOST_DNS
,S_OK
},
6537 {URL_SCHEME_HTTP
,S_OK
},
6538 {URLZONE_INVALID
,E_NOTIMPL
}
6541 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6542 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6545 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6547 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6553 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6554 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6556 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6562 {Uri_HOST_UNKNOWN
,S_OK
},
6564 {URL_SCHEME_MK
,S_OK
},
6565 {URLZONE_INVALID
,E_NOTIMPL
}
6568 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6569 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6572 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6574 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6580 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6581 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6583 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6589 {Uri_HOST_UNKNOWN
,S_OK
},
6591 {URL_SCHEME_MK
,S_OK
},
6592 {URLZONE_INVALID
,E_NOTIMPL
}
6595 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6596 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6599 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6601 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6607 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6608 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6610 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6616 {Uri_HOST_UNKNOWN
,S_OK
},
6618 {URL_SCHEME_MK
,S_OK
},
6619 {URLZONE_INVALID
,E_NOTIMPL
}
6624 typedef struct _uri_parse_test
{
6629 const char *property
;
6634 static const uri_parse_test uri_parse_tests
[] = {
6635 /* PARSE_CANONICALIZE tests. */
6636 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"zip://google.com/test<|>",S_OK
,FALSE
},
6637 {"http://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"http://google.com/test%3C%7C%3E",S_OK
,FALSE
},
6638 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE
,URL_UNESCAPE
,"http://google.com/0#?",S_OK
,FALSE
},
6639 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_UNSAFE
,"test %3C%7C%3E",S_OK
,FALSE
},
6640 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_SPACES_ONLY
,"test%20<|>",S_OK
,FALSE
},
6641 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_UNESCAPE
|URL_ESCAPE_UNSAFE
,"test%20%3C%7C%3E",S_OK
,FALSE
},
6642 {"http://google.com/%20",0,PARSE_CANONICALIZE
,URL_ESCAPE_PERCENT
,"http://google.com/%2520",S_OK
,FALSE
},
6643 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"http://google.com/test/../",S_OK
,FALSE
},
6644 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_NO_META
,"http://google.com/test/../",S_OK
,FALSE
},
6645 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"http://google.com/",S_OK
,FALSE
},
6646 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"zip://google.com/",S_OK
,FALSE
},
6647 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"file:///c:/test/../test",S_OK
,FALSE
},
6649 /* PARSE_FRIENDLY tests. */
6650 {"http://test@google.com/test#test",0,PARSE_FRIENDLY
,0,"http://google.com/test#test",S_OK
,FALSE
},
6651 {"zip://test@google.com/test",0,PARSE_FRIENDLY
,0,"zip://test@google.com/test",S_OK
,FALSE
},
6653 /* PARSE_ROOTDOCUMENT tests. */
6654 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT
,0,"http://google.com:200/",S_OK
,FALSE
},
6655 {"http://google.com",Uri_CREATE_NO_CANONICALIZE
,PARSE_ROOTDOCUMENT
,0,"http://google.com/",S_OK
,FALSE
},
6656 {"zip://google.com/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6657 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6658 {"file://server/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6659 {"zip:test/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6661 /* PARSE_DOCUMENT tests. */
6662 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT
,0,"http://test@google.com/test?query",S_OK
,FALSE
},
6663 {"http:testing#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6664 {"file:///c:/test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6665 {"zip://google.com/#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6666 {"zip:test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6667 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6669 /* PARSE_PATH_FROM_URL tests. */
6670 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
,FALSE
},
6671 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\t<|>est.mp3",S_OK
,FALSE
},
6672 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL
,0,"c:\\te%XX t\\",S_OK
,FALSE
},
6673 {"file://server/test",0,PARSE_PATH_FROM_URL
,0,"\\\\server\\test",S_OK
,FALSE
},
6674 {"http://google.com/",0,PARSE_PATH_FROM_URL
,0,"",E_INVALIDARG
,FALSE
},
6676 /* PARSE_URL_FROM_PATH tests. */
6677 /* This function almost seems to useless (just returns the absolute uri). */
6678 {"test.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"test.com",S_OK
,FALSE
},
6679 {"/test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"/test/test",S_OK
,FALSE
},
6680 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH
,PARSE_URL_FROM_PATH
,0,"file://c:\\test\\test",S_OK
,FALSE
},
6681 {"file:c:/test",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6682 {"http:google.com/",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6684 /* PARSE_SCHEMA tests. */
6685 {"http://google.com/test",0,PARSE_SCHEMA
,0,"http",S_OK
,FALSE
},
6686 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SCHEMA
,0,"",S_OK
,FALSE
},
6688 /* PARSE_SITE tests. */
6689 {"http://google.uk.com/",0,PARSE_SITE
,0,"google.uk.com",S_OK
,FALSE
},
6690 {"http://google.com.com/",0,PARSE_SITE
,0,"google.com.com",S_OK
,FALSE
},
6691 {"google.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SITE
,0,"",S_OK
,FALSE
},
6692 {"file://server/test",0,PARSE_SITE
,0,"server",S_OK
,FALSE
},
6694 /* PARSE_DOMAIN tests. */
6695 {"http://google.com.uk/",0,PARSE_DOMAIN
,0,"google.com.uk",S_OK
,FALSE
},
6696 {"http://google.com.com/",0,PARSE_DOMAIN
,0,"com.com",S_OK
,FALSE
},
6697 {"test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6698 {"file://server/test",0,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6700 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6701 {"http://google.com/test#Test",0,PARSE_ANCHOR
,0,"#Test",S_OK
,FALSE
},
6702 {"http://google.com/test#Test",0,PARSE_LOCATION
,0,"#Test",S_OK
,FALSE
},
6703 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_ANCHOR
,0,"",S_OK
,FALSE
},
6704 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_LOCATION
,0,"",S_OK
,FALSE
}
6707 static inline LPWSTR
a2w(LPCSTR str
) {
6711 DWORD len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
6712 ret
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
6713 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
6719 static inline BOOL
heap_free(void* mem
) {
6720 return HeapFree(GetProcessHeap(), 0, mem
);
6723 static inline DWORD
strcmp_aw(LPCSTR strA
, LPCWSTR strB
) {
6724 LPWSTR strAW
= a2w(strA
);
6725 DWORD ret
= lstrcmpW(strAW
, strB
);
6730 static inline ULONG
get_refcnt(IUri
*uri
) {
6732 return IUri_Release(uri
);
6735 static void change_property(IUriBuilder
*builder
, const uri_builder_property
*prop
,
6740 valueW
= a2w(prop
->value
);
6741 switch(prop
->property
) {
6742 case Uri_PROPERTY_FRAGMENT
:
6743 hr
= IUriBuilder_SetFragment(builder
, valueW
);
6746 ok(hr
== prop
->expected
,
6747 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6748 hr
, prop
->expected
, test_index
);
6751 ok(hr
== prop
->expected
,
6752 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6753 hr
, prop
->expected
, test_index
);
6756 case Uri_PROPERTY_HOST
:
6757 hr
= IUriBuilder_SetHost(builder
, valueW
);
6760 ok(hr
== prop
->expected
,
6761 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6762 hr
, prop
->expected
, test_index
);
6765 ok(hr
== prop
->expected
,
6766 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6767 hr
, prop
->expected
, test_index
);
6770 case Uri_PROPERTY_PASSWORD
:
6771 hr
= IUriBuilder_SetPassword(builder
, valueW
);
6774 ok(hr
== prop
->expected
,
6775 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6776 hr
, prop
->expected
, test_index
);
6779 ok(hr
== prop
->expected
,
6780 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6781 hr
, prop
->expected
, test_index
);
6784 case Uri_PROPERTY_PATH
:
6785 hr
= IUriBuilder_SetPath(builder
, valueW
);
6788 ok(hr
== prop
->expected
,
6789 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6790 hr
, prop
->expected
, test_index
);
6793 ok(hr
== prop
->expected
,
6794 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6795 hr
, prop
->expected
, test_index
);
6798 case Uri_PROPERTY_QUERY
:
6799 hr
= IUriBuilder_SetQuery(builder
, valueW
);
6802 ok(hr
== prop
->expected
,
6803 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6804 hr
, prop
->expected
, test_index
);
6807 ok(hr
== prop
->expected
,
6808 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6809 hr
, prop
->expected
, test_index
);
6812 case Uri_PROPERTY_SCHEME_NAME
:
6813 hr
= IUriBuilder_SetSchemeName(builder
, valueW
);
6816 ok(hr
== prop
->expected
,
6817 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6818 hr
, prop
->expected
, test_index
);
6821 ok(hr
== prop
->expected
,
6822 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6823 hr
, prop
->expected
, test_index
);
6826 case Uri_PROPERTY_USER_NAME
:
6827 hr
= IUriBuilder_SetUserName(builder
, valueW
);
6830 ok(hr
== prop
->expected
,
6831 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6832 hr
, prop
->expected
, test_index
);
6835 ok(hr
== prop
->expected
,
6836 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6837 hr
, prop
->expected
, test_index
);
6841 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop
->property
, test_index
);
6848 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6851 static void test_CreateUri_InvalidFlags(void) {
6854 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
6856 IUri
*uri
= (void*) 0xdeadbeef;
6858 hr
= pCreateUri(http_urlW
, invalid_flag_tests
[i
].flags
, 0, &uri
);
6859 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6860 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
6861 ok(uri
== NULL
, "Error: expected the IUri to be NULL, but it was %p instead\n", uri
);
6865 static void test_CreateUri_InvalidArgs(void) {
6867 IUri
*uri
= (void*) 0xdeadbeef;
6869 const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
6870 static const WCHAR emptyW
[] = {0};
6872 hr
= pCreateUri(http_urlW
, 0, 0, NULL
);
6873 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
6875 hr
= pCreateUri(NULL
, 0, 0, &uri
);
6876 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
6877 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6879 uri
= (void*) 0xdeadbeef;
6880 hr
= pCreateUri(invalidW
, 0, 0, &uri
);
6881 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
6882 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6884 uri
= (void*) 0xdeadbeef;
6885 hr
= pCreateUri(emptyW
, 0, 0, &uri
);
6886 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
6887 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
6890 static void test_CreateUri_InvalidUri(void) {
6893 for(i
= 0; i
< sizeof(invalid_uri_tests
)/sizeof(invalid_uri_tests
[0]); ++i
) {
6894 invalid_uri test
= invalid_uri_tests
[i
];
6899 uriW
= a2w(test
.uri
);
6900 hr
= pCreateUri(uriW
, test
.flags
, 0, &uri
);
6903 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6904 hr
, E_INVALIDARG
, i
);
6907 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
6908 hr
, E_INVALIDARG
, i
);
6910 if(uri
) IUri_Release(uri
);
6916 static void test_IUri_GetPropertyBSTR(void) {
6921 /* Make sure GetPropertyBSTR handles invalid args correctly. */
6922 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
6923 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
6925 BSTR received
= NULL
;
6927 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, NULL
, 0);
6928 ok(hr
== E_POINTER
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
6930 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
6931 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_PORT
, &received
, 0);
6932 ok(hr
== S_OK
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
6933 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
6934 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
6935 SysFreeString(received
);
6937 /* Make sure it handles the ZONE property correctly. */
6939 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_ZONE
, &received
, 0);
6940 ok(hr
== S_FALSE
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_FALSE
);
6941 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
6942 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
6943 SysFreeString(received
);
6945 if(uri
) IUri_Release(uri
);
6947 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
6948 uri_properties test
= uri_tests
[i
];
6952 uriW
= a2w(test
.uri
);
6953 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
6954 if(test
.create_todo
) {
6956 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6957 hr
, test
.create_expected
, i
);
6960 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
6961 hr
, test
.create_expected
, i
);
6967 /* Checks all the string properties of the uri. */
6968 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
6969 BSTR received
= NULL
;
6970 uri_str_property prop
= test
.str_props
[j
];
6972 hr
= IUri_GetPropertyBSTR(uri
, j
, &received
, 0);
6975 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6976 hr
, prop
.expected
, i
, j
);
6979 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
6980 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6981 prop
.value
, wine_dbgstr_w(received
), i
, j
);
6984 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
6985 hr
, prop
.expected
, i
, j
);
6986 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
6987 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
6988 prop
.value
, wine_dbgstr_w(received
), i
, j
);
6991 SysFreeString(received
);
6995 if(uri
) IUri_Release(uri
);
7001 static void test_IUri_GetPropertyDWORD(void) {
7006 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7007 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7009 DWORD received
= 0xdeadbeef;
7011 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_DWORD_START
, NULL
, 0);
7012 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7014 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_ABSOLUTE_URI
, &received
, 0);
7015 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7016 ok(received
== 0, "Error: Expected received=%d but instead received=%d.\n", 0, received
);
7018 if(uri
) IUri_Release(uri
);
7020 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7021 uri_properties test
= uri_tests
[i
];
7025 uriW
= a2w(test
.uri
);
7026 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7027 if(test
.create_todo
) {
7029 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7030 hr
, test
.create_expected
, i
);
7033 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7034 hr
, test
.create_expected
, i
);
7040 /* Checks all the DWORD properties of the uri. */
7041 for(j
= 0; j
< sizeof(test
.dword_props
)/sizeof(test
.dword_props
[0]); ++j
) {
7043 uri_dword_property prop
= test
.dword_props
[j
];
7045 hr
= IUri_GetPropertyDWORD(uri
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
7048 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7049 hr
, prop
.expected
, i
, j
);
7052 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7053 prop
.value
, received
, i
, j
);
7056 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7057 hr
, prop
.expected
, i
, j
);
7058 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7059 prop
.value
, received
, i
, j
);
7064 if(uri
) IUri_Release(uri
);
7070 /* Tests all the 'Get*' property functions which deal with strings. */
7071 static void test_IUri_GetStrProperties(void) {
7076 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7077 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7078 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7080 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
7081 ok(hr
== E_POINTER
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7083 hr
= IUri_GetAuthority(uri
, NULL
);
7084 ok(hr
== E_POINTER
, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7086 hr
= IUri_GetDisplayUri(uri
, NULL
);
7087 ok(hr
== E_POINTER
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7089 hr
= IUri_GetDomain(uri
, NULL
);
7090 ok(hr
== E_POINTER
, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7092 hr
= IUri_GetExtension(uri
, NULL
);
7093 ok(hr
== E_POINTER
, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7095 hr
= IUri_GetFragment(uri
, NULL
);
7096 ok(hr
== E_POINTER
, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7098 hr
= IUri_GetHost(uri
, NULL
);
7099 ok(hr
== E_POINTER
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7101 hr
= IUri_GetPassword(uri
, NULL
);
7102 ok(hr
== E_POINTER
, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7104 hr
= IUri_GetPath(uri
, NULL
);
7105 ok(hr
== E_POINTER
, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7107 hr
= IUri_GetPathAndQuery(uri
, NULL
);
7108 ok(hr
== E_POINTER
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7110 hr
= IUri_GetQuery(uri
, NULL
);
7111 ok(hr
== E_POINTER
, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7113 hr
= IUri_GetRawUri(uri
, NULL
);
7114 ok(hr
== E_POINTER
, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7116 hr
= IUri_GetSchemeName(uri
, NULL
);
7117 ok(hr
== E_POINTER
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7119 hr
= IUri_GetUserInfo(uri
, NULL
);
7120 ok(hr
== E_POINTER
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7122 hr
= IUri_GetUserName(uri
, NULL
);
7123 ok(hr
== E_POINTER
, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7125 if(uri
) IUri_Release(uri
);
7127 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7128 uri_properties test
= uri_tests
[i
];
7132 uriW
= a2w(test
.uri
);
7133 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7134 if(test
.create_todo
) {
7136 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7137 hr
, test
.create_expected
, i
);
7140 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7141 hr
, test
.create_expected
, i
);
7145 uri_str_property prop
;
7146 BSTR received
= NULL
;
7148 /* GetAbsoluteUri() tests. */
7149 prop
= test
.str_props
[Uri_PROPERTY_ABSOLUTE_URI
];
7150 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7153 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7154 hr
, prop
.expected
, i
);
7157 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7158 "Error: Expected %s but got %s on uri_tests[%d].\n",
7159 prop
.value
, wine_dbgstr_w(received
), i
);
7162 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7163 hr
, prop
.expected
, i
);
7164 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7165 "Error: Expected %s but got %s on uri_tests[%d].\n",
7166 prop
.value
, wine_dbgstr_w(received
), i
);
7168 SysFreeString(received
);
7171 /* GetAuthority() tests. */
7172 prop
= test
.str_props
[Uri_PROPERTY_AUTHORITY
];
7173 hr
= IUri_GetAuthority(uri
, &received
);
7176 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7177 hr
, prop
.expected
, i
);
7180 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7181 prop
.value
, wine_dbgstr_w(received
), i
);
7184 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7185 hr
, prop
.expected
, i
);
7186 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7187 prop
.value
, wine_dbgstr_w(received
), i
);
7189 SysFreeString(received
);
7192 /* GetDisplayUri() tests. */
7193 prop
= test
.str_props
[Uri_PROPERTY_DISPLAY_URI
];
7194 hr
= IUri_GetDisplayUri(uri
, &received
);
7197 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7198 hr
, prop
.expected
, i
);
7201 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7202 "Error: Expected %s but got %s on uri_test[%d].\n",
7203 prop
.value
, wine_dbgstr_w(received
), i
);
7206 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7207 hr
, prop
.expected
, i
);
7208 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7209 "Error: Expected %s but got %s on uri_tests[%d].\n",
7210 prop
.value
, wine_dbgstr_w(received
), i
);
7212 SysFreeString(received
);
7215 /* GetDomain() tests. */
7216 prop
= test
.str_props
[Uri_PROPERTY_DOMAIN
];
7217 hr
= IUri_GetDomain(uri
, &received
);
7220 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7221 hr
, prop
.expected
, i
);
7224 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7225 prop
.value
, wine_dbgstr_w(received
), i
);
7228 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7229 hr
, prop
.expected
, i
);
7230 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7231 prop
.value
, wine_dbgstr_w(received
), i
);
7233 SysFreeString(received
);
7236 /* GetExtension() tests. */
7237 prop
= test
.str_props
[Uri_PROPERTY_EXTENSION
];
7238 hr
= IUri_GetExtension(uri
, &received
);
7241 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7242 hr
, prop
.expected
, i
);
7245 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7246 prop
.value
, wine_dbgstr_w(received
), i
);
7249 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7250 hr
, prop
.expected
, i
);
7251 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7252 prop
.value
, wine_dbgstr_w(received
), i
);
7254 SysFreeString(received
);
7257 /* GetFragment() tests. */
7258 prop
= test
.str_props
[Uri_PROPERTY_FRAGMENT
];
7259 hr
= IUri_GetFragment(uri
, &received
);
7262 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7263 hr
, prop
.expected
, i
);
7266 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7267 prop
.value
, wine_dbgstr_w(received
), i
);
7270 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7271 hr
, prop
.expected
, i
);
7272 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7273 prop
.value
, wine_dbgstr_w(received
), i
);
7275 SysFreeString(received
);
7278 /* GetHost() tests. */
7279 prop
= test
.str_props
[Uri_PROPERTY_HOST
];
7280 hr
= IUri_GetHost(uri
, &received
);
7283 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7284 hr
, prop
.expected
, i
);
7287 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7288 prop
.value
, wine_dbgstr_w(received
), i
);
7291 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7292 hr
, prop
.expected
, i
);
7293 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7294 prop
.value
, wine_dbgstr_w(received
), i
);
7296 SysFreeString(received
);
7299 /* GetPassword() tests. */
7300 prop
= test
.str_props
[Uri_PROPERTY_PASSWORD
];
7301 hr
= IUri_GetPassword(uri
, &received
);
7304 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7305 hr
, prop
.expected
, i
);
7308 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7309 prop
.value
, wine_dbgstr_w(received
), i
);
7312 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7313 hr
, prop
.expected
, i
);
7314 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7315 prop
.value
, wine_dbgstr_w(received
), i
);
7317 SysFreeString(received
);
7320 /* GetPath() tests. */
7321 prop
= test
.str_props
[Uri_PROPERTY_PATH
];
7322 hr
= IUri_GetPath(uri
, &received
);
7325 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7326 hr
, prop
.expected
, i
);
7329 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7330 prop
.value
, wine_dbgstr_w(received
), i
);
7333 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7334 hr
, prop
.expected
, i
);
7335 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7336 prop
.value
, wine_dbgstr_w(received
), i
);
7338 SysFreeString(received
);
7341 /* GetPathAndQuery() tests. */
7342 prop
= test
.str_props
[Uri_PROPERTY_PATH_AND_QUERY
];
7343 hr
= IUri_GetPathAndQuery(uri
, &received
);
7346 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7347 hr
, prop
.expected
, i
);
7350 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7351 prop
.value
, wine_dbgstr_w(received
), i
);
7354 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7355 hr
, prop
.expected
, i
);
7356 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7357 prop
.value
, wine_dbgstr_w(received
), i
);
7359 SysFreeString(received
);
7362 /* GetQuery() tests. */
7363 prop
= test
.str_props
[Uri_PROPERTY_QUERY
];
7364 hr
= IUri_GetQuery(uri
, &received
);
7367 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7368 hr
, prop
.expected
, i
);
7371 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7372 prop
.value
, wine_dbgstr_w(received
), i
);
7375 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7376 hr
, prop
.expected
, i
);
7377 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7378 prop
.value
, wine_dbgstr_w(received
), i
);
7380 SysFreeString(received
);
7383 /* GetRawUri() tests. */
7384 prop
= test
.str_props
[Uri_PROPERTY_RAW_URI
];
7385 hr
= IUri_GetRawUri(uri
, &received
);
7388 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7389 hr
, prop
.expected
, i
);
7392 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7393 prop
.value
, wine_dbgstr_w(received
), i
);
7396 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7397 hr
, prop
.expected
, i
);
7398 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7399 prop
.value
, wine_dbgstr_w(received
), i
);
7401 SysFreeString(received
);
7404 /* GetSchemeName() tests. */
7405 prop
= test
.str_props
[Uri_PROPERTY_SCHEME_NAME
];
7406 hr
= IUri_GetSchemeName(uri
, &received
);
7409 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7410 hr
, prop
.expected
, i
);
7413 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7414 prop
.value
, wine_dbgstr_w(received
), i
);
7417 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7418 hr
, prop
.expected
, i
);
7419 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7420 prop
.value
, wine_dbgstr_w(received
), i
);
7422 SysFreeString(received
);
7425 /* GetUserInfo() tests. */
7426 prop
= test
.str_props
[Uri_PROPERTY_USER_INFO
];
7427 hr
= IUri_GetUserInfo(uri
, &received
);
7430 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7431 hr
, prop
.expected
, i
);
7434 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7435 prop
.value
, wine_dbgstr_w(received
), i
);
7438 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7439 hr
, prop
.expected
, i
);
7440 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7441 prop
.value
, wine_dbgstr_w(received
), i
);
7443 SysFreeString(received
);
7446 /* GetUserName() tests. */
7447 prop
= test
.str_props
[Uri_PROPERTY_USER_NAME
];
7448 hr
= IUri_GetUserName(uri
, &received
);
7451 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7452 hr
, prop
.expected
, i
);
7455 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7456 prop
.value
, wine_dbgstr_w(received
), i
);
7459 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7460 hr
, prop
.expected
, i
);
7461 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7462 prop
.value
, wine_dbgstr_w(received
), i
);
7464 SysFreeString(received
);
7467 if(uri
) IUri_Release(uri
);
7473 static void test_IUri_GetDwordProperties(void) {
7478 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7479 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7480 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7482 hr
= IUri_GetHostType(uri
, NULL
);
7483 ok(hr
== E_INVALIDARG
, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7485 hr
= IUri_GetPort(uri
, NULL
);
7486 ok(hr
== E_INVALIDARG
, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7488 hr
= IUri_GetScheme(uri
, NULL
);
7489 ok(hr
== E_INVALIDARG
, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7491 hr
= IUri_GetZone(uri
, NULL
);
7492 ok(hr
== E_INVALIDARG
, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7494 if(uri
) IUri_Release(uri
);
7496 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7497 uri_properties test
= uri_tests
[i
];
7501 uriW
= a2w(test
.uri
);
7502 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7503 if(test
.create_todo
) {
7505 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7506 hr
, test
.create_expected
, i
);
7509 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7510 hr
, test
.create_expected
, i
);
7514 uri_dword_property prop
;
7517 /* Assign an insane value so tests don't accidentally pass when
7520 received
= -9999999;
7522 /* GetHostType() tests. */
7523 prop
= test
.dword_props
[Uri_PROPERTY_HOST_TYPE
-Uri_PROPERTY_DWORD_START
];
7524 hr
= IUri_GetHostType(uri
, &received
);
7527 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7528 hr
, prop
.expected
, i
);
7531 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7534 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7535 hr
, prop
.expected
, i
);
7536 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7538 received
= -9999999;
7540 /* GetPort() tests. */
7541 prop
= test
.dword_props
[Uri_PROPERTY_PORT
-Uri_PROPERTY_DWORD_START
];
7542 hr
= IUri_GetPort(uri
, &received
);
7545 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7546 hr
, prop
.expected
, i
);
7549 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7552 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7553 hr
, prop
.expected
, i
);
7554 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7556 received
= -9999999;
7558 /* GetScheme() tests. */
7559 prop
= test
.dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
];
7560 hr
= IUri_GetScheme(uri
, &received
);
7563 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7564 hr
, prop
.expected
, i
);
7567 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7570 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7571 hr
, prop
.expected
, i
);
7572 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7574 received
= -9999999;
7576 /* GetZone() tests. */
7577 prop
= test
.dword_props
[Uri_PROPERTY_ZONE
-Uri_PROPERTY_DWORD_START
];
7578 hr
= IUri_GetZone(uri
, &received
);
7581 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7582 hr
, prop
.expected
, i
);
7585 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7588 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7589 hr
, prop
.expected
, i
);
7590 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7594 if(uri
) IUri_Release(uri
);
7600 static void test_IUri_GetPropertyLength(void) {
7605 /* Make sure it handles invalid args correctly. */
7606 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7607 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7609 DWORD received
= 0xdeadbeef;
7611 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_STRING_START
, NULL
, 0);
7612 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7614 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_DWORD_START
, &received
, 0);
7615 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7616 ok(received
== 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received
);
7618 if(uri
) IUri_Release(uri
);
7620 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7621 uri_properties test
= uri_tests
[i
];
7625 uriW
= a2w(test
.uri
);
7626 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7627 if(test
.create_todo
) {
7629 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7630 hr
, test
.create_expected
, i
);
7633 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7634 hr
, test
.create_expected
, i
);
7640 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7641 DWORD expectedLen
, brokenLen
, receivedLen
;
7642 uri_str_property prop
= test
.str_props
[j
];
7644 expectedLen
= lstrlen(prop
.value
);
7645 brokenLen
= lstrlen(prop
.broken_value
);
7647 /* This won't be necessary once GetPropertyLength is implemented. */
7650 hr
= IUri_GetPropertyLength(uri
, j
, &receivedLen
, 0);
7653 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7654 hr
, prop
.expected
, i
, j
);
7657 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7658 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7659 expectedLen
, receivedLen
, i
, j
);
7662 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7663 hr
, prop
.expected
, i
, j
);
7664 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7665 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7666 expectedLen
, receivedLen
, i
, j
);
7671 if(uri
) IUri_Release(uri
);
7677 static DWORD
compute_expected_props(uri_properties
*test
)
7681 for(i
=Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_STRING_LAST
; i
++) {
7682 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
== S_OK
)
7686 for(i
=Uri_PROPERTY_DWORD_START
; i
<= Uri_PROPERTY_DWORD_LAST
; i
++) {
7687 if(test
->dword_props
[i
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
7694 static void test_IUri_GetProperties(void) {
7699 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7700 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7702 hr
= IUri_GetProperties(uri
, NULL
);
7703 ok(hr
== E_INVALIDARG
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7705 if(uri
) IUri_Release(uri
);
7707 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7708 uri_properties test
= uri_tests
[i
];
7712 uriW
= a2w(test
.uri
);
7713 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7714 if(test
.create_todo
) {
7716 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7719 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7723 DWORD received
= 0, expected_props
;
7726 hr
= IUri_GetProperties(uri
, &received
);
7727 ok(hr
== S_OK
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7729 expected_props
= compute_expected_props(&test
);
7731 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7732 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7733 if(expected_props
& (1 << j
))
7734 ok(received
& (1 << j
), "Error: Expected flag for property %d on uri_tests[%d].\n", j
, i
);
7736 ok(!(received
& (1 << j
)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j
, i
);
7740 if(uri
) IUri_Release(uri
);
7746 static void test_IUri_HasProperty(void) {
7751 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7752 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7754 hr
= IUri_HasProperty(uri
, Uri_PROPERTY_RAW_URI
, NULL
);
7755 ok(hr
== E_INVALIDARG
, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7757 if(uri
) IUri_Release(uri
);
7759 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7760 uri_properties test
= uri_tests
[i
];
7764 uriW
= a2w(test
.uri
);
7766 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7767 if(test
.create_todo
) {
7769 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7772 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7776 DWORD expected_props
, j
;
7778 expected_props
= compute_expected_props(&test
);
7780 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7781 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7784 hr
= IUri_HasProperty(uri
, j
, &received
);
7785 ok(hr
== S_OK
, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7788 if(expected_props
& (1 << j
)) {
7789 ok(received
== TRUE
, "Error: Expected to have property %d on uri_tests[%d].\n", j
, i
);
7791 ok(received
== FALSE
, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j
, i
);
7796 if(uri
) IUri_Release(uri
);
7802 static void test_IUri_IsEqual(void) {
7810 /* Make sure IsEqual handles invalid args correctly. */
7811 hres
= pCreateUri(http_urlW
, 0, 0, &uriA
);
7812 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7813 hres
= pCreateUri(http_urlW
, 0, 0, &uriB
);
7814 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7817 hres
= IUri_IsEqual(uriA
, NULL
, &equal
);
7818 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7819 ok(!equal
, "Error: Expected equal to be FALSE, but was %d instead.\n", equal
);
7821 hres
= IUri_IsEqual(uriA
, uriB
, NULL
);
7822 ok(hres
== E_POINTER
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, E_POINTER
);
7827 for(i
= 0; i
< sizeof(equality_tests
)/sizeof(equality_tests
[0]); ++i
) {
7828 uri_equality test
= equality_tests
[i
];
7829 LPWSTR uriA_W
, uriB_W
;
7833 uriA_W
= a2w(test
.a
);
7834 uriB_W
= a2w(test
.b
);
7836 hres
= pCreateUri(uriA_W
, test
.create_flags_a
, 0, &uriA
);
7837 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres
, S_OK
, i
);
7839 hres
= pCreateUri(uriB_W
, test
.create_flags_b
, 0, &uriB
);
7840 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres
, S_OK
, i
);
7843 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
7844 if(test
.todo
) todo_wine
{
7845 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7846 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7848 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7849 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7851 if(uriA
) IUri_Release(uriA
);
7852 if(uriB
) IUri_Release(uriB
);
7859 static void test_CreateUriWithFragment_InvalidArgs(void) {
7861 IUri
*uri
= (void*) 0xdeadbeef;
7862 const WCHAR fragmentW
[] = {'#','f','r','a','g','m','e','n','t',0};
7864 hr
= pCreateUriWithFragment(NULL
, fragmentW
, 0, 0, &uri
);
7865 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7866 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7868 hr
= pCreateUriWithFragment(http_urlW
, fragmentW
, 0, 0, NULL
);
7869 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7871 /* Original URI can't already contain a fragment component. */
7872 uri
= (void*) 0xdeadbeef;
7873 hr
= pCreateUriWithFragment(http_url_fragW
, fragmentW
, 0, 0, &uri
);
7874 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7875 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7878 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
7879 static void test_CreateUriWithFragment_InvalidFlags(void) {
7882 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
7884 IUri
*uri
= (void*) 0xdeadbeef;
7886 hr
= pCreateUriWithFragment(http_urlW
, NULL
, invalid_flag_tests
[i
].flags
, 0, &uri
);
7887 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
7888 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
7889 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7893 static void test_CreateUriWithFragment(void) {
7896 for(i
= 0; i
< sizeof(uri_fragment_tests
)/sizeof(uri_fragment_tests
[0]); ++i
) {
7900 uri_with_fragment test
= uri_fragment_tests
[i
];
7902 uriW
= a2w(test
.uri
);
7903 fragW
= a2w(test
.fragment
);
7905 hr
= pCreateUriWithFragment(uriW
, fragW
, test
.create_flags
, 0, &uri
);
7906 if(test
.expected_todo
) {
7908 ok(hr
== test
.create_expected
,
7909 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7910 hr
, test
.create_expected
, i
);
7913 ok(hr
== test
.create_expected
,
7914 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7915 hr
, test
.create_expected
, i
);
7918 BSTR received
= NULL
;
7920 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7921 if(test
.expected_todo
) {
7924 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7928 ok(!strcmp_aw(test
.expected_uri
, received
),
7929 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7930 test
.expected_uri
, wine_dbgstr_w(received
), i
);
7933 ok(hr
== S_OK
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
7935 ok(!strcmp_aw(test
.expected_uri
, received
), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
7936 test
.expected_uri
, wine_dbgstr_w(received
), i
);
7939 SysFreeString(received
);
7942 if(uri
) IUri_Release(uri
);
7948 static void test_CreateIUriBuilder(void) {
7950 IUriBuilder
*builder
= NULL
;
7953 hr
= pCreateIUriBuilder(NULL
, 0, 0, NULL
);
7954 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
7957 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
7958 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7959 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7961 ULONG cur_count
, orig_count
;
7963 orig_count
= get_refcnt(uri
);
7964 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
7965 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7966 ok(builder
!= NULL
, "Error: Expecting builder not to be NULL\n");
7968 cur_count
= get_refcnt(uri
);
7969 ok(cur_count
== orig_count
+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
+1, cur_count
);
7971 if(builder
) IUriBuilder_Release(builder
);
7972 cur_count
= get_refcnt(uri
);
7973 ok(cur_count
== orig_count
, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
, cur_count
);
7975 if(uri
) IUri_Release(uri
);
7978 static void test_IUriBuilder_CreateUri(IUriBuilder
*builder
, const uri_builder_test
*test
,
7983 hr
= IUriBuilder_CreateUri(builder
, test
->uri_flags
, 0, 0, &uri
);
7984 if(test
->uri_todo
) {
7986 ok(hr
== test
->uri_hres
,
7987 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7988 hr
, test
->uri_hres
, test_index
);
7991 ok(hr
== test
->uri_hres
,
7992 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
7993 hr
, test
->uri_hres
, test_index
);
7999 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8000 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8001 BSTR received
= NULL
;
8003 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8006 ok(hr
== prop
.result
,
8007 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8008 hr
, prop
.result
, test_index
, i
);
8011 ok(hr
== prop
.result
,
8012 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8013 hr
, prop
.result
, test_index
, i
);
8018 ok(!strcmp_aw(prop
.expected
, received
),
8019 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8020 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8023 ok(!strcmp_aw(prop
.expected
, received
),
8024 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8025 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8028 SysFreeString(received
);
8031 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8032 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8033 DWORD received
= -2;
8035 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8038 ok(hr
== prop
.result
,
8039 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8040 hr
, prop
.result
, test_index
, i
);
8043 ok(hr
== prop
.result
,
8044 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8045 hr
, prop
.result
, test_index
, i
);
8050 ok(received
== prop
.expected
,
8051 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8052 prop
.expected
, received
, test_index
, i
);
8055 ok(received
== prop
.expected
,
8056 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8057 prop
.expected
, received
, test_index
, i
);
8062 if(uri
) IUri_Release(uri
);
8065 static void test_IUriBuilder_CreateUriSimple(IUriBuilder
*builder
, const uri_builder_test
*test
,
8070 hr
= IUriBuilder_CreateUriSimple(builder
, test
->uri_simple_encode_flags
, 0, &uri
);
8071 if(test
->uri_simple_todo
) {
8073 ok(hr
== test
->uri_simple_hres
,
8074 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8075 hr
, test
->uri_simple_hres
, test_index
);
8078 ok(hr
== test
->uri_simple_hres
,
8079 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8080 hr
, test
->uri_simple_hres
, test_index
);
8086 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8087 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8088 BSTR received
= NULL
;
8090 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8093 ok(hr
== prop
.result
,
8094 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8095 hr
, prop
.result
, test_index
, i
);
8098 ok(hr
== prop
.result
,
8099 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8100 hr
, prop
.result
, test_index
, i
);
8105 ok(!strcmp_aw(prop
.expected
, received
),
8106 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8107 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8110 ok(!strcmp_aw(prop
.expected
, received
),
8111 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8112 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8115 SysFreeString(received
);
8118 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8119 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8120 DWORD received
= -2;
8122 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8125 ok(hr
== prop
.result
,
8126 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8127 hr
, prop
.result
, test_index
, i
);
8130 ok(hr
== prop
.result
,
8131 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8132 hr
, prop
.result
, test_index
, i
);
8137 ok(received
== prop
.expected
,
8138 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8139 prop
.expected
, received
, test_index
, i
);
8142 ok(received
== prop
.expected
,
8143 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8144 prop
.expected
, received
, test_index
, i
);
8149 if(uri
) IUri_Release(uri
);
8152 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder
*builder
, const uri_builder_test
*test
,
8157 hr
= IUriBuilder_CreateUriWithFlags(builder
, test
->uri_with_flags
, test
->uri_with_builder_flags
,
8158 test
->uri_with_encode_flags
, 0, &uri
);
8159 if(test
->uri_with_todo
) {
8161 ok(hr
== test
->uri_with_hres
,
8162 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8163 hr
, test
->uri_with_hres
, test_index
);
8166 ok(hr
== test
->uri_with_hres
,
8167 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8168 hr
, test
->uri_with_hres
, test_index
);
8174 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8175 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8176 BSTR received
= NULL
;
8178 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8181 ok(hr
== prop
.result
,
8182 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8183 hr
, prop
.result
, test_index
, i
);
8186 ok(hr
== prop
.result
,
8187 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8188 hr
, prop
.result
, test_index
, i
);
8193 ok(!strcmp_aw(prop
.expected
, received
),
8194 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8195 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8198 ok(!strcmp_aw(prop
.expected
, received
),
8199 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8200 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8203 SysFreeString(received
);
8206 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8207 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8208 DWORD received
= -2;
8210 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8213 ok(hr
== prop
.result
,
8214 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8215 hr
, prop
.result
, test_index
, i
);
8218 ok(hr
== prop
.result
,
8219 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8220 hr
, prop
.result
, test_index
, i
);
8225 ok(received
== prop
.expected
,
8226 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8227 prop
.expected
, received
, test_index
, i
);
8230 ok(received
== prop
.expected
,
8231 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8232 prop
.expected
, received
, test_index
, i
);
8237 if(uri
) IUri_Release(uri
);
8240 static void test_IUriBuilder_CreateInvalidArgs(void) {
8241 IUriBuilder
*builder
;
8244 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8245 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8247 IUri
*test
= NULL
, *uri
= (void*) 0xdeadbeef;
8249 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8250 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, NULL
);
8251 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8253 uri
= (void*) 0xdeadbeef;
8254 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8255 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_NOTIMPL
);
8256 ok(uri
== NULL
, "Error: expected uri to be NULL, but was %p instead.\n", uri
);
8258 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, NULL
);
8259 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8262 uri
= (void*) 0xdeadbeef;
8263 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8264 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8266 ok(!uri
, "Error: Expected uri to NULL, but was %p instead.\n", uri
);
8268 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, NULL
);
8269 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8272 uri
= (void*) 0xdeadbeef;
8273 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8274 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8276 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8278 hr
= pCreateUri(http_urlW
, 0, 0, &test
);
8279 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8281 hr
= IUriBuilder_SetIUri(builder
, test
);
8282 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8284 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8286 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8287 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8288 ok(uri
!= NULL
, "Error: The uri was NULL.\n");
8289 if(uri
) IUri_Release(uri
);
8292 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8293 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8295 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8296 if(uri
) IUri_Release(uri
);
8299 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &uri
);
8300 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8302 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8303 if(uri
) IUri_Release(uri
);
8305 hr
= IUriBuilder_SetFragment(builder
, NULL
);
8306 ok(hr
== S_OK
, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8308 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8309 uri
= (void*) 0xdeadbeef;
8310 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8311 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8312 ok(!uri
, "Error: Expected uri to be NULL but was %p instead.\n", uri
);
8314 uri
= (void*) 0xdeadbeef;
8315 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8316 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8318 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8320 uri
= (void*) 0xdeadbeef;
8321 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8322 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8324 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8326 if(test
) IUri_Release(test
);
8328 if(builder
) IUriBuilder_Release(builder
);
8331 /* Tests invalid args to the "Get*" functions. */
8332 static void test_IUriBuilder_GetInvalidArgs(void) {
8333 IUriBuilder
*builder
= NULL
;
8336 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8337 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8339 LPCWSTR received
= (void*) 0xdeadbeef;
8340 DWORD len
= -1, port
= -1;
8343 hr
= IUriBuilder_GetFragment(builder
, NULL
, NULL
);
8344 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8346 hr
= IUriBuilder_GetFragment(builder
, NULL
, &received
);
8347 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8349 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8350 hr
= IUriBuilder_GetFragment(builder
, &len
, NULL
);
8351 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8353 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8355 hr
= IUriBuilder_GetHost(builder
, NULL
, NULL
);
8356 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8358 received
= (void*) 0xdeadbeef;
8359 hr
= IUriBuilder_GetHost(builder
, NULL
, &received
);
8360 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8362 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8364 hr
= IUriBuilder_GetHost(builder
, &len
, NULL
);
8365 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8367 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8369 hr
= IUriBuilder_GetPassword(builder
, NULL
, NULL
);
8370 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8372 received
= (void*) 0xdeadbeef;
8373 hr
= IUriBuilder_GetPassword(builder
, NULL
, &received
);
8374 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8376 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8378 hr
= IUriBuilder_GetPassword(builder
, &len
, NULL
);
8379 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8381 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8383 hr
= IUriBuilder_GetPath(builder
, NULL
, NULL
);
8384 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8386 received
= (void*) 0xdeadbeef;
8387 hr
= IUriBuilder_GetPath(builder
, NULL
, &received
);
8388 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8390 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8392 hr
= IUriBuilder_GetPath(builder
, &len
, NULL
);
8393 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8395 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8397 hr
= IUriBuilder_GetPort(builder
, NULL
, NULL
);
8398 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8400 hr
= IUriBuilder_GetPort(builder
, NULL
, &port
);
8401 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8403 ok(!port
, "Error: Expected port to be 0, but was %d instead.\n", port
);
8404 hr
= IUriBuilder_GetPort(builder
, &set
, NULL
);
8405 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8407 ok(!set
, "Error: Expected set to be FALSE, but was %d instead.\n", set
);
8409 hr
= IUriBuilder_GetQuery(builder
, NULL
, NULL
);
8410 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8412 received
= (void*) 0xdeadbeef;
8413 hr
= IUriBuilder_GetQuery(builder
, NULL
, &received
);
8414 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8416 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8418 hr
= IUriBuilder_GetQuery(builder
, &len
, NULL
);
8419 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8421 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8423 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, NULL
);
8424 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8426 received
= (void*) 0xdeadbeef;
8427 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, &received
);
8428 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8430 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8432 hr
= IUriBuilder_GetSchemeName(builder
, &len
, NULL
);
8433 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8435 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8437 hr
= IUriBuilder_GetUserName(builder
, NULL
, NULL
);
8438 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8440 received
= (void*) 0xdeadbeef;
8441 hr
= IUriBuilder_GetUserName(builder
, NULL
, &received
);
8442 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8444 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8446 hr
= IUriBuilder_GetUserName(builder
, &len
, NULL
);
8447 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8449 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8451 if(builder
) IUriBuilder_Release(builder
);
8454 static void test_IUriBuilder_GetFragment(IUriBuilder
*builder
, const uri_builder_test
*test
,
8458 LPCWSTR received
= NULL
;
8460 const uri_builder_property
*prop
= NULL
;
8462 /* Check if the property was set earlier. */
8463 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8464 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_FRAGMENT
)
8465 prop
= &(test
->properties
[i
]);
8469 /* Use expected_value unless it's NULL, then use value. */
8470 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8471 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8474 ok(hr
== (expected
? S_OK
: S_FALSE
),
8475 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8476 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8480 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8481 expected
, wine_dbgstr_w(received
), test_index
);
8484 ok(lstrlen(expected
) == len
,
8485 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8486 lstrlen(expected
), len
, test_index
);
8490 ok(hr
== (expected
? S_OK
: S_FALSE
),
8491 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8492 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8493 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8494 expected
, wine_dbgstr_w(received
), test_index
);
8495 ok(lstrlen(expected
) == len
,
8496 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8497 lstrlen(expected
), len
, test_index
);
8500 /* The property wasn't set earlier, so it should return whatever
8501 * the base IUri contains (if anything).
8504 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8506 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8507 hr
, S_OK
, test_index
);
8510 received
= (void*) 0xdeadbeef;
8513 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8515 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8516 hr
, S_FALSE
, test_index
);
8518 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8520 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8521 received
, test_index
);
8524 BOOL has_prop
= FALSE
;
8525 BSTR expected
= NULL
;
8527 hr
= IUri_GetFragment(uri
, &expected
);
8529 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8531 has_prop
= hr
== S_OK
;
8533 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8536 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8537 hr
, S_OK
, test_index
);
8539 ok(!lstrcmpW(expected
, received
),
8540 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8541 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8542 ok(lstrlenW(expected
) == len
,
8543 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8544 lstrlenW(expected
), len
, test_index
);
8548 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8549 hr
, S_FALSE
, test_index
);
8551 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8552 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8556 SysFreeString(expected
);
8559 if(uri
) IUri_Release(uri
);
8563 static void test_IUriBuilder_GetHost(IUriBuilder
*builder
, const uri_builder_test
*test
,
8567 LPCWSTR received
= NULL
;
8569 const uri_builder_property
*prop
= NULL
;
8571 /* Check if the property was set earlier. */
8572 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8573 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_HOST
)
8574 prop
= &(test
->properties
[i
]);
8578 /* Use expected_value unless it's NULL, then use value. */
8579 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8580 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8583 ok(hr
== (expected
? S_OK
: S_FALSE
),
8584 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8585 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8589 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8590 expected
, wine_dbgstr_w(received
), test_index
);
8593 ok(lstrlen(expected
) == len
,
8594 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8595 lstrlen(expected
), len
, test_index
);
8599 ok(hr
== (expected
? S_OK
: S_FALSE
),
8600 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8601 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8602 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8603 expected
, wine_dbgstr_w(received
), test_index
);
8604 ok(lstrlen(expected
) == len
,
8605 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8606 lstrlen(expected
), len
, test_index
);
8609 /* The property wasn't set earlier, so it should return whatever
8610 * the base IUri contains (if anything).
8613 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8615 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8616 hr
, S_OK
, test_index
);
8619 received
= (void*) 0xdeadbeef;
8622 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8624 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8625 hr
, S_FALSE
, test_index
);
8627 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8629 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8630 received
, test_index
);
8633 BOOL has_prop
= FALSE
;
8634 BSTR expected
= NULL
;
8636 hr
= IUri_GetHost(uri
, &expected
);
8638 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8640 has_prop
= hr
== S_OK
;
8642 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8645 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8646 hr
, S_OK
, test_index
);
8648 ok(!lstrcmpW(expected
, received
),
8649 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8650 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8651 ok(lstrlenW(expected
) == len
,
8652 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8653 lstrlenW(expected
), len
, test_index
);
8657 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8658 hr
, S_FALSE
, test_index
);
8660 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8661 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8665 SysFreeString(expected
);
8668 if(uri
) IUri_Release(uri
);
8672 static void test_IUriBuilder_GetPassword(IUriBuilder
*builder
, const uri_builder_test
*test
,
8676 LPCWSTR received
= NULL
;
8678 const uri_builder_property
*prop
= NULL
;
8680 /* Check if the property was set earlier. */
8681 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8682 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PASSWORD
)
8683 prop
= &(test
->properties
[i
]);
8687 /* Use expected_value unless it's NULL, then use value. */
8688 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8689 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8692 ok(hr
== (expected
? S_OK
: S_FALSE
),
8693 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8694 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8698 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8699 expected
, wine_dbgstr_w(received
), test_index
);
8702 ok(lstrlen(expected
) == len
,
8703 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8704 lstrlen(expected
), len
, test_index
);
8708 ok(hr
== (expected
? S_OK
: S_FALSE
),
8709 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8710 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8711 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8712 expected
, wine_dbgstr_w(received
), test_index
);
8713 ok(lstrlen(expected
) == len
,
8714 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8715 lstrlen(expected
), len
, test_index
);
8718 /* The property wasn't set earlier, so it should return whatever
8719 * the base IUri contains (if anything).
8722 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8724 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8725 hr
, S_OK
, test_index
);
8728 received
= (void*) 0xdeadbeef;
8731 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8733 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8734 hr
, S_FALSE
, test_index
);
8736 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8738 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8739 received
, test_index
);
8742 BOOL has_prop
= FALSE
;
8743 BSTR expected
= NULL
;
8745 hr
= IUri_GetPassword(uri
, &expected
);
8747 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8749 has_prop
= hr
== S_OK
;
8751 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8754 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8755 hr
, S_OK
, test_index
);
8757 ok(!lstrcmpW(expected
, received
),
8758 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8759 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8760 ok(lstrlenW(expected
) == len
,
8761 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8762 lstrlenW(expected
), len
, test_index
);
8766 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8767 hr
, S_FALSE
, test_index
);
8769 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8770 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8774 SysFreeString(expected
);
8777 if(uri
) IUri_Release(uri
);
8781 static void test_IUriBuilder_GetPath(IUriBuilder
*builder
, const uri_builder_test
*test
,
8785 LPCWSTR received
= NULL
;
8787 const uri_builder_property
*prop
= NULL
;
8789 /* Check if the property was set earlier. */
8790 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8791 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PATH
)
8792 prop
= &(test
->properties
[i
]);
8796 /* Use expected_value unless it's NULL, then use value. */
8797 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8798 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8801 ok(hr
== (expected
? S_OK
: S_FALSE
),
8802 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8803 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8807 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8808 expected
, wine_dbgstr_w(received
), test_index
);
8811 ok(lstrlen(expected
) == len
,
8812 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8813 lstrlen(expected
), len
, test_index
);
8817 ok(hr
== (expected
? S_OK
: S_FALSE
),
8818 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8819 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8820 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8821 expected
, wine_dbgstr_w(received
), test_index
);
8822 ok(lstrlen(expected
) == len
,
8823 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8824 lstrlen(expected
), len
, test_index
);
8827 /* The property wasn't set earlier, so it should return whatever
8828 * the base IUri contains (if anything).
8831 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8833 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8834 hr
, S_OK
, test_index
);
8837 received
= (void*) 0xdeadbeef;
8840 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8842 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8843 hr
, S_FALSE
, test_index
);
8845 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8847 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8848 received
, test_index
);
8851 BOOL has_prop
= FALSE
;
8852 BSTR expected
= NULL
;
8854 hr
= IUri_GetPath(uri
, &expected
);
8856 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8858 has_prop
= hr
== S_OK
;
8860 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8863 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8864 hr
, S_OK
, test_index
);
8866 ok(!lstrcmpW(expected
, received
),
8867 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8868 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8869 ok(lstrlenW(expected
) == len
,
8870 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8871 lstrlenW(expected
), len
, test_index
);
8875 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8876 hr
, S_FALSE
, test_index
);
8878 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8879 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8883 SysFreeString(expected
);
8886 if(uri
) IUri_Release(uri
);
8890 static void test_IUriBuilder_GetPort(IUriBuilder
*builder
, const uri_builder_test
*test
,
8893 BOOL has_port
= FALSE
;
8894 DWORD received
= -1;
8896 if(test
->port_prop
.change
) {
8897 DWORD expected
= test
->port_prop
.value
;
8899 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8900 if(test
->port_prop
.todo
) {
8903 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8904 hr
, S_OK
, test_index
);
8908 ok(has_port
== test
->port_prop
.set
,
8909 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
8910 test
->port_prop
.set
, has_port
, test_index
);
8913 ok(received
== expected
,
8914 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8915 expected
, received
, test_index
);
8920 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8921 hr
, S_OK
, test_index
);
8922 ok(has_port
== test
->port_prop
.set
,
8923 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8924 test
->port_prop
.set
, has_port
, test_index
);
8925 ok(received
== test
->port_prop
.value
,
8926 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
8927 test
->port_prop
.value
, received
, test_index
);
8932 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8934 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8935 hr
, S_OK
, test_index
);
8938 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8940 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8941 hr
, S_OK
, test_index
);
8943 ok(has_port
== FALSE
,
8944 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
8945 has_port
, test_index
);
8946 ok(!received
, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
8947 received
, test_index
);
8952 hr
= IUri_GetPort(uri
, &expected
);
8954 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8957 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
8959 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8960 hr
, S_OK
, test_index
);
8963 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
8965 ok(received
== expected
,
8966 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
8967 expected
, received
, test_index
);
8971 if(uri
) IUri_Release(uri
);
8975 static void test_IUriBuilder_GetQuery(IUriBuilder
*builder
, const uri_builder_test
*test
,
8979 LPCWSTR received
= NULL
;
8981 const uri_builder_property
*prop
= NULL
;
8983 /* Check if the property was set earlier. */
8984 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8985 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_QUERY
)
8986 prop
= &(test
->properties
[i
]);
8990 /* Use expected_value unless it's NULL, then use value. */
8991 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8992 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
8995 ok(hr
== (expected
? S_OK
: S_FALSE
),
8996 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8997 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9001 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9002 expected
, wine_dbgstr_w(received
), test_index
);
9005 ok(lstrlen(expected
) == len
,
9006 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9007 lstrlen(expected
), len
, test_index
);
9011 ok(hr
== (expected
? S_OK
: S_FALSE
),
9012 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9013 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9014 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9015 expected
, wine_dbgstr_w(received
), test_index
);
9016 ok(lstrlen(expected
) == len
,
9017 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9018 lstrlen(expected
), len
, test_index
);
9021 /* The property wasn't set earlier, so it should return whatever
9022 * the base IUri contains (if anything).
9025 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9027 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9028 hr
, S_OK
, test_index
);
9031 received
= (void*) 0xdeadbeef;
9034 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9036 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9037 hr
, S_FALSE
, test_index
);
9039 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9041 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9042 received
, test_index
);
9045 BOOL has_prop
= FALSE
;
9046 BSTR expected
= NULL
;
9048 hr
= IUri_GetQuery(uri
, &expected
);
9050 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9052 has_prop
= hr
== S_OK
;
9054 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9057 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9058 hr
, S_OK
, test_index
);
9060 ok(!lstrcmpW(expected
, received
),
9061 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9062 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9063 ok(lstrlenW(expected
) == len
,
9064 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9065 lstrlenW(expected
), len
, test_index
);
9069 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9070 hr
, S_FALSE
, test_index
);
9072 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9073 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9077 SysFreeString(expected
);
9080 if(uri
) IUri_Release(uri
);
9084 static void test_IUriBuilder_GetSchemeName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9088 LPCWSTR received
= NULL
;
9090 const uri_builder_property
*prop
= NULL
;
9092 /* Check if the property was set earlier. */
9093 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9094 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_SCHEME_NAME
)
9095 prop
= &(test
->properties
[i
]);
9099 /* Use expected_value unless it's NULL, then use value. */
9100 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9101 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9104 ok(hr
== (expected
? S_OK
: S_FALSE
),
9105 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9106 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9110 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9111 expected
, wine_dbgstr_w(received
), test_index
);
9114 ok(lstrlen(expected
) == len
,
9115 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9116 lstrlen(expected
), len
, test_index
);
9120 ok(hr
== (expected
? S_OK
: S_FALSE
),
9121 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9122 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9123 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9124 expected
, wine_dbgstr_w(received
), test_index
);
9125 ok(lstrlen(expected
) == len
,
9126 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9127 lstrlen(expected
), len
, test_index
);
9130 /* The property wasn't set earlier, so it should return whatever
9131 * the base IUri contains (if anything).
9134 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9136 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9137 hr
, S_OK
, test_index
);
9140 received
= (void*) 0xdeadbeef;
9143 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9145 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9146 hr
, S_FALSE
, test_index
);
9148 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9150 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9151 received
, test_index
);
9154 BOOL has_prop
= FALSE
;
9155 BSTR expected
= NULL
;
9157 hr
= IUri_GetSchemeName(uri
, &expected
);
9159 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9161 has_prop
= hr
== S_OK
;
9163 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9166 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9167 hr
, S_OK
, test_index
);
9169 ok(!lstrcmpW(expected
, received
),
9170 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9171 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9172 ok(lstrlenW(expected
) == len
,
9173 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9174 lstrlenW(expected
), len
, test_index
);
9178 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9179 hr
, S_FALSE
, test_index
);
9181 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9182 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9186 SysFreeString(expected
);
9189 if(uri
) IUri_Release(uri
);
9193 static void test_IUriBuilder_GetUserName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9197 LPCWSTR received
= NULL
;
9199 const uri_builder_property
*prop
= NULL
;
9201 /* Check if the property was set earlier. */
9202 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9203 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_USER_NAME
)
9204 prop
= &(test
->properties
[i
]);
9207 if(prop
&& prop
->value
&& *prop
->value
) {
9208 /* Use expected_value unless it's NULL, then use value. */
9209 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9210 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9213 ok(hr
== (expected
? S_OK
: S_FALSE
),
9214 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9215 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9219 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9220 expected
, wine_dbgstr_w(received
), test_index
);
9223 ok(lstrlen(expected
) == len
,
9224 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9225 lstrlen(expected
), len
, test_index
);
9229 ok(hr
== (expected
? S_OK
: S_FALSE
),
9230 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9231 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9232 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9233 expected
, wine_dbgstr_w(received
), test_index
);
9234 ok(lstrlen(expected
) == len
,
9235 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9236 lstrlen(expected
), len
, test_index
);
9239 /* The property wasn't set earlier, so it should return whatever
9240 * the base IUri contains (if anything).
9243 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9245 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9246 hr
, S_OK
, test_index
);
9249 received
= (void*) 0xdeadbeef;
9252 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9254 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9255 hr
, S_FALSE
, test_index
);
9257 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9259 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9260 received
, test_index
);
9263 BSTR expected
= NULL
;
9264 BOOL has_prop
= FALSE
;
9266 hr
= IUri_GetUserName(uri
, &expected
);
9268 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9270 has_prop
= hr
== S_OK
;
9272 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9275 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9276 hr
, S_OK
, test_index
);
9278 ok(!lstrcmpW(expected
, received
),
9279 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9280 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9281 ok(lstrlenW(expected
) == len
,
9282 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9283 lstrlenW(expected
), len
, test_index
);
9287 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9288 hr
, S_FALSE
, test_index
);
9290 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9291 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9295 SysFreeString(expected
);
9298 if(uri
) IUri_Release(uri
);
9302 /* Tests IUriBuilder functions. */
9303 static void test_IUriBuilder(void) {
9305 IUriBuilder
*builder
;
9308 for(i
= 0; i
< sizeof(uri_builder_tests
)/sizeof(uri_builder_tests
[0]); ++i
) {
9310 uri_builder_test test
= uri_builder_tests
[i
];
9314 uriW
= a2w(test
.uri
);
9315 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9316 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9318 if(FAILED(hr
)) continue;
9320 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9321 if(test
.create_builder_todo
) {
9323 ok(hr
== test
.create_builder_expected
,
9324 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9325 hr
, test
.create_builder_expected
, i
);
9328 ok(hr
== test
.create_builder_expected
,
9329 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9330 hr
, test
.create_builder_expected
, i
);
9334 BOOL modified
= FALSE
, received
= FALSE
;
9336 /* Perform all the string property changes. */
9337 for(j
= 0; j
< URI_BUILDER_STR_PROPERTY_COUNT
; ++j
) {
9338 uri_builder_property prop
= test
.properties
[j
];
9340 change_property(builder
, &prop
, i
);
9341 if(prop
.property
!= Uri_PROPERTY_SCHEME_NAME
&&
9342 prop
.property
!= Uri_PROPERTY_HOST
)
9344 else if(prop
.value
&& *prop
.value
)
9346 else if(prop
.value
&& !*prop
.value
&& prop
.property
== Uri_PROPERTY_HOST
)
9347 /* Host name property can't be NULL, but it can be empty. */
9352 if(test
.port_prop
.change
) {
9353 hr
= IUriBuilder_SetPort(builder
, test
.port_prop
.set
, test
.port_prop
.value
);
9355 if(test
.port_prop
.todo
) {
9357 ok(hr
== test
.port_prop
.expected
,
9358 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9359 hr
, test
.port_prop
.expected
, i
);
9362 ok(hr
== test
.port_prop
.expected
,
9363 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9364 hr
, test
.port_prop
.expected
, i
);
9368 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9370 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9373 ok(received
== modified
,
9374 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9375 modified
, received
, i
);
9377 /* Test the "Get*" functions. */
9378 test_IUriBuilder_GetFragment(builder
, &test
, i
);
9379 test_IUriBuilder_GetHost(builder
, &test
, i
);
9380 test_IUriBuilder_GetPassword(builder
, &test
, i
);
9381 test_IUriBuilder_GetPath(builder
, &test
, i
);
9382 test_IUriBuilder_GetPort(builder
, &test
, i
);
9383 test_IUriBuilder_GetQuery(builder
, &test
, i
);
9384 test_IUriBuilder_GetSchemeName(builder
, &test
, i
);
9385 test_IUriBuilder_GetUserName(builder
, &test
, i
);
9387 test_IUriBuilder_CreateUri(builder
, &test
, i
);
9388 test_IUriBuilder_CreateUriSimple(builder
, &test
, i
);
9389 test_IUriBuilder_CreateUriWithFlags(builder
, &test
, i
);
9391 if(builder
) IUriBuilder_Release(builder
);
9392 if(uri
) IUri_Release(uri
);
9397 static void test_IUriBuilder_HasBeenModified(void) {
9399 IUriBuilder
*builder
= NULL
;
9401 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9402 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9404 static const WCHAR hostW
[] = {'g','o','o','g','l','e','.','c','o','m',0};
9408 hr
= IUriBuilder_HasBeenModified(builder
, NULL
);
9409 ok(hr
== E_POINTER
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9412 hr
= IUriBuilder_SetHost(builder
, hostW
);
9413 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9416 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9417 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9420 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9422 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9423 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9428 hr
= IUriBuilder_SetIUri(builder
, uri
);
9429 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9432 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9433 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9436 ok(received
== FALSE
, "Error: Expected received to be FALSE.\n");
9438 /* Test what happens with you call SetIUri with the same IUri again. */
9439 hr
= IUriBuilder_SetHost(builder
, hostW
);
9440 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9442 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9443 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9446 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9448 hr
= IUriBuilder_SetIUri(builder
, uri
);
9449 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9451 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9452 * reset any of the changes that were made to the IUriBuilder.
9454 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9455 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9457 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9459 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9460 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9462 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9463 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9464 ok(len
== lstrlenW(hostW
), "Error: Expected len to be %d, but was %d instead.\n",
9465 lstrlenW(hostW
), len
);
9468 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9469 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9471 hr
= IUriBuilder_SetHost(builder
, hostW
);
9472 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9473 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9474 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9477 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9479 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9480 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr
, S_OK
);
9482 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9483 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9486 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9488 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9489 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9491 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9492 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9493 ok(len
== lstrlenW(hostW
), "Error: Expected len to %d, but was %d instead.\n",
9494 lstrlenW(hostW
), len
);
9497 if(uri
) IUri_Release(uri
);
9499 if(builder
) IUriBuilder_Release(builder
);
9502 /* Test IUriBuilder {Get,Set}IUri functions. */
9503 static void test_IUriBuilder_IUriProperty(void) {
9504 IUriBuilder
*builder
= NULL
;
9507 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9508 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9512 hr
= IUriBuilder_GetIUri(builder
, NULL
);
9513 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9516 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9519 ULONG cur_count
, orig_count
;
9521 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9522 orig_count
= get_refcnt(uri
);
9523 hr
= IUriBuilder_SetIUri(builder
, uri
);
9524 cur_count
= get_refcnt(uri
);
9526 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9527 orig_count
+1, cur_count
);
9529 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9530 cur_count
= get_refcnt(uri
);
9532 ok(cur_count
== orig_count
, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9533 orig_count
, cur_count
);
9535 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9536 hr
= IUriBuilder_SetIUri(builder
, uri
);
9537 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9538 orig_count
= get_refcnt(uri
);
9540 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, &test
);
9541 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9543 cur_count
= get_refcnt(uri
);
9544 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9545 orig_count
+1, cur_count
);
9546 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n",
9549 if(test
) IUri_Release(test
);
9552 hr
= IUriBuilder_CreateUri(builder
, -1, 0, 0, &test
);
9553 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9555 cur_count
= get_refcnt(uri
);
9556 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9557 orig_count
+1, cur_count
);
9558 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9560 if(test
) IUri_Release(test
);
9562 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9566 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, &test
);
9567 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9569 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9571 if(test
) IUri_Release(test
);
9573 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9574 * explicitly set (because it's a default flags).
9577 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, &test
);
9578 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9580 cur_count
= get_refcnt(uri
);
9581 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9582 orig_count
+1, cur_count
);
9583 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9585 if(test
) IUri_Release(test
);
9588 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, &test
);
9589 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9591 cur_count
= get_refcnt(uri
);
9592 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9593 orig_count
+1, cur_count
);
9594 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9596 if(test
) IUri_Release(test
);
9599 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &test
);
9600 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9603 cur_count
= get_refcnt(uri
);
9604 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9605 orig_count
+1, cur_count
);
9606 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9608 if(test
) IUri_Release(test
);
9610 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9614 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, 0, &test
);
9615 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9617 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9619 if(test
) IUri_Release(test
);
9621 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9622 * explicitly set (because it's a default flags).
9625 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, 0, &test
);
9626 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9628 cur_count
= get_refcnt(uri
);
9629 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9630 orig_count
+1, cur_count
);
9631 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9633 if(test
) IUri_Release(test
);
9635 if(uri
) IUri_Release(uri
);
9637 if(builder
) IUriBuilder_Release(builder
);
9640 static void test_IUriBuilder_RemoveProperties(void) {
9641 IUriBuilder
*builder
= NULL
;
9645 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9646 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9648 /* Properties that can't be removed. */
9649 const DWORD invalid
= Uri_HAS_ABSOLUTE_URI
|Uri_HAS_DISPLAY_URI
|Uri_HAS_RAW_URI
|Uri_HAS_HOST_TYPE
|
9650 Uri_HAS_SCHEME
|Uri_HAS_ZONE
;
9652 for(i
= Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_DWORD_LAST
; ++i
) {
9653 hr
= IUriBuilder_RemoveProperties(builder
, i
<< 1);
9654 if((i
<< 1) & invalid
) {
9655 ok(hr
== E_INVALIDARG
,
9656 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9657 hr
, E_INVALIDARG
, i
);
9660 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9665 /* Also doesn't accept anything that's outside the range of the
9668 hr
= IUriBuilder_RemoveProperties(builder
, (Uri_PROPERTY_DWORD_LAST
+1) << 1);
9669 ok(hr
== E_INVALIDARG
, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9672 if(builder
) IUriBuilder_Release(builder
);
9674 for(i
= 0; i
< sizeof(uri_builder_remove_tests
)/sizeof(uri_builder_remove_tests
[0]); ++i
) {
9675 uri_builder_remove_test test
= uri_builder_remove_tests
[i
];
9679 uriW
= a2w(test
.uri
);
9680 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9684 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9685 if(test
.create_builder_todo
) {
9687 ok(hr
== test
.create_builder_expected
,
9688 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9689 hr
, test
.create_builder_expected
, i
);
9692 ok(hr
== test
.create_builder_expected
,
9693 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9694 hr
, test
.create_builder_expected
, i
);
9697 hr
= IUriBuilder_RemoveProperties(builder
, test
.remove_properties
);
9698 if(test
.remove_todo
) {
9700 ok(hr
== test
.remove_expected
,
9701 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9702 hr
, test
.remove_expected
, i
);
9705 ok(hr
== test
.remove_expected
,
9706 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9707 hr
, test
.remove_expected
, i
);
9710 IUri
*result
= NULL
;
9712 hr
= IUriBuilder_CreateUri(builder
, test
.expected_flags
, 0, 0, &result
);
9713 if(test
.expected_todo
) {
9715 ok(hr
== test
.expected_hres
,
9716 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9717 hr
, test
.expected_hres
, i
);
9720 ok(hr
== test
.expected_hres
,
9721 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9722 hr
, test
.expected_hres
, i
);
9725 BSTR received
= NULL
;
9727 hr
= IUri_GetAbsoluteUri(result
, &received
);
9728 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
9729 ok(!strcmp_aw(test
.expected_uri
, received
),
9730 "Error: Expected %s but got %s instead on test %d.\n",
9731 test
.expected_uri
, wine_dbgstr_w(received
), i
);
9732 SysFreeString(received
);
9734 if(result
) IUri_Release(result
);
9737 if(builder
) IUriBuilder_Release(builder
);
9739 if(uri
) IUri_Release(uri
);
9744 static void test_IUriBuilder_Misc(void) {
9748 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9750 IUriBuilder
*builder
;
9752 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9753 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9758 hr
= IUriBuilder_GetPort(builder
, &has
, &port
);
9759 ok(hr
== S_OK
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9761 /* 'has' will be set to FALSE, even though uri had a port. */
9762 ok(has
== FALSE
, "Error: Expected 'has' to be FALSE, was %d instead.\n", has
);
9763 /* Still sets 'port' to 80. */
9764 ok(port
== 80, "Error: Expected the port to be 80, but, was %d instead.\n", port
);
9767 if(builder
) IUriBuilder_Release(builder
);
9769 if(uri
) IUri_Release(uri
);
9772 static void test_IUriBuilderFactory(void) {
9775 IUriBuilderFactory
*factory
;
9776 IUriBuilder
*builder
;
9778 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9779 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
9782 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&factory
);
9783 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x.\n", hr
);
9784 ok(factory
!= NULL
, "Error: Expected 'factory' to not be NULL.\n");
9787 builder
= (void*) 0xdeadbeef;
9788 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 10, 0, &builder
);
9789 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9791 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9793 builder
= (void*) 0xdeadbeef;
9794 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 10, &builder
);
9795 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9797 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9799 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, NULL
);
9800 ok(hr
== E_POINTER
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9804 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, &builder
);
9805 ok(hr
== S_OK
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9808 IUri
*tmp
= (void*) 0xdeadbeef;
9812 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9813 ok(hr
== S_OK
, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9815 ok(!tmp
, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp
);
9817 hr
= IUriBuilder_GetHost(builder
, &result_len
, &result
);
9818 ok(hr
== S_FALSE
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9821 if(builder
) IUriBuilder_Release(builder
);
9823 builder
= (void*) 0xdeadbeef;
9824 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 10, 0, &builder
);
9825 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9827 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9829 builder
= (void*) 0xdeadbeef;
9830 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 10, &builder
);
9831 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9833 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9835 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, NULL
);
9836 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9840 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, &builder
);
9841 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9846 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9847 ok(hr
== S_OK
, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9849 ok(tmp
== uri
, "Error: Expected tmp to be %p, but was %p.\n", uri
, tmp
);
9850 if(uri
) IUri_Release(uri
);
9852 if(builder
) IUriBuilder_Release(builder
);
9854 if(factory
) IUriBuilderFactory_Release(factory
);
9856 if(uri
) IUri_Release(uri
);
9859 static void test_CoInternetCombineIUri(void) {
9861 IUri
*base
, *relative
, *result
;
9865 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
9866 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
9868 result
= (void*) 0xdeadbeef;
9869 hr
= pCoInternetCombineIUri(base
, NULL
, 0, &result
, 0);
9870 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9871 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
9875 hr
= pCreateUri(http_urlW
, 0, 0, &relative
);
9876 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
9878 result
= (void*) 0xdeadbeef;
9879 hr
= pCoInternetCombineIUri(NULL
, relative
, 0, &result
, 0);
9880 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9881 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
9884 hr
= pCoInternetCombineIUri(base
, relative
, 0, NULL
, 0);
9885 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
9887 if(base
) IUri_Release(base
);
9888 if(relative
) IUri_Release(relative
);
9890 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
9891 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
9893 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
9894 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
9896 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
9898 hr
= pCreateUri(relativeW
, uri_combine_tests
[i
].relative_create_flags
, 0, &relative
);
9899 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
9903 hr
= pCoInternetCombineIUri(base
, relative
, uri_combine_tests
[i
].combine_flags
, &result
, 0);
9904 if(uri_combine_tests
[i
].todo
) {
9906 ok(hr
== uri_combine_tests
[i
].expected
,
9907 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9908 hr
, uri_combine_tests
[i
].expected
, i
);
9911 ok(hr
== uri_combine_tests
[i
].expected
,
9912 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
9913 hr
, uri_combine_tests
[i
]. expected
, i
);
9918 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
9919 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
9922 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
9925 ok(hr
== prop
.expected
,
9926 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9927 hr
, prop
.expected
, i
, j
);
9930 ok(!strcmp_aw(prop
.value
, received
) ||
9931 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
9932 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9933 prop
.value
, wine_dbgstr_w(received
), i
, j
);
9936 ok(hr
== prop
.expected
,
9937 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
9938 hr
, prop
.expected
, i
, j
);
9939 ok(!strcmp_aw(prop
.value
, received
) ||
9940 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
9941 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
9942 prop
.value
, wine_dbgstr_w(received
), i
, j
);
9944 SysFreeString(received
);
9947 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
9948 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
9951 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
9954 ok(hr
== prop
.expected
,
9955 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9956 hr
, prop
.expected
, i
, j
);
9959 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9960 prop
.value
, received
, i
, j
);
9963 ok(hr
== prop
.expected
,
9964 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
9965 hr
, prop
.expected
, i
, j
);
9966 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
9967 prop
.value
, received
, i
, j
);
9971 if(result
) IUri_Release(result
);
9973 if(relative
) IUri_Release(relative
);
9974 heap_free(relativeW
);
9976 if(base
) IUri_Release(base
);
9981 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
9982 REFIID riid
, void **ppv
)
9984 ok(0, "unexpected call\n");
9985 return E_NOINTERFACE
;
9988 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
9993 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
9998 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
9999 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
10000 DWORD
*pcchResult
, DWORD dwReserved
)
10002 CHECK_EXPECT(ParseUrl
);
10003 ok(!lstrcmpW(pwzUrl
, parse_urlW
), "Error: Expected %s, but got %s instead.\n",
10004 wine_dbgstr_w(parse_urlW
), wine_dbgstr_w(pwzUrl
));
10005 ok(ParseAction
== parse_action
, "Error: Expected %d, but got %d.\n", parse_action
, ParseAction
);
10006 ok(dwParseFlags
== parse_flags
, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags
, dwParseFlags
);
10007 ok(cchResult
== 200, "Error: Got %d.\n", cchResult
);
10009 memcpy(pwzResult
, parse_resultW
, sizeof(parse_resultW
));
10010 *pcchResult
= lstrlenW(parse_resultW
);
10015 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
10016 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
10017 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
10019 CHECK_EXPECT(CombineUrl
);
10020 ok(!lstrcmpW(pwzBaseUrl
, combine_baseW
), "Error: Expected %s, but got %s instead.\n",
10021 wine_dbgstr_w(combine_baseW
), wine_dbgstr_w(pwzBaseUrl
));
10022 ok(!lstrcmpW(pwzRelativeUrl
, combine_relativeW
), "Error: Expected %s, but got %s instead.\n",
10023 wine_dbgstr_w(combine_relativeW
), wine_dbgstr_w(pwzRelativeUrl
));
10024 ok(dwCombineFlags
== (URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
),
10025 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags
);
10026 ok(cchResult
== INTERNET_MAX_URL_LENGTH
+1, "Error: Got %d.\n", cchResult
);
10028 memcpy(pwzResult
, combine_resultW
, sizeof(combine_resultW
));
10029 *pcchResult
= lstrlenW(combine_resultW
);
10034 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
10035 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
10037 ok(0, "unexpected call\n");
10041 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
10042 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
10043 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
10045 ok(0, "unexpected call\n");
10049 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
10050 InternetProtocolInfo_QueryInterface
,
10051 InternetProtocolInfo_AddRef
,
10052 InternetProtocolInfo_Release
,
10053 InternetProtocolInfo_ParseUrl
,
10054 InternetProtocolInfo_CombineUrl
,
10055 InternetProtocolInfo_CompareUrl
,
10056 InternetProtocolInfo_QueryInfo
10059 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
10061 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
10063 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
10064 *ppv
= &protocol_info
;
10068 ok(0, "unexpected call\n");
10069 return E_NOINTERFACE
;
10072 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
10077 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
10082 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
10083 REFIID riid
, void **ppv
)
10085 ok(0, "unexpected call\n");
10089 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
10091 ok(0, "unexpected call\n");
10095 static const IClassFactoryVtbl ClassFactoryVtbl
= {
10096 ClassFactory_QueryInterface
,
10097 ClassFactory_AddRef
,
10098 ClassFactory_Release
,
10099 ClassFactory_CreateInstance
,
10100 ClassFactory_LockServer
10103 static IClassFactory protocol_cf
= { &ClassFactoryVtbl
};
10105 static void register_protocols(void)
10107 IInternetSession
*session
;
10110 hres
= pCoInternetGetSession(0, &session
, 0);
10111 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
10115 hres
= IInternetSession_RegisterNameSpace(session
, &protocol_cf
, &IID_NULL
,
10116 winetestW
, 0, NULL
, 0);
10117 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
10119 IInternetSession_Release(session
);
10122 static void unregister_protocols(void) {
10123 IInternetSession
*session
;
10126 hr
= pCoInternetGetSession(0, &session
, 0);
10127 ok(hr
== S_OK
, "CoInternetGetSession failed: 0x%08x\n", hr
);
10131 hr
= IInternetSession_UnregisterNameSpace(session
, &protocol_cf
, winetestW
);
10132 ok(hr
== S_OK
, "UnregisterNameSpace failed: 0x%08x\n", hr
);
10134 IInternetSession_Release(session
);
10137 static void test_CoInternetCombineIUri_Pluggable(void) {
10141 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10142 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10143 if(SUCCEEDED(hr
)) {
10144 IUri
*relative
= NULL
;
10146 hr
= pCreateUri(combine_relativeW
, Uri_CREATE_ALLOW_RELATIVE
, 0, &relative
);
10147 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10148 if(SUCCEEDED(hr
)) {
10149 IUri
*result
= NULL
;
10151 SET_EXPECT(CombineUrl
);
10153 hr
= pCoInternetCombineIUri(base
, relative
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10155 ok(hr
== S_OK
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10157 CHECK_CALLED(CombineUrl
);
10159 if(SUCCEEDED(hr
)) {
10160 BSTR received
= NULL
;
10161 hr
= IUri_GetAbsoluteUri(result
, &received
);
10162 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10163 if(SUCCEEDED(hr
)) {
10164 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10165 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10167 SysFreeString(received
);
10169 if(result
) IUri_Release(result
);
10171 if(relative
) IUri_Release(relative
);
10173 if(base
) IUri_Release(base
);
10176 static void test_CoInternetCombineUrlEx(void) {
10178 IUri
*base
, *result
;
10182 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10183 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10184 if(SUCCEEDED(hr
)) {
10185 result
= (void*) 0xdeadbeef;
10186 hr
= pCoInternetCombineUrlEx(base
, NULL
, 0, &result
, 0);
10187 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10189 ok(!result
, "Error: Expected 'result' to be NULL was %p instead.\n", result
);
10192 result
= (void*) 0xdeadbeef;
10193 hr
= pCoInternetCombineUrlEx(NULL
, http_urlW
, 0, &result
, 0);
10194 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10196 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10198 result
= (void*) 0xdeadbeef;
10199 hr
= pCoInternetCombineUrlEx(NULL
, NULL
, 0, &result
, 0);
10200 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10202 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10204 hr
= pCoInternetCombineUrlEx(base
, http_urlW
, 0, NULL
, 0);
10205 ok(hr
== E_POINTER
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10207 if(base
) IUri_Release(base
);
10209 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10210 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10212 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10213 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10214 if(SUCCEEDED(hr
)) {
10215 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10217 hr
= pCoInternetCombineUrlEx(base
, relativeW
, uri_combine_tests
[i
].combine_flags
,
10219 if(uri_combine_tests
[i
].todo
) {
10221 ok(hr
== uri_combine_tests
[i
].expected
,
10222 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10223 hr
, uri_combine_tests
[i
].expected
, i
);
10226 ok(hr
== uri_combine_tests
[i
].expected
,
10227 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10228 hr
, uri_combine_tests
[i
]. expected
, i
);
10230 if(SUCCEEDED(hr
)) {
10233 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10234 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10236 LPCSTR value
= (prop
.value_ex
) ? prop
.value_ex
: prop
.value
;
10238 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10241 ok(hr
== prop
.expected
,
10242 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10243 hr
, prop
.expected
, i
, j
);
10246 ok(!strcmp_aw(value
, received
) ||
10247 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10248 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10249 value
, wine_dbgstr_w(received
), i
, j
);
10252 ok(hr
== prop
.expected
,
10253 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10254 hr
, prop
.expected
, i
, j
);
10255 ok(!strcmp_aw(value
, received
) ||
10256 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10257 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10258 value
, wine_dbgstr_w(received
), i
, j
);
10260 SysFreeString(received
);
10263 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10264 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10267 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10270 ok(hr
== prop
.expected
,
10271 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10272 hr
, prop
.expected
, i
, j
);
10275 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10276 prop
.value
, received
, i
, j
);
10279 ok(hr
== prop
.expected
,
10280 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10281 hr
, prop
.expected
, i
, j
);
10282 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10283 prop
.value
, received
, i
, j
);
10287 if(result
) IUri_Release(result
);
10288 heap_free(relativeW
);
10290 if(base
) IUri_Release(base
);
10295 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10299 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10300 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10301 if(SUCCEEDED(hr
)) {
10302 IUri
*result
= NULL
;
10304 SET_EXPECT(CombineUrl
);
10306 hr
= pCoInternetCombineUrlEx(base
, combine_relativeW
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10308 ok(hr
== S_OK
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10310 CHECK_CALLED(CombineUrl
);
10312 if(SUCCEEDED(hr
)) {
10313 BSTR received
= NULL
;
10314 hr
= IUri_GetAbsoluteUri(result
, &received
);
10315 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10316 if(SUCCEEDED(hr
)) {
10317 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10318 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10320 SysFreeString(received
);
10322 if(result
) IUri_Release(result
);
10324 if(base
) IUri_Release(base
);
10327 static void test_CoInternetParseIUri_InvalidArgs(void) {
10333 hr
= pCoInternetParseIUri(NULL
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10334 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10336 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10338 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10339 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10340 if(SUCCEEDED(hr
)) {
10341 DWORD expected_len
;
10344 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, NULL
, 0, &result
, 0);
10345 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10347 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10349 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, NULL
, 0);
10350 ok(hr
== E_POINTER
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10354 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_URL
, 0, tmp
, 3, &result
, 0);
10355 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10357 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10360 hr
= pCoInternetParseIUri(uri
, PARSE_MIME
, 0, tmp
, 3, &result
, 0);
10361 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10363 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10366 hr
= pCoInternetParseIUri(uri
, PARSE_SERVER
, 0, tmp
, 3, &result
, 0);
10367 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10369 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10372 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_DOMAIN
, 0, tmp
, 3, &result
, 0);
10373 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10375 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10377 expected_len
= lstrlenW(http_urlW
);
10379 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10380 ok(hr
== STRSAFE_E_INSUFFICIENT_BUFFER
,
10381 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10382 hr
, STRSAFE_E_INSUFFICIENT_BUFFER
);
10383 ok(result
== expected_len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
10384 expected_len
, result
);
10386 if(uri
) IUri_Release(uri
);
10389 static void test_CoInternetParseIUri(void) {
10392 for(i
= 0; i
< sizeof(uri_parse_tests
)/sizeof(uri_parse_tests
[0]); ++i
) {
10396 uri_parse_test test
= uri_parse_tests
[i
];
10398 uriW
= a2w(test
.uri
);
10399 hr
= pCreateUri(uriW
, test
.uri_flags
, 0, &uri
);
10400 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr
, i
);
10401 if(SUCCEEDED(hr
)) {
10402 WCHAR result
[INTERNET_MAX_URL_LENGTH
+1];
10403 DWORD result_len
= -1;
10405 hr
= pCoInternetParseIUri(uri
, test
.action
, test
.flags
, result
, INTERNET_MAX_URL_LENGTH
+1, &result_len
, 0);
10408 ok(hr
== test
.expected
,
10409 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10410 hr
, test
.expected
, i
);
10413 ok(hr
== test
.expected
,
10414 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10415 hr
, test
.expected
, i
);
10417 if(SUCCEEDED(hr
)) {
10418 DWORD len
= lstrlenA(test
.property
);
10419 ok(!strcmp_aw(test
.property
, result
),
10420 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10421 test
.property
, wine_dbgstr_w(result
), i
);
10422 ok(len
== result_len
,
10423 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10424 len
, result_len
, i
);
10427 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10431 if(uri
) IUri_Release(uri
);
10436 static void test_CoInternetParseIUri_Pluggable(void) {
10440 hr
= pCreateUri(parse_urlW
, 0, 0, &uri
);
10441 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr
);
10442 if(SUCCEEDED(hr
)) {
10446 SET_EXPECT(ParseUrl
);
10448 parse_action
= PARSE_CANONICALIZE
;
10449 parse_flags
= URL_UNESCAPE
|URL_ESCAPE_UNSAFE
;
10451 hr
= pCoInternetParseIUri(uri
, parse_action
, parse_flags
, result
, 200, &result_len
, 0);
10452 ok(hr
== S_OK
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10454 CHECK_CALLED(ParseUrl
);
10456 if(SUCCEEDED(hr
)) {
10457 ok(result_len
== lstrlenW(parse_resultW
), "Error: Expected %d, but got %d.\n",
10458 lstrlenW(parse_resultW
), result_len
);
10459 ok(!lstrcmpW(result
, parse_resultW
), "Error: Expected %s, but got %s.\n",
10460 wine_dbgstr_w(parse_resultW
), wine_dbgstr_w(result
));
10463 if(uri
) IUri_Release(uri
);
10469 const char *base_url
;
10470 DWORD base_uri_flags
;
10471 const char *legacy_url
;
10472 const char *uniform_url
;
10473 const char *no_canon_url
;
10474 const char *uri_url
;
10475 } create_urlmon_test_t
;
10477 static const create_urlmon_test_t create_urlmon_tests
[] = {
10479 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE
,
10481 "http://www.winehq.org/",
10482 "http://www.winehq.org/",
10483 "http://www.winehq.org",
10484 "http://www.winehq.org"
10487 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE
,
10489 "file://c:\\dir\\file.txt",
10490 "file:///c:/dir/file.txt",
10491 "file:///c:/dir/file.txt",
10492 "file:///c:/dir/file.txt"
10495 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH
,
10497 "file://c:\\dir\\file.txt",
10498 "file:///c:/dir/file.txt",
10499 "file:///c:/dir/file.txt",
10500 "file://c:\\dir\\file.txt"
10503 "dat%61",Uri_CREATE_ALLOW_RELATIVE
,
10504 "http://www.winehq.org",0,
10505 "http://www.winehq.org/data",
10506 "http://www.winehq.org/data",
10507 "http://www.winehq.org:80/data",
10510 "file.txt",Uri_CREATE_ALLOW_RELATIVE
,
10511 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE
,
10512 "file://c:\\dir\\file.txt",
10513 "file:///c:/dir/file.txt",
10514 "file:///c:/dir/file.txt",
10517 "",Uri_CREATE_ALLOW_RELATIVE
,
10525 "test",Uri_CREATE_ALLOW_RELATIVE
,
10533 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
10535 "file://c:\\dir\\file.txt",
10536 "file:///c:/dir/file.txt",
10537 "file:///c:/dir/file.txt",
10538 "file:///c:/dir/file.txt",
10542 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10543 static void _test_urlmon_display_name(unsigned line
, IMoniker
*mon
, const char *exurl
)
10545 WCHAR
*display_name
;
10548 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
10549 ok_(__FILE__
,line
)(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
10550 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_name
), "unexpected display name: %s, expected %s\n",
10551 wine_dbgstr_w(display_name
), exurl
);
10553 CoTaskMemFree(display_name
);
10556 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10557 static void _test_display_uri(unsigned line
, IMoniker
*mon
, const char *exurl
)
10559 IUriContainer
*uri_container
;
10564 hres
= IMoniker_QueryInterface(mon
, &IID_IUriContainer
, (void**)&uri_container
);
10565 ok(hres
== S_OK
, "Could not get IUriContainer iface: %08x\n", hres
);
10568 hres
= IUriContainer_GetIUri(uri_container
, &uri
);
10569 IUriContainer_Release(uri_container
);
10570 ok(hres
== S_OK
, "GetIUri failed: %08x\n", hres
);
10571 ok(uri
!= NULL
, "uri == NULL\n");
10573 hres
= IUri_GetDisplayUri(uri
, &display_uri
);
10575 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
10576 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_uri
), "unexpected display uri: %s, expected %s\n",
10577 wine_dbgstr_w(display_uri
), exurl
);
10578 SysFreeString(display_uri
);
10581 static void test_CreateURLMoniker(void)
10583 const create_urlmon_test_t
*test
;
10584 IMoniker
*mon
, *base_mon
;
10585 WCHAR
*url
, *base_url
;
10586 IUri
*uri
, *base_uri
;
10589 for(test
= create_urlmon_tests
; test
< create_urlmon_tests
+ sizeof(create_urlmon_tests
)/sizeof(*create_urlmon_tests
); test
++) {
10590 url
= a2w(test
->url
);
10591 base_url
= a2w(test
->base_url
);
10594 hres
= pCreateUri(base_url
, test
->base_uri_flags
, 0, &base_uri
);
10595 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10597 hres
= pCreateURLMonikerEx2(NULL
, base_uri
, &base_mon
, URL_MK_NO_CANONICALIZE
);
10598 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10604 hres
= CreateURLMoniker(base_mon
, url
, &mon
);
10605 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10606 test_urlmon_display_name(mon
, test
->legacy_url
);
10607 test_display_uri(mon
, test
->legacy_url
);
10608 IMoniker_Release(mon
);
10610 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_LEGACY
);
10611 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10612 test_urlmon_display_name(mon
, test
->legacy_url
);
10613 test_display_uri(mon
, test
->legacy_url
);
10614 IMoniker_Release(mon
);
10616 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_UNIFORM
);
10617 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10618 test_urlmon_display_name(mon
, test
->uniform_url
);
10619 test_display_uri(mon
, test
->uniform_url
);
10620 IMoniker_Release(mon
);
10622 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_NO_CANONICALIZE
);
10623 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10624 test_urlmon_display_name(mon
, test
->no_canon_url
);
10625 test_display_uri(mon
, test
->no_canon_url
);
10626 IMoniker_Release(mon
);
10628 hres
= pCreateUri(url
, test
->uri_flags
, 0, &uri
);
10629 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10631 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_LEGACY
);
10632 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10633 test_urlmon_display_name(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10634 test_display_uri(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10635 IMoniker_Release(mon
);
10637 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_UNIFORM
);
10638 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10639 test_urlmon_display_name(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10640 test_display_uri(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10641 IMoniker_Release(mon
);
10643 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_NO_CANONICALIZE
);
10644 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10645 test_urlmon_display_name(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10646 test_display_uri(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10647 IMoniker_Release(mon
);
10651 heap_free(base_url
);
10653 IUri_Release(base_uri
);
10655 IMoniker_Release(base_mon
);
10659 static int add_default_flags(DWORD flags
) {
10660 if(!(flags
& Uri_CREATE_NO_CANONICALIZE
))
10661 flags
|= Uri_CREATE_CANONICALIZE
;
10662 if(!(flags
& Uri_CREATE_NO_DECODE_EXTRA_INFO
))
10663 flags
|= Uri_CREATE_DECODE_EXTRA_INFO
;
10664 if(!(flags
& Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
))
10665 flags
|= Uri_CREATE_CRACK_UNKNOWN_SCHEMES
;
10666 if(!(flags
& Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
10667 flags
|= Uri_CREATE_PRE_PROCESS_HTML_URI
;
10668 if(!(flags
& Uri_CREATE_IE_SETTINGS
))
10669 flags
|= Uri_CREATE_NO_IE_SETTINGS
;
10674 static void test_IPersistStream(void)
10676 int i
, props_order
[Uri_PROPERTY_DWORD_LAST
+1] = { 0 };
10678 props_order
[Uri_PROPERTY_RAW_URI
] = 1;
10679 props_order
[Uri_PROPERTY_FRAGMENT
] = 2;
10680 props_order
[Uri_PROPERTY_HOST
] = 3;
10681 props_order
[Uri_PROPERTY_PASSWORD
] = 4;
10682 props_order
[Uri_PROPERTY_PATH
] = 5;
10683 props_order
[Uri_PROPERTY_PORT
] = 6;
10684 props_order
[Uri_PROPERTY_QUERY
] = 7;
10685 props_order
[Uri_PROPERTY_SCHEME_NAME
] = 8;
10686 props_order
[Uri_PROPERTY_USER_NAME
] = 9;
10688 for(i
=0; i
<sizeof(uri_tests
)/sizeof(*uri_tests
); i
++) {
10689 const uri_properties
*test
= uri_tests
+i
;
10692 IPersistStream
*persist_stream
;
10695 DWORD props
, props_no
, dw_data
[6];
10696 WCHAR str_data
[1024];
10697 ULARGE_INTEGER size
, max_size
;
10698 LARGE_INTEGER no_off
;
10703 if(test
->create_todo
|| test
->create_expected
!=S_OK
)
10706 uriW
= a2w(test
->uri
);
10707 hr
= pCreateUri(uriW
, test
->create_flags
, 0, &uri
);
10708 ok(hr
== S_OK
, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i
, hr
);
10710 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
10711 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10713 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
10714 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed 0x%08x.\n", hr
);
10715 hr
= IPersistStream_IsDirty(persist_stream
);
10716 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10717 hr
= IPersistStream_Save(persist_stream
, stream
, FALSE
);
10718 ok(hr
== S_OK
, "%d) Save failed 0x%08x, expected S_OK.\n", i
, hr
);
10719 hr
= IPersistStream_IsDirty(persist_stream
);
10720 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10721 no_off
.QuadPart
= 0;
10722 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
10723 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10724 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10725 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10726 hr
= IPersistStream_GetSizeMax(persist_stream
, &max_size
);
10727 ok(hr
== S_OK
, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i
, hr
);
10728 ok(U(size
).LowPart
+2 == U(max_size
).LowPart
,
10729 "%d) Written data size is %d, max_size %d.\n",
10730 i
, U(size
).LowPart
, U(max_size
).LowPart
);
10732 hr
= IStream_Read(stream
, (void*)dw_data
, sizeof(DWORD
), NULL
);
10733 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10734 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
10735 i
, dw_data
[0]-2, U(size
).LowPart
);
10736 hr
= IStream_Read(stream
, (void*)dw_data
, 6*sizeof(DWORD
), NULL
);
10737 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10738 ok(dw_data
[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[0]);
10739 ok(dw_data
[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[1]);
10740 ok(dw_data
[2] == add_default_flags(test
->create_flags
),
10741 "%d) Incorrect value %x, expected %x (creation flags).\n",
10742 i
, dw_data
[2], add_default_flags(test
->create_flags
));
10743 ok(dw_data
[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[3]);
10744 ok(dw_data
[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[4]);
10745 ok(dw_data
[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[5]);
10748 for(props
=0; props
<=Uri_PROPERTY_DWORD_LAST
; props
++) {
10749 if(!props_order
[props
])
10752 if(props
<= Uri_PROPERTY_STRING_LAST
) {
10753 if(test
->str_props
[props
].expected
== S_OK
)
10756 if(test
->dword_props
[props
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
10760 if(test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTP
10761 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_FTP
10762 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTPS
)
10765 hr
= IStream_Read(stream
, (void*)&props
, sizeof(DWORD
), NULL
);
10766 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10767 ok(props
== props_no
, "%d) Properties no is %d, expected %d.\n", i
, props
, props_no
);
10772 hr
= IStream_Read(stream
, (void*)dw_data
, 2*sizeof(DWORD
), NULL
);
10773 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10775 ok(dw_data
[2]<props_order
[dw_data
[0]],
10776 "%d) Incorrect properties order (%d, %d)\n",
10777 i
, dw_data
[0], dw_data
[3]);
10778 dw_data
[2] = props_order
[dw_data
[0]];
10779 dw_data
[3] = dw_data
[0];
10781 if(dw_data
[0]<=Uri_PROPERTY_STRING_LAST
) {
10782 const uri_str_property
*prop
= test
->str_props
+dw_data
[0];
10783 hr
= IStream_Read(stream
, (void*)str_data
, dw_data
[1], NULL
);
10784 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10785 ok(!strcmp_aw(prop
->value
, str_data
) || broken(prop
->broken_value
&& !strcmp_aw(prop
->broken_value
, str_data
)),
10786 "%d) Expected %s but got %s (%d).\n", i
, prop
->value
, wine_dbgstr_w(str_data
), dw_data
[0]);
10787 } else if(dw_data
[0]>=Uri_PROPERTY_DWORD_START
&& dw_data
[0]<=Uri_PROPERTY_DWORD_LAST
) {
10788 const uri_dword_property
*prop
= test
->dword_props
+dw_data
[0]-Uri_PROPERTY_DWORD_START
;
10789 ok(dw_data
[1] == sizeof(DWORD
), "%d) Size of dword property is %d (%d)\n", i
, dw_data
[1], dw_data
[0]);
10790 hr
= IStream_Read(stream
, (void*)&dw_data
[1], sizeof(DWORD
), NULL
);
10791 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10792 ok(prop
->value
== dw_data
[1], "%d) Expected %d but got %d (%d).\n", i
, prop
->value
, dw_data
[1], dw_data
[0]);
10794 ok(FALSE
, "%d) Incorrect property type (%d)\n", i
, dw_data
[0]);
10798 ok(props
== 0, "%d) No all properties were processed %d. Next property type: %d\n",
10799 i
, props
, dw_data
[0]);
10801 IPersistStream_Release(persist_stream
);
10804 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10805 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10806 hr
= IPersistStream_GetClassID(persist_stream
, &curi
);
10807 ok(hr
== S_OK
, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i
, hr
);
10808 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetClassID returned incorrect CLSID.\n", i
);
10809 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
10810 &IID_IUri
, (void**)&uri
);
10811 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
10812 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
10813 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10814 hr
= IPersistStream_Load(persist_stream
, stream
);
10815 ok(hr
== S_OK
, "%d) Load failed 0x%08x, expected S_OK.\n", i
, hr
);
10816 hr
= IUri_GetRawUri(uri
, &raw_uri
);
10817 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
10818 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
10819 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
10820 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
10821 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
10822 wine_dbgstr_w(raw_uri
));
10823 SysFreeString(raw_uri
);
10825 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
10826 ok(hr
== S_OK
, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i
, hr
);
10827 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10828 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10829 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10830 MSHCTX_DIFFERENTMACHINE
, NULL
, MSHLFLAGS_NORMAL
);
10831 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10832 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10833 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
);
10834 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10835 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10836 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLESTRONG
);
10837 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10838 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10839 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLEWEAK
);
10840 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10841 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10842 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NOPING
);
10843 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10844 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10845 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NORMAL
);
10846 ok(hr
== S_OK
, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10847 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
10848 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
10849 ok(hr
== E_INVALIDARG
, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10850 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
10851 MSHCTX_INPROC
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
10852 ok(hr
== S_OK
, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i
, hr
);
10853 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i
);
10855 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
10856 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10857 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10858 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10859 hr
= IStream_Read(stream
, (void*)dw_data
, 3*sizeof(DWORD
), NULL
);
10860 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10861 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
10862 i
, dw_data
[0]-2, U(size
).LowPart
);
10863 ok(dw_data
[1] == MSHCTX_LOCAL
, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
10865 ok(dw_data
[2] == dw_data
[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10866 i
, dw_data
[2], dw_data
[0]-8);
10867 if(!test
->str_props
[Uri_PROPERTY_PATH
].value
[0] &&
10868 (test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTP
10869 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_FTP
10870 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTPS
))
10871 U(max_size
).LowPart
+= 3*sizeof(DWORD
);
10872 ok(dw_data
[2] == U(max_size
).LowPart
, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10873 i
, dw_data
[2], U(max_size
).LowPart
);
10874 IMarshal_Release(marshal
);
10877 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10878 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10879 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
10880 &IID_IUri
, (void**)&uri
);
10881 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
10882 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
10883 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10884 hr
= IMarshal_UnmarshalInterface(marshal
, stream
, &IID_IUri
, (void**)&uri
);
10885 ok(hr
== S_OK
, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10886 hr
= IUri_GetRawUri(uri
, &raw_uri
);
10887 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
10888 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
10889 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
10890 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
10891 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
10892 wine_dbgstr_w(raw_uri
));
10893 SysFreeString(raw_uri
);
10895 IMarshal_Release(marshal
);
10896 IStream_Release(stream
);
10897 IPersistStream_Release(persist_stream
);
10903 static void test_UninitializedUri(void)
10906 IUriBuilderFactory
*ubf
;
10907 IPersistStream
*ps
;
10915 hr
= CoCreateInstance(&CLSID_CUri
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
10916 &IID_IUri
, (void**)&uri
);
10918 win_skip("Skipping uninitialized Uri tests.\n");
10922 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&ubf
);
10923 ok(hr
== S_OK
, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr
);
10924 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&ps
);
10925 ok(hr
== S_OK
, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr
);
10927 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
10928 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
10929 hr
= IUri_GetAbsoluteUri(uri
, &bstr
);
10930 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
10931 hr
= IUri_GetAuthority(uri
, &bstr
);
10932 ok(hr
== E_UNEXPECTED
, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr
);
10933 hr
= IUri_GetDisplayUri(uri
, &bstr
);
10934 ok(hr
== E_UNEXPECTED
, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr
);
10935 hr
= IUri_GetDomain(uri
, &bstr
);
10936 ok(hr
== E_UNEXPECTED
, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr
);
10937 hr
= IUri_GetExtension(uri
, &bstr
);
10938 ok(hr
== E_UNEXPECTED
, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr
);
10939 hr
= IUri_GetFragment(uri
, &bstr
);
10940 ok(hr
== E_UNEXPECTED
, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr
);
10941 hr
= IUri_GetHost(uri
, &bstr
);
10942 ok(hr
== E_UNEXPECTED
, "GetHost returned %x, expected E_UNEXPECTED.\n", hr
);
10943 hr
= IUri_GetHostType(uri
, &dword
);
10944 ok(hr
== E_UNEXPECTED
, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr
);
10945 hr
= IUri_GetPassword(uri
, &bstr
);
10946 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
10947 hr
= IUri_GetPassword(uri
, &bstr
);
10948 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
10949 hr
= IUri_GetPathAndQuery(uri
, &bstr
);
10950 ok(hr
== E_UNEXPECTED
, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr
);
10951 hr
= IUri_GetPort(uri
, &dword
);
10952 ok(hr
== E_UNEXPECTED
, "GetPort returned %x, expected E_UNEXPECTED.\n", hr
);
10953 hr
= IUri_GetProperties(uri
, &dword
);
10954 ok(hr
== E_UNEXPECTED
, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr
);
10955 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, &bstr
, 0);
10956 ok(hr
== E_UNEXPECTED
, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr
);
10957 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_PORT
, &dword
, 0);
10958 ok(hr
== E_UNEXPECTED
, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr
);
10959 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_RAW_URI
, &dword
, 0);
10960 ok(hr
== E_UNEXPECTED
, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr
);
10961 hr
= IUri_GetQuery(uri
, &bstr
);
10962 ok(hr
== E_UNEXPECTED
, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr
);
10963 hr
= IUri_GetRawUri(uri
, &bstr
);
10964 ok(hr
== E_UNEXPECTED
, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr
);
10965 hr
= IUri_GetScheme(uri
, &dword
);
10966 ok(hr
== E_UNEXPECTED
, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr
);
10967 hr
= IUri_GetSchemeName(uri
, &bstr
);
10968 ok(hr
== E_UNEXPECTED
, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr
);
10969 hr
= IUri_GetUserInfo(uri
, &bstr
);
10970 ok(hr
== E_UNEXPECTED
, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr
);
10971 hr
= IUri_GetUserName(uri
, &bstr
);
10972 ok(hr
== E_UNEXPECTED
, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr
);
10973 hr
= IUri_GetZone(uri
, &dword
);
10974 ok(hr
== E_UNEXPECTED
, "GetZone returned %x, expected E_UNEXPECTED.\n", hr
);
10975 hr
= IUri_IsEqual(uri
, uri
, &eq
);
10976 ok(hr
== E_UNEXPECTED
, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr
);
10978 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(ubf
, 0, 0, &ub
);
10979 ok(hr
== E_UNEXPECTED
, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr
);
10980 hr
= IUriBuilderFactory_CreateIUriBuilder(ubf
, 0, 0, &ub
);
10981 ok(hr
== S_OK
, "CreateIUriBuilder returned %x, expected S_OK.\n", hr
);
10982 IUriBuilder_Release(ub
);
10984 hr
= IPersistStream_GetSizeMax(ps
, &ui
);
10985 ok(hr
== S_OK
, "GetSizeMax returned %x, expected S_OK.\n", hr
);
10986 ok(ui
.u
.LowPart
== 34, "ui.LowPart = %d, expected 34.\n", ui
.u
.LowPart
);
10987 hr
= IPersistStream_IsDirty(ps
);
10988 ok(hr
== S_FALSE
, "IsDirty returned %x, expected S_FALSE.\n", hr
);
10990 IPersistStream_Release(ps
);
10991 IUriBuilderFactory_Release(ubf
);
10998 hurlmon
= GetModuleHandle("urlmon.dll");
10999 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
11000 pCreateUri
= (void*) GetProcAddress(hurlmon
, "CreateUri");
11001 pCreateUriWithFragment
= (void*) GetProcAddress(hurlmon
, "CreateUriWithFragment");
11002 pCreateIUriBuilder
= (void*) GetProcAddress(hurlmon
, "CreateIUriBuilder");
11003 pCoInternetCombineIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineIUri");
11004 pCoInternetCombineUrlEx
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineUrlEx");
11005 pCoInternetParseIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetParseIUri");
11006 pCreateURLMonikerEx
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx");
11007 pCreateURLMonikerEx2
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx2");
11010 win_skip("CreateUri is not present, skipping tests.\n");
11014 trace("test CreateUri invalid flags...\n");
11015 test_CreateUri_InvalidFlags();
11017 trace("test CreateUri invalid args...\n");
11018 test_CreateUri_InvalidArgs();
11020 trace("test CreateUri invalid URIs...\n");
11021 test_CreateUri_InvalidUri();
11023 trace("test IUri_GetPropertyBSTR...\n");
11024 test_IUri_GetPropertyBSTR();
11026 trace("test IUri_GetPropertyDWORD...\n");
11027 test_IUri_GetPropertyDWORD();
11029 trace("test IUri_GetStrProperties...\n");
11030 test_IUri_GetStrProperties();
11032 trace("test IUri_GetDwordProperties...\n");
11033 test_IUri_GetDwordProperties();
11035 trace("test IUri_GetPropertyLength...\n");
11036 test_IUri_GetPropertyLength();
11038 trace("test IUri_GetProperties...\n");
11039 test_IUri_GetProperties();
11041 trace("test IUri_HasProperty...\n");
11042 test_IUri_HasProperty();
11044 trace("test IUri_IsEqual...\n");
11045 test_IUri_IsEqual();
11047 trace("test CreateUriWithFragment invalid args...\n");
11048 test_CreateUriWithFragment_InvalidArgs();
11050 trace("test CreateUriWithFragment invalid flags...\n");
11051 test_CreateUriWithFragment_InvalidFlags();
11053 trace("test CreateUriWithFragment...\n");
11054 test_CreateUriWithFragment();
11056 trace("test CreateIUriBuilder...\n");
11057 test_CreateIUriBuilder();
11059 trace("test IUriBuilder_CreateInvalidArgs...\n");
11060 test_IUriBuilder_CreateInvalidArgs();
11062 trace("test IUriBuilder...\n");
11063 test_IUriBuilder();
11065 trace("test IUriBuilder_GetInvalidArgs...\n");
11066 test_IUriBuilder_GetInvalidArgs();
11068 trace("test IUriBuilder_HasBeenModified...\n");
11069 test_IUriBuilder_HasBeenModified();
11071 trace("test IUriBuilder_IUriProperty...\n");
11072 test_IUriBuilder_IUriProperty();
11074 trace("test IUriBuilder_RemoveProperties...\n");
11075 test_IUriBuilder_RemoveProperties();
11077 trace("test IUriBuilder miscellaneous...\n");
11078 test_IUriBuilder_Misc();
11080 trace("test IUriBuilderFactory...\n");
11081 test_IUriBuilderFactory();
11083 trace("test CoInternetCombineIUri...\n");
11084 test_CoInternetCombineIUri();
11086 trace("test CoInternetCombineUrlEx...\n");
11087 test_CoInternetCombineUrlEx();
11089 trace("test CoInternetParseIUri Invalid Args...\n");
11090 test_CoInternetParseIUri_InvalidArgs();
11092 trace("test CoInternetParseIUri...\n");
11093 test_CoInternetParseIUri();
11095 register_protocols();
11097 trace("test CoInternetCombineIUri pluggable...\n");
11098 test_CoInternetCombineIUri_Pluggable();
11100 trace("test CoInternetCombineUrlEx Pluggable...\n");
11101 test_CoInternetCombineUrlEx_Pluggable();
11103 trace("test CoInternetParseIUri pluggable...\n");
11104 test_CoInternetParseIUri_Pluggable();
11106 trace("test CreateURLMoniker...\n");
11107 test_CreateURLMoniker();
11109 CoInitialize(NULL
);
11111 trace("test IPersistStream...\n");
11112 test_IPersistStream();
11114 trace("test uninitialized Uri...\n");
11115 test_UninitializedUri();
11118 unregister_protocols();