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 BOOL broken_combine_hres
;
125 } uri_dword_property
;
127 typedef struct _uri_properties
{
130 HRESULT create_expected
;
133 uri_str_property str_props
[URI_STR_PROPERTY_COUNT
];
134 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
137 static const uri_properties uri_tests
[] = {
138 { "http://www.winehq.org/tests/../tests/../..", 0, S_OK
, FALSE
,
140 {"http://www.winehq.org/",S_OK
,FALSE
}, /* ABSOLUTE_URI */
141 {"www.winehq.org",S_OK
,FALSE
}, /* AUTHORITY */
142 {"http://www.winehq.org/",S_OK
,FALSE
}, /* DISPLAY_URI */
143 {"winehq.org",S_OK
,FALSE
}, /* DOMAIN */
144 {"",S_FALSE
,FALSE
}, /* EXTENSION */
145 {"",S_FALSE
,FALSE
}, /* FRAGMENT */
146 {"www.winehq.org",S_OK
,FALSE
}, /* HOST */
147 {"",S_FALSE
,FALSE
}, /* PASSWORD */
148 {"/",S_OK
,FALSE
}, /* PATH */
149 {"/",S_OK
,FALSE
}, /* PATH_AND_QUERY */
150 {"",S_FALSE
,FALSE
}, /* QUERY */
151 {"http://www.winehq.org/tests/../tests/../..",S_OK
,FALSE
}, /* RAW_URI */
152 {"http",S_OK
,FALSE
}, /* SCHEME_NAME */
153 {"",S_FALSE
,FALSE
}, /* USER_INFO */
154 {"",S_FALSE
,FALSE
} /* USER_NAME */
157 {Uri_HOST_DNS
,S_OK
,FALSE
}, /* HOST_TYPE */
158 {80,S_OK
,FALSE
}, /* PORT */
159 {URL_SCHEME_HTTP
,S_OK
,FALSE
}, /* SCHEME */
160 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
} /* ZONE */
163 { "http://winehq.org/tests/.././tests", 0, S_OK
, FALSE
,
165 {"http://winehq.org/tests",S_OK
,FALSE
},
166 {"winehq.org",S_OK
,FALSE
},
167 {"http://winehq.org/tests",S_OK
,FALSE
},
168 {"winehq.org",S_OK
,FALSE
},
171 {"winehq.org",S_OK
,FALSE
},
173 {"/tests",S_OK
,FALSE
},
174 {"/tests",S_OK
,FALSE
},
176 {"http://winehq.org/tests/.././tests",S_OK
,FALSE
},
182 {Uri_HOST_DNS
,S_OK
,FALSE
},
184 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
185 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
188 { "HtTp://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
190 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
191 {"www.winehq.org",S_OK
,FALSE
},
192 {"http://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
193 {"winehq.org",S_OK
,FALSE
},
196 {"www.winehq.org",S_OK
,FALSE
},
199 {"/?query=x&return=y",S_OK
,FALSE
},
200 {"?query=x&return=y",S_OK
,FALSE
},
201 {"HtTp://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
207 {Uri_HOST_DNS
,S_OK
,FALSE
},
209 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
210 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
213 { "HtTpS://www.winehq.org/tests/..?query=x&return=y", 0, S_OK
, FALSE
,
215 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
216 {"www.winehq.org",S_OK
,FALSE
},
217 {"https://www.winehq.org/?query=x&return=y",S_OK
,FALSE
},
218 {"winehq.org",S_OK
,FALSE
},
221 {"www.winehq.org",S_OK
,FALSE
},
224 {"/?query=x&return=y",S_OK
,FALSE
},
225 {"?query=x&return=y",S_OK
,FALSE
},
226 {"HtTpS://www.winehq.org/tests/..?query=x&return=y",S_OK
,FALSE
},
227 {"https",S_OK
,FALSE
},
232 {Uri_HOST_DNS
,S_OK
,FALSE
},
234 {URL_SCHEME_HTTPS
,S_OK
,FALSE
},
235 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
238 { "hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters", 0, S_OK
, FALSE
,
240 {"http://usEr%3Ainfo@example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
241 {"usEr%3Ainfo@example.com",S_OK
,FALSE
},
242 {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
243 {"example.com",S_OK
,FALSE
},
246 {"example.com",S_OK
,FALSE
},
248 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
249 {"/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK
,FALSE
},
251 {"hTTp://us%45r%3Ainfo@examp%4CE.com:80/path/a/b/./c/../%2E%2E/Forbidden'<|> Characters",S_OK
,FALSE
},
253 {"usEr%3Ainfo",S_OK
,FALSE
},
254 {"usEr%3Ainfo",S_OK
,FALSE
}
257 {Uri_HOST_DNS
,S_OK
,FALSE
},
259 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
260 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
263 { "ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt", 0, S_OK
, FALSE
,
265 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
266 {"winepass:wine@ftp.winehq.org:9999",S_OK
,FALSE
},
267 {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK
,FALSE
},
268 {"winehq.org",S_OK
,FALSE
},
271 {"ftp.winehq.org",S_OK
,FALSE
},
273 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
274 {"/dir/foo%20bar.txt",S_OK
,FALSE
},
276 {"ftp://winepass:wine@ftp.winehq.org:9999/dir/foo bar.txt",S_OK
,FALSE
},
278 {"winepass:wine",S_OK
,FALSE
},
279 {"winepass",S_OK
,FALSE
}
282 {Uri_HOST_DNS
,S_OK
,FALSE
},
284 {URL_SCHEME_FTP
,S_OK
,FALSE
},
285 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
288 { "file://c:\\tests\\../tests/foo%20bar.mp3", 0, S_OK
, FALSE
,
290 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
292 {"file:///c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
298 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
299 {"/c:/tests/foo%2520bar.mp3",S_OK
,FALSE
},
301 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
307 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
309 {URL_SCHEME_FILE
,S_OK
,FALSE
},
310 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
313 { "file://c:\\tests\\../tests/foo%20bar.mp3", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
315 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
317 {"file:///c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
323 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
324 {"/c:/tests/../tests/foo%2520bar.mp3",S_OK
,FALSE
},
326 {"file://c:\\tests\\../tests/foo%20bar.mp3",S_OK
,FALSE
},
332 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
334 {URL_SCHEME_FILE
,S_OK
,FALSE
},
335 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
338 { "FILE://localhost/test dir\\../tests/test%20file.README.txt", 0, S_OK
, FALSE
,
340 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
342 {"file:///tests/test%20file.README.txt",S_OK
,FALSE
},
348 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
349 {"/tests/test%20file.README.txt",S_OK
,FALSE
},
351 {"FILE://localhost/test dir\\../tests/test%20file.README.txt",S_OK
,FALSE
},
357 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
359 {URL_SCHEME_FILE
,S_OK
,FALSE
},
360 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
363 { "urn:nothing:should:happen here", 0, S_OK
, FALSE
,
365 {"urn:nothing:should:happen here",S_OK
,FALSE
},
367 {"urn:nothing:should:happen here",S_OK
,FALSE
},
373 {"nothing:should:happen here",S_OK
,FALSE
},
374 {"nothing:should:happen here",S_OK
,FALSE
},
376 {"urn:nothing:should:happen here",S_OK
,FALSE
},
382 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
384 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
385 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
388 { "http://127.0.0.1/tests/../test dir/./test.txt", 0, S_OK
, FALSE
,
390 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
391 {"127.0.0.1",S_OK
,FALSE
},
392 {"http://127.0.0.1/test%20dir/test.txt",S_OK
,FALSE
},
396 {"127.0.0.1",S_OK
,FALSE
},
398 {"/test%20dir/test.txt",S_OK
,FALSE
},
399 {"/test%20dir/test.txt",S_OK
,FALSE
},
401 {"http://127.0.0.1/tests/../test dir/./test.txt",S_OK
,FALSE
},
407 {Uri_HOST_IPV4
,S_OK
,FALSE
},
409 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
410 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
413 { "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]", 0, S_OK
, FALSE
,
415 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
416 {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK
,FALSE
},
417 {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK
,FALSE
},
421 {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK
,FALSE
},
426 {"http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]",S_OK
,FALSE
},
432 {Uri_HOST_IPV6
,S_OK
,FALSE
},
434 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
435 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
438 { "ftp://[::13.1.68.3]", 0, S_OK
, FALSE
,
440 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
441 {"[::13.1.68.3]",S_OK
,FALSE
},
442 {"ftp://[::13.1.68.3]/",S_OK
,FALSE
},
446 {"::13.1.68.3",S_OK
,FALSE
},
451 {"ftp://[::13.1.68.3]",S_OK
,FALSE
},
457 {Uri_HOST_IPV6
,S_OK
,FALSE
},
459 {URL_SCHEME_FTP
,S_OK
,FALSE
},
460 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
463 { "http://[FEDC:BA98:0:0:0:0:0:3210]", 0, S_OK
, FALSE
,
465 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
466 {"[fedc:ba98::3210]",S_OK
,FALSE
},
467 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
471 {"fedc:ba98::3210",S_OK
,FALSE
},
476 {"http://[FEDC:BA98:0:0:0:0:0:3210]",S_OK
,FALSE
},
482 {Uri_HOST_IPV6
,S_OK
,FALSE
},
484 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
485 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
488 { "1234://www.winehq.org", 0, S_OK
, FALSE
,
490 {"1234://www.winehq.org/",S_OK
,FALSE
},
491 {"www.winehq.org",S_OK
,FALSE
},
492 {"1234://www.winehq.org/",S_OK
,FALSE
},
493 {"winehq.org",S_OK
,FALSE
},
496 {"www.winehq.org",S_OK
,FALSE
},
501 {"1234://www.winehq.org",S_OK
,FALSE
},
507 {Uri_HOST_DNS
,S_OK
,FALSE
},
509 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
510 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
513 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
514 { "C:/test/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
516 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
518 {"file:///C:/test/test.mp3",S_OK
,FALSE
},
524 {"/C:/test/test.mp3",S_OK
,FALSE
},
525 {"/C:/test/test.mp3",S_OK
,FALSE
},
527 {"C:/test/test.mp3",S_OK
,FALSE
},
533 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
535 {URL_SCHEME_FILE
,S_OK
,FALSE
},
536 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
539 /* Test's to make sure the parser/canonicalizer handles implicit file schemes correctly. */
540 { "\\\\Server/test.mp3", Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
, S_OK
, FALSE
,
542 {"file://server/test.mp3",S_OK
,FALSE
},
543 {"server",S_OK
,FALSE
},
544 {"file://server/test.mp3",S_OK
,FALSE
},
548 {"server",S_OK
,FALSE
},
550 {"/test.mp3",S_OK
,FALSE
},
551 {"/test.mp3",S_OK
,FALSE
},
553 {"\\\\Server/test.mp3",S_OK
,FALSE
},
559 {Uri_HOST_DNS
,S_OK
,FALSE
},
561 {URL_SCHEME_FILE
,S_OK
,FALSE
},
562 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
565 { "www.winehq.org/test", Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
567 {"*:www.winehq.org/test",S_OK
,FALSE
},
568 {"www.winehq.org",S_OK
,FALSE
},
569 {"*:www.winehq.org/test",S_OK
,FALSE
},
570 {"winehq.org",S_OK
,FALSE
},
573 {"www.winehq.org",S_OK
,FALSE
},
575 {"/test",S_OK
,FALSE
},
576 {"/test",S_OK
,FALSE
},
578 {"www.winehq.org/test",S_OK
,FALSE
},
584 {Uri_HOST_DNS
,S_OK
,FALSE
},
586 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
587 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
590 /* Valid since the '*' is the only character in the scheme name. */
591 { "*:www.winehq.org/test", 0, S_OK
, FALSE
,
593 {"*:www.winehq.org/test",S_OK
,FALSE
},
594 {"www.winehq.org",S_OK
,FALSE
},
595 {"*:www.winehq.org/test",S_OK
,FALSE
},
596 {"winehq.org",S_OK
,FALSE
},
599 {"www.winehq.org",S_OK
,FALSE
},
601 {"/test",S_OK
,FALSE
},
602 {"/test",S_OK
,FALSE
},
604 {"*:www.winehq.org/test",S_OK
,FALSE
},
610 {Uri_HOST_DNS
,S_OK
,FALSE
},
612 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
613 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
616 { "/../some dir/test.ext", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
618 {"/../some dir/test.ext",S_OK
,FALSE
},
620 {"/../some dir/test.ext",S_OK
,FALSE
},
626 {"/../some dir/test.ext",S_OK
,FALSE
},
627 {"/../some dir/test.ext",S_OK
,FALSE
},
629 {"/../some dir/test.ext",S_OK
,FALSE
},
635 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
637 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
638 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
641 { "//implicit/wildcard/uri scheme", Uri_CREATE_ALLOW_RELATIVE
|Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
, S_OK
, FALSE
,
643 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
645 {"*://implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
651 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
652 {"//implicit/wildcard/uri%20scheme",S_OK
,FALSE
},
654 {"//implicit/wildcard/uri scheme",S_OK
,FALSE
},
660 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
662 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
663 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
666 /* URI is considered opaque since CREATE_NO_CRACK_UNKNOWN_SCHEMES is set and its an unknown scheme. */
667 { "zip://google.com", Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
, S_OK
, FALSE
,
669 {"zip:/.//google.com",S_OK
,FALSE
},
671 {"zip:/.//google.com",S_OK
,FALSE
},
677 {"/.//google.com",S_OK
,FALSE
},
678 {"/.//google.com",S_OK
,FALSE
},
680 {"zip://google.com",S_OK
,FALSE
},
686 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
688 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
689 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
692 /* Windows uses the first occurrence of ':' to delimit the userinfo. */
693 { "ftp://user:pass:word@winehq.org/", 0, S_OK
, FALSE
,
695 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
696 {"user:pass:word@winehq.org",S_OK
,FALSE
},
697 {"ftp://winehq.org/",S_OK
,FALSE
},
698 {"winehq.org",S_OK
,FALSE
},
701 {"winehq.org",S_OK
,FALSE
},
702 {"pass:word",S_OK
,FALSE
},
706 {"ftp://user:pass:word@winehq.org/",S_OK
,FALSE
},
708 {"user:pass:word",S_OK
,FALSE
},
712 {Uri_HOST_DNS
,S_OK
,FALSE
},
714 {URL_SCHEME_FTP
,S_OK
,FALSE
},
715 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
718 /* Make sure % encoded unreserved characters are decoded. */
719 { "ftp://w%49%4Ee:PA%53%53@ftp.google.com/", 0, S_OK
, FALSE
,
721 {"ftp://wINe:PASS@ftp.google.com/",S_OK
,FALSE
},
722 {"wINe:PASS@ftp.google.com",S_OK
,FALSE
},
723 {"ftp://ftp.google.com/",S_OK
,FALSE
},
724 {"google.com",S_OK
,FALSE
},
727 {"ftp.google.com",S_OK
,FALSE
},
732 {"ftp://w%49%4Ee:PA%53%53@ftp.google.com/",S_OK
,FALSE
},
734 {"wINe:PASS",S_OK
,FALSE
},
738 {Uri_HOST_DNS
,S_OK
,FALSE
},
740 {URL_SCHEME_FTP
,S_OK
,FALSE
},
741 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
744 /* Make sure % encoded characters which are NOT unreserved are NOT decoded. */
745 { "ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/", 0, S_OK
, FALSE
,
747 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
748 {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK
,FALSE
},
749 {"ftp://ftp.google.com/",S_OK
,FALSE
},
750 {"google.com",S_OK
,FALSE
},
753 {"ftp.google.com",S_OK
,FALSE
},
754 {"PA%7B%7D",S_OK
,FALSE
},
758 {"ftp://w%5D%5Be:PA%7B%7D@ftp.google.com/",S_OK
,FALSE
},
760 {"w%5D%5Be:PA%7B%7D",S_OK
,FALSE
},
761 {"w%5D%5Be",S_OK
,FALSE
}
764 {Uri_HOST_DNS
,S_OK
,FALSE
},
766 {URL_SCHEME_FTP
,S_OK
,FALSE
},
767 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
770 /* You're allowed to have an empty password portion in the userinfo section. */
771 { "ftp://empty:@ftp.google.com/", 0, S_OK
, FALSE
,
773 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
774 {"empty:@ftp.google.com",S_OK
,FALSE
},
775 {"ftp://ftp.google.com/",S_OK
,FALSE
},
776 {"google.com",S_OK
,FALSE
},
779 {"ftp.google.com",S_OK
,FALSE
},
784 {"ftp://empty:@ftp.google.com/",S_OK
,FALSE
},
786 {"empty:",S_OK
,FALSE
},
790 {Uri_HOST_DNS
,S_OK
,FALSE
},
792 {URL_SCHEME_FTP
,S_OK
,FALSE
},
793 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
796 /* Make sure forbidden characters in "userinfo" get encoded. */
797 { "ftp://\" \"weird@ftp.google.com/", 0, S_OK
, FALSE
,
799 {"ftp://%22%20%22weird@ftp.google.com/",S_OK
,FALSE
},
800 {"%22%20%22weird@ftp.google.com",S_OK
,FALSE
},
801 {"ftp://ftp.google.com/",S_OK
,FALSE
},
802 {"google.com",S_OK
,FALSE
},
805 {"ftp.google.com",S_OK
,FALSE
},
810 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
812 {"%22%20%22weird",S_OK
,FALSE
},
813 {"%22%20%22weird",S_OK
,FALSE
}
816 {Uri_HOST_DNS
,S_OK
,FALSE
},
818 {URL_SCHEME_FTP
,S_OK
,FALSE
},
819 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
822 /* Make sure the forbidden characters don't get percent encoded. */
823 { "ftp://\" \"weird@ftp.google.com/", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
825 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
826 {"\" \"weird@ftp.google.com",S_OK
,FALSE
},
827 {"ftp://ftp.google.com/",S_OK
,FALSE
},
828 {"google.com",S_OK
,FALSE
},
831 {"ftp.google.com",S_OK
,FALSE
},
836 {"ftp://\" \"weird@ftp.google.com/",S_OK
,FALSE
},
838 {"\" \"weird",S_OK
,FALSE
},
839 {"\" \"weird",S_OK
,FALSE
}
842 {Uri_HOST_DNS
,S_OK
,FALSE
},
844 {URL_SCHEME_FTP
,S_OK
,FALSE
},
845 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
848 /* Make sure already percent encoded characters don't get unencoded. */
849 { "ftp://\"%20\"weird@ftp.google.com/\"%20\"weird", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
851 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
852 {"\"%20\"weird@ftp.google.com",S_OK
,FALSE
},
853 {"ftp://ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
854 {"google.com",S_OK
,FALSE
},
857 {"ftp.google.com",S_OK
,FALSE
},
859 {"/\"%20\"weird",S_OK
,FALSE
},
860 {"/\"%20\"weird",S_OK
,FALSE
},
862 {"ftp://\"%20\"weird@ftp.google.com/\"%20\"weird",S_OK
,FALSE
},
864 {"\"%20\"weird",S_OK
,FALSE
},
865 {"\"%20\"weird",S_OK
,FALSE
}
868 {Uri_HOST_DNS
,S_OK
,FALSE
},
870 {URL_SCHEME_FTP
,S_OK
,FALSE
},
871 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
874 /* Allowed to have invalid % encoded because its an unknown scheme type. */
875 { "zip://%xy:word@winehq.org/", 0, S_OK
, FALSE
,
877 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
878 {"%xy:word@winehq.org",S_OK
,FALSE
},
879 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
880 {"winehq.org",S_OK
,FALSE
},
883 {"winehq.org",S_OK
,FALSE
},
888 {"zip://%xy:word@winehq.org/",S_OK
,FALSE
},
890 {"%xy:word",S_OK
,FALSE
},
894 {Uri_HOST_DNS
,S_OK
,FALSE
},
896 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
897 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
900 /* Unreserved, percent encoded characters aren't decoded in the userinfo because the scheme
903 { "zip://%2E:%52%53ord@winehq.org/", 0, S_OK
, FALSE
,
905 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
906 {"%2E:%52%53ord@winehq.org",S_OK
,FALSE
},
907 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
908 {"winehq.org",S_OK
,FALSE
},
911 {"winehq.org",S_OK
,FALSE
},
912 {"%52%53ord",S_OK
,FALSE
},
916 {"zip://%2E:%52%53ord@winehq.org/",S_OK
,FALSE
},
918 {"%2E:%52%53ord",S_OK
,FALSE
},
922 {Uri_HOST_DNS
,S_OK
,FALSE
},
924 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
925 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
928 { "ftp://[](),'test':word@winehq.org/", 0, S_OK
, FALSE
,
930 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
931 {"[](),'test':word@winehq.org",S_OK
,FALSE
},
932 {"ftp://winehq.org/",S_OK
,FALSE
},
933 {"winehq.org",S_OK
,FALSE
},
936 {"winehq.org",S_OK
,FALSE
},
941 {"ftp://[](),'test':word@winehq.org/",S_OK
,FALSE
},
943 {"[](),'test':word",S_OK
,FALSE
},
944 {"[](),'test'",S_OK
,FALSE
}
947 {Uri_HOST_DNS
,S_OK
,FALSE
},
949 {URL_SCHEME_FTP
,S_OK
,FALSE
},
950 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
953 { "ftp://test?:word@winehq.org/", 0, S_OK
, FALSE
,
955 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
957 {"ftp://test/?:word@winehq.org/",S_OK
,FALSE
},
964 {"/?:word@winehq.org/",S_OK
,FALSE
},
965 {"?:word@winehq.org/",S_OK
,FALSE
},
966 {"ftp://test?:word@winehq.org/",S_OK
,FALSE
},
972 {Uri_HOST_DNS
,S_OK
,FALSE
},
974 {URL_SCHEME_FTP
,S_OK
,FALSE
},
975 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
978 { "ftp://test#:word@winehq.org/", 0, S_OK
, FALSE
,
980 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
982 {"ftp://test/#:word@winehq.org/",S_OK
,FALSE
},
985 {"#:word@winehq.org/",S_OK
,FALSE
},
991 {"ftp://test#:word@winehq.org/",S_OK
,FALSE
},
997 {Uri_HOST_DNS
,S_OK
,FALSE
},
999 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1000 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1003 /* Allowed to have a backslash in the userinfo since it's an unknown scheme. */
1004 { "zip://test\\:word@winehq.org/", 0, S_OK
, FALSE
,
1006 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1007 {"test\\:word@winehq.org",S_OK
,FALSE
},
1008 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1009 {"winehq.org",S_OK
,FALSE
},
1012 {"winehq.org",S_OK
,FALSE
},
1013 {"word",S_OK
,FALSE
},
1017 {"zip://test\\:word@winehq.org/",S_OK
,FALSE
},
1019 {"test\\:word",S_OK
,FALSE
},
1020 {"test\\",S_OK
,FALSE
}
1023 {Uri_HOST_DNS
,S_OK
,FALSE
},
1025 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1026 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1029 /* It normalizes IPv4 addresses correctly. */
1030 { "http://127.000.000.100/", 0, S_OK
, FALSE
,
1032 {"http://127.0.0.100/",S_OK
,FALSE
},
1033 {"127.0.0.100",S_OK
,FALSE
},
1034 {"http://127.0.0.100/",S_OK
,FALSE
},
1038 {"127.0.0.100",S_OK
,FALSE
},
1043 {"http://127.000.000.100/",S_OK
,FALSE
},
1044 {"http",S_OK
,FALSE
},
1049 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1051 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1052 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1055 { "http://127.0.0.1:8000", 0, S_OK
, FALSE
,
1057 {"http://127.0.0.1:8000/",S_OK
},
1058 {"127.0.0.1:8000",S_OK
},
1059 {"http://127.0.0.1:8000/",S_OK
},
1068 {"http://127.0.0.1:8000",S_OK
},
1074 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1076 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1077 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1080 /* Make sure it normalizes partial IPv4 addresses correctly. */
1081 { "http://127.0/", 0, S_OK
, FALSE
,
1083 {"http://127.0.0.0/",S_OK
,FALSE
},
1084 {"127.0.0.0",S_OK
,FALSE
},
1085 {"http://127.0.0.0/",S_OK
,FALSE
},
1089 {"127.0.0.0",S_OK
,FALSE
},
1094 {"http://127.0/",S_OK
,FALSE
},
1095 {"http",S_OK
,FALSE
},
1100 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1102 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1103 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1106 /* Make sure it converts implicit IPv4's correctly. */
1107 { "http://123456/", 0, S_OK
, FALSE
,
1109 {"http://0.1.226.64/",S_OK
,FALSE
},
1110 {"0.1.226.64",S_OK
,FALSE
},
1111 {"http://0.1.226.64/",S_OK
,FALSE
},
1115 {"0.1.226.64",S_OK
,FALSE
},
1120 {"http://123456/",S_OK
,FALSE
},
1121 {"http",S_OK
,FALSE
},
1126 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1128 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1129 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1133 { "http://4294967295/", 0, S_OK
, FALSE
,
1135 {"http://255.255.255.255/",S_OK
,FALSE
},
1136 {"255.255.255.255",S_OK
,FALSE
},
1137 {"http://255.255.255.255/",S_OK
,FALSE
},
1141 {"255.255.255.255",S_OK
,FALSE
},
1146 {"http://4294967295/",S_OK
,FALSE
},
1147 {"http",S_OK
,FALSE
},
1152 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1154 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1155 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1159 { "http://4294967296/", 0, S_OK
, FALSE
,
1161 {"http://4294967296/",S_OK
,FALSE
},
1162 {"4294967296",S_OK
,FALSE
},
1163 {"http://4294967296/",S_OK
,FALSE
},
1167 {"4294967296",S_OK
,FALSE
},
1172 {"http://4294967296/",S_OK
,FALSE
},
1173 {"http",S_OK
,FALSE
},
1178 {Uri_HOST_DNS
,S_OK
,FALSE
},
1180 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1181 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1184 /* Window's doesn't normalize IP address for unknown schemes. */
1185 { "1234://4294967295/", 0, S_OK
, FALSE
,
1187 {"1234://4294967295/",S_OK
,FALSE
},
1188 {"4294967295",S_OK
,FALSE
},
1189 {"1234://4294967295/",S_OK
,FALSE
},
1193 {"4294967295",S_OK
,FALSE
},
1198 {"1234://4294967295/",S_OK
,FALSE
},
1199 {"1234",S_OK
,FALSE
},
1204 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1206 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1207 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1210 /* Window's doesn't normalize IP address for unknown schemes. */
1211 { "1234://127.001/", 0, S_OK
, FALSE
,
1213 {"1234://127.001/",S_OK
,FALSE
},
1214 {"127.001",S_OK
,FALSE
},
1215 {"1234://127.001/",S_OK
,FALSE
},
1219 {"127.001",S_OK
,FALSE
},
1224 {"1234://127.001/",S_OK
,FALSE
},
1225 {"1234",S_OK
,FALSE
},
1230 {Uri_HOST_IPV4
,S_OK
,FALSE
},
1232 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1233 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1236 { "http://[FEDC:BA98::3210]", 0, S_OK
, FALSE
,
1238 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1239 {"[fedc:ba98::3210]",S_OK
,FALSE
},
1240 {"http://[fedc:ba98::3210]/",S_OK
,FALSE
},
1244 {"fedc:ba98::3210",S_OK
,FALSE
},
1249 {"http://[FEDC:BA98::3210]",S_OK
,FALSE
},
1250 {"http",S_OK
,FALSE
},
1255 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1257 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1258 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1261 { "http://[::]", 0, S_OK
, FALSE
,
1263 {"http://[::]/",S_OK
,FALSE
},
1264 {"[::]",S_OK
,FALSE
},
1265 {"http://[::]/",S_OK
,FALSE
},
1274 {"http://[::]",S_OK
,FALSE
},
1275 {"http",S_OK
,FALSE
},
1280 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1282 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1283 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1286 { "http://[FEDC:BA98::]", 0, S_OK
, FALSE
,
1288 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1289 {"[fedc:ba98::]",S_OK
,FALSE
},
1290 {"http://[fedc:ba98::]/",S_OK
,FALSE
},
1294 {"fedc:ba98::",S_OK
,FALSE
},
1299 {"http://[FEDC:BA98::]",S_OK
,FALSE
},
1300 {"http",S_OK
,FALSE
},
1305 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1307 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1308 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1311 /* Valid even with 2 byte elision because it doesn't appear the beginning or end. */
1312 { "http://[1::3:4:5:6:7:8]", 0, S_OK
, FALSE
,
1314 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1315 {"[1:0:3:4:5:6:7:8]",S_OK
,FALSE
},
1316 {"http://[1:0:3:4:5:6:7:8]/",S_OK
,FALSE
},
1320 {"1:0:3:4:5:6:7:8",S_OK
,FALSE
},
1325 {"http://[1::3:4:5:6:7:8]",S_OK
,FALSE
},
1326 {"http",S_OK
,FALSE
},
1331 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1333 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1334 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1337 { "http://[v2.34]/", 0, S_OK
, FALSE
,
1339 {"http://[v2.34]/",S_OK
,FALSE
},
1340 {"[v2.34]",S_OK
,FALSE
},
1341 {"http://[v2.34]/",S_OK
,FALSE
},
1345 {"[v2.34]",S_OK
,FALSE
},
1350 {"http://[v2.34]/",S_OK
,FALSE
},
1351 {"http",S_OK
,FALSE
},
1356 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
1358 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1359 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1362 /* Windows ignores ':' if they appear after a '[' on a non-IPLiteral host. */
1363 { "http://[xyz:12345.com/test", 0, S_OK
, FALSE
,
1365 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1366 {"[xyz:12345.com",S_OK
,FALSE
},
1367 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1368 {"[xyz:12345.com",S_OK
,FALSE
},
1371 {"[xyz:12345.com",S_OK
,FALSE
},
1373 {"/test",S_OK
,FALSE
},
1374 {"/test",S_OK
,FALSE
},
1376 {"http://[xyz:12345.com/test",S_OK
,FALSE
},
1377 {"http",S_OK
,FALSE
},
1382 {Uri_HOST_DNS
,S_OK
,FALSE
},
1384 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1385 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1388 /* Valid URI since the '[' and ']' don't appear at the beginning and end
1389 * of the host name (respectively).
1391 { "ftp://www.[works].com/", 0, S_OK
, FALSE
,
1393 {"ftp://www.[works].com/",S_OK
,FALSE
},
1394 {"www.[works].com",S_OK
,FALSE
},
1395 {"ftp://www.[works].com/",S_OK
,FALSE
},
1396 {"[works].com",S_OK
,FALSE
},
1399 {"www.[works].com",S_OK
,FALSE
},
1404 {"ftp://www.[works].com/",S_OK
,FALSE
},
1410 {Uri_HOST_DNS
,S_OK
,FALSE
},
1412 {URL_SCHEME_FTP
,S_OK
,FALSE
},
1413 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1416 /* Considers ':' a delimiter since it appears after the ']'. */
1417 { "http://www.google.com]:12345/", 0, S_OK
, FALSE
,
1419 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1420 {"www.google.com]:12345",S_OK
,FALSE
},
1421 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1422 {"google.com]",S_OK
,FALSE
},
1425 {"www.google.com]",S_OK
,FALSE
},
1430 {"http://www.google.com]:12345/",S_OK
,FALSE
},
1431 {"http",S_OK
,FALSE
},
1436 {Uri_HOST_DNS
,S_OK
,FALSE
},
1438 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1439 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1442 /* Unknown scheme types can have invalid % encoded data in the hostname. */
1443 { "zip://w%XXw%GEw.google.com/", 0, S_OK
, FALSE
,
1445 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1446 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1447 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1448 {"google.com",S_OK
,FALSE
},
1451 {"w%XXw%GEw.google.com",S_OK
,FALSE
},
1456 {"zip://w%XXw%GEw.google.com/",S_OK
,FALSE
},
1462 {Uri_HOST_DNS
,S_OK
,FALSE
},
1464 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1465 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1468 /* Unknown scheme types hostname doesn't get lower cased. */
1469 { "zip://GOOGLE.com/", 0, S_OK
, FALSE
,
1471 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1472 {"GOOGLE.com",S_OK
,FALSE
},
1473 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1474 {"GOOGLE.com",S_OK
,FALSE
},
1477 {"GOOGLE.com",S_OK
,FALSE
},
1482 {"zip://GOOGLE.com/",S_OK
,FALSE
},
1488 {Uri_HOST_DNS
,S_OK
,FALSE
},
1490 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1491 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1494 /* Hostname gets lower-cased for known scheme types. */
1495 { "http://WWW.GOOGLE.com/", 0, S_OK
, FALSE
,
1497 {"http://www.google.com/",S_OK
,FALSE
},
1498 {"www.google.com",S_OK
,FALSE
},
1499 {"http://www.google.com/",S_OK
,FALSE
},
1500 {"google.com",S_OK
,FALSE
},
1503 {"www.google.com",S_OK
,FALSE
},
1508 {"http://WWW.GOOGLE.com/",S_OK
,FALSE
},
1509 {"http",S_OK
,FALSE
},
1514 {Uri_HOST_DNS
,S_OK
,FALSE
},
1516 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1517 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1520 /* Characters that get % encoded in the hostname also have their percent
1521 * encoded forms lower cased.
1523 { "http://www.%7Cgoogle|.com/", 0, S_OK
, FALSE
,
1525 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1526 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1527 {"http://www.%7cgoogle%7c.com/",S_OK
,FALSE
},
1528 {"%7cgoogle%7c.com",S_OK
,FALSE
},
1531 {"www.%7cgoogle%7c.com",S_OK
,FALSE
},
1536 {"http://www.%7Cgoogle|.com/",S_OK
,FALSE
},
1537 {"http",S_OK
,FALSE
},
1542 {Uri_HOST_DNS
,S_OK
,FALSE
},
1544 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1545 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1548 /* IPv4 addresses attached to IPv6 can be included in elisions. */
1549 { "http://[1:2:3:4:5:6:0.0.0.0]", 0, S_OK
, FALSE
,
1551 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1552 {"[1:2:3:4:5:6::]",S_OK
,FALSE
},
1553 {"http://[1:2:3:4:5:6::]/",S_OK
,FALSE
},
1557 {"1:2:3:4:5:6::",S_OK
,FALSE
},
1562 {"http://[1:2:3:4:5:6:0.0.0.0]",S_OK
,FALSE
},
1563 {"http",S_OK
,FALSE
},
1568 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1570 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1571 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1574 /* IPv4 addresses get normalized. */
1575 { "http://[::001.002.003.000]", 0, S_OK
, FALSE
,
1577 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1578 {"[::1.2.3.0]",S_OK
,FALSE
},
1579 {"http://[::1.2.3.0]/",S_OK
,FALSE
},
1583 {"::1.2.3.0",S_OK
,FALSE
},
1588 {"http://[::001.002.003.000]",S_OK
,FALSE
},
1589 {"http",S_OK
,FALSE
},
1594 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1596 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1597 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1600 /* Windows doesn't do anything to IPv6's in unknown schemes. */
1601 { "zip://[0001:0:000:0004:0005:0006:001.002.003.000]", 0, S_OK
, FALSE
,
1603 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1604 {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1605 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK
,FALSE
},
1609 {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK
,FALSE
},
1614 {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK
,FALSE
},
1620 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1622 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1623 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1626 /* IPv4 address is converted into 2 h16 components. */
1627 { "http://[ffff::192.222.111.32]", 0, S_OK
, FALSE
,
1629 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1630 {"[ffff::c0de:6f20]",S_OK
,FALSE
},
1631 {"http://[ffff::c0de:6f20]/",S_OK
,FALSE
},
1635 {"ffff::c0de:6f20",S_OK
,FALSE
},
1640 {"http://[ffff::192.222.111.32]",S_OK
,FALSE
},
1641 {"http",S_OK
,FALSE
},
1646 {Uri_HOST_IPV6
,S_OK
,FALSE
},
1648 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1649 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1652 /* Max value for a port. */
1653 { "http://google.com:65535", 0, S_OK
, FALSE
,
1655 {"http://google.com:65535/",S_OK
,FALSE
},
1656 {"google.com:65535",S_OK
,FALSE
},
1657 {"http://google.com:65535/",S_OK
,FALSE
},
1658 {"google.com",S_OK
,FALSE
},
1661 {"google.com",S_OK
,FALSE
},
1666 {"http://google.com:65535",S_OK
,FALSE
},
1667 {"http",S_OK
,FALSE
},
1672 {Uri_HOST_DNS
,S_OK
,FALSE
},
1674 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1675 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1678 { "zip://google.com:65536", 0, S_OK
, FALSE
,
1680 {"zip://google.com:65536/",S_OK
,FALSE
},
1681 {"google.com:65536",S_OK
,FALSE
},
1682 {"zip://google.com:65536/",S_OK
,FALSE
},
1683 {"google.com:65536",S_OK
,FALSE
},
1686 {"google.com:65536",S_OK
,FALSE
},
1691 {"zip://google.com:65536",S_OK
,FALSE
},
1697 {Uri_HOST_DNS
,S_OK
,FALSE
},
1699 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1700 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1703 { "zip://google.com:65536:25", 0, S_OK
, FALSE
,
1705 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1706 {"google.com:65536:25",S_OK
,FALSE
},
1707 {"zip://google.com:65536:25/",S_OK
,FALSE
},
1708 {"google.com:65536:25",S_OK
,FALSE
},
1711 {"google.com:65536:25",S_OK
,FALSE
},
1716 {"zip://google.com:65536:25",S_OK
,FALSE
},
1722 {Uri_HOST_DNS
,S_OK
,FALSE
},
1724 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1725 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1728 { "zip://[::ffff]:abcd", 0, S_OK
, FALSE
,
1730 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1731 {"[::ffff]:abcd",S_OK
,FALSE
},
1732 {"zip://[::ffff]:abcd/",S_OK
,FALSE
},
1736 {"[::ffff]:abcd",S_OK
,FALSE
},
1741 {"zip://[::ffff]:abcd",S_OK
,FALSE
},
1747 {Uri_HOST_DNS
,S_OK
,FALSE
},
1749 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1750 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1753 { "zip://127.0.0.1:abcd", 0, S_OK
, FALSE
,
1755 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1756 {"127.0.0.1:abcd",S_OK
,FALSE
},
1757 {"zip://127.0.0.1:abcd/",S_OK
,FALSE
},
1758 {"0.1:abcd",S_OK
,FALSE
},
1761 {"127.0.0.1:abcd",S_OK
,FALSE
},
1766 {"zip://127.0.0.1:abcd",S_OK
,FALSE
},
1772 {Uri_HOST_DNS
,S_OK
,FALSE
},
1774 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
1775 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1778 /* Port is just copied over. */
1779 { "http://google.com:00035", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1781 {"http://google.com:00035",S_OK
,FALSE
},
1782 {"google.com:00035",S_OK
,FALSE
},
1783 {"http://google.com:00035",S_OK
,FALSE
,"http://google.com:35"},
1784 {"google.com",S_OK
,FALSE
},
1787 {"google.com",S_OK
,FALSE
},
1792 {"http://google.com:00035",S_OK
,FALSE
},
1793 {"http",S_OK
,FALSE
},
1798 {Uri_HOST_DNS
,S_OK
,FALSE
},
1800 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1801 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1804 /* Default port is copied over. */
1805 { "http://google.com:80", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
1807 {"http://google.com:80",S_OK
,FALSE
},
1808 {"google.com:80",S_OK
,FALSE
},
1809 {"http://google.com:80",S_OK
,FALSE
},
1810 {"google.com",S_OK
,FALSE
},
1813 {"google.com",S_OK
,FALSE
},
1818 {"http://google.com:80",S_OK
,FALSE
},
1819 {"http",S_OK
,FALSE
},
1824 {Uri_HOST_DNS
,S_OK
,FALSE
},
1826 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1827 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1830 { "http://google.com.uk", 0, S_OK
, FALSE
,
1832 {"http://google.com.uk/",S_OK
,FALSE
},
1833 {"google.com.uk",S_OK
,FALSE
},
1834 {"http://google.com.uk/",S_OK
,FALSE
},
1835 {"google.com.uk",S_OK
,FALSE
},
1838 {"google.com.uk",S_OK
,FALSE
},
1843 {"http://google.com.uk",S_OK
,FALSE
},
1844 {"http",S_OK
,FALSE
},
1849 {Uri_HOST_DNS
,S_OK
,FALSE
},
1851 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1852 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1855 { "http://google.com.com", 0, S_OK
, FALSE
,
1857 {"http://google.com.com/",S_OK
,FALSE
},
1858 {"google.com.com",S_OK
,FALSE
},
1859 {"http://google.com.com/",S_OK
,FALSE
},
1860 {"com.com",S_OK
,FALSE
},
1863 {"google.com.com",S_OK
,FALSE
},
1868 {"http://google.com.com",S_OK
,FALSE
},
1869 {"http",S_OK
,FALSE
},
1874 {Uri_HOST_DNS
,S_OK
,FALSE
},
1876 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1877 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1880 { "http://google.uk.1", 0, S_OK
, FALSE
,
1882 {"http://google.uk.1/",S_OK
,FALSE
},
1883 {"google.uk.1",S_OK
,FALSE
},
1884 {"http://google.uk.1/",S_OK
,FALSE
},
1885 {"google.uk.1",S_OK
,FALSE
},
1888 {"google.uk.1",S_OK
,FALSE
},
1893 {"http://google.uk.1",S_OK
,FALSE
},
1894 {"http",S_OK
,FALSE
},
1899 {Uri_HOST_DNS
,S_OK
,FALSE
},
1901 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1902 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1905 /* Since foo isn't a recognized 3 character TLD its considered the domain name. */
1906 { "http://google.foo.uk", 0, S_OK
, FALSE
,
1908 {"http://google.foo.uk/",S_OK
,FALSE
},
1909 {"google.foo.uk",S_OK
,FALSE
},
1910 {"http://google.foo.uk/",S_OK
,FALSE
},
1911 {"foo.uk",S_OK
,FALSE
},
1914 {"google.foo.uk",S_OK
,FALSE
},
1919 {"http://google.foo.uk",S_OK
,FALSE
},
1920 {"http",S_OK
,FALSE
},
1925 {Uri_HOST_DNS
,S_OK
,FALSE
},
1927 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1928 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1931 { "http://.com", 0, S_OK
, FALSE
,
1933 {"http://.com/",S_OK
,FALSE
},
1934 {".com",S_OK
,FALSE
},
1935 {"http://.com/",S_OK
,FALSE
},
1936 {".com",S_OK
,FALSE
},
1939 {".com",S_OK
,FALSE
},
1944 {"http://.com",S_OK
,FALSE
},
1945 {"http",S_OK
,FALSE
},
1950 {Uri_HOST_DNS
,S_OK
,FALSE
},
1952 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1953 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1956 { "http://.uk", 0, S_OK
, FALSE
,
1958 {"http://.uk/",S_OK
,FALSE
},
1960 {"http://.uk/",S_OK
,FALSE
},
1969 {"http://.uk",S_OK
,FALSE
},
1970 {"http",S_OK
,FALSE
},
1975 {Uri_HOST_DNS
,S_OK
,FALSE
},
1977 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
1978 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
1981 { "http://www.co.google.com.[]", 0, S_OK
, FALSE
,
1983 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1984 {"www.co.google.com.[]",S_OK
,FALSE
},
1985 {"http://www.co.google.com.[]/",S_OK
,FALSE
},
1986 {"google.com.[]",S_OK
,FALSE
},
1989 {"www.co.google.com.[]",S_OK
,FALSE
},
1994 {"http://www.co.google.com.[]",S_OK
,FALSE
},
1995 {"http",S_OK
,FALSE
},
2000 {Uri_HOST_DNS
,S_OK
,FALSE
},
2002 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2003 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2006 { "http://co.uk", 0, S_OK
, FALSE
,
2008 {"http://co.uk/",S_OK
,FALSE
},
2009 {"co.uk",S_OK
,FALSE
},
2010 {"http://co.uk/",S_OK
,FALSE
},
2014 {"co.uk",S_OK
,FALSE
},
2019 {"http://co.uk",S_OK
,FALSE
},
2020 {"http",S_OK
,FALSE
},
2025 {Uri_HOST_DNS
,S_OK
,FALSE
},
2027 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2028 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2031 { "http://www.co.google.us.test", 0, S_OK
, FALSE
,
2033 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2034 {"www.co.google.us.test",S_OK
,FALSE
},
2035 {"http://www.co.google.us.test/",S_OK
,FALSE
},
2036 {"us.test",S_OK
,FALSE
},
2039 {"www.co.google.us.test",S_OK
,FALSE
},
2044 {"http://www.co.google.us.test",S_OK
,FALSE
},
2045 {"http",S_OK
,FALSE
},
2050 {Uri_HOST_DNS
,S_OK
,FALSE
},
2052 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2053 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2056 { "http://gov.uk", 0, S_OK
, FALSE
,
2058 {"http://gov.uk/",S_OK
,FALSE
},
2059 {"gov.uk",S_OK
,FALSE
},
2060 {"http://gov.uk/",S_OK
,FALSE
},
2064 {"gov.uk",S_OK
,FALSE
},
2069 {"http://gov.uk",S_OK
,FALSE
},
2070 {"http",S_OK
,FALSE
},
2075 {Uri_HOST_DNS
,S_OK
,FALSE
},
2077 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2078 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2081 { "zip://www.google.com\\test", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2083 {"zip://www.google.com\\test",S_OK
,FALSE
},
2084 {"www.google.com\\test",S_OK
,FALSE
},
2085 {"zip://www.google.com\\test",S_OK
,FALSE
},
2086 {"google.com\\test",S_OK
,FALSE
},
2089 {"www.google.com\\test",S_OK
,FALSE
},
2094 {"zip://www.google.com\\test",S_OK
,FALSE
},
2100 {Uri_HOST_DNS
,S_OK
,FALSE
},
2102 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2103 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2106 { "urn:excepts:bad:%XY:encoded", 0, S_OK
, FALSE
,
2108 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2110 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2116 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2117 {"excepts:bad:%XY:encoded",S_OK
,FALSE
},
2119 {"urn:excepts:bad:%XY:encoded",S_OK
,FALSE
},
2125 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2127 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2128 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2131 /* Since the original URI doesn't contain an extra '/' before the path no % encoded values
2132 * are decoded and all '%' are encoded.
2134 { "file://C:/te%3Es%2Et/tes%t.mp3", 0, S_OK
, FALSE
,
2136 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2138 {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2140 {".mp3",S_OK
,FALSE
},
2144 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2145 {"/C:/te%253Es%252Et/tes%25t.mp3",S_OK
,FALSE
},
2147 {"file://C:/te%3Es%2Et/tes%t.mp3",S_OK
,FALSE
},
2148 {"file",S_OK
,FALSE
},
2153 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2155 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2156 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2159 /* Since there's a '/' in front of the drive letter, any percent encoded, non-forbidden character
2160 * is decoded and only %'s in front of invalid hex digits are encoded.
2162 { "file:///C:/te%3Es%2Et/t%23es%t.mp3", 0, S_OK
, FALSE
,
2164 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2166 {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2168 {".mp3",S_OK
,FALSE
},
2172 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2173 {"/C:/te%3Es.t/t#es%25t.mp3",S_OK
,FALSE
},
2175 {"file:///C:/te%3Es%2Et/t%23es%t.mp3",S_OK
,FALSE
},
2176 {"file",S_OK
,FALSE
},
2181 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2183 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2184 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2187 /* Only unreserved percent encoded characters are decoded for known schemes that aren't file. */
2188 { "http://[::001.002.003.000]/%3F%23%2E%54/test", 0, S_OK
, FALSE
,
2190 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2191 {"[::1.2.3.0]",S_OK
,FALSE
},
2192 {"http://[::1.2.3.0]/%3F%23.T/test",S_OK
,FALSE
},
2196 {"::1.2.3.0",S_OK
,FALSE
},
2198 {"/%3F%23.T/test",S_OK
,FALSE
},
2199 {"/%3F%23.T/test",S_OK
,FALSE
},
2201 {"http://[::001.002.003.000]/%3F%23%2E%54/test",S_OK
,FALSE
},
2202 {"http",S_OK
,FALSE
},
2207 {Uri_HOST_IPV6
,S_OK
,FALSE
},
2209 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2210 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2213 /* Forbidden characters are always encoded for file URIs. */
2214 { "file:///C:/\"test\"/test.mp3", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2216 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2218 {"file:///C:/%22test%22/test.mp3",S_OK
,FALSE
},
2220 {".mp3",S_OK
,FALSE
},
2224 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2225 {"/C:/%22test%22/test.mp3",S_OK
,FALSE
},
2227 {"file:///C:/\"test\"/test.mp3",S_OK
,FALSE
},
2228 {"file",S_OK
,FALSE
},
2233 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2235 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2236 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2239 /* Forbidden characters are never encoded for unknown scheme types. */
2240 { "1234://4294967295/<|>\" test<|>", 0, S_OK
, FALSE
,
2242 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2243 {"4294967295",S_OK
,FALSE
},
2244 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2248 {"4294967295",S_OK
,FALSE
},
2250 {"/<|>\" test<|>",S_OK
,FALSE
},
2251 {"/<|>\" test<|>",S_OK
,FALSE
},
2253 {"1234://4294967295/<|>\" test<|>",S_OK
,FALSE
},
2254 {"1234",S_OK
,FALSE
},
2259 {Uri_HOST_IPV4
,S_OK
,FALSE
},
2261 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2262 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2265 /* Make sure forbidden characters are percent encoded. */
2266 { "http://gov.uk/<|> test<|>", 0, S_OK
, FALSE
,
2268 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2269 {"gov.uk",S_OK
,FALSE
},
2270 {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2274 {"gov.uk",S_OK
,FALSE
},
2276 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2277 {"/%3C%7C%3E%20test%3C%7C%3E",S_OK
,FALSE
},
2279 {"http://gov.uk/<|> test<|>",S_OK
,FALSE
},
2280 {"http",S_OK
,FALSE
},
2285 {Uri_HOST_DNS
,S_OK
,FALSE
},
2287 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2288 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2291 { "http://gov.uk/test/../test2/././../test3/.././././", 0, S_OK
, FALSE
,
2293 {"http://gov.uk/",S_OK
,FALSE
},
2294 {"gov.uk",S_OK
,FALSE
},
2295 {"http://gov.uk/",S_OK
,FALSE
},
2299 {"gov.uk",S_OK
,FALSE
},
2304 {"http://gov.uk/test/../test2/././../test3/.././././",S_OK
,FALSE
},
2305 {"http",S_OK
,FALSE
},
2310 {Uri_HOST_DNS
,S_OK
,FALSE
},
2312 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2313 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2316 { "http://gov.uk/test/test2/../../..", 0, S_OK
, FALSE
,
2318 {"http://gov.uk/",S_OK
,FALSE
},
2319 {"gov.uk",S_OK
,FALSE
},
2320 {"http://gov.uk/",S_OK
,FALSE
},
2324 {"gov.uk",S_OK
,FALSE
},
2329 {"http://gov.uk/test/test2/../../..",S_OK
,FALSE
},
2330 {"http",S_OK
,FALSE
},
2335 {Uri_HOST_DNS
,S_OK
,FALSE
},
2337 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2338 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2341 { "http://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2343 {"http://gov.uk/",S_OK
,FALSE
},
2344 {"gov.uk",S_OK
,FALSE
},
2345 {"http://gov.uk/",S_OK
,FALSE
},
2349 {"gov.uk",S_OK
,FALSE
},
2354 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2355 {"http",S_OK
,FALSE
},
2360 {Uri_HOST_DNS
,S_OK
,FALSE
},
2362 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2363 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2366 { "file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3", 0, S_OK
, FALSE
,
2368 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2370 {"file:///c:/foo%2520bar.mp3",S_OK
,FALSE
},
2372 {".mp3",S_OK
,FALSE
},
2376 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2377 {"/c:/foo%2520bar.mp3",S_OK
,FALSE
},
2379 {"file://c:\\tests\\../tests\\./.\\..\\foo%20bar.mp3",S_OK
,FALSE
},
2380 {"file",S_OK
,FALSE
},
2385 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2387 {URL_SCHEME_FILE
,S_OK
,FALSE
},
2388 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2391 /* Dot removal happens for unknown scheme types. */
2392 { "zip://gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2394 {"zip://gov.uk/",S_OK
,FALSE
},
2395 {"gov.uk",S_OK
,FALSE
},
2396 {"zip://gov.uk/",S_OK
,FALSE
},
2400 {"gov.uk",S_OK
,FALSE
},
2405 {"zip://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2411 {Uri_HOST_DNS
,S_OK
,FALSE
},
2413 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2414 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2417 /* Dot removal doesn't happen if NO_CANONICALIZE is set. */
2418 { "http://gov.uk/test/test2/../../.", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2420 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2421 {"gov.uk",S_OK
,FALSE
},
2422 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2426 {"gov.uk",S_OK
,FALSE
},
2428 {"/test/test2/../../.",S_OK
,FALSE
},
2429 {"/test/test2/../../.",S_OK
,FALSE
},
2431 {"http://gov.uk/test/test2/../../.",S_OK
,FALSE
},
2432 {"http",S_OK
,FALSE
},
2437 {Uri_HOST_DNS
,S_OK
,FALSE
},
2439 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2440 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2443 /* Dot removal doesn't happen for wildcard scheme types. */
2444 { "*:gov.uk/test/test2/../../.", 0, S_OK
, FALSE
,
2446 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2447 {"gov.uk",S_OK
,FALSE
},
2448 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2452 {"gov.uk",S_OK
,FALSE
},
2454 {"/test/test2/../../.",S_OK
,FALSE
},
2455 {"/test/test2/../../.",S_OK
,FALSE
},
2457 {"*:gov.uk/test/test2/../../.",S_OK
,FALSE
},
2463 {Uri_HOST_DNS
,S_OK
,FALSE
},
2465 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
2466 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2469 /* Forbidden characters are encoded for opaque known scheme types. */
2470 { "mailto:\"acco<|>unt@example.com\"", 0, S_OK
, FALSE
,
2472 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2474 {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2476 {".com%22",S_OK
,FALSE
},
2480 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2481 {"%22acco%3C%7C%3Eunt@example.com%22",S_OK
,FALSE
},
2483 {"mailto:\"acco<|>unt@example.com\"",S_OK
,FALSE
},
2484 {"mailto",S_OK
,FALSE
},
2489 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2491 {URL_SCHEME_MAILTO
,S_OK
,FALSE
},
2492 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2495 { "news:test.tes<|>t.com", 0, S_OK
, FALSE
,
2497 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2499 {"news:test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2501 {".com",S_OK
,FALSE
},
2505 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2506 {"test.tes%3C%7C%3Et.com",S_OK
,FALSE
},
2508 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2509 {"news",S_OK
,FALSE
},
2514 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2516 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2517 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2520 /* Don't encode forbidden characters. */
2521 { "news:test.tes<|>t.com", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2523 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2525 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2527 {".com",S_OK
,FALSE
},
2531 {"test.tes<|>t.com",S_OK
,FALSE
},
2532 {"test.tes<|>t.com",S_OK
,FALSE
},
2534 {"news:test.tes<|>t.com",S_OK
,FALSE
},
2535 {"news",S_OK
,FALSE
},
2540 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2542 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2543 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2546 /* Forbidden characters aren't encoded for unknown, opaque URIs. */
2547 { "urn:test.tes<|>t.com", 0, S_OK
, FALSE
,
2549 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2551 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2553 {".com",S_OK
,FALSE
},
2557 {"test.tes<|>t.com",S_OK
,FALSE
},
2558 {"test.tes<|>t.com",S_OK
,FALSE
},
2560 {"urn:test.tes<|>t.com",S_OK
,FALSE
},
2566 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2568 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2569 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2572 /* Percent encoded unreserved characters are decoded for known opaque URIs. */
2573 { "news:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2575 {"news:test.test.com",S_OK
,FALSE
},
2577 {"news:test.test.com",S_OK
,FALSE
},
2579 {".com",S_OK
,FALSE
},
2583 {"test.test.com",S_OK
,FALSE
},
2584 {"test.test.com",S_OK
,FALSE
},
2586 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2587 {"news",S_OK
,FALSE
},
2592 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2594 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2595 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2598 /* Percent encoded characters are still decoded for known scheme types. */
2599 { "news:test.%74%65%73%74.com", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2601 {"news:test.test.com",S_OK
,FALSE
},
2603 {"news:test.test.com",S_OK
,FALSE
},
2605 {".com",S_OK
,FALSE
},
2609 {"test.test.com",S_OK
,FALSE
},
2610 {"test.test.com",S_OK
,FALSE
},
2612 {"news:test.%74%65%73%74.com",S_OK
,FALSE
},
2613 {"news",S_OK
,FALSE
},
2618 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2620 {URL_SCHEME_NEWS
,S_OK
,FALSE
},
2621 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2624 /* Percent encoded characters aren't decoded for unknown scheme types. */
2625 { "urn:test.%74%65%73%74.com", 0, S_OK
, FALSE
,
2627 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2629 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2631 {".com",S_OK
,FALSE
},
2635 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2636 {"test.%74%65%73%74.com",S_OK
,FALSE
},
2638 {"urn:test.%74%65%73%74.com",S_OK
,FALSE
},
2644 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
2646 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2647 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
2650 /* Unknown scheme types can have invalid % encoded data in query string. */
2651 { "zip://www.winehq.org/tests/..?query=%xx&return=y", 0, S_OK
, FALSE
,
2653 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2654 {"www.winehq.org",S_OK
,FALSE
},
2655 {"zip://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2656 {"winehq.org",S_OK
,FALSE
},
2659 {"www.winehq.org",S_OK
,FALSE
},
2662 {"/?query=%xx&return=y",S_OK
,FALSE
},
2663 {"?query=%xx&return=y",S_OK
,FALSE
},
2664 {"zip://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2670 {Uri_HOST_DNS
,S_OK
,FALSE
},
2672 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2673 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2676 /* Known scheme types can have invalid % encoded data with the right flags. */
2677 { "http://www.winehq.org/tests/..?query=%xx&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2679 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2680 {"www.winehq.org",S_OK
,FALSE
},
2681 {"http://www.winehq.org/?query=%xx&return=y",S_OK
,FALSE
},
2682 {"winehq.org",S_OK
,FALSE
},
2685 {"www.winehq.org",S_OK
,FALSE
},
2688 {"/?query=%xx&return=y",S_OK
,FALSE
},
2689 {"?query=%xx&return=y",S_OK
,FALSE
},
2690 {"http://www.winehq.org/tests/..?query=%xx&return=y",S_OK
,FALSE
},
2691 {"http",S_OK
,FALSE
},
2696 {Uri_HOST_DNS
,S_OK
,FALSE
},
2698 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2699 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2702 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2703 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2705 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2706 {"www.winehq.org",S_OK
,FALSE
},
2707 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2708 {"winehq.org",S_OK
,FALSE
},
2711 {"www.winehq.org",S_OK
,FALSE
},
2714 {"/?query=<|>&return=y",S_OK
,FALSE
},
2715 {"?query=<|>&return=y",S_OK
,FALSE
},
2716 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2717 {"http",S_OK
,FALSE
},
2722 {Uri_HOST_DNS
,S_OK
,FALSE
},
2724 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2725 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2728 /* Forbidden characters in query aren't percent encoded for known scheme types with this flag. */
2729 { "http://www.winehq.org/tests/..?query=<|>&return=y", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
2731 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2732 {"www.winehq.org",S_OK
,FALSE
},
2733 {"http://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2734 {"winehq.org",S_OK
,FALSE
},
2737 {"www.winehq.org",S_OK
,FALSE
},
2740 {"/?query=<|>&return=y",S_OK
,FALSE
},
2741 {"?query=<|>&return=y",S_OK
,FALSE
},
2742 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2743 {"http",S_OK
,FALSE
},
2748 {Uri_HOST_DNS
,S_OK
,FALSE
},
2750 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2751 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2754 /* Forbidden characters are encoded for known scheme types. */
2755 { "http://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2757 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2758 {"www.winehq.org",S_OK
,FALSE
},
2759 {"http://www.winehq.org/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2760 {"winehq.org",S_OK
,FALSE
},
2763 {"www.winehq.org",S_OK
,FALSE
},
2766 {"/?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2767 {"?query=%3C%7C%3E&return=y",S_OK
,FALSE
},
2768 {"http://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2769 {"http",S_OK
,FALSE
},
2774 {Uri_HOST_DNS
,S_OK
,FALSE
},
2776 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2777 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2780 /* Forbidden characters are not encoded for unknown scheme types. */
2781 { "zip://www.winehq.org/tests/..?query=<|>&return=y", 0, S_OK
, FALSE
,
2783 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2784 {"www.winehq.org",S_OK
,FALSE
},
2785 {"zip://www.winehq.org/?query=<|>&return=y",S_OK
,FALSE
},
2786 {"winehq.org",S_OK
,FALSE
},
2789 {"www.winehq.org",S_OK
,FALSE
},
2792 {"/?query=<|>&return=y",S_OK
,FALSE
},
2793 {"?query=<|>&return=y",S_OK
,FALSE
},
2794 {"zip://www.winehq.org/tests/..?query=<|>&return=y",S_OK
,FALSE
},
2800 {Uri_HOST_DNS
,S_OK
,FALSE
},
2802 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2803 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2806 /* Percent encoded, unreserved characters are decoded for known scheme types. */
2807 { "http://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2809 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2810 {"www.winehq.org",S_OK
,FALSE
},
2811 {"http://www.winehq.org/?query=01&return=y",S_OK
,FALSE
},
2812 {"winehq.org",S_OK
,FALSE
},
2815 {"www.winehq.org",S_OK
,FALSE
},
2818 {"/?query=01&return=y",S_OK
,FALSE
},
2819 {"?query=01&return=y",S_OK
,FALSE
},
2820 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2821 {"http",S_OK
,FALSE
},
2826 {Uri_HOST_DNS
,S_OK
,FALSE
},
2828 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2829 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2832 /* Percent encoded, unreserved characters aren't decoded for unknown scheme types. */
2833 { "zip://www.winehq.org/tests/..?query=%30%31&return=y", 0, S_OK
, FALSE
,
2835 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2836 {"www.winehq.org",S_OK
,FALSE
},
2837 {"zip://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2838 {"winehq.org",S_OK
,FALSE
},
2841 {"www.winehq.org",S_OK
,FALSE
},
2844 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2845 {"?query=%30%31&return=y",S_OK
,FALSE
},
2846 {"zip://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2852 {Uri_HOST_DNS
,S_OK
,FALSE
},
2854 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2855 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2858 /* Percent encoded characters aren't decoded when NO_DECODE_EXTRA_INFO is set. */
2859 { "http://www.winehq.org/tests/..?query=%30%31&return=y", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2861 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2862 {"www.winehq.org",S_OK
,FALSE
},
2863 {"http://www.winehq.org/?query=%30%31&return=y",S_OK
,FALSE
},
2864 {"winehq.org",S_OK
,FALSE
},
2867 {"www.winehq.org",S_OK
,FALSE
},
2870 {"/?query=%30%31&return=y",S_OK
,FALSE
},
2871 {"?query=%30%31&return=y",S_OK
,FALSE
},
2872 {"http://www.winehq.org/tests/..?query=%30%31&return=y",S_OK
,FALSE
},
2873 {"http",S_OK
,FALSE
},
2878 {Uri_HOST_DNS
,S_OK
,FALSE
},
2880 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2881 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2884 { "http://www.winehq.org?query=12&return=y", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
2886 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2887 {"www.winehq.org",S_OK
,FALSE
},
2888 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2889 {"winehq.org",S_OK
,FALSE
},
2892 {"www.winehq.org",S_OK
,FALSE
},
2895 {"?query=12&return=y",S_OK
,FALSE
},
2896 {"?query=12&return=y",S_OK
,FALSE
},
2897 {"http://www.winehq.org?query=12&return=y",S_OK
,FALSE
},
2898 {"http",S_OK
,FALSE
},
2903 {Uri_HOST_DNS
,S_OK
,FALSE
},
2905 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2906 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2909 /* Unknown scheme types can have invalid % encoded data in fragments. */
2910 { "zip://www.winehq.org/tests/#Te%xx", 0, S_OK
, FALSE
,
2912 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2913 {"www.winehq.org",S_OK
,FALSE
},
2914 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2915 {"winehq.org",S_OK
,FALSE
},
2917 {"#Te%xx",S_OK
,FALSE
},
2918 {"www.winehq.org",S_OK
,FALSE
},
2920 {"/tests/",S_OK
,FALSE
},
2921 {"/tests/",S_OK
,FALSE
},
2923 {"zip://www.winehq.org/tests/#Te%xx",S_OK
,FALSE
},
2929 {Uri_HOST_DNS
,S_OK
,FALSE
},
2931 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2932 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2935 /* Forbidden characters in fragment aren't encoded for unknown schemes. */
2936 { "zip://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2938 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2939 {"www.winehq.org",S_OK
,FALSE
},
2940 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2941 {"winehq.org",S_OK
,FALSE
},
2943 {"#Te<|>",S_OK
,FALSE
},
2944 {"www.winehq.org",S_OK
,FALSE
},
2946 {"/tests/",S_OK
,FALSE
},
2947 {"/tests/",S_OK
,FALSE
},
2949 {"zip://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2955 {Uri_HOST_DNS
,S_OK
,FALSE
},
2957 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
2958 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2961 /* Forbidden characters in the fragment are percent encoded for known schemes. */
2962 { "http://www.winehq.org/tests/#Te<|>", 0, S_OK
, FALSE
,
2964 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2965 {"www.winehq.org",S_OK
,FALSE
},
2966 {"http://www.winehq.org/tests/#Te%3C%7C%3E",S_OK
,FALSE
},
2967 {"winehq.org",S_OK
,FALSE
},
2969 {"#Te%3C%7C%3E",S_OK
,FALSE
},
2970 {"www.winehq.org",S_OK
,FALSE
},
2972 {"/tests/",S_OK
,FALSE
},
2973 {"/tests/",S_OK
,FALSE
},
2975 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2976 {"http",S_OK
,FALSE
},
2981 {Uri_HOST_DNS
,S_OK
,FALSE
},
2983 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
2984 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
2987 /* Forbidden characters aren't encoded in the fragment with this flag. */
2988 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
2990 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2991 {"www.winehq.org",S_OK
,FALSE
},
2992 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
2993 {"winehq.org",S_OK
,FALSE
},
2995 {"#Te<|>",S_OK
,FALSE
},
2996 {"www.winehq.org",S_OK
,FALSE
},
2998 {"/tests/",S_OK
,FALSE
},
2999 {"/tests/",S_OK
,FALSE
},
3001 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3002 {"http",S_OK
,FALSE
},
3007 {Uri_HOST_DNS
,S_OK
,FALSE
},
3009 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3010 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3013 /* Forbidden characters aren't encoded in the fragment with this flag. */
3014 { "http://www.winehq.org/tests/#Te<|>", Uri_CREATE_NO_ENCODE_FORBIDDEN_CHARACTERS
, S_OK
, FALSE
,
3016 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3017 {"www.winehq.org",S_OK
,FALSE
},
3018 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3019 {"winehq.org",S_OK
,FALSE
},
3021 {"#Te<|>",S_OK
,FALSE
},
3022 {"www.winehq.org",S_OK
,FALSE
},
3024 {"/tests/",S_OK
,FALSE
},
3025 {"/tests/",S_OK
,FALSE
},
3027 {"http://www.winehq.org/tests/#Te<|>",S_OK
,FALSE
},
3028 {"http",S_OK
,FALSE
},
3033 {Uri_HOST_DNS
,S_OK
,FALSE
},
3035 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3036 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3039 /* Percent encoded, unreserved characters aren't decoded for known scheme types. */
3040 { "zip://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3042 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3043 {"www.winehq.org",S_OK
,FALSE
},
3044 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3045 {"winehq.org",S_OK
,FALSE
},
3047 {"#Te%30%31%32",S_OK
,FALSE
},
3048 {"www.winehq.org",S_OK
,FALSE
},
3050 {"/tests/",S_OK
,FALSE
},
3051 {"/tests/",S_OK
,FALSE
},
3053 {"zip://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3059 {Uri_HOST_DNS
,S_OK
,FALSE
},
3061 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3062 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3065 /* Percent encoded, unreserved characters are decoded for known schemes. */
3066 { "http://www.winehq.org/tests/#Te%30%31%32", 0, S_OK
, FALSE
,
3068 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3069 {"www.winehq.org",S_OK
,FALSE
},
3070 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3071 {"winehq.org",S_OK
,FALSE
},
3073 {"#Te012",S_OK
,FALSE
},
3074 {"www.winehq.org",S_OK
,FALSE
},
3076 {"/tests/",S_OK
,FALSE
},
3077 {"/tests/",S_OK
,FALSE
},
3079 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3080 {"http",S_OK
,FALSE
},
3085 {Uri_HOST_DNS
,S_OK
,FALSE
},
3087 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3088 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3091 /* Percent encoded, unreserved characters are decoded even if NO_CANONICALIZE is set. */
3092 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3094 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3095 {"www.winehq.org",S_OK
,FALSE
},
3096 {"http://www.winehq.org/tests/#Te012",S_OK
,FALSE
},
3097 {"winehq.org",S_OK
,FALSE
},
3099 {"#Te012",S_OK
,FALSE
},
3100 {"www.winehq.org",S_OK
,FALSE
},
3102 {"/tests/",S_OK
,FALSE
},
3103 {"/tests/",S_OK
,FALSE
},
3105 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3106 {"http",S_OK
,FALSE
},
3111 {Uri_HOST_DNS
,S_OK
,FALSE
},
3113 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3114 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3117 /* Percent encoded, unreserved characters aren't decoded when NO_DECODE_EXTRA is set. */
3118 { "http://www.winehq.org/tests/#Te%30%31%32", Uri_CREATE_NO_DECODE_EXTRA_INFO
, S_OK
, FALSE
,
3120 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3121 {"www.winehq.org",S_OK
,FALSE
},
3122 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3123 {"winehq.org",S_OK
,FALSE
},
3125 {"#Te%30%31%32",S_OK
,FALSE
},
3126 {"www.winehq.org",S_OK
,FALSE
},
3128 {"/tests/",S_OK
,FALSE
},
3129 {"/tests/",S_OK
,FALSE
},
3131 {"http://www.winehq.org/tests/#Te%30%31%32",S_OK
,FALSE
},
3132 {"http",S_OK
,FALSE
},
3137 {Uri_HOST_DNS
,S_OK
,FALSE
},
3139 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3140 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
3143 /* Leading/Trailing whitespace is removed. */
3144 { " http://google.com/ ", 0, S_OK
, FALSE
,
3146 {"http://google.com/",S_OK
,FALSE
},
3147 {"google.com",S_OK
,FALSE
},
3148 {"http://google.com/",S_OK
,FALSE
},
3149 {"google.com",S_OK
,FALSE
},
3152 {"google.com",S_OK
,FALSE
},
3157 {"http://google.com/",S_OK
,FALSE
},
3158 {"http",S_OK
,FALSE
},
3163 {Uri_HOST_DNS
,S_OK
,FALSE
},
3165 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3166 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3169 { "\t\t\r\nhttp\n://g\noogle.co\rm/\n\n\n", 0, S_OK
, FALSE
,
3171 {"http://google.com/",S_OK
,FALSE
},
3172 {"google.com",S_OK
,FALSE
},
3173 {"http://google.com/",S_OK
,FALSE
},
3174 {"google.com",S_OK
,FALSE
},
3177 {"google.com",S_OK
,FALSE
},
3182 {"http://google.com/",S_OK
,FALSE
},
3183 {"http",S_OK
,FALSE
},
3188 {Uri_HOST_DNS
,S_OK
,FALSE
},
3190 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3191 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3194 { "http://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3196 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3197 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3198 {"http://g%0aoogle.co%0dm/%0A%0A%0A",S_OK
,FALSE
},
3199 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3202 {"g%0aoogle.co%0dm",S_OK
,FALSE
},
3204 {"/%0A%0A%0A",S_OK
,FALSE
},
3205 {"/%0A%0A%0A",S_OK
,FALSE
},
3207 {"http://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3208 {"http",S_OK
,FALSE
},
3213 {Uri_HOST_DNS
,S_OK
,FALSE
},
3215 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3216 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3219 { "zip://g\noogle.co\rm/\n\n\n", Uri_CREATE_NO_PRE_PROCESS_HTML_URI
, S_OK
, FALSE
,
3221 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3222 {"g\noogle.co\rm",S_OK
,FALSE
},
3223 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3224 {"g\noogle.co\rm",S_OK
,FALSE
},
3227 {"g\noogle.co\rm",S_OK
,FALSE
},
3229 {"/\n\n\n",S_OK
,FALSE
},
3230 {"/\n\n\n",S_OK
,FALSE
},
3232 {"zip://g\noogle.co\rm/\n\n\n",S_OK
,FALSE
},
3238 {Uri_HOST_DNS
,S_OK
,FALSE
},
3240 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3241 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3244 /* Since file URLs are usually hierarchical, it returns an empty string
3245 * for the absolute URI property since it was declared as an opaque URI.
3247 { "file:index.html", 0, S_OK
, FALSE
,
3251 {"file:index.html",S_OK
,FALSE
},
3253 {".html",S_OK
,FALSE
},
3257 {"index.html",S_OK
,FALSE
},
3258 {"index.html",S_OK
,FALSE
},
3260 {"file:index.html",S_OK
,FALSE
},
3261 {"file",S_OK
,FALSE
},
3266 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3268 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3269 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3272 /* Doesn't have an absolute since it's opaque, but gets it port set. */
3273 { "http:test.com/index.html", 0, S_OK
, FALSE
,
3277 {"http:test.com/index.html",S_OK
,FALSE
},
3279 {".html",S_OK
,FALSE
},
3283 {"test.com/index.html",S_OK
,FALSE
},
3284 {"test.com/index.html",S_OK
,FALSE
},
3286 {"http:test.com/index.html",S_OK
,FALSE
},
3287 {"http",S_OK
,FALSE
},
3292 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3294 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3295 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3298 { "ftp:test.com/index.html", 0, S_OK
, FALSE
,
3302 {"ftp:test.com/index.html",S_OK
,FALSE
},
3304 {".html",S_OK
,FALSE
},
3308 {"test.com/index.html",S_OK
,FALSE
},
3309 {"test.com/index.html",S_OK
,FALSE
},
3311 {"ftp:test.com/index.html",S_OK
,FALSE
},
3317 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3319 {URL_SCHEME_FTP
,S_OK
,FALSE
},
3320 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3323 { "file://C|/test.mp3", 0, S_OK
, FALSE
,
3325 {"file:///C:/test.mp3",S_OK
,FALSE
},
3327 {"file:///C:/test.mp3",S_OK
,FALSE
},
3329 {".mp3",S_OK
,FALSE
},
3333 {"/C:/test.mp3",S_OK
,FALSE
},
3334 {"/C:/test.mp3",S_OK
,FALSE
},
3336 {"file://C|/test.mp3",S_OK
,FALSE
},
3337 {"file",S_OK
,FALSE
},
3342 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3344 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3345 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3348 { "file:///C|/test.mp3", 0, S_OK
, FALSE
,
3350 {"file:///C:/test.mp3",S_OK
,FALSE
},
3352 {"file:///C:/test.mp3",S_OK
,FALSE
},
3354 {".mp3",S_OK
,FALSE
},
3358 {"/C:/test.mp3",S_OK
,FALSE
},
3359 {"/C:/test.mp3",S_OK
,FALSE
},
3361 {"file:///C|/test.mp3",S_OK
,FALSE
},
3362 {"file",S_OK
,FALSE
},
3367 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3369 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3370 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3373 /* Extra '/' isn't added before "c:" since USE_DOS_PATH is set and '/' are converted
3376 { "file://c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3378 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3380 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3382 {".html",S_OK
,FALSE
},
3386 {"c:\\dir\\index.html",S_OK
,FALSE
},
3387 {"c:\\dir\\index.html",S_OK
,FALSE
},
3389 {"file://c:/dir/index.html",S_OK
,FALSE
},
3390 {"file",S_OK
,FALSE
},
3395 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3397 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3398 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3401 /* Extra '/' after "file://" is removed. */
3402 { "file:///c:/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3404 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3406 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3408 {".html",S_OK
,FALSE
},
3412 {"c:\\dir\\index.html",S_OK
,FALSE
},
3413 {"c:\\dir\\index.html",S_OK
,FALSE
},
3415 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3416 {"file",S_OK
,FALSE
},
3421 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3423 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3424 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3427 /* Allow more characters when Uri_CREATE_FILE_USE_DOS_PATH is specified */
3428 { "file:///c:/dir\\%%61%20%5Fname/file%2A.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3430 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3432 {"file://c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3434 {".html",S_OK
,FALSE
},
3438 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3439 {"c:\\dir\\%a _name\\file*.html",S_OK
,FALSE
},
3441 {"file:///c:/dir\\%%61%20%5Fname/file%2A.html",S_OK
,FALSE
},
3442 {"file",S_OK
,FALSE
},
3447 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3449 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3450 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3453 { "file://c|/dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3455 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3457 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3459 {".html",S_OK
,FALSE
},
3463 {"c:\\dir\\index.html",S_OK
,FALSE
},
3464 {"c:\\dir\\index.html",S_OK
,FALSE
},
3466 {"file://c|/dir\\index.html",S_OK
,FALSE
},
3467 {"file",S_OK
,FALSE
},
3472 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3474 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3475 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3478 /* The backslashes after the scheme name are converted to forward slashes. */
3479 { "file:\\\\c:\\dir\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3481 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3483 {"file://c:\\dir\\index.html",S_OK
,FALSE
},
3485 {".html",S_OK
,FALSE
},
3489 {"c:\\dir\\index.html",S_OK
,FALSE
},
3490 {"c:\\dir\\index.html",S_OK
,FALSE
},
3492 {"file:\\\\c:\\dir\\index.html",S_OK
,FALSE
},
3493 {"file",S_OK
,FALSE
},
3498 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3500 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3501 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3504 { "file:\\\\c:/dir/index.html", 0, S_OK
, FALSE
,
3506 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3508 {"file:///c:/dir/index.html",S_OK
,FALSE
},
3510 {".html",S_OK
,FALSE
},
3514 {"/c:/dir/index.html",S_OK
,FALSE
},
3515 {"/c:/dir/index.html",S_OK
,FALSE
},
3517 {"file:\\\\c:/dir/index.html",S_OK
,FALSE
},
3518 {"file",S_OK
,FALSE
},
3523 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3525 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3526 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3529 { "http:\\\\google.com", 0, S_OK
, FALSE
,
3531 {"http://google.com/",S_OK
,FALSE
},
3532 {"google.com",S_OK
,FALSE
},
3533 {"http://google.com/",S_OK
,FALSE
},
3534 {"google.com",S_OK
,FALSE
},
3537 {"google.com",S_OK
,FALSE
},
3542 {"http:\\\\google.com",S_OK
,FALSE
},
3543 {"http",S_OK
,FALSE
},
3548 {Uri_HOST_DNS
,S_OK
,FALSE
},
3550 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3551 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3554 /* the "\\\\" aren't converted to "//" for unknown scheme types and it's considered opaque. */
3555 { "zip:\\\\google.com", 0, S_OK
, FALSE
,
3557 {"zip:\\\\google.com",S_OK
,FALSE
},
3559 {"zip:\\\\google.com",S_OK
,FALSE
},
3561 {".com",S_OK
,FALSE
},
3565 {"\\\\google.com",S_OK
,FALSE
},
3566 {"\\\\google.com",S_OK
,FALSE
},
3568 {"zip:\\\\google.com",S_OK
,FALSE
},
3574 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3576 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3577 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3580 /* Dot segments aren't removed. */
3581 { "file://c:\\dir\\../..\\./index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3583 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3585 {"file://c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3587 {".html",S_OK
,FALSE
},
3591 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3592 {"c:\\dir\\..\\..\\.\\index.html",S_OK
,FALSE
},
3594 {"file://c:\\dir\\../..\\./index.html",S_OK
,FALSE
},
3595 {"file",S_OK
,FALSE
},
3600 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3602 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3603 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3606 /* Forbidden characters aren't percent encoded. */
3607 { "file://c:\\dir\\i^|ndex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3609 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3611 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3613 {".html",S_OK
,FALSE
},
3617 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3618 {"c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3620 {"file://c:\\dir\\i^|ndex.html",S_OK
,FALSE
},
3621 {"file",S_OK
,FALSE
},
3626 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3628 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3629 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3632 /* The '\' are still converted to '/' even though it's an opaque file URI. */
3633 { "file:c:\\dir\\../..\\index.html", 0, S_OK
, FALSE
,
3637 {"file:c:/dir/../../index.html",S_OK
,FALSE
},
3639 {".html",S_OK
,FALSE
},
3643 {"c:/dir/../../index.html",S_OK
,FALSE
},
3644 {"c:/dir/../../index.html",S_OK
,FALSE
},
3646 {"file:c:\\dir\\../..\\index.html",S_OK
,FALSE
},
3647 {"file",S_OK
,FALSE
},
3652 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3654 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3655 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3658 /* '/' are still converted to '\' even though it's an opaque URI. */
3659 { "file:c:/dir\\../..\\index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3663 {"file:c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3665 {".html",S_OK
,FALSE
},
3669 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3670 {"c:\\dir\\..\\..\\index.html",S_OK
,FALSE
},
3672 {"file:c:/dir\\../..\\index.html",S_OK
,FALSE
},
3673 {"file",S_OK
,FALSE
},
3678 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3680 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3681 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3684 /* Forbidden characters aren't percent encoded. */
3685 { "file:c:\\in^|dex.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3689 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3691 {".html",S_OK
,FALSE
},
3695 {"c:\\in^|dex.html",S_OK
,FALSE
},
3696 {"c:\\in^|dex.html",S_OK
,FALSE
},
3698 {"file:c:\\in^|dex.html",S_OK
,FALSE
},
3699 {"file",S_OK
,FALSE
},
3704 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3706 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3707 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3710 /* Doesn't have a UserName since the ':' appears at the beginning of the
3713 { "http://:password@gov.uk", 0, S_OK
, FALSE
,
3715 {"http://:password@gov.uk/",S_OK
,FALSE
},
3716 {":password@gov.uk",S_OK
,FALSE
},
3717 {"http://gov.uk/",S_OK
,FALSE
},
3721 {"gov.uk",S_OK
,FALSE
},
3722 {"password",S_OK
,FALSE
},
3726 {"http://:password@gov.uk",S_OK
,FALSE
},
3727 {"http",S_OK
,FALSE
},
3728 {":password",S_OK
,FALSE
},
3732 {Uri_HOST_DNS
,S_OK
,FALSE
},
3734 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3735 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3738 /* Has a UserName since the userinfo section doesn't contain a password. */
3739 { "http://@gov.uk", 0, S_OK
, FALSE
,
3741 {"http://gov.uk/",S_OK
,FALSE
,"http://@gov.uk/"},
3742 {"@gov.uk",S_OK
,FALSE
},
3743 {"http://gov.uk/",S_OK
,FALSE
},
3747 {"gov.uk",S_OK
,FALSE
},
3752 {"http://@gov.uk",S_OK
,FALSE
},
3753 {"http",S_OK
,FALSE
},
3758 {Uri_HOST_DNS
,S_OK
,FALSE
},
3760 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3761 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3764 /* ":@" not included in the absolute URI. */
3765 { "http://:@gov.uk", 0, S_OK
, FALSE
,
3767 {"http://gov.uk/",S_OK
,FALSE
,"http://:@gov.uk/"},
3768 {":@gov.uk",S_OK
,FALSE
},
3769 {"http://gov.uk/",S_OK
,FALSE
},
3773 {"gov.uk",S_OK
,FALSE
},
3778 {"http://:@gov.uk",S_OK
,FALSE
},
3779 {"http",S_OK
,FALSE
},
3784 {Uri_HOST_DNS
,S_OK
,FALSE
},
3786 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3787 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3790 /* '@' is included because it's an unknown scheme type. */
3791 { "zip://@gov.uk", 0, S_OK
, FALSE
,
3793 {"zip://@gov.uk/",S_OK
,FALSE
},
3794 {"@gov.uk",S_OK
,FALSE
},
3795 {"zip://@gov.uk/",S_OK
,FALSE
},
3799 {"gov.uk",S_OK
,FALSE
},
3804 {"zip://@gov.uk",S_OK
,FALSE
},
3810 {Uri_HOST_DNS
,S_OK
,FALSE
},
3812 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3813 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3816 /* ":@" are included because it's an unknown scheme type. */
3817 { "zip://:@gov.uk", 0, S_OK
, FALSE
,
3819 {"zip://:@gov.uk/",S_OK
,FALSE
},
3820 {":@gov.uk",S_OK
,FALSE
},
3821 {"zip://:@gov.uk/",S_OK
,FALSE
},
3825 {"gov.uk",S_OK
,FALSE
},
3830 {"zip://:@gov.uk",S_OK
,FALSE
},
3836 {Uri_HOST_DNS
,S_OK
,FALSE
},
3838 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
3839 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3842 { "about:blank", 0, S_OK
, FALSE
,
3844 {"about:blank",S_OK
,FALSE
},
3846 {"about:blank",S_OK
,FALSE
},
3852 {"blank",S_OK
,FALSE
},
3853 {"blank",S_OK
,FALSE
},
3855 {"about:blank",S_OK
,FALSE
},
3856 {"about",S_OK
,FALSE
},
3861 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3863 {URL_SCHEME_ABOUT
,S_OK
,FALSE
},
3864 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3867 { "mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",0,S_OK
,FALSE
,
3869 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3871 {"mk:@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3873 {".htm",S_OK
,FALSE
},
3877 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3878 {"@MSITStore:C:\\Program%20Files/AutoCAD%202008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3880 {"mk:@MSITStore:C:\\Program Files/AutoCAD 2008\\Help/acad_acg.chm::/WSfacf1429558a55de1a7524c1004e616f8b-322b.htm",S_OK
,FALSE
},
3886 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3888 {URL_SCHEME_MK
,S_OK
,FALSE
},
3889 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3892 { "mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",0,S_OK
,FALSE
,
3894 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3896 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3898 {".htm",S_OK
,FALSE
},
3902 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3903 {"@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3905 {"mk:@MSITStore:Z:\\home\\test\\chm\\silqhelp.chm::/thesilqquickstartguide.htm",S_OK
,FALSE
},
3911 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3913 {URL_SCHEME_MK
,S_OK
,FALSE
},
3914 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3917 /* Two '\' are added to the URI when USE_DOS_PATH is set, and it's a UNC path. */
3918 { "file://server/dir/index.html", Uri_CREATE_FILE_USE_DOS_PATH
, S_OK
, FALSE
,
3920 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3921 {"server",S_OK
,FALSE
},
3922 {"file://\\\\server\\dir\\index.html",S_OK
,FALSE
},
3924 {".html",S_OK
,FALSE
},
3926 {"server",S_OK
,FALSE
},
3928 {"\\dir\\index.html",S_OK
,FALSE
},
3929 {"\\dir\\index.html",S_OK
,FALSE
},
3931 {"file://server/dir/index.html",S_OK
,FALSE
},
3932 {"file",S_OK
,FALSE
},
3937 {Uri_HOST_DNS
,S_OK
,FALSE
},
3939 {URL_SCHEME_FILE
,S_OK
,FALSE
},
3940 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3943 /* When CreateUri generates an IUri, it still displays the default port in the
3946 { "http://google.com:80/", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
3948 {"http://google.com:80/",S_OK
,FALSE
},
3949 {"google.com:80",S_OK
,FALSE
},
3950 {"http://google.com:80/",S_OK
,FALSE
},
3951 {"google.com",S_OK
,FALSE
},
3954 {"google.com",S_OK
,FALSE
},
3959 {"http://google.com:80/",S_OK
,FALSE
},
3960 {"http",S_OK
,FALSE
},
3965 {Uri_HOST_DNS
,S_OK
,FALSE
},
3967 {URL_SCHEME_HTTP
,S_OK
,FALSE
},
3968 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3971 /* For res URIs the host is everything up until the first '/'. */
3972 { "res://C:\\dir\\file.exe/DATA/test.html", 0, S_OK
, FALSE
,
3974 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3975 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3976 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3978 {".html",S_OK
,FALSE
},
3980 {"C:\\dir\\file.exe",S_OK
,FALSE
},
3982 {"/DATA/test.html",S_OK
,FALSE
},
3983 {"/DATA/test.html",S_OK
,FALSE
},
3985 {"res://C:\\dir\\file.exe/DATA/test.html",S_OK
,FALSE
},
3991 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
3993 {URL_SCHEME_RES
,S_OK
,FALSE
},
3994 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
3997 /* Res URI can contain a '|' in the host name. */
3998 { "res://c:\\di|r\\file.exe/test", 0, S_OK
, FALSE
,
4000 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4001 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4002 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4006 {"c:\\di|r\\file.exe",S_OK
,FALSE
},
4008 {"/test",S_OK
,FALSE
},
4009 {"/test",S_OK
,FALSE
},
4011 {"res://c:\\di|r\\file.exe/test",S_OK
,FALSE
},
4017 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4019 {URL_SCHEME_RES
,S_OK
,FALSE
},
4020 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
},
4023 /* Res URIs can have invalid percent encoded values. */
4024 { "res://c:\\dir%xx\\file.exe/test", 0, S_OK
, FALSE
,
4026 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4027 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4028 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4032 {"c:\\dir%xx\\file.exe",S_OK
,FALSE
},
4034 {"/test",S_OK
,FALSE
},
4035 {"/test",S_OK
,FALSE
},
4037 {"res://c:\\dir%xx\\file.exe/test",S_OK
,FALSE
},
4043 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4045 {URL_SCHEME_RES
,S_OK
,FALSE
},
4046 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4049 /* Res doesn't get forbidden characters percent encoded in it's path. */
4050 { "res://c:\\test/tes<|>t", 0, S_OK
, FALSE
,
4052 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4053 {"c:\\test",S_OK
,FALSE
},
4054 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4058 {"c:\\test",S_OK
,FALSE
},
4060 {"/tes<|>t",S_OK
,FALSE
},
4061 {"/tes<|>t",S_OK
,FALSE
},
4063 {"res://c:\\test/tes<|>t",S_OK
,FALSE
},
4069 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4071 {URL_SCHEME_RES
,S_OK
,FALSE
},
4072 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4075 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4077 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4079 {"mk:@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4081 {".jpg",S_OK
,FALSE
},
4085 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4086 {"@MSITStore:Z:\\dir\\test.chm::/images/xxx.jpg",S_OK
,FALSE
},
4088 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4094 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4096 {URL_SCHEME_MK
,S_OK
,FALSE
},
4097 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4100 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", Uri_CREATE_NO_CANONICALIZE
, S_OK
, FALSE
,
4102 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4104 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4106 {".jpg",S_OK
,FALSE
},
4110 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4111 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4113 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4119 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4121 {URL_SCHEME_MK
,S_OK
,FALSE
},
4122 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4125 { "xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg", 0, S_OK
, FALSE
,
4127 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4129 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4131 {".jpg",S_OK
,FALSE
},
4135 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4136 {"@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4138 {"xx:@MSITStore:Z:\\dir\\test.chm::/html/../images/xxx.jpg",S_OK
,FALSE
},
4144 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4146 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4147 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4150 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4152 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4154 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4156 {".jpg",S_OK
,FALSE
},
4160 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4161 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4163 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4169 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4171 {URL_SCHEME_MK
,S_OK
,FALSE
},
4172 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4175 { "mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg", 0, S_OK
, FALSE
,
4177 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4179 {"mk:@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4181 {".jpg",S_OK
,FALSE
},
4185 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4186 {"@MSITStore:Z:\\dir\\images/xxx.jpg",S_OK
,FALSE
},
4188 {"mk:@MSITStore:Z:\\dir\\dir2\\..\\test.chm::/html/../../images/xxx.jpg",S_OK
,FALSE
},
4194 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4196 {URL_SCHEME_MK
,S_OK
,FALSE
},
4197 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4200 { "mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg", 0, S_OK
, FALSE
,
4202 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4204 {"mk:images/xxx.jpg",S_OK
,FALSE
},
4206 {".jpg",S_OK
,FALSE
},
4210 {"images/xxx.jpg",S_OK
,FALSE
},
4211 {"images/xxx.jpg",S_OK
,FALSE
},
4213 {"mk:@MSITStore:Z:\\dir\\test.chm::/html/../../../../images/xxx.jpg",S_OK
,FALSE
},
4219 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4221 {URL_SCHEME_MK
,S_OK
,FALSE
},
4222 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4225 { "", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4244 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4246 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4247 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4250 { " \t ", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4269 {Uri_HOST_UNKNOWN
,S_OK
,FALSE
},
4271 {URL_SCHEME_UNKNOWN
,S_OK
,FALSE
},
4272 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4275 { "javascript:void", 0, S_OK
, FALSE
,
4277 {"javascript:void",S_OK
},
4279 {"javascript:void",S_OK
},
4288 {"javascript:void",S_OK
},
4289 {"javascript",S_OK
},
4294 {Uri_HOST_UNKNOWN
,S_OK
},
4296 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4297 {URLZONE_INVALID
,E_NOTIMPL
}
4300 { "javascript://undefined", 0, S_OK
, FALSE
,
4302 {"javascript://undefined",S_OK
},
4304 {"javascript://undefined",S_OK
},
4310 {"//undefined",S_OK
},
4311 {"//undefined",S_OK
},
4313 {"javascript://undefined",S_OK
},
4314 {"javascript",S_OK
},
4319 {Uri_HOST_UNKNOWN
,S_OK
},
4321 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4322 {URLZONE_INVALID
,E_NOTIMPL
}
4325 { "JavaSCript:escape('/\\?#?')", 0, S_OK
, FALSE
,
4327 {"javascript:escape('/\\?#?')",S_OK
},
4329 {"javascript:escape('/\\?#?')",S_OK
},
4335 {"escape('/\\?#?')",S_OK
},
4336 {"escape('/\\?#?')",S_OK
},
4338 {"JavaSCript:escape('/\\?#?')",S_OK
},
4339 {"javascript",S_OK
},
4344 {Uri_HOST_UNKNOWN
,S_OK
},
4346 {URL_SCHEME_JAVASCRIPT
,S_OK
},
4347 {URLZONE_INVALID
,E_NOTIMPL
}
4350 { "*://google.com", 0, S_OK
, FALSE
,
4352 {"*:google.com/",S_OK
,FALSE
},
4353 {"google.com",S_OK
},
4354 {"*:google.com/",S_OK
,FALSE
},
4355 {"google.com",S_OK
,FALSE
},
4358 {"google.com",S_OK
,FALSE
},
4363 {"*://google.com",S_OK
,FALSE
},
4369 {Uri_HOST_DNS
,S_OK
,FALSE
},
4371 {URL_SCHEME_WILDCARD
,S_OK
,FALSE
},
4372 {URLZONE_INVALID
,E_NOTIMPL
,FALSE
}
4375 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",0,S_OK
,FALSE
,
4377 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4379 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4385 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4386 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4388 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/file.txt",S_OK
},
4394 {Uri_HOST_UNKNOWN
,S_OK
},
4396 {URL_SCHEME_MK
,S_OK
},
4397 {URLZONE_INVALID
,E_NOTIMPL
}
4400 { "gopher://test.winehq.org:151/file.txt",0,S_OK
,FALSE
,
4402 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4403 {"test.winehq.org:151",S_OK
},
4404 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4405 {"winehq.org",S_OK
},
4408 {"test.winehq.org",S_OK
},
4413 {"gopher://test.winehq.org:151/file.txt",S_OK
},
4419 {Uri_HOST_DNS
,S_OK
},
4421 {URL_SCHEME_GOPHER
,S_OK
},
4422 {URLZONE_INVALID
,E_NOTIMPL
}
4425 { "//host.com/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4427 {"//host.com/path/file.txt?query",S_OK
},
4429 {"//host.com/path/file.txt?query",S_OK
},
4435 {"/path/file.txt",S_OK
},
4436 {"/path/file.txt?query",S_OK
},
4438 {"//host.com/path/file.txt?query",S_OK
},
4444 {Uri_HOST_DNS
,S_OK
},
4446 {URL_SCHEME_UNKNOWN
,S_OK
},
4447 {URLZONE_INVALID
,E_NOTIMPL
}
4450 { "//host/path/file.txt?query", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4452 {"//host/path/file.txt?query",S_OK
},
4454 {"//host/path/file.txt?query",S_OK
},
4460 {"/path/file.txt",S_OK
},
4461 {"/path/file.txt?query",S_OK
},
4463 {"//host/path/file.txt?query",S_OK
},
4469 {Uri_HOST_DNS
,S_OK
},
4471 {URL_SCHEME_UNKNOWN
,S_OK
},
4472 {URLZONE_INVALID
,E_NOTIMPL
}
4475 { "//host", Uri_CREATE_ALLOW_RELATIVE
, S_OK
, FALSE
,
4494 {Uri_HOST_DNS
,S_OK
},
4496 {URL_SCHEME_UNKNOWN
,S_OK
},
4497 {URLZONE_INVALID
,E_NOTIMPL
}
4502 typedef struct _invalid_uri
{
4508 static const invalid_uri invalid_uri_tests
[] = {
4509 /* Has to have a scheme name. */
4510 {"://www.winehq.org",0,FALSE
},
4511 /* Window's doesn't like URI's which are implicitly file paths without the
4512 * ALLOW_IMPLICIT_FILE_SCHEME flag set.
4514 {"C:/test/test.mp3",0,FALSE
},
4515 {"\\\\Server/test/test.mp3",0,FALSE
},
4516 {"C:/test/test.mp3",Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME
,FALSE
},
4517 {"\\\\Server/test/test.mp3",Uri_CREATE_ALLOW_RELATIVE
,FALSE
},
4518 /* Invalid schemes. */
4519 {"*abcd://not.valid.com",0,FALSE
},
4520 {"*a*b*c*d://not.valid.com",0,FALSE
},
4521 /* Not allowed to have invalid % encoded data. */
4522 {"ftp://google.co%XX/",0,FALSE
},
4523 /* To many h16 components. */
4524 {"http://[1:2:3:4:5:6:7:8:9]",0,FALSE
},
4525 /* Not enough room for IPv4 address. */
4526 {"http://[1:2:3:4:5:6:7:192.0.1.0]",0,FALSE
},
4527 /* Not enough h16 components. */
4528 {"http://[1:2:3:4]",0,FALSE
},
4529 /* Not enough components including IPv4. */
4530 {"http://[1:192.0.1.0]",0,FALSE
},
4531 /* Not allowed to have partial IPv4 in IPv6. */
4532 {"http://[::192.0]",0,FALSE
},
4533 /* Can't have elision of 1 h16 at beginning of address. */
4534 {"http://[::2:3:4:5:6:7:8]",0,FALSE
},
4535 /* Can't have elision of 1 h16 at end of address. */
4536 {"http://[1:2:3:4:5:6:7::]",0,FALSE
},
4537 /* Expects a valid IP Literal. */
4538 {"ftp://[not.valid.uri]/",0,FALSE
},
4539 /* Expects valid port for a known scheme type. */
4540 {"ftp://www.winehq.org:123fgh",0,FALSE
},
4541 /* Port exceeds USHORT_MAX for known scheme type. */
4542 {"ftp://www.winehq.org:65536",0,FALSE
},
4543 /* Invalid port with IPv4 address. */
4544 {"http://www.winehq.org:1abcd",0,FALSE
},
4545 /* Invalid port with IPv6 address. */
4546 {"http://[::ffff]:32xy",0,FALSE
},
4547 /* Not allowed to have backslashes with NO_CANONICALIZE. */
4548 {"gopher://www.google.com\\test",Uri_CREATE_NO_CANONICALIZE
,FALSE
},
4549 /* Not allowed to have invalid % encoded data in opaque URI path. */
4550 {"news:test%XX",0,FALSE
},
4551 {"mailto:wine@winehq%G8.com",0,FALSE
},
4552 /* Known scheme types can't have invalid % encoded data in query string. */
4553 {"http://google.com/?query=te%xx",0,FALSE
},
4554 /* Invalid % encoded data in fragment of know scheme type. */
4555 {"ftp://google.com/#Test%xx",0,FALSE
},
4556 {" http://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4557 {"\n\nhttp://google.com/",Uri_CREATE_NO_PRE_PROCESS_HTML_URI
,FALSE
},
4558 {"file://c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4559 {"file://c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4560 {"file://c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4561 {"file:c:\\test<test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4562 {"file:c:\\test>test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4563 {"file:c:\\test\"test",Uri_CREATE_FILE_USE_DOS_PATH
,FALSE
},
4564 /* res URIs aren't allowed to have forbidden dos path characters in the
4567 {"res://c:\\te<st\\test/test",0,FALSE
},
4568 {"res://c:\\te>st\\test/test",0,FALSE
},
4569 {"res://c:\\te\"st\\test/test",0,FALSE
},
4570 {"res://c:\\test/te%xxst",0,FALSE
}
4573 typedef struct _uri_equality
{
4575 DWORD create_flags_a
;
4577 DWORD create_flags_b
;
4582 static const uri_equality equality_tests
[] = {
4584 "HTTP://www.winehq.org/test dir/./",0,
4585 "http://www.winehq.org/test dir/../test dir/",0,
4589 /* http://www.winehq.org/test%20dir */
4590 "http://%77%77%77%2E%77%69%6E%65%68%71%2E%6F%72%67/%74%65%73%74%20%64%69%72",0,
4591 "http://www.winehq.org/test dir",0,
4595 "c:\\test.mp3",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
4596 "file:///c:/test.mp3",0,
4600 "ftp://ftp.winehq.org/",0,
4601 "ftp://ftp.winehq.org",0,
4605 "ftp://ftp.winehq.org/test/test2/../../testB/",0,
4606 "ftp://ftp.winehq.org/t%45stB/",0,
4610 "http://google.com/TEST",0,
4611 "http://google.com/test",0,
4615 "http://GOOGLE.com/",0,
4616 "http://google.com/",0,
4619 /* Performs case insensitive compare of host names (for known scheme types). */
4621 "ftp://GOOGLE.com/",Uri_CREATE_NO_CANONICALIZE
,
4622 "ftp://google.com/",0,
4626 "zip://GOOGLE.com/",0,
4627 "zip://google.com/",0,
4631 "file:///c:/TEST/TeST/",0,
4632 "file:///c:/test/test/",0,
4636 "file:///server/TEST",0,
4637 "file:///SERVER/TEST",0,
4641 "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
4642 "http://google.com/",0,
4646 "ftp://google.com:21/",0,
4647 "ftp://google.com/",0,
4651 "http://google.com:80/",Uri_CREATE_NO_CANONICALIZE
,
4652 "http://google.com/",0,
4656 "http://google.com:70/",0,
4657 "http://google.com:71/",0,
4661 "file:///c:/dir/file.txt", 0,
4662 "file:///c:/dir/file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4666 "file:///c:/dir/file.txt", 0,
4667 "file:///c:\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4671 "file:///c:/dir/file.txt", 0,
4672 "file:///c:\\dir2\\..\\dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4676 "file:///c:\\dir2\\..\\ dir\\file.txt", Uri_CREATE_NO_CANONICALIZE
,
4677 "file:///c:/%20dir/file.txt", 0,
4681 "file:///c:/Dir/file.txt", 0,
4682 "file:///C:/dir/file.TXT", Uri_CREATE_FILE_USE_DOS_PATH
,
4686 "file:///c:/dir/file.txt", 0,
4687 "file:///c:\\dir\\file.txt", Uri_CREATE_FILE_USE_DOS_PATH
,
4691 "file:///c:/dir/file.txt#a", 0,
4692 "file:///c:\\dir\\file.txt#b", Uri_CREATE_FILE_USE_DOS_PATH
,
4697 typedef struct _uri_with_fragment
{
4699 const char* fragment
;
4701 HRESULT create_expected
;
4704 const char* expected_uri
;
4706 } uri_with_fragment
;
4708 static const uri_with_fragment uri_fragment_tests
[] = {
4710 "http://google.com/","#fragment",0,S_OK
,FALSE
,
4711 "http://google.com/#fragment",FALSE
4714 "http://google.com/","fragment",0,S_OK
,FALSE
,
4715 "http://google.com/#fragment",FALSE
4718 "zip://test.com/","?test",0,S_OK
,FALSE
,
4719 "zip://test.com/#?test",FALSE
4721 /* The fragment can be empty. */
4723 "ftp://ftp.google.com/","",0,S_OK
,FALSE
,
4724 "ftp://ftp.google.com/#",FALSE
4728 typedef struct _uri_builder_property
{
4731 const char *expected_value
;
4732 Uri_PROPERTY property
;
4735 } uri_builder_property
;
4737 typedef struct _uri_builder_port
{
4745 typedef struct _uri_builder_str_property
{
4746 const char* expected
;
4749 } uri_builder_str_property
;
4751 typedef struct _uri_builder_dword_property
{
4755 } uri_builder_dword_property
;
4757 typedef struct _uri_builder_test
{
4760 HRESULT create_builder_expected
;
4761 BOOL create_builder_todo
;
4763 uri_builder_property properties
[URI_BUILDER_STR_PROPERTY_COUNT
];
4765 uri_builder_port port_prop
;
4771 DWORD uri_simple_encode_flags
;
4772 HRESULT uri_simple_hres
;
4773 BOOL uri_simple_todo
;
4775 DWORD uri_with_flags
;
4776 DWORD uri_with_builder_flags
;
4777 DWORD uri_with_encode_flags
;
4778 HRESULT uri_with_hres
;
4781 uri_builder_str_property expected_str_props
[URI_STR_PROPERTY_COUNT
];
4782 uri_builder_dword_property expected_dword_props
[URI_DWORD_PROPERTY_COUNT
];
4785 static const uri_builder_test uri_builder_tests
[] = {
4786 { "http://google.com/",0,S_OK
,FALSE
,
4788 {TRUE
,"#fragment",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4789 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
},
4790 {TRUE
,"?query=x",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
4791 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
4798 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4799 {"username:password@google.com",S_OK
},
4800 {"http://google.com/?query=x#fragment",S_OK
},
4801 {"google.com",S_OK
},
4804 {"google.com",S_OK
},
4809 {"http://username:password@google.com/?query=x#fragment",S_OK
},
4811 {"username:password",S_OK
},
4815 {Uri_HOST_DNS
,S_OK
},
4817 {URL_SCHEME_HTTP
,S_OK
},
4818 {URLZONE_INVALID
,E_NOTIMPL
}
4821 { "http://google.com/",0,S_OK
,FALSE
,
4823 {TRUE
,"test",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
4825 {TRUE
,TRUE
,120,S_OK
,FALSE
},
4830 {"test://google.com:120/",S_OK
},
4831 {"google.com:120",S_OK
},
4832 {"test://google.com:120/",S_OK
},
4833 {"google.com",S_OK
},
4836 {"google.com",S_OK
},
4841 {"test://google.com:120/",S_OK
},
4847 {Uri_HOST_DNS
,S_OK
},
4849 {URL_SCHEME_UNKNOWN
,S_OK
},
4850 {URLZONE_INVALID
,E_NOTIMPL
}
4853 { "/Test/test dir",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4855 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
4856 {TRUE
,"::192.2.3.4",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
4857 {TRUE
,NULL
,NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
4864 {"http://[::192.2.3.4]/",S_OK
},
4865 {"[::192.2.3.4]",S_OK
},
4866 {"http://[::192.2.3.4]/",S_OK
},
4870 {"::192.2.3.4",S_OK
},
4875 {"http://[::192.2.3.4]/",S_OK
},
4881 {Uri_HOST_IPV6
,S_OK
},
4883 {URL_SCHEME_HTTP
,S_OK
},
4884 {URLZONE_INVALID
,E_NOTIMPL
}
4887 { "http://google.com/",0,S_OK
,FALSE
,
4889 {TRUE
,"Frag","#Frag",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
4896 {"http://google.com/#Frag",S_OK
},
4897 {"google.com",S_OK
},
4898 {"http://google.com/#Frag",S_OK
},
4899 {"google.com",S_OK
},
4902 {"google.com",S_OK
},
4907 {"http://google.com/#Frag",S_OK
},
4913 {Uri_HOST_DNS
,S_OK
},
4915 {URL_SCHEME_HTTP
,S_OK
},
4916 {URLZONE_INVALID
,E_NOTIMPL
}
4919 { "http://google.com/",0,S_OK
,FALSE
,
4921 {TRUE
,"","#",Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
},
4928 {"http://google.com/#",S_OK
},
4929 {"google.com",S_OK
},
4930 {"http://google.com/#",S_OK
},
4931 {"google.com",S_OK
},
4934 {"google.com",S_OK
},
4939 {"http://google.com/#",S_OK
},
4945 {Uri_HOST_DNS
,S_OK
},
4947 {URL_SCHEME_HTTP
,S_OK
},
4948 {URLZONE_INVALID
,E_NOTIMPL
}
4951 { "http://google.com/",0,S_OK
,FALSE
,
4953 {TRUE
,":password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4960 {"http://::password@google.com/",S_OK
},
4961 {"::password@google.com",S_OK
},
4962 {"http://google.com/",S_OK
},
4963 {"google.com",S_OK
},
4966 {"google.com",S_OK
},
4971 {"http://::password@google.com/",S_OK
},
4973 {"::password",S_OK
},
4977 {Uri_HOST_DNS
,S_OK
},
4979 {URL_SCHEME_HTTP
,S_OK
},
4980 {URLZONE_INVALID
,E_NOTIMPL
}
4983 { "test/test",Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4985 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
4988 Uri_CREATE_ALLOW_RELATIVE
,S_OK
,FALSE
,
4990 Uri_CREATE_ALLOW_RELATIVE
,0,0,S_OK
,FALSE
,
4992 {":password@test/test",S_OK
},
4993 {":password@",S_OK
},
4994 {":password@test/test",S_OK
},
5003 {":password@test/test",S_OK
},
5009 {Uri_HOST_UNKNOWN
,S_OK
},
5011 {URL_SCHEME_UNKNOWN
,S_OK
},
5012 {URLZONE_INVALID
,E_NOTIMPL
}
5015 { "http://google.com/",0,S_OK
,FALSE
,
5017 {TRUE
,"test/test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5024 {"http://google.com/test/test",S_OK
},
5025 {"google.com",S_OK
},
5026 {"http://google.com/test/test",S_OK
},
5027 {"google.com",S_OK
},
5030 {"google.com",S_OK
},
5032 {"/test/test",S_OK
},
5033 {"/test/test",S_OK
},
5035 {"http://google.com/test/test",S_OK
},
5041 {Uri_HOST_DNS
,S_OK
},
5043 {URL_SCHEME_HTTP
,S_OK
},
5044 {URLZONE_INVALID
,E_NOTIMPL
}
5047 { "zip:testing/test",0,S_OK
,FALSE
,
5049 {TRUE
,"test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5073 {Uri_HOST_UNKNOWN
,S_OK
},
5075 {URL_SCHEME_UNKNOWN
,S_OK
},
5076 {URLZONE_INVALID
,E_NOTIMPL
}
5079 { "http://google.com/",0,S_OK
,FALSE
,
5083 /* 555 will be returned from GetPort even though FALSE was passed as the hasPort parameter. */
5084 {TRUE
,FALSE
,555,S_OK
,FALSE
},
5089 {"http://google.com/",S_OK
},
5090 {"google.com",S_OK
},
5091 {"http://google.com/",S_OK
},
5092 {"google.com",S_OK
},
5095 {"google.com",S_OK
},
5100 {"http://google.com/",S_OK
},
5106 {Uri_HOST_DNS
,S_OK
},
5107 /* Still returns 80, even though earlier the port was disabled. */
5109 {URL_SCHEME_HTTP
,S_OK
},
5110 {URLZONE_INVALID
,E_NOTIMPL
}
5113 { "http://google.com/",0,S_OK
,FALSE
,
5117 /* Instead of getting "TRUE" back as the "hasPort" parameter in GetPort,
5118 * you'll get 122345 instead.
5120 {TRUE
,122345,222,S_OK
,FALSE
},
5125 {"http://google.com:222/",S_OK
},
5126 {"google.com:222",S_OK
},
5127 {"http://google.com:222/",S_OK
},
5128 {"google.com",S_OK
},
5131 {"google.com",S_OK
},
5136 {"http://google.com:222/",S_OK
},
5142 {Uri_HOST_DNS
,S_OK
},
5144 {URL_SCHEME_HTTP
,S_OK
},
5145 {URLZONE_INVALID
,E_NOTIMPL
}
5148 /* IUri's created with the IUriBuilder can have ports that exceed USHORT_MAX. */
5149 { "http://google.com/",0,S_OK
,FALSE
,
5153 {TRUE
,TRUE
,999999,S_OK
,FALSE
},
5158 {"http://google.com:999999/",S_OK
},
5159 {"google.com:999999",S_OK
},
5160 {"http://google.com:999999/",S_OK
},
5161 {"google.com",S_OK
},
5164 {"google.com",S_OK
},
5169 {"http://google.com:999999/",S_OK
},
5175 {Uri_HOST_DNS
,S_OK
},
5177 {URL_SCHEME_HTTP
,S_OK
},
5178 {URLZONE_INVALID
,E_NOTIMPL
}
5181 { "http://google.com/",0,S_OK
,FALSE
,
5183 {TRUE
,"test","?test",Uri_PROPERTY_QUERY
,S_OK
,FALSE
},
5191 {"http://google.com/?test",S_OK
},
5192 {"google.com",S_OK
},
5193 {"http://google.com/?test",S_OK
},
5194 {"google.com",S_OK
},
5197 {"google.com",S_OK
},
5202 {"http://google.com/?test",S_OK
},
5208 {Uri_HOST_DNS
,S_OK
},
5210 {URL_SCHEME_HTTP
,S_OK
},
5211 {URLZONE_INVALID
,E_NOTIMPL
}
5214 { "http://:password@google.com/",0,S_OK
,FALSE
,
5223 {"http://:password@google.com/",S_OK
},
5224 {":password@google.com",S_OK
},
5225 {"http://google.com/",S_OK
},
5226 {"google.com",S_OK
},
5229 {"google.com",S_OK
},
5234 {"http://:password@google.com/",S_OK
},
5240 {Uri_HOST_DNS
,S_OK
},
5242 {URL_SCHEME_HTTP
,S_OK
},
5243 {URLZONE_INVALID
,E_NOTIMPL
}
5246 /* IUriBuilder doesn't need a base IUri to build a IUri. */
5247 { NULL
,0,S_OK
,FALSE
,
5249 {TRUE
,"http",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
},
5250 {TRUE
,"google.com",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5257 {"http://google.com/",S_OK
},
5258 {"google.com",S_OK
},
5259 {"http://google.com/",S_OK
},
5260 {"google.com",S_OK
},
5263 {"google.com",S_OK
},
5268 {"http://google.com/",S_OK
},
5274 {Uri_HOST_DNS
,S_OK
},
5276 {URL_SCHEME_HTTP
,S_OK
},
5277 {URLZONE_INVALID
,E_NOTIMPL
}
5280 /* Can't set the scheme name to NULL. */
5281 { "zip://google.com/",0,S_OK
,FALSE
,
5283 {TRUE
,NULL
,"zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5290 {"zip://google.com/",S_OK
},
5291 {"google.com",S_OK
},
5292 {"zip://google.com/",S_OK
},
5293 {"google.com",S_OK
},
5296 {"google.com",S_OK
},
5301 {"zip://google.com/",S_OK
},
5307 {Uri_HOST_DNS
,S_OK
},
5309 {URL_SCHEME_UNKNOWN
,S_OK
},
5310 {URLZONE_INVALID
,E_NOTIMPL
}
5313 /* Can't set the scheme name to an empty string. */
5314 { "zip://google.com/",0,S_OK
,FALSE
,
5316 {TRUE
,"","zip",Uri_PROPERTY_SCHEME_NAME
,E_INVALIDARG
,FALSE
}
5323 {"zip://google.com/",S_OK
},
5324 {"google.com",S_OK
},
5325 {"zip://google.com/",S_OK
},
5326 {"google.com",S_OK
},
5329 {"google.com",S_OK
},
5334 {"zip://google.com/",S_OK
},
5340 {Uri_HOST_DNS
,S_OK
},
5342 {URL_SCHEME_UNKNOWN
,S_OK
},
5343 {URLZONE_INVALID
,E_NOTIMPL
}
5346 /* -1 to CreateUri makes it use the same flags as the base IUri was created with.
5347 * CreateUriSimple always uses the flags the base IUri was created with (if any).
5349 { "http://google.com/../../",Uri_CREATE_NO_CANONICALIZE
,S_OK
,FALSE
,
5354 0,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5356 {"http://google.com/../../",S_OK
},
5357 {"google.com",S_OK
},
5358 {"http://google.com/../../",S_OK
},
5359 {"google.com",S_OK
},
5362 {"google.com",S_OK
},
5367 {"http://google.com/../../",S_OK
},
5373 {Uri_HOST_DNS
,S_OK
},
5375 {URL_SCHEME_HTTP
,S_OK
},
5376 {URLZONE_INVALID
,E_NOTIMPL
}
5379 { "http://google.com/",0,S_OK
,FALSE
,
5381 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5386 Uri_CREATE_NO_DECODE_EXTRA_INFO
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5388 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5389 {"google.com",S_OK
},
5390 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5391 {"google.com",S_OK
},
5393 {"#Fr%3C%7C%3Eg",S_OK
},
5394 {"google.com",S_OK
},
5399 {"http://google.com/#Fr<|>g",S_OK
},
5405 {Uri_HOST_DNS
,S_OK
},
5407 {URL_SCHEME_HTTP
,S_OK
},
5408 {URLZONE_INVALID
,E_NOTIMPL
}
5411 { "http://google.com/",0,S_OK
,FALSE
,
5413 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5416 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,E_INVALIDARG
,FALSE
,
5418 Uri_CREATE_CANONICALIZE
|Uri_CREATE_NO_CANONICALIZE
,UriBuilder_USE_ORIGINAL_FLAGS
,0,S_OK
,FALSE
,
5420 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5421 {"google.com",S_OK
},
5422 {"http://google.com/#Fr%3C%7C%3Eg",S_OK
},
5423 {"google.com",S_OK
},
5425 {"#Fr%3C%7C%3Eg",S_OK
},
5426 {"google.com",S_OK
},
5431 {"http://google.com/#Fr<|>g",S_OK
},
5437 {Uri_HOST_DNS
,S_OK
},
5439 {URL_SCHEME_HTTP
,S_OK
},
5440 {URLZONE_INVALID
,E_NOTIMPL
}
5443 { NULL
,0,S_OK
,FALSE
,
5445 {TRUE
,"/test/test/",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
},
5446 {TRUE
,"#Fr<|>g",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
,FALSE
}
5449 0,INET_E_INVALID_URL
,FALSE
,
5450 0,INET_E_INVALID_URL
,FALSE
,
5451 0,0,0,INET_E_INVALID_URL
,FALSE
5453 { "http://google.com/",0,S_OK
,FALSE
,
5455 {TRUE
,"ht%xxtp",NULL
,Uri_PROPERTY_SCHEME_NAME
,S_OK
,FALSE
}
5458 0,INET_E_INVALID_URL
,FALSE
,
5459 0,INET_E_INVALID_URL
,FALSE
,
5460 0,0,0,INET_E_INVALID_URL
,FALSE
5462 /* File scheme's can't have a username set. */
5463 { "file://google.com/",0,S_OK
,FALSE
,
5465 {TRUE
,"username",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5468 0,INET_E_INVALID_URL
,FALSE
,
5469 0,INET_E_INVALID_URL
,FALSE
,
5470 0,0,0,INET_E_INVALID_URL
,FALSE
5472 /* File schemes can't have a password set. */
5473 { "file://google.com/",0,S_OK
,FALSE
,
5475 {TRUE
,"password",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5478 0,INET_E_INVALID_URL
,FALSE
,
5479 0,INET_E_INVALID_URL
,FALSE
,
5480 0,0,0,INET_E_INVALID_URL
,FALSE
5482 /* UserName can't contain any character that is a delimeter for another
5483 * component that appears after it in a normal URI.
5485 { "http://google.com/",0,S_OK
,FALSE
,
5487 {TRUE
,"user:pass",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5490 0,INET_E_INVALID_URL
,FALSE
,
5491 0,INET_E_INVALID_URL
,FALSE
,
5492 0,0,0,INET_E_INVALID_URL
,FALSE
5494 { "http://google.com/",0,S_OK
,FALSE
,
5496 {TRUE
,"user@google.com",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5499 0,INET_E_INVALID_URL
,FALSE
,
5500 0,INET_E_INVALID_URL
,FALSE
,
5501 0,0,0,INET_E_INVALID_URL
,FALSE
5503 { "http://google.com/",0,S_OK
,FALSE
,
5505 {TRUE
,"user/path",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5508 0,INET_E_INVALID_URL
,FALSE
,
5509 0,INET_E_INVALID_URL
,FALSE
,
5510 0,0,0,INET_E_INVALID_URL
,FALSE
5512 { "http://google.com/",0,S_OK
,FALSE
,
5514 {TRUE
,"user?Query",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5517 0,INET_E_INVALID_URL
,FALSE
,
5518 0,INET_E_INVALID_URL
,FALSE
,
5519 0,0,0,INET_E_INVALID_URL
,FALSE
5521 { "http://google.com/",0,S_OK
,FALSE
,
5523 {TRUE
,"user#Frag",NULL
,Uri_PROPERTY_USER_NAME
,S_OK
,FALSE
}
5526 0,INET_E_INVALID_URL
,FALSE
,
5527 0,INET_E_INVALID_URL
,FALSE
,
5528 0,0,0,INET_E_INVALID_URL
,FALSE
5530 { "http://google.com/",0,S_OK
,FALSE
,
5532 {TRUE
,"pass@google.com",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5535 0,INET_E_INVALID_URL
,FALSE
,
5536 0,INET_E_INVALID_URL
,FALSE
,
5537 0,0,0,INET_E_INVALID_URL
,FALSE
5539 { "http://google.com/",0,S_OK
,FALSE
,
5541 {TRUE
,"pass/path",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5544 0,INET_E_INVALID_URL
,FALSE
,
5545 0,INET_E_INVALID_URL
,FALSE
,
5546 0,0,0,INET_E_INVALID_URL
,FALSE
5548 { "http://google.com/",0,S_OK
,FALSE
,
5550 {TRUE
,"pass?query",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5553 0,INET_E_INVALID_URL
,FALSE
,
5554 0,INET_E_INVALID_URL
,FALSE
,
5555 0,0,0,INET_E_INVALID_URL
,FALSE
5557 { "http://google.com/",0,S_OK
,FALSE
,
5559 {TRUE
,"pass#frag",NULL
,Uri_PROPERTY_PASSWORD
,S_OK
,FALSE
}
5562 0,INET_E_INVALID_URL
,FALSE
,
5563 0,INET_E_INVALID_URL
,FALSE
,
5564 0,0,0,INET_E_INVALID_URL
,FALSE
5566 { "http://google.com/",0,S_OK
,FALSE
,
5568 {TRUE
,"winehq.org/test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5571 0,INET_E_INVALID_URL
,FALSE
,
5572 0,INET_E_INVALID_URL
,FALSE
,
5573 0,0,0,INET_E_INVALID_URL
,FALSE
5575 { "http://google.com/",0,S_OK
,FALSE
,
5577 {TRUE
,"winehq.org?test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5580 0,INET_E_INVALID_URL
,FALSE
,
5581 0,INET_E_INVALID_URL
,FALSE
,
5582 0,0,0,INET_E_INVALID_URL
,FALSE
5584 { "http://google.com/",0,S_OK
,FALSE
,
5586 {TRUE
,"winehq.org#test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5589 0,INET_E_INVALID_URL
,FALSE
,
5590 0,INET_E_INVALID_URL
,FALSE
,
5591 0,0,0,INET_E_INVALID_URL
,FALSE
5593 /* Hostname is allowed to contain a ':' (even for known scheme types). */
5594 { "http://google.com/",0,S_OK
,FALSE
,
5596 {TRUE
,"winehq.org:test",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
},
5603 {"http://winehq.org:test/",S_OK
},
5604 {"winehq.org:test",S_OK
},
5605 {"http://winehq.org:test/",S_OK
},
5606 {"winehq.org:test",S_OK
},
5609 {"winehq.org:test",S_OK
},
5614 {"http://winehq.org:test/",S_OK
},
5620 {Uri_HOST_DNS
,S_OK
},
5622 {URL_SCHEME_HTTP
,S_OK
},
5623 {URLZONE_INVALID
,E_NOTIMPL
}
5626 /* Can't set the host name to NULL. */
5627 { "http://google.com/",0,S_OK
,FALSE
,
5629 {TRUE
,NULL
,"google.com",Uri_PROPERTY_HOST
,E_INVALIDARG
,FALSE
}
5636 {"http://google.com/",S_OK
},
5637 {"google.com",S_OK
},
5638 {"http://google.com/",S_OK
},
5639 {"google.com",S_OK
},
5642 {"google.com",S_OK
},
5647 {"http://google.com/",S_OK
},
5653 {Uri_HOST_DNS
,S_OK
},
5655 {URL_SCHEME_HTTP
,S_OK
},
5656 {URLZONE_INVALID
,E_NOTIMPL
}
5659 /* Can set the host name to an empty string. */
5660 { "http://google.com/",0,S_OK
,FALSE
,
5662 {TRUE
,"",NULL
,Uri_PROPERTY_HOST
,S_OK
,FALSE
}
5686 {Uri_HOST_UNKNOWN
,S_OK
},
5688 {URL_SCHEME_HTTP
,S_OK
},
5689 {URLZONE_INVALID
,E_NOTIMPL
}
5692 { "http://google.com/",0,S_OK
,FALSE
,
5694 {TRUE
,"/path?query",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5697 0,INET_E_INVALID_URL
,FALSE
,
5698 0,INET_E_INVALID_URL
,FALSE
,
5699 0,0,0,INET_E_INVALID_URL
,FALSE
5701 { "http://google.com/",0,S_OK
,FALSE
,
5703 {TRUE
,"/path#test",NULL
,Uri_PROPERTY_PATH
,S_OK
,FALSE
}
5706 0,INET_E_INVALID_URL
,FALSE
,
5707 0,INET_E_INVALID_URL
,FALSE
,
5708 0,0,0,INET_E_INVALID_URL
,FALSE
5710 { "http://google.com/",0,S_OK
,FALSE
,
5712 {TRUE
,"?path#test",NULL
,Uri_PROPERTY_QUERY
,S_OK
,FALSE
}
5715 0,INET_E_INVALID_URL
,FALSE
,
5716 0,INET_E_INVALID_URL
,FALSE
,
5717 0,0,0,INET_E_INVALID_URL
,FALSE
5719 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5721 {TRUE
,NULL
,NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5728 {"file:///c:/dir/file.html",S_OK
},
5730 {"file:///c:/dir/file.html",S_OK
},
5736 {"/c:/dir/file.html",S_OK
},
5737 {"/c:/dir/file.html",S_OK
},
5739 {"file:///c:/dir/file.html",S_OK
},
5745 {Uri_HOST_UNKNOWN
,S_OK
},
5747 {URL_SCHEME_FILE
,S_OK
},
5748 {URLZONE_INVALID
,E_NOTIMPL
}
5751 { "file:///c:/dir/file.html",0,S_OK
,FALSE
,
5753 {TRUE
,"#",NULL
,Uri_PROPERTY_FRAGMENT
,S_OK
},
5760 {"file:///c:/dir/file.html#",S_OK
},
5762 {"file:///c:/dir/file.html#",S_OK
},
5768 {"/c:/dir/file.html",S_OK
},
5769 {"/c:/dir/file.html",S_OK
},
5771 {"file:///c:/dir/file.html#",S_OK
},
5777 {Uri_HOST_UNKNOWN
,S_OK
},
5779 {URL_SCHEME_FILE
,S_OK
},
5780 {URLZONE_INVALID
,E_NOTIMPL
}
5785 typedef struct _uri_builder_remove_test
{
5788 HRESULT create_builder_expected
;
5789 BOOL create_builder_todo
;
5791 DWORD remove_properties
;
5792 HRESULT remove_expected
;
5795 const char *expected_uri
;
5796 DWORD expected_flags
;
5797 HRESULT expected_hres
;
5799 } uri_builder_remove_test
;
5801 static const uri_builder_remove_test uri_builder_remove_tests
[] = {
5802 { "http://google.com/test?test=y#Frag",0,S_OK
,FALSE
,
5803 Uri_HAS_FRAGMENT
|Uri_HAS_PATH
|Uri_HAS_QUERY
,S_OK
,FALSE
,
5804 "http://google.com/",0,S_OK
,FALSE
5806 { "http://user:pass@winehq.org/",0,S_OK
,FALSE
,
5807 Uri_HAS_USER_NAME
|Uri_HAS_PASSWORD
,S_OK
,FALSE
,
5808 "http://winehq.org/",0,S_OK
,FALSE
5810 { "zip://google.com?Test=x",0,S_OK
,FALSE
,
5811 Uri_HAS_HOST
,S_OK
,FALSE
,
5812 "zip:/?Test=x",0,S_OK
,FALSE
5814 /* Doesn't remove the whole userinfo component. */
5815 { "http://username:pass@google.com/",0,S_OK
,FALSE
,
5816 Uri_HAS_USER_INFO
,S_OK
,FALSE
,
5817 "http://username:pass@google.com/",0,S_OK
,FALSE
5819 /* Doesn't remove the domain. */
5820 { "http://google.com/",0,S_OK
,FALSE
,
5821 Uri_HAS_DOMAIN
,S_OK
,FALSE
,
5822 "http://google.com/",0,S_OK
,FALSE
5824 { "http://google.com:120/",0,S_OK
,FALSE
,
5825 Uri_HAS_AUTHORITY
,S_OK
,FALSE
,
5826 "http://google.com:120/",0,S_OK
,FALSE
5828 { "http://google.com/test.com/",0,S_OK
,FALSE
,
5829 Uri_HAS_EXTENSION
,S_OK
,FALSE
,
5830 "http://google.com/test.com/",0,S_OK
,FALSE
5832 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5833 Uri_HAS_PATH_AND_QUERY
,S_OK
,FALSE
,
5834 "http://google.com/?test=x",0,S_OK
,FALSE
5836 /* Can't remove the scheme name. */
5837 { "http://google.com/?test=x",0,S_OK
,FALSE
,
5838 Uri_HAS_SCHEME_NAME
|Uri_HAS_QUERY
,E_INVALIDARG
,FALSE
,
5839 "http://google.com/?test=x",0,S_OK
,FALSE
5843 typedef struct _uri_combine_str_property
{
5847 const char *broken_value
;
5848 const char *value_ex
;
5849 } uri_combine_str_property
;
5851 typedef struct _uri_combine_test
{
5852 const char *base_uri
;
5853 DWORD base_create_flags
;
5854 const char *relative_uri
;
5855 DWORD relative_create_flags
;
5856 DWORD combine_flags
;
5860 uri_combine_str_property str_props
[URI_STR_PROPERTY_COUNT
];
5861 uri_dword_property dword_props
[URI_DWORD_PROPERTY_COUNT
];
5864 static const uri_combine_test uri_combine_tests
[] = {
5865 { "http://google.com/fun/stuff",0,
5866 "../not/fun/stuff",Uri_CREATE_ALLOW_RELATIVE
,
5869 {"http://google.com/not/fun/stuff",S_OK
},
5870 {"google.com",S_OK
},
5871 {"http://google.com/not/fun/stuff",S_OK
},
5872 {"google.com",S_OK
},
5875 {"google.com",S_OK
},
5877 {"/not/fun/stuff",S_OK
},
5878 {"/not/fun/stuff",S_OK
},
5880 {"http://google.com/not/fun/stuff",S_OK
},
5886 {Uri_HOST_DNS
,S_OK
},
5888 {URL_SCHEME_HTTP
,S_OK
},
5889 {URLZONE_INVALID
,E_NOTIMPL
}
5892 { "http://google.com/test",0,
5893 "zip://test.com/cool",0,
5896 {"zip://test.com/cool",S_OK
},
5898 {"zip://test.com/cool",S_OK
},
5907 {"zip://test.com/cool",S_OK
},
5913 {Uri_HOST_DNS
,S_OK
},
5915 {URL_SCHEME_UNKNOWN
,S_OK
},
5916 {URLZONE_INVALID
,E_NOTIMPL
}
5919 { "http://google.com/use/base/path",0,
5920 "?relative",Uri_CREATE_ALLOW_RELATIVE
,
5923 {"http://google.com/use/base/path?relative",S_OK
},
5924 {"google.com",S_OK
},
5925 {"http://google.com/use/base/path?relative",S_OK
},
5926 {"google.com",S_OK
},
5929 {"google.com",S_OK
},
5931 {"/use/base/path",S_OK
},
5932 {"/use/base/path?relative",S_OK
},
5934 {"http://google.com/use/base/path?relative",S_OK
},
5940 {Uri_HOST_DNS
,S_OK
},
5942 {URL_SCHEME_HTTP
,S_OK
},
5943 {URLZONE_INVALID
,E_NOTIMPL
}
5946 { "http://google.com/path",0,
5947 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5950 {"http://google.com/testing",S_OK
},
5951 {"google.com",S_OK
},
5952 {"http://google.com/testing",S_OK
},
5953 {"google.com",S_OK
},
5956 {"google.com",S_OK
},
5961 {"http://google.com/testing",S_OK
},
5967 {Uri_HOST_DNS
,S_OK
},
5969 {URL_SCHEME_HTTP
,S_OK
},
5970 {URLZONE_INVALID
,E_NOTIMPL
}
5973 { "http://google.com/path",0,
5974 "/test/../test/.././testing",Uri_CREATE_ALLOW_RELATIVE
,
5975 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
5977 {"http://google.com:80/test/../test/.././testing",S_OK
},
5978 {"google.com",S_OK
},
5979 {"http://google.com:80/test/../test/.././testing",S_OK
},
5980 {"google.com",S_OK
},
5983 {"google.com",S_OK
},
5985 {"/test/../test/.././testing",S_OK
},
5986 {"/test/../test/.././testing",S_OK
},
5988 {"http://google.com:80/test/../test/.././testing",S_OK
},
5994 {Uri_HOST_DNS
,S_OK
},
5996 {URL_SCHEME_HTTP
,S_OK
},
5997 {URLZONE_INVALID
,E_NOTIMPL
}
6000 { "http://winehq.org/test/abc",0,
6001 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6004 {"http://winehq.org/test/testing/test",S_OK
},
6005 {"winehq.org",S_OK
},
6006 {"http://winehq.org/test/testing/test",S_OK
},
6007 {"winehq.org",S_OK
},
6010 {"winehq.org",S_OK
},
6012 {"/test/testing/test",S_OK
},
6013 {"/test/testing/test",S_OK
},
6015 {"http://winehq.org/test/testing/test",S_OK
},
6021 {Uri_HOST_DNS
,S_OK
},
6023 {URL_SCHEME_HTTP
,S_OK
},
6024 {URLZONE_INVALID
,E_NOTIMPL
}
6027 { "http://winehq.org/test/abc",0,
6028 "testing/abc/../test",Uri_CREATE_ALLOW_RELATIVE
,
6029 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6031 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6032 /* Default port is hidden in the authority. */
6033 {"winehq.org",S_OK
},
6034 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6035 {"winehq.org",S_OK
},
6038 {"winehq.org",S_OK
},
6040 {"/test/testing/abc/../test",S_OK
},
6041 {"/test/testing/abc/../test",S_OK
},
6043 {"http://winehq.org:80/test/testing/abc/../test",S_OK
},
6049 {Uri_HOST_DNS
,S_OK
},
6051 {URL_SCHEME_HTTP
,S_OK
},
6052 {URLZONE_INVALID
,E_NOTIMPL
}
6055 { "http://winehq.org/test?query",0,
6056 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6059 {"http://winehq.org/testing",S_OK
},
6060 {"winehq.org",S_OK
},
6061 {"http://winehq.org/testing",S_OK
},
6062 {"winehq.org",S_OK
},
6065 {"winehq.org",S_OK
},
6070 {"http://winehq.org/testing",S_OK
},
6076 {Uri_HOST_DNS
,S_OK
},
6078 {URL_SCHEME_HTTP
,S_OK
},
6079 {URLZONE_INVALID
,E_NOTIMPL
}
6082 { "http://winehq.org/test#frag",0,
6083 "testing",Uri_CREATE_ALLOW_RELATIVE
,
6086 {"http://winehq.org/testing",S_OK
},
6087 {"winehq.org",S_OK
},
6088 {"http://winehq.org/testing",S_OK
},
6089 {"winehq.org",S_OK
},
6092 {"winehq.org",S_OK
},
6097 {"http://winehq.org/testing",S_OK
},
6103 {Uri_HOST_DNS
,S_OK
},
6105 {URL_SCHEME_HTTP
,S_OK
},
6106 {URLZONE_INVALID
,E_NOTIMPL
}
6109 { "testing?query#frag",Uri_CREATE_ALLOW_RELATIVE
,
6110 "test",Uri_CREATE_ALLOW_RELATIVE
,
6130 {Uri_HOST_UNKNOWN
,S_OK
},
6132 {URL_SCHEME_UNKNOWN
,S_OK
},
6133 {URLZONE_INVALID
,E_NOTIMPL
}
6136 { "file:///c:/test/test",0,
6137 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6138 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6140 {"file://c:\\testing.mp3",S_OK
},
6142 {"file://c:\\testing.mp3",S_OK
},
6148 {"c:\\testing.mp3",S_OK
},
6149 {"c:\\testing.mp3",S_OK
},
6151 {"file://c:\\testing.mp3",S_OK
},
6157 {Uri_HOST_UNKNOWN
,S_OK
},
6159 {URL_SCHEME_FILE
,S_OK
},
6160 {URLZONE_INVALID
,E_NOTIMPL
}
6163 { "file:///c:/test/test",0,
6164 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6167 {"file:///c:/testing.mp3",S_OK
},
6169 {"file:///c:/testing.mp3",S_OK
},
6175 {"/c:/testing.mp3",S_OK
},
6176 {"/c:/testing.mp3",S_OK
},
6178 {"file:///c:/testing.mp3",S_OK
},
6184 {Uri_HOST_UNKNOWN
,S_OK
},
6186 {URL_SCHEME_FILE
,S_OK
},
6187 {URLZONE_INVALID
,E_NOTIMPL
}
6190 { "file://test.com/test/test",0,
6191 "/testing.mp3",Uri_CREATE_ALLOW_RELATIVE
,
6192 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6194 {"file://\\\\test.com\\testing.mp3",S_OK
},
6196 {"file://\\\\test.com\\testing.mp3",S_OK
},
6202 {"\\testing.mp3",S_OK
},
6203 {"\\testing.mp3",S_OK
},
6205 {"file://\\\\test.com\\testing.mp3",S_OK
},
6211 {Uri_HOST_DNS
,S_OK
},
6213 {URL_SCHEME_FILE
,S_OK
},
6214 {URLZONE_INVALID
,E_NOTIMPL
}
6217 /* URL_DONT_SIMPLIFY has no effect. */
6218 { "http://google.com/test",0,
6219 "zip://test.com/cool/../cool/test",0,
6220 URL_DONT_SIMPLIFY
,S_OK
,FALSE
,
6222 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6224 {"zip://test.com/cool/test",S_OK
,FALSE
,NULL
,"zip://test.com/cool/../cool/test"},
6230 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6231 {"/cool/test",S_OK
,FALSE
,NULL
,"/cool/../cool/test"},
6233 /* The resulting IUri has the same Raw URI as the relative URI (only IE 8).
6234 * On IE 7 it reduces the path in the Raw URI.
6236 {"zip://test.com/cool/../cool/test",S_OK
,FALSE
,"zip://test.com/cool/test"},
6242 {Uri_HOST_DNS
,S_OK
},
6244 {URL_SCHEME_UNKNOWN
,S_OK
},
6245 {URLZONE_INVALID
,E_NOTIMPL
}
6248 /* FILE_USE_PATHURL has no effect in IE 8, in IE 7 the
6249 * resulting URI is converted into a dos path.
6251 { "http://google.com/test",0,
6252 "file:///c:/test/",0,
6253 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6255 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6257 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6263 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6264 {"/c:/test/",S_OK
,FALSE
,"c:\\test\\"},
6266 {"file:///c:/test/",S_OK
,FALSE
,"file://c:\\test\\"},
6272 {Uri_HOST_UNKNOWN
,S_OK
},
6274 {URL_SCHEME_FILE
,S_OK
},
6275 {URLZONE_INVALID
,E_NOTIMPL
}
6278 { "http://google.com/test",0,
6279 "http://test.com/test#%30test",0,
6280 URL_DONT_UNESCAPE_EXTRA_INFO
,S_OK
,FALSE
,
6282 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6284 {"http://test.com/test#0test",S_OK
,FALSE
,NULL
,"http://test.com/test#%30test"},
6287 {"#0test",S_OK
,FALSE
,NULL
,"#%30test"},
6293 /* IE 7 decodes the %30 to a 0 in the Raw URI. */
6294 {"http://test.com/test#%30test",S_OK
,FALSE
,"http://test.com/test#0test"},
6300 {Uri_HOST_DNS
,S_OK
},
6302 {URL_SCHEME_HTTP
,S_OK
},
6303 {URLZONE_INVALID
,E_NOTIMPL
}
6306 /* Windows validates the path component from the relative Uri. */
6307 { "http://google.com/test",0,
6308 "/Te%XXst",Uri_CREATE_ALLOW_RELATIVE
,
6309 0,E_INVALIDARG
,FALSE
6311 /* Windows doesn't validate the query from the relative Uri. */
6312 { "http://google.com/test",0,
6313 "?Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6316 {"http://google.com/test?Tes%XXt",S_OK
},
6317 {"google.com",S_OK
},
6318 {"http://google.com/test?Tes%XXt",S_OK
},
6319 {"google.com",S_OK
},
6322 {"google.com",S_OK
},
6325 {"/test?Tes%XXt",S_OK
},
6327 {"http://google.com/test?Tes%XXt",S_OK
},
6333 {Uri_HOST_DNS
,S_OK
},
6335 {URL_SCHEME_HTTP
,S_OK
},
6336 {URLZONE_INVALID
,E_NOTIMPL
}
6339 /* Windows doesn't validate the fragment from the relative Uri. */
6340 { "http://google.com/test",0,
6341 "#Tes%XXt",Uri_CREATE_ALLOW_RELATIVE
,
6344 {"http://google.com/test#Tes%XXt",S_OK
},
6345 {"google.com",S_OK
},
6346 {"http://google.com/test#Tes%XXt",S_OK
},
6347 {"google.com",S_OK
},
6350 {"google.com",S_OK
},
6355 {"http://google.com/test#Tes%XXt",S_OK
},
6361 {Uri_HOST_DNS
,S_OK
},
6363 {URL_SCHEME_HTTP
,S_OK
},
6364 {URLZONE_INVALID
,E_NOTIMPL
}
6367 /* Creates an IUri which contains an invalid dos path char. */
6368 { "file:///c:/test",0,
6369 "/test<ing",Uri_CREATE_ALLOW_RELATIVE
,
6370 URL_FILE_USE_PATHURL
,S_OK
,FALSE
,
6372 {"file://c:\\test<ing",S_OK
},
6374 {"file://c:\\test<ing",S_OK
},
6380 {"c:\\test<ing",S_OK
},
6381 {"c:\\test<ing",S_OK
},
6383 {"file://c:\\test<ing",S_OK
},
6389 {Uri_HOST_UNKNOWN
,S_OK
},
6391 {URL_SCHEME_FILE
,S_OK
},
6392 {URLZONE_INVALID
,E_NOTIMPL
}
6395 /* Appends the path after the drive letter (if any). */
6396 { "file:///c:/test",0,
6397 "/c:/testing",Uri_CREATE_ALLOW_RELATIVE
,
6400 {"file:///c:/c:/testing",S_OK
},
6402 {"file:///c:/c:/testing",S_OK
},
6408 {"/c:/c:/testing",S_OK
},
6409 {"/c:/c:/testing",S_OK
},
6411 {"file:///c:/c:/testing",S_OK
},
6417 {Uri_HOST_UNKNOWN
,S_OK
},
6419 {URL_SCHEME_FILE
,S_OK
},
6420 {URLZONE_INVALID
,E_NOTIMPL
}
6423 /* A '/' is added if the base URI doesn't have a path and the
6424 * relative URI doesn't contain a path (since the base URI is
6427 { "http://google.com",Uri_CREATE_NO_CANONICALIZE
,
6428 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6431 {"http://google.com/?test",S_OK
},
6432 {"google.com",S_OK
},
6433 {"http://google.com/?test",S_OK
},
6434 {"google.com",S_OK
},
6437 {"google.com",S_OK
},
6442 {"http://google.com/?test",S_OK
},
6448 {Uri_HOST_DNS
,S_OK
},
6450 {URL_SCHEME_HTTP
,S_OK
},
6451 {URLZONE_INVALID
,E_NOTIMPL
}
6454 { "zip://google.com",Uri_CREATE_NO_CANONICALIZE
,
6455 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6458 {"zip://google.com/?test",S_OK
},
6459 {"google.com",S_OK
},
6460 {"zip://google.com/?test",S_OK
},
6461 {"google.com",S_OK
},
6464 {"google.com",S_OK
},
6469 {"zip://google.com/?test",S_OK
},
6475 {Uri_HOST_DNS
,S_OK
},
6477 {URL_SCHEME_UNKNOWN
,S_OK
},
6478 {URLZONE_INVALID
,E_NOTIMPL
}
6481 /* No path is appended since the base URI is opaque. */
6483 "?test",Uri_CREATE_ALLOW_RELATIVE
,
6503 {Uri_HOST_UNKNOWN
,S_OK
},
6505 {URL_SCHEME_UNKNOWN
,S_OK
},
6506 {URLZONE_INVALID
,E_NOTIMPL
}
6510 "../testing/test",Uri_CREATE_ALLOW_RELATIVE
,
6513 {"file:///c:/testing/test",S_OK
},
6515 {"file:///c:/testing/test",S_OK
},
6521 {"/c:/testing/test",S_OK
},
6522 {"/c:/testing/test",S_OK
},
6524 {"file:///c:/testing/test",S_OK
},
6530 {Uri_HOST_UNKNOWN
,S_OK
},
6532 {URL_SCHEME_FILE
,S_OK
},
6533 {URLZONE_INVALID
,E_NOTIMPL
}
6536 { "http://winehq.org/dir/testfile",0,
6537 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6540 {"http://winehq.org/dir/test?querystring",S_OK
},
6541 {"winehq.org",S_OK
},
6542 {"http://winehq.org/dir/test?querystring",S_OK
},
6543 {"winehq.org",S_OK
},
6546 {"winehq.org",S_OK
},
6549 {"/dir/test?querystring",S_OK
},
6550 {"?querystring",S_OK
},
6551 {"http://winehq.org/dir/test?querystring",S_OK
},
6557 {Uri_HOST_DNS
,S_OK
},
6559 {URL_SCHEME_HTTP
,S_OK
},
6560 {URLZONE_INVALID
,E_NOTIMPL
}
6563 { "http://winehq.org/dir/test",0,
6564 "test?querystring",Uri_CREATE_ALLOW_RELATIVE
,
6567 {"http://winehq.org/dir/test?querystring",S_OK
},
6568 {"winehq.org",S_OK
},
6569 {"http://winehq.org/dir/test?querystring",S_OK
},
6570 {"winehq.org",S_OK
},
6573 {"winehq.org",S_OK
},
6576 {"/dir/test?querystring",S_OK
},
6577 {"?querystring",S_OK
},
6578 {"http://winehq.org/dir/test?querystring",S_OK
},
6584 {Uri_HOST_DNS
,S_OK
},
6586 {URL_SCHEME_HTTP
,S_OK
},
6587 {URLZONE_INVALID
,E_NOTIMPL
}
6590 { "http://winehq.org/dir/test?querystring",0,
6591 "#hash",Uri_CREATE_ALLOW_RELATIVE
,
6594 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6595 {"winehq.org",S_OK
},
6596 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6597 {"winehq.org",S_OK
},
6600 {"winehq.org",S_OK
},
6603 {"/dir/test?querystring",S_OK
},
6604 {"?querystring",S_OK
},
6605 {"http://winehq.org/dir/test?querystring#hash",S_OK
},
6611 {Uri_HOST_DNS
,S_OK
},
6613 {URL_SCHEME_HTTP
,S_OK
},
6614 {URLZONE_INVALID
,E_NOTIMPL
}
6617 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir\\file.txt",0,
6618 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6621 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6623 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6629 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6630 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6632 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6638 {Uri_HOST_UNKNOWN
,S_OK
},
6640 {URL_SCHEME_MK
,S_OK
},
6641 {URLZONE_INVALID
,E_NOTIMPL
}
6644 { "mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::\\subdir\\file.txt",0,
6645 "relative/path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6648 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6650 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6656 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6657 {"@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6659 {"mk:@MSITSTORE:C:\\Some\\Bogus\\Path.chm::/subdir/relative/path.txt",S_OK
},
6665 {Uri_HOST_UNKNOWN
,S_OK
},
6667 {URL_SCHEME_MK
,S_OK
},
6668 {URLZONE_INVALID
,E_NOTIMPL
}
6671 { "mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir\\file.txt",0,
6672 "relative\\path.txt",Uri_CREATE_ALLOW_RELATIVE
,
6675 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6677 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6683 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6684 {"@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6686 {"mk:@MSITSTORE:C:/Some\\Bogus/Path.chm::/subdir/relative/path.txt",S_OK
},
6692 {Uri_HOST_UNKNOWN
,S_OK
},
6694 {URL_SCHEME_MK
,S_OK
},
6695 {URLZONE_INVALID
,E_NOTIMPL
}
6698 { "http://winehq.org/dir/test?querystring",0,
6699 "//winehq.com/#hash",Uri_CREATE_ALLOW_RELATIVE
,
6702 {"http://winehq.com/#hash",S_OK
},
6703 {"winehq.com",S_OK
},
6704 {"http://winehq.com/#hash",S_OK
},
6705 {"winehq.com",S_OK
},
6708 {"winehq.com",S_OK
},
6713 {"http://winehq.com/#hash",S_OK
},
6719 {Uri_HOST_DNS
,S_OK
},
6720 {80,S_OK
,FALSE
,TRUE
},
6721 {URL_SCHEME_HTTP
,S_OK
},
6722 {URLZONE_INVALID
,E_NOTIMPL
}
6725 { "http://winehq.org/dir/test?querystring",0,
6726 "//winehq.com/dir2/../dir/file.txt?query#hash",Uri_CREATE_ALLOW_RELATIVE
,
6729 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
6730 {"winehq.com",S_OK
},
6731 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
6732 {"winehq.com",S_OK
},
6735 {"winehq.com",S_OK
},
6737 {"/dir/file.txt",S_OK
},
6738 {"/dir/file.txt?query",S_OK
},
6740 {"http://winehq.com/dir/file.txt?query#hash",S_OK
},
6746 {Uri_HOST_DNS
,S_OK
},
6747 {80,S_OK
,FALSE
,TRUE
},
6748 {URL_SCHEME_HTTP
,S_OK
},
6749 {URLZONE_INVALID
,E_NOTIMPL
}
6754 typedef struct _uri_parse_test
{
6759 const char *property
;
6764 static const uri_parse_test uri_parse_tests
[] = {
6765 /* PARSE_CANONICALIZE tests. */
6766 {"zip://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"zip://google.com/test<|>",S_OK
,FALSE
},
6767 {"http://google.com/test<|>",0,PARSE_CANONICALIZE
,0,"http://google.com/test%3C%7C%3E",S_OK
,FALSE
},
6768 {"http://google.com/%30%23%3F",0,PARSE_CANONICALIZE
,URL_UNESCAPE
,"http://google.com/0#?",S_OK
,FALSE
},
6769 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_UNSAFE
,"test %3C%7C%3E",S_OK
,FALSE
},
6770 {"test <|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_ESCAPE_SPACES_ONLY
,"test%20<|>",S_OK
,FALSE
},
6771 {"test%20<|>",Uri_CREATE_ALLOW_RELATIVE
,PARSE_CANONICALIZE
,URL_UNESCAPE
|URL_ESCAPE_UNSAFE
,"test%20%3C%7C%3E",S_OK
,FALSE
},
6772 {"http://google.com/%20",0,PARSE_CANONICALIZE
,URL_ESCAPE_PERCENT
,"http://google.com/%2520",S_OK
,FALSE
},
6773 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"http://google.com/test/../",S_OK
,FALSE
},
6774 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_NO_META
,"http://google.com/test/../",S_OK
,FALSE
},
6775 {"http://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"http://google.com/",S_OK
,FALSE
},
6776 {"zip://google.com/test/../",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,0,"zip://google.com/",S_OK
,FALSE
},
6777 {"file:///c:/test/../test",Uri_CREATE_NO_CANONICALIZE
,PARSE_CANONICALIZE
,URL_DONT_SIMPLIFY
,"file:///c:/test/../test",S_OK
,FALSE
},
6779 /* PARSE_FRIENDLY tests. */
6780 {"http://test@google.com/test#test",0,PARSE_FRIENDLY
,0,"http://google.com/test#test",S_OK
,FALSE
},
6781 {"zip://test@google.com/test",0,PARSE_FRIENDLY
,0,"zip://test@google.com/test",S_OK
,FALSE
},
6783 /* PARSE_ROOTDOCUMENT tests. */
6784 {"http://google.com:200/test/test",0,PARSE_ROOTDOCUMENT
,0,"http://google.com:200/",S_OK
,FALSE
},
6785 {"http://google.com",Uri_CREATE_NO_CANONICALIZE
,PARSE_ROOTDOCUMENT
,0,"http://google.com/",S_OK
,FALSE
},
6786 {"zip://google.com/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6787 {"file:///c:/testing/",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6788 {"file://server/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6789 {"zip:test/test",0,PARSE_ROOTDOCUMENT
,0,"",S_OK
,FALSE
},
6791 /* PARSE_DOCUMENT tests. */
6792 {"http://test@google.com/test?query#frag",0,PARSE_DOCUMENT
,0,"http://test@google.com/test?query",S_OK
,FALSE
},
6793 {"http:testing#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6794 {"file:///c:/test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6795 {"zip://google.com/#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6796 {"zip:test#frag",0,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6797 {"testing#frag",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOCUMENT
,0,"",S_OK
,FALSE
},
6799 /* PARSE_PATH_FROM_URL tests. */
6800 {"file:///c:/test.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\test.mp3",S_OK
,FALSE
},
6801 {"file:///c:/t<|>est.mp3",0,PARSE_PATH_FROM_URL
,0,"c:\\t<|>est.mp3",S_OK
,FALSE
},
6802 {"file:///c:/te%XX t/",0,PARSE_PATH_FROM_URL
,0,"c:\\te%XX t\\",S_OK
,FALSE
},
6803 {"file://server/test",0,PARSE_PATH_FROM_URL
,0,"\\\\server\\test",S_OK
,FALSE
},
6804 {"http://google.com/",0,PARSE_PATH_FROM_URL
,0,"",E_INVALIDARG
,FALSE
},
6806 /* PARSE_URL_FROM_PATH tests. */
6807 /* This function almost seems to useless (just returns the absolute uri). */
6808 {"test.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"test.com",S_OK
,FALSE
},
6809 {"/test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_URL_FROM_PATH
,0,"/test/test",S_OK
,FALSE
},
6810 {"file://c:\\test\\test",Uri_CREATE_FILE_USE_DOS_PATH
,PARSE_URL_FROM_PATH
,0,"file://c:\\test\\test",S_OK
,FALSE
},
6811 {"file:c:/test",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6812 {"http:google.com/",0,PARSE_URL_FROM_PATH
,0,"",S_OK
,FALSE
},
6814 /* PARSE_SCHEMA tests. */
6815 {"http://google.com/test",0,PARSE_SCHEMA
,0,"http",S_OK
,FALSE
},
6816 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SCHEMA
,0,"",S_OK
,FALSE
},
6818 /* PARSE_SITE tests. */
6819 {"http://google.uk.com/",0,PARSE_SITE
,0,"google.uk.com",S_OK
,FALSE
},
6820 {"http://google.com.com/",0,PARSE_SITE
,0,"google.com.com",S_OK
,FALSE
},
6821 {"google.com",Uri_CREATE_ALLOW_RELATIVE
,PARSE_SITE
,0,"",S_OK
,FALSE
},
6822 {"file://server/test",0,PARSE_SITE
,0,"server",S_OK
,FALSE
},
6824 /* PARSE_DOMAIN tests. */
6825 {"http://google.com.uk/",0,PARSE_DOMAIN
,0,"google.com.uk",S_OK
,FALSE
},
6826 {"http://google.com.com/",0,PARSE_DOMAIN
,0,"com.com",S_OK
,FALSE
},
6827 {"test/test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6828 {"file://server/test",0,PARSE_DOMAIN
,0,"",S_OK
,FALSE
},
6830 /* PARSE_LOCATION and PARSE_ANCHOR tests. */
6831 {"http://google.com/test#Test",0,PARSE_ANCHOR
,0,"#Test",S_OK
,FALSE
},
6832 {"http://google.com/test#Test",0,PARSE_LOCATION
,0,"#Test",S_OK
,FALSE
},
6833 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_ANCHOR
,0,"",S_OK
,FALSE
},
6834 {"test",Uri_CREATE_ALLOW_RELATIVE
,PARSE_LOCATION
,0,"",S_OK
,FALSE
}
6837 static inline LPWSTR
a2w(LPCSTR str
) {
6841 DWORD len
= MultiByteToWideChar(CP_ACP
, 0, str
, -1, NULL
, 0);
6842 ret
= HeapAlloc(GetProcessHeap(), 0, len
*sizeof(WCHAR
));
6843 MultiByteToWideChar(CP_ACP
, 0, str
, -1, ret
, len
);
6849 static inline BOOL
heap_free(void* mem
) {
6850 return HeapFree(GetProcessHeap(), 0, mem
);
6853 static inline DWORD
strcmp_aw(LPCSTR strA
, LPCWSTR strB
) {
6854 LPWSTR strAW
= a2w(strA
);
6855 DWORD ret
= lstrcmpW(strAW
, strB
);
6860 static inline ULONG
get_refcnt(IUri
*uri
) {
6862 return IUri_Release(uri
);
6865 static void change_property(IUriBuilder
*builder
, const uri_builder_property
*prop
,
6870 valueW
= a2w(prop
->value
);
6871 switch(prop
->property
) {
6872 case Uri_PROPERTY_FRAGMENT
:
6873 hr
= IUriBuilder_SetFragment(builder
, valueW
);
6876 ok(hr
== prop
->expected
,
6877 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6878 hr
, prop
->expected
, test_index
);
6881 ok(hr
== prop
->expected
,
6882 "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6883 hr
, prop
->expected
, test_index
);
6886 case Uri_PROPERTY_HOST
:
6887 hr
= IUriBuilder_SetHost(builder
, valueW
);
6890 ok(hr
== prop
->expected
,
6891 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6892 hr
, prop
->expected
, test_index
);
6895 ok(hr
== prop
->expected
,
6896 "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6897 hr
, prop
->expected
, test_index
);
6900 case Uri_PROPERTY_PASSWORD
:
6901 hr
= IUriBuilder_SetPassword(builder
, valueW
);
6904 ok(hr
== prop
->expected
,
6905 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6906 hr
, prop
->expected
, test_index
);
6909 ok(hr
== prop
->expected
,
6910 "Error: IUriBuilder_SetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6911 hr
, prop
->expected
, test_index
);
6914 case Uri_PROPERTY_PATH
:
6915 hr
= IUriBuilder_SetPath(builder
, valueW
);
6918 ok(hr
== prop
->expected
,
6919 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6920 hr
, prop
->expected
, test_index
);
6923 ok(hr
== prop
->expected
,
6924 "Error: IUriBuilder_SetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6925 hr
, prop
->expected
, test_index
);
6928 case Uri_PROPERTY_QUERY
:
6929 hr
= IUriBuilder_SetQuery(builder
, valueW
);
6932 ok(hr
== prop
->expected
,
6933 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6934 hr
, prop
->expected
, test_index
);
6937 ok(hr
== prop
->expected
,
6938 "Error: IUriBuilder_SetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6939 hr
, prop
->expected
, test_index
);
6942 case Uri_PROPERTY_SCHEME_NAME
:
6943 hr
= IUriBuilder_SetSchemeName(builder
, valueW
);
6946 ok(hr
== prop
->expected
,
6947 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6948 hr
, prop
->expected
, test_index
);
6951 ok(hr
== prop
->expected
,
6952 "Error: IUriBuilder_SetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6953 hr
, prop
->expected
, test_index
);
6956 case Uri_PROPERTY_USER_NAME
:
6957 hr
= IUriBuilder_SetUserName(builder
, valueW
);
6960 ok(hr
== prop
->expected
,
6961 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6962 hr
, prop
->expected
, test_index
);
6965 ok(hr
== prop
->expected
,
6966 "Error: IUriBuilder_SetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
6967 hr
, prop
->expected
, test_index
);
6971 trace("Unsupported operation for %d on uri_builder_tests[%d].\n", prop
->property
, test_index
);
6978 * Simple tests to make sure the CreateUri function handles invalid flag combinations
6981 static void test_CreateUri_InvalidFlags(void) {
6984 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
6986 IUri
*uri
= (void*) 0xdeadbeef;
6988 hr
= pCreateUri(http_urlW
, invalid_flag_tests
[i
].flags
, 0, &uri
);
6989 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x, flags=0x%08x\n",
6990 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
6991 ok(uri
== NULL
, "Error: expected the IUri to be NULL, but it was %p instead\n", uri
);
6995 static void test_CreateUri_InvalidArgs(void) {
6997 IUri
*uri
= (void*) 0xdeadbeef;
6999 const WCHAR invalidW
[] = {'i','n','v','a','l','i','d',0};
7000 static const WCHAR emptyW
[] = {0};
7002 hr
= pCreateUri(http_urlW
, 0, 0, NULL
);
7003 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7005 hr
= pCreateUri(NULL
, 0, 0, &uri
);
7006 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x\n", hr
, E_INVALIDARG
);
7007 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7009 uri
= (void*) 0xdeadbeef;
7010 hr
= pCreateUri(invalidW
, 0, 0, &uri
);
7011 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7012 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7014 uri
= (void*) 0xdeadbeef;
7015 hr
= pCreateUri(emptyW
, 0, 0, &uri
);
7016 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7017 ok(uri
== NULL
, "Error: Expected the IUri to be NULL, but it was %p instead\n", uri
);
7020 static void test_CreateUri_InvalidUri(void) {
7023 for(i
= 0; i
< sizeof(invalid_uri_tests
)/sizeof(invalid_uri_tests
[0]); ++i
) {
7024 invalid_uri test
= invalid_uri_tests
[i
];
7029 uriW
= a2w(test
.uri
);
7030 hr
= pCreateUri(uriW
, test
.flags
, 0, &uri
);
7033 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7034 hr
, E_INVALIDARG
, i
);
7037 ok(hr
== E_INVALIDARG
, "Error: CreateUri returned 0x%08x, expected 0x%08x on invalid_uri_tests[%d].\n",
7038 hr
, E_INVALIDARG
, i
);
7040 if(uri
) IUri_Release(uri
);
7046 static void test_IUri_GetPropertyBSTR(void) {
7051 /* Make sure GetPropertyBSTR handles invalid args correctly. */
7052 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7053 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7055 BSTR received
= NULL
;
7057 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, NULL
, 0);
7058 ok(hr
== E_POINTER
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7060 /* Make sure it handles a invalid Uri_PROPERTY's correctly. */
7061 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_PORT
, &received
, 0);
7062 ok(hr
== S_OK
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7063 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7064 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7065 SysFreeString(received
);
7067 /* Make sure it handles the ZONE property correctly. */
7069 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_ZONE
, &received
, 0);
7070 ok(hr
== S_FALSE
, "Error: GetPropertyBSTR returned 0x%08x, expected 0x%08x.\n", hr
, S_FALSE
);
7071 ok(received
!= NULL
, "Error: Expected the string not to be NULL.\n");
7072 ok(!SysStringLen(received
), "Error: Expected the string to be of len=0 but it was %d instead.\n", SysStringLen(received
));
7073 SysFreeString(received
);
7075 if(uri
) IUri_Release(uri
);
7077 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7078 uri_properties test
= uri_tests
[i
];
7082 uriW
= a2w(test
.uri
);
7083 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7084 if(test
.create_todo
) {
7086 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7087 hr
, test
.create_expected
, i
);
7090 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7091 hr
, test
.create_expected
, i
);
7097 /* Checks all the string properties of the uri. */
7098 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7099 BSTR received
= NULL
;
7100 uri_str_property prop
= test
.str_props
[j
];
7102 hr
= IUri_GetPropertyBSTR(uri
, j
, &received
, 0);
7105 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7106 hr
, prop
.expected
, i
, j
);
7109 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7110 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7111 prop
.value
, wine_dbgstr_w(received
), i
, j
);
7114 ok(hr
== prop
.expected
, "GetPropertyBSTR returned 0x%08x, expected 0x%08x. On uri_tests[%d].str_props[%d].\n",
7115 hr
, prop
.expected
, i
, j
);
7116 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7117 "Expected %s but got %s on uri_tests[%d].str_props[%d].\n",
7118 prop
.value
, wine_dbgstr_w(received
), i
, j
);
7121 SysFreeString(received
);
7125 if(uri
) IUri_Release(uri
);
7131 static void test_IUri_GetPropertyDWORD(void) {
7136 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7137 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7139 DWORD received
= 0xdeadbeef;
7141 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_DWORD_START
, NULL
, 0);
7142 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7144 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_ABSOLUTE_URI
, &received
, 0);
7145 ok(hr
== E_INVALIDARG
, "Error: GetPropertyDWORD returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7146 ok(received
== 0, "Error: Expected received=%d but instead received=%d.\n", 0, received
);
7148 if(uri
) IUri_Release(uri
);
7150 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7151 uri_properties test
= uri_tests
[i
];
7155 uriW
= a2w(test
.uri
);
7156 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7157 if(test
.create_todo
) {
7159 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7160 hr
, test
.create_expected
, i
);
7163 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x. Failed on uri_tests[%d].\n",
7164 hr
, test
.create_expected
, i
);
7170 /* Checks all the DWORD properties of the uri. */
7171 for(j
= 0; j
< sizeof(test
.dword_props
)/sizeof(test
.dword_props
[0]); ++j
) {
7173 uri_dword_property prop
= test
.dword_props
[j
];
7175 hr
= IUri_GetPropertyDWORD(uri
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
7178 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7179 hr
, prop
.expected
, i
, j
);
7182 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7183 prop
.value
, received
, i
, j
);
7186 ok(hr
== prop
.expected
, "GetPropertyDWORD returned 0x%08x, expected 0x%08x. On uri_tests[%d].dword_props[%d].\n",
7187 hr
, prop
.expected
, i
, j
);
7188 ok(prop
.value
== received
, "Expected %d but got %d on uri_tests[%d].dword_props[%d].\n",
7189 prop
.value
, received
, i
, j
);
7194 if(uri
) IUri_Release(uri
);
7200 /* Tests all the 'Get*' property functions which deal with strings. */
7201 static void test_IUri_GetStrProperties(void) {
7206 /* Make sure all the 'Get*' string property functions handle invalid args correctly. */
7207 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7208 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7210 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
7211 ok(hr
== E_POINTER
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7213 hr
= IUri_GetAuthority(uri
, NULL
);
7214 ok(hr
== E_POINTER
, "Error: GetAuthority returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7216 hr
= IUri_GetDisplayUri(uri
, NULL
);
7217 ok(hr
== E_POINTER
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7219 hr
= IUri_GetDomain(uri
, NULL
);
7220 ok(hr
== E_POINTER
, "Error: GetDomain returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7222 hr
= IUri_GetExtension(uri
, NULL
);
7223 ok(hr
== E_POINTER
, "Error: GetExtension returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7225 hr
= IUri_GetFragment(uri
, NULL
);
7226 ok(hr
== E_POINTER
, "Error: GetFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7228 hr
= IUri_GetHost(uri
, NULL
);
7229 ok(hr
== E_POINTER
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7231 hr
= IUri_GetPassword(uri
, NULL
);
7232 ok(hr
== E_POINTER
, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7234 hr
= IUri_GetPath(uri
, NULL
);
7235 ok(hr
== E_POINTER
, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7237 hr
= IUri_GetPathAndQuery(uri
, NULL
);
7238 ok(hr
== E_POINTER
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7240 hr
= IUri_GetQuery(uri
, NULL
);
7241 ok(hr
== E_POINTER
, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7243 hr
= IUri_GetRawUri(uri
, NULL
);
7244 ok(hr
== E_POINTER
, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7246 hr
= IUri_GetSchemeName(uri
, NULL
);
7247 ok(hr
== E_POINTER
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7249 hr
= IUri_GetUserInfo(uri
, NULL
);
7250 ok(hr
== E_POINTER
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7252 hr
= IUri_GetUserName(uri
, NULL
);
7253 ok(hr
== E_POINTER
, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
7255 if(uri
) IUri_Release(uri
);
7257 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7258 uri_properties test
= uri_tests
[i
];
7262 uriW
= a2w(test
.uri
);
7263 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7264 if(test
.create_todo
) {
7266 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7267 hr
, test
.create_expected
, i
);
7270 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7271 hr
, test
.create_expected
, i
);
7275 uri_str_property prop
;
7276 BSTR received
= NULL
;
7278 /* GetAbsoluteUri() tests. */
7279 prop
= test
.str_props
[Uri_PROPERTY_ABSOLUTE_URI
];
7280 hr
= IUri_GetAbsoluteUri(uri
, &received
);
7283 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7284 hr
, prop
.expected
, i
);
7287 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7288 "Error: Expected %s but got %s on uri_tests[%d].\n",
7289 prop
.value
, wine_dbgstr_w(received
), i
);
7292 ok(hr
== prop
.expected
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7293 hr
, prop
.expected
, i
);
7294 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7295 "Error: Expected %s but got %s on uri_tests[%d].\n",
7296 prop
.value
, wine_dbgstr_w(received
), i
);
7298 SysFreeString(received
);
7301 /* GetAuthority() tests. */
7302 prop
= test
.str_props
[Uri_PROPERTY_AUTHORITY
];
7303 hr
= IUri_GetAuthority(uri
, &received
);
7306 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7307 hr
, prop
.expected
, i
);
7310 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7311 prop
.value
, wine_dbgstr_w(received
), i
);
7314 ok(hr
== prop
.expected
, "Error: GetAuthority returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7315 hr
, prop
.expected
, i
);
7316 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7317 prop
.value
, wine_dbgstr_w(received
), i
);
7319 SysFreeString(received
);
7322 /* GetDisplayUri() tests. */
7323 prop
= test
.str_props
[Uri_PROPERTY_DISPLAY_URI
];
7324 hr
= IUri_GetDisplayUri(uri
, &received
);
7327 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7328 hr
, prop
.expected
, i
);
7331 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7332 "Error: Expected %s but got %s on uri_test[%d].\n",
7333 prop
.value
, wine_dbgstr_w(received
), i
);
7336 ok(hr
== prop
.expected
, "Error: GetDisplayUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7337 hr
, prop
.expected
, i
);
7338 ok(!strcmp_aw(prop
.value
, received
) || broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
7339 "Error: Expected %s but got %s on uri_tests[%d].\n",
7340 prop
.value
, wine_dbgstr_w(received
), i
);
7342 SysFreeString(received
);
7345 /* GetDomain() tests. */
7346 prop
= test
.str_props
[Uri_PROPERTY_DOMAIN
];
7347 hr
= IUri_GetDomain(uri
, &received
);
7350 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7351 hr
, prop
.expected
, i
);
7354 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7355 prop
.value
, wine_dbgstr_w(received
), i
);
7358 ok(hr
== prop
.expected
, "Error: GetDomain returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7359 hr
, prop
.expected
, i
);
7360 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7361 prop
.value
, wine_dbgstr_w(received
), i
);
7363 SysFreeString(received
);
7366 /* GetExtension() tests. */
7367 prop
= test
.str_props
[Uri_PROPERTY_EXTENSION
];
7368 hr
= IUri_GetExtension(uri
, &received
);
7371 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7372 hr
, prop
.expected
, i
);
7375 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7376 prop
.value
, wine_dbgstr_w(received
), i
);
7379 ok(hr
== prop
.expected
, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7380 hr
, prop
.expected
, i
);
7381 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7382 prop
.value
, wine_dbgstr_w(received
), i
);
7384 SysFreeString(received
);
7387 /* GetFragment() tests. */
7388 prop
= test
.str_props
[Uri_PROPERTY_FRAGMENT
];
7389 hr
= IUri_GetFragment(uri
, &received
);
7392 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7393 hr
, prop
.expected
, i
);
7396 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7397 prop
.value
, wine_dbgstr_w(received
), i
);
7400 ok(hr
== prop
.expected
, "Error: GetFragment returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7401 hr
, prop
.expected
, i
);
7402 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7403 prop
.value
, wine_dbgstr_w(received
), i
);
7405 SysFreeString(received
);
7408 /* GetHost() tests. */
7409 prop
= test
.str_props
[Uri_PROPERTY_HOST
];
7410 hr
= IUri_GetHost(uri
, &received
);
7413 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7414 hr
, prop
.expected
, i
);
7417 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7418 prop
.value
, wine_dbgstr_w(received
), i
);
7421 ok(hr
== prop
.expected
, "Error: GetHost returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7422 hr
, prop
.expected
, i
);
7423 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7424 prop
.value
, wine_dbgstr_w(received
), i
);
7426 SysFreeString(received
);
7429 /* GetPassword() tests. */
7430 prop
= test
.str_props
[Uri_PROPERTY_PASSWORD
];
7431 hr
= IUri_GetPassword(uri
, &received
);
7434 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7435 hr
, prop
.expected
, i
);
7438 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7439 prop
.value
, wine_dbgstr_w(received
), i
);
7442 ok(hr
== prop
.expected
, "Error: GetPassword returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7443 hr
, prop
.expected
, i
);
7444 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7445 prop
.value
, wine_dbgstr_w(received
), i
);
7447 SysFreeString(received
);
7450 /* GetPath() tests. */
7451 prop
= test
.str_props
[Uri_PROPERTY_PATH
];
7452 hr
= IUri_GetPath(uri
, &received
);
7455 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7456 hr
, prop
.expected
, i
);
7459 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7460 prop
.value
, wine_dbgstr_w(received
), i
);
7463 ok(hr
== prop
.expected
, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7464 hr
, prop
.expected
, i
);
7465 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7466 prop
.value
, wine_dbgstr_w(received
), i
);
7468 SysFreeString(received
);
7471 /* GetPathAndQuery() tests. */
7472 prop
= test
.str_props
[Uri_PROPERTY_PATH_AND_QUERY
];
7473 hr
= IUri_GetPathAndQuery(uri
, &received
);
7476 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7477 hr
, prop
.expected
, i
);
7480 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7481 prop
.value
, wine_dbgstr_w(received
), i
);
7484 ok(hr
== prop
.expected
, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7485 hr
, prop
.expected
, i
);
7486 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7487 prop
.value
, wine_dbgstr_w(received
), i
);
7489 SysFreeString(received
);
7492 /* GetQuery() tests. */
7493 prop
= test
.str_props
[Uri_PROPERTY_QUERY
];
7494 hr
= IUri_GetQuery(uri
, &received
);
7497 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7498 hr
, prop
.expected
, i
);
7501 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7502 prop
.value
, wine_dbgstr_w(received
), i
);
7505 ok(hr
== prop
.expected
, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7506 hr
, prop
.expected
, i
);
7507 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7508 prop
.value
, wine_dbgstr_w(received
), i
);
7510 SysFreeString(received
);
7513 /* GetRawUri() tests. */
7514 prop
= test
.str_props
[Uri_PROPERTY_RAW_URI
];
7515 hr
= IUri_GetRawUri(uri
, &received
);
7518 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7519 hr
, prop
.expected
, i
);
7522 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7523 prop
.value
, wine_dbgstr_w(received
), i
);
7526 ok(hr
== prop
.expected
, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7527 hr
, prop
.expected
, i
);
7528 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7529 prop
.value
, wine_dbgstr_w(received
), i
);
7531 SysFreeString(received
);
7534 /* GetSchemeName() tests. */
7535 prop
= test
.str_props
[Uri_PROPERTY_SCHEME_NAME
];
7536 hr
= IUri_GetSchemeName(uri
, &received
);
7539 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7540 hr
, prop
.expected
, i
);
7543 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7544 prop
.value
, wine_dbgstr_w(received
), i
);
7547 ok(hr
== prop
.expected
, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7548 hr
, prop
.expected
, i
);
7549 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7550 prop
.value
, wine_dbgstr_w(received
), i
);
7552 SysFreeString(received
);
7555 /* GetUserInfo() tests. */
7556 prop
= test
.str_props
[Uri_PROPERTY_USER_INFO
];
7557 hr
= IUri_GetUserInfo(uri
, &received
);
7560 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7561 hr
, prop
.expected
, i
);
7564 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7565 prop
.value
, wine_dbgstr_w(received
), i
);
7568 ok(hr
== prop
.expected
, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7569 hr
, prop
.expected
, i
);
7570 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7571 prop
.value
, wine_dbgstr_w(received
), i
);
7573 SysFreeString(received
);
7576 /* GetUserName() tests. */
7577 prop
= test
.str_props
[Uri_PROPERTY_USER_NAME
];
7578 hr
= IUri_GetUserName(uri
, &received
);
7581 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7582 hr
, prop
.expected
, i
);
7585 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7586 prop
.value
, wine_dbgstr_w(received
), i
);
7589 ok(hr
== prop
.expected
, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7590 hr
, prop
.expected
, i
);
7591 ok(!strcmp_aw(prop
.value
, received
), "Error: Expected %s but got %s on uri_tests[%d].\n",
7592 prop
.value
, wine_dbgstr_w(received
), i
);
7594 SysFreeString(received
);
7597 if(uri
) IUri_Release(uri
);
7603 static void test_IUri_GetDwordProperties(void) {
7608 /* Make sure all the 'Get*' dword property functions handle invalid args correctly. */
7609 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7610 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7612 hr
= IUri_GetHostType(uri
, NULL
);
7613 ok(hr
== E_INVALIDARG
, "Error: GetHostType returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7615 hr
= IUri_GetPort(uri
, NULL
);
7616 ok(hr
== E_INVALIDARG
, "Error: GetPort returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7618 hr
= IUri_GetScheme(uri
, NULL
);
7619 ok(hr
== E_INVALIDARG
, "Error: GetScheme returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7621 hr
= IUri_GetZone(uri
, NULL
);
7622 ok(hr
== E_INVALIDARG
, "Error: GetZone returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7624 if(uri
) IUri_Release(uri
);
7626 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7627 uri_properties test
= uri_tests
[i
];
7631 uriW
= a2w(test
.uri
);
7632 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7633 if(test
.create_todo
) {
7635 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7636 hr
, test
.create_expected
, i
);
7639 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7640 hr
, test
.create_expected
, i
);
7644 uri_dword_property prop
;
7647 /* Assign an insane value so tests don't accidentally pass when
7650 received
= -9999999;
7652 /* GetHostType() tests. */
7653 prop
= test
.dword_props
[Uri_PROPERTY_HOST_TYPE
-Uri_PROPERTY_DWORD_START
];
7654 hr
= IUri_GetHostType(uri
, &received
);
7657 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7658 hr
, prop
.expected
, i
);
7661 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7664 ok(hr
== prop
.expected
, "Error: GetHostType returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7665 hr
, prop
.expected
, i
);
7666 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7668 received
= -9999999;
7670 /* GetPort() tests. */
7671 prop
= test
.dword_props
[Uri_PROPERTY_PORT
-Uri_PROPERTY_DWORD_START
];
7672 hr
= IUri_GetPort(uri
, &received
);
7675 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7676 hr
, prop
.expected
, i
);
7679 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7682 ok(hr
== prop
.expected
, "Error: GetPort returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7683 hr
, prop
.expected
, i
);
7684 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7686 received
= -9999999;
7688 /* GetScheme() tests. */
7689 prop
= test
.dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
];
7690 hr
= IUri_GetScheme(uri
, &received
);
7693 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7694 hr
, prop
.expected
, i
);
7697 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7700 ok(hr
== prop
.expected
, "Error: GetScheme returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7701 hr
, prop
.expected
, i
);
7702 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7704 received
= -9999999;
7706 /* GetZone() tests. */
7707 prop
= test
.dword_props
[Uri_PROPERTY_ZONE
-Uri_PROPERTY_DWORD_START
];
7708 hr
= IUri_GetZone(uri
, &received
);
7711 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7712 hr
, prop
.expected
, i
);
7715 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7718 ok(hr
== prop
.expected
, "Error: GetZone returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7719 hr
, prop
.expected
, i
);
7720 ok(received
== prop
.value
, "Error: Expected %d but got %d on uri_tests[%d].\n", prop
.value
, received
, i
);
7724 if(uri
) IUri_Release(uri
);
7730 static void test_IUri_GetPropertyLength(void) {
7735 /* Make sure it handles invalid args correctly. */
7736 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7737 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7739 DWORD received
= 0xdeadbeef;
7741 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_STRING_START
, NULL
, 0);
7742 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7744 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_DWORD_START
, &received
, 0);
7745 ok(hr
== E_INVALIDARG
, "Error: GetPropertyLength return 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7746 ok(received
== 0xdeadbeef, "Error: Expected 0xdeadbeef but got 0x%08x.\n", received
);
7748 if(uri
) IUri_Release(uri
);
7750 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7751 uri_properties test
= uri_tests
[i
];
7755 uriW
= a2w(test
.uri
);
7756 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7757 if(test
.create_todo
) {
7759 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n",
7760 hr
, test
.create_expected
, i
);
7763 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_test[%d].\n",
7764 hr
, test
.create_expected
, i
);
7770 for(j
= Uri_PROPERTY_STRING_START
; j
<= Uri_PROPERTY_STRING_LAST
; ++j
) {
7771 DWORD expectedLen
, brokenLen
, receivedLen
;
7772 uri_str_property prop
= test
.str_props
[j
];
7774 expectedLen
= lstrlen(prop
.value
);
7775 brokenLen
= lstrlen(prop
.broken_value
);
7777 /* This won't be necessary once GetPropertyLength is implemented. */
7780 hr
= IUri_GetPropertyLength(uri
, j
, &receivedLen
, 0);
7783 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7784 hr
, prop
.expected
, i
, j
);
7787 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7788 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7789 expectedLen
, receivedLen
, i
, j
);
7792 ok(hr
== prop
.expected
, "Error: GetPropertyLength returned 0x%08x, expected 0x%08x on uri_tests[%d].str_props[%d].\n",
7793 hr
, prop
.expected
, i
, j
);
7794 ok(receivedLen
== expectedLen
|| broken(receivedLen
== brokenLen
),
7795 "Error: Expected a length of %d but got %d on uri_tests[%d].str_props[%d].\n",
7796 expectedLen
, receivedLen
, i
, j
);
7801 if(uri
) IUri_Release(uri
);
7807 static DWORD
compute_expected_props(uri_properties
*test
)
7811 for(i
=Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_STRING_LAST
; i
++) {
7812 if(test
->str_props
[i
-Uri_PROPERTY_STRING_START
].expected
== S_OK
)
7816 for(i
=Uri_PROPERTY_DWORD_START
; i
<= Uri_PROPERTY_DWORD_LAST
; i
++) {
7817 if(test
->dword_props
[i
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
7824 static void test_IUri_GetProperties(void) {
7829 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7830 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7832 hr
= IUri_GetProperties(uri
, NULL
);
7833 ok(hr
== E_INVALIDARG
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7835 if(uri
) IUri_Release(uri
);
7837 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7838 uri_properties test
= uri_tests
[i
];
7842 uriW
= a2w(test
.uri
);
7843 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7844 if(test
.create_todo
) {
7846 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7849 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7853 DWORD received
= 0, expected_props
;
7856 hr
= IUri_GetProperties(uri
, &received
);
7857 ok(hr
== S_OK
, "Error: GetProperties returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7859 expected_props
= compute_expected_props(&test
);
7861 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7862 /* (1 << j) converts a Uri_PROPERTY to its corresponding Uri_HAS_* flag mask. */
7863 if(expected_props
& (1 << j
))
7864 ok(received
& (1 << j
), "Error: Expected flag for property %d on uri_tests[%d].\n", j
, i
);
7866 ok(!(received
& (1 << j
)), "Error: Received flag for property %d when not expected on uri_tests[%d].\n", j
, i
);
7870 if(uri
) IUri_Release(uri
);
7876 static void test_IUri_HasProperty(void) {
7881 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
7882 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
7884 hr
= IUri_HasProperty(uri
, Uri_PROPERTY_RAW_URI
, NULL
);
7885 ok(hr
== E_INVALIDARG
, "Error: HasProperty returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7887 if(uri
) IUri_Release(uri
);
7889 for(i
= 0; i
< sizeof(uri_tests
)/sizeof(uri_tests
[0]); ++i
) {
7890 uri_properties test
= uri_tests
[i
];
7894 uriW
= a2w(test
.uri
);
7896 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
7897 if(test
.create_todo
) {
7899 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7902 ok(hr
== test
.create_expected
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, test
.create_expected
);
7906 DWORD expected_props
, j
;
7908 expected_props
= compute_expected_props(&test
);
7910 for(j
= 0; j
<= Uri_PROPERTY_DWORD_LAST
; ++j
) {
7911 /* Assign -1, then explicitly test for TRUE or FALSE later. */
7914 hr
= IUri_HasProperty(uri
, j
, &received
);
7915 ok(hr
== S_OK
, "Error: HasProperty returned 0x%08x, expected 0x%08x for property %d on uri_tests[%d].\n",
7918 if(expected_props
& (1 << j
)) {
7919 ok(received
== TRUE
, "Error: Expected to have property %d on uri_tests[%d].\n", j
, i
);
7921 ok(received
== FALSE
, "Error: Wasn't expecting to have property %d on uri_tests[%d].\n", j
, i
);
7926 if(uri
) IUri_Release(uri
);
7932 static void test_IUri_IsEqual(void) {
7940 /* Make sure IsEqual handles invalid args correctly. */
7941 hres
= pCreateUri(http_urlW
, 0, 0, &uriA
);
7942 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7943 hres
= pCreateUri(http_urlW
, 0, 0, &uriB
);
7944 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7947 hres
= IUri_IsEqual(uriA
, NULL
, &equal
);
7948 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, S_OK
);
7949 ok(!equal
, "Error: Expected equal to be FALSE, but was %d instead.\n", equal
);
7951 hres
= IUri_IsEqual(uriA
, uriB
, NULL
);
7952 ok(hres
== E_POINTER
, "Error: IsEqual returned 0x%08x, expected 0x%08x.\n", hres
, E_POINTER
);
7957 for(i
= 0; i
< sizeof(equality_tests
)/sizeof(equality_tests
[0]); ++i
) {
7958 uri_equality test
= equality_tests
[i
];
7959 LPWSTR uriA_W
, uriB_W
;
7963 uriA_W
= a2w(test
.a
);
7964 uriB_W
= a2w(test
.b
);
7966 hres
= pCreateUri(uriA_W
, test
.create_flags_a
, 0, &uriA
);
7967 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].a\n", hres
, S_OK
, i
);
7969 hres
= pCreateUri(uriB_W
, test
.create_flags_b
, 0, &uriB
);
7970 ok(hres
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on equality_tests[%d].b\n", hres
, S_OK
, i
);
7973 hres
= IUri_IsEqual(uriA
, uriB
, &equal
);
7974 if(test
.todo
) todo_wine
{
7975 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7976 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7978 ok(hres
== S_OK
, "Error: IsEqual returned 0x%08x, expected 0x%08x on equality_tests[%d].\n", hres
, S_OK
, i
);
7979 ok(equal
== test
.equal
, "Error: Expected the comparison to be %d on equality_tests[%d].\n", test
.equal
, i
);
7981 if(uriA
) IUri_Release(uriA
);
7982 if(uriB
) IUri_Release(uriB
);
7989 static void test_CreateUriWithFragment_InvalidArgs(void) {
7991 IUri
*uri
= (void*) 0xdeadbeef;
7992 const WCHAR fragmentW
[] = {'#','f','r','a','g','m','e','n','t',0};
7994 hr
= pCreateUriWithFragment(NULL
, fragmentW
, 0, 0, &uri
);
7995 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
7996 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
7998 hr
= pCreateUriWithFragment(http_urlW
, fragmentW
, 0, 0, NULL
);
7999 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8001 /* Original URI can't already contain a fragment component. */
8002 uri
= (void*) 0xdeadbeef;
8003 hr
= pCreateUriWithFragment(http_url_fragW
, fragmentW
, 0, 0, &uri
);
8004 ok(hr
== E_INVALIDARG
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
8005 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8008 /* CreateUriWithFragment has the same invalid flag combinations as CreateUri. */
8009 static void test_CreateUriWithFragment_InvalidFlags(void) {
8012 for(i
= 0; i
< sizeof(invalid_flag_tests
)/sizeof(invalid_flag_tests
[0]); ++i
) {
8014 IUri
*uri
= (void*) 0xdeadbeef;
8016 hr
= pCreateUriWithFragment(http_urlW
, NULL
, invalid_flag_tests
[i
].flags
, 0, &uri
);
8017 ok(hr
== invalid_flag_tests
[i
].expected
, "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x. flags=0x%08x.\n",
8018 hr
, invalid_flag_tests
[i
].expected
, invalid_flag_tests
[i
].flags
);
8019 ok(uri
== NULL
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8023 static void test_CreateUriWithFragment(void) {
8026 for(i
= 0; i
< sizeof(uri_fragment_tests
)/sizeof(uri_fragment_tests
[0]); ++i
) {
8030 uri_with_fragment test
= uri_fragment_tests
[i
];
8032 uriW
= a2w(test
.uri
);
8033 fragW
= a2w(test
.fragment
);
8035 hr
= pCreateUriWithFragment(uriW
, fragW
, test
.create_flags
, 0, &uri
);
8036 if(test
.expected_todo
) {
8038 ok(hr
== test
.create_expected
,
8039 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8040 hr
, test
.create_expected
, i
);
8043 ok(hr
== test
.create_expected
,
8044 "Error: CreateUriWithFragment returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8045 hr
, test
.create_expected
, i
);
8048 BSTR received
= NULL
;
8050 hr
= IUri_GetAbsoluteUri(uri
, &received
);
8051 if(test
.expected_todo
) {
8054 "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8058 ok(!strcmp_aw(test
.expected_uri
, received
),
8059 "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8060 test
.expected_uri
, wine_dbgstr_w(received
), i
);
8063 ok(hr
== S_OK
, "Error: GetAbsoluteUri returned 0x%08x, expected 0x%08x on uri_fragment_tests[%d].\n",
8065 ok(!strcmp_aw(test
.expected_uri
, received
), "Error: Expected %s but got %s on uri_fragment_tests[%d].\n",
8066 test
.expected_uri
, wine_dbgstr_w(received
), i
);
8069 SysFreeString(received
);
8072 if(uri
) IUri_Release(uri
);
8078 static void test_CreateIUriBuilder(void) {
8080 IUriBuilder
*builder
= NULL
;
8083 hr
= pCreateIUriBuilder(NULL
, 0, 0, NULL
);
8084 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x\n",
8087 /* CreateIUriBuilder increases the ref count of the IUri it receives. */
8088 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
8089 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8091 ULONG cur_count
, orig_count
;
8093 orig_count
= get_refcnt(uri
);
8094 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
8095 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8096 ok(builder
!= NULL
, "Error: Expecting builder not to be NULL\n");
8098 cur_count
= get_refcnt(uri
);
8099 ok(cur_count
== orig_count
+1, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
+1, cur_count
);
8101 if(builder
) IUriBuilder_Release(builder
);
8102 cur_count
= get_refcnt(uri
);
8103 ok(cur_count
== orig_count
, "Error: Expected the ref count to be %u, but was %u instead.\n", orig_count
, cur_count
);
8105 if(uri
) IUri_Release(uri
);
8108 static void test_IUriBuilder_CreateUri(IUriBuilder
*builder
, const uri_builder_test
*test
,
8113 hr
= IUriBuilder_CreateUri(builder
, test
->uri_flags
, 0, 0, &uri
);
8114 if(test
->uri_todo
) {
8116 ok(hr
== test
->uri_hres
,
8117 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8118 hr
, test
->uri_hres
, test_index
);
8121 ok(hr
== test
->uri_hres
,
8122 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8123 hr
, test
->uri_hres
, test_index
);
8129 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8130 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8131 BSTR received
= NULL
;
8133 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8136 ok(hr
== prop
.result
,
8137 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8138 hr
, prop
.result
, test_index
, i
);
8141 ok(hr
== prop
.result
,
8142 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8143 hr
, prop
.result
, test_index
, i
);
8148 ok(!strcmp_aw(prop
.expected
, received
),
8149 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8150 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8153 ok(!strcmp_aw(prop
.expected
, received
),
8154 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8155 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8158 SysFreeString(received
);
8161 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8162 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8163 DWORD received
= -2;
8165 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8168 ok(hr
== prop
.result
,
8169 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8170 hr
, prop
.result
, test_index
, i
);
8173 ok(hr
== prop
.result
,
8174 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8175 hr
, prop
.result
, test_index
, i
);
8180 ok(received
== prop
.expected
,
8181 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8182 prop
.expected
, received
, test_index
, i
);
8185 ok(received
== prop
.expected
,
8186 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8187 prop
.expected
, received
, test_index
, i
);
8192 if(uri
) IUri_Release(uri
);
8195 static void test_IUriBuilder_CreateUriSimple(IUriBuilder
*builder
, const uri_builder_test
*test
,
8200 hr
= IUriBuilder_CreateUriSimple(builder
, test
->uri_simple_encode_flags
, 0, &uri
);
8201 if(test
->uri_simple_todo
) {
8203 ok(hr
== test
->uri_simple_hres
,
8204 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8205 hr
, test
->uri_simple_hres
, test_index
);
8208 ok(hr
== test
->uri_simple_hres
,
8209 "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8210 hr
, test
->uri_simple_hres
, test_index
);
8216 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8217 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8218 BSTR received
= NULL
;
8220 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8223 ok(hr
== prop
.result
,
8224 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8225 hr
, prop
.result
, test_index
, i
);
8228 ok(hr
== prop
.result
,
8229 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8230 hr
, prop
.result
, test_index
, i
);
8235 ok(!strcmp_aw(prop
.expected
, received
),
8236 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8237 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8240 ok(!strcmp_aw(prop
.expected
, received
),
8241 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8242 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8245 SysFreeString(received
);
8248 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8249 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8250 DWORD received
= -2;
8252 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8255 ok(hr
== prop
.result
,
8256 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8257 hr
, prop
.result
, test_index
, i
);
8260 ok(hr
== prop
.result
,
8261 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8262 hr
, prop
.result
, test_index
, i
);
8267 ok(received
== prop
.expected
,
8268 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8269 prop
.expected
, received
, test_index
, i
);
8272 ok(received
== prop
.expected
,
8273 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8274 prop
.expected
, received
, test_index
, i
);
8279 if(uri
) IUri_Release(uri
);
8282 static void test_IUriBuilder_CreateUriWithFlags(IUriBuilder
*builder
, const uri_builder_test
*test
,
8287 hr
= IUriBuilder_CreateUriWithFlags(builder
, test
->uri_with_flags
, test
->uri_with_builder_flags
,
8288 test
->uri_with_encode_flags
, 0, &uri
);
8289 if(test
->uri_with_todo
) {
8291 ok(hr
== test
->uri_with_hres
,
8292 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8293 hr
, test
->uri_with_hres
, test_index
);
8296 ok(hr
== test
->uri_with_hres
,
8297 "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8298 hr
, test
->uri_with_hres
, test_index
);
8304 for(i
= 0; i
< sizeof(test
->expected_str_props
)/sizeof(test
->expected_str_props
[0]); ++i
) {
8305 uri_builder_str_property prop
= test
->expected_str_props
[i
];
8306 BSTR received
= NULL
;
8308 hr
= IUri_GetPropertyBSTR(uri
, i
, &received
, 0);
8311 ok(hr
== prop
.result
,
8312 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8313 hr
, prop
.result
, test_index
, i
);
8316 ok(hr
== prop
.result
,
8317 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_str_props[%d].\n",
8318 hr
, prop
.result
, test_index
, i
);
8323 ok(!strcmp_aw(prop
.expected
, received
),
8324 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8325 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8328 ok(!strcmp_aw(prop
.expected
, received
),
8329 "Error: Expected %s but got %s instead on uri_builder_tests[%d].expected_str_props[%d].\n",
8330 prop
.expected
, wine_dbgstr_w(received
), test_index
, i
);
8333 SysFreeString(received
);
8336 for(i
= 0; i
< sizeof(test
->expected_dword_props
)/sizeof(test
->expected_dword_props
[0]); ++i
) {
8337 uri_builder_dword_property prop
= test
->expected_dword_props
[i
];
8338 DWORD received
= -2;
8340 hr
= IUri_GetPropertyDWORD(uri
, i
+Uri_PROPERTY_DWORD_START
, &received
, 0);
8343 ok(hr
== prop
.result
,
8344 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8345 hr
, prop
.result
, test_index
, i
);
8348 ok(hr
== prop
.result
,
8349 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].expected_dword_props[%d].\n",
8350 hr
, prop
.result
, test_index
, i
);
8355 ok(received
== prop
.expected
,
8356 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8357 prop
.expected
, received
, test_index
, i
);
8360 ok(received
== prop
.expected
,
8361 "Error: Expected %d but got %d instead on uri_builder_tests[%d].expected_dword_props[%d].\n",
8362 prop
.expected
, received
, test_index
, i
);
8367 if(uri
) IUri_Release(uri
);
8370 static void test_IUriBuilder_CreateInvalidArgs(void) {
8371 IUriBuilder
*builder
;
8374 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8375 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8377 IUri
*test
= NULL
, *uri
= (void*) 0xdeadbeef;
8379 /* Test what happens if the IUriBuilder doesn't have a IUri set. */
8380 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, NULL
);
8381 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_POINTER
);
8383 uri
= (void*) 0xdeadbeef;
8384 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8385 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, E_NOTIMPL
);
8386 ok(uri
== NULL
, "Error: expected uri to be NULL, but was %p instead.\n", uri
);
8388 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, NULL
);
8389 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8392 uri
= (void*) 0xdeadbeef;
8393 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8394 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8396 ok(!uri
, "Error: Expected uri to NULL, but was %p instead.\n", uri
);
8398 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, NULL
);
8399 ok(hr
== E_POINTER
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8402 uri
= (void*) 0xdeadbeef;
8403 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8404 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8406 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8408 hr
= pCreateUri(http_urlW
, 0, 0, &test
);
8409 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8411 hr
= IUriBuilder_SetIUri(builder
, test
);
8412 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8414 /* No longer returns E_NOTIMPL, since a IUri has been set and hasn't been modified. */
8416 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8417 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8418 ok(uri
!= NULL
, "Error: The uri was NULL.\n");
8419 if(uri
) IUri_Release(uri
);
8422 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8423 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8425 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8426 if(uri
) IUri_Release(uri
);
8429 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &uri
);
8430 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8432 ok(uri
!= NULL
, "Error: uri was NULL.\n");
8433 if(uri
) IUri_Release(uri
);
8435 hr
= IUriBuilder_SetFragment(builder
, NULL
);
8436 ok(hr
== S_OK
, "Error: IUriBuilder_SetFragment returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8438 /* The IUriBuilder is changed, so it returns E_NOTIMPL again. */
8439 uri
= (void*) 0xdeadbeef;
8440 hr
= IUriBuilder_CreateUri(builder
, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8441 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8442 ok(!uri
, "Error: Expected uri to be NULL but was %p instead.\n", uri
);
8444 uri
= (void*) 0xdeadbeef;
8445 hr
= IUriBuilder_CreateUriSimple(builder
, Uri_HAS_USER_NAME
, 0, &uri
);
8446 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n",
8448 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8450 uri
= (void*) 0xdeadbeef;
8451 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, Uri_HAS_USER_NAME
, 0, &uri
);
8452 ok(hr
== E_NOTIMPL
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
8454 ok(!uri
, "Error: Expected uri to be NULL, but was %p instead.\n", uri
);
8456 if(test
) IUri_Release(test
);
8458 if(builder
) IUriBuilder_Release(builder
);
8461 /* Tests invalid args to the "Get*" functions. */
8462 static void test_IUriBuilder_GetInvalidArgs(void) {
8463 IUriBuilder
*builder
= NULL
;
8466 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
8467 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
8469 LPCWSTR received
= (void*) 0xdeadbeef;
8470 DWORD len
= -1, port
= -1;
8473 hr
= IUriBuilder_GetFragment(builder
, NULL
, NULL
);
8474 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8476 hr
= IUriBuilder_GetFragment(builder
, NULL
, &received
);
8477 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8479 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8480 hr
= IUriBuilder_GetFragment(builder
, &len
, NULL
);
8481 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x.\n",
8483 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8485 hr
= IUriBuilder_GetHost(builder
, NULL
, NULL
);
8486 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8488 received
= (void*) 0xdeadbeef;
8489 hr
= IUriBuilder_GetHost(builder
, NULL
, &received
);
8490 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8492 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8494 hr
= IUriBuilder_GetHost(builder
, &len
, NULL
);
8495 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n",
8497 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8499 hr
= IUriBuilder_GetPassword(builder
, NULL
, NULL
);
8500 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8502 received
= (void*) 0xdeadbeef;
8503 hr
= IUriBuilder_GetPassword(builder
, NULL
, &received
);
8504 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8506 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8508 hr
= IUriBuilder_GetPassword(builder
, &len
, NULL
);
8509 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x.\n",
8511 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8513 hr
= IUriBuilder_GetPath(builder
, NULL
, NULL
);
8514 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8516 received
= (void*) 0xdeadbeef;
8517 hr
= IUriBuilder_GetPath(builder
, NULL
, &received
);
8518 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8520 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8522 hr
= IUriBuilder_GetPath(builder
, &len
, NULL
);
8523 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x.\n",
8525 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8527 hr
= IUriBuilder_GetPort(builder
, NULL
, NULL
);
8528 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8530 hr
= IUriBuilder_GetPort(builder
, NULL
, &port
);
8531 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8533 ok(!port
, "Error: Expected port to be 0, but was %d instead.\n", port
);
8534 hr
= IUriBuilder_GetPort(builder
, &set
, NULL
);
8535 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n",
8537 ok(!set
, "Error: Expected set to be FALSE, but was %d instead.\n", set
);
8539 hr
= IUriBuilder_GetQuery(builder
, NULL
, NULL
);
8540 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8542 received
= (void*) 0xdeadbeef;
8543 hr
= IUriBuilder_GetQuery(builder
, NULL
, &received
);
8544 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8546 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8548 hr
= IUriBuilder_GetQuery(builder
, &len
, NULL
);
8549 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x.\n",
8551 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8553 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, NULL
);
8554 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8556 received
= (void*) 0xdeadbeef;
8557 hr
= IUriBuilder_GetSchemeName(builder
, NULL
, &received
);
8558 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8560 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8562 hr
= IUriBuilder_GetSchemeName(builder
, &len
, NULL
);
8563 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x.\n",
8565 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8567 hr
= IUriBuilder_GetUserName(builder
, NULL
, NULL
);
8568 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8570 received
= (void*) 0xdeadbeef;
8571 hr
= IUriBuilder_GetUserName(builder
, NULL
, &received
);
8572 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8574 ok(!received
, "Error: Expected received to be NULL, but was %p instead.\n", received
);
8576 hr
= IUriBuilder_GetUserName(builder
, &len
, NULL
);
8577 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x.\n",
8579 ok(!len
, "Error: Expected len to be 0, but was %d instead.\n", len
);
8581 if(builder
) IUriBuilder_Release(builder
);
8584 static void test_IUriBuilder_GetFragment(IUriBuilder
*builder
, const uri_builder_test
*test
,
8588 LPCWSTR received
= NULL
;
8590 const uri_builder_property
*prop
= NULL
;
8592 /* Check if the property was set earlier. */
8593 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8594 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_FRAGMENT
)
8595 prop
= &(test
->properties
[i
]);
8599 /* Use expected_value unless it's NULL, then use value. */
8600 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8601 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8604 ok(hr
== (expected
? S_OK
: S_FALSE
),
8605 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8606 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8610 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8611 expected
, wine_dbgstr_w(received
), test_index
);
8614 ok(lstrlen(expected
) == len
,
8615 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8616 lstrlen(expected
), len
, test_index
);
8620 ok(hr
== (expected
? S_OK
: S_FALSE
),
8621 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8622 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8623 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8624 expected
, wine_dbgstr_w(received
), test_index
);
8625 ok(lstrlen(expected
) == len
,
8626 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8627 lstrlen(expected
), len
, test_index
);
8630 /* The property wasn't set earlier, so it should return whatever
8631 * the base IUri contains (if anything).
8634 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8636 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8637 hr
, S_OK
, test_index
);
8640 received
= (void*) 0xdeadbeef;
8643 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8645 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8646 hr
, S_FALSE
, test_index
);
8648 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8650 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8651 received
, test_index
);
8654 BOOL has_prop
= FALSE
;
8655 BSTR expected
= NULL
;
8657 hr
= IUri_GetFragment(uri
, &expected
);
8659 "Error: Expected IUri_GetFragment to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8661 has_prop
= hr
== S_OK
;
8663 hr
= IUriBuilder_GetFragment(builder
, &len
, &received
);
8666 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8667 hr
, S_OK
, test_index
);
8669 ok(!lstrcmpW(expected
, received
),
8670 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8671 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8672 ok(lstrlenW(expected
) == len
,
8673 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8674 lstrlenW(expected
), len
, test_index
);
8678 "Error: IUriBuilder_GetFragment returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8679 hr
, S_FALSE
, test_index
);
8681 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8682 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8686 SysFreeString(expected
);
8689 if(uri
) IUri_Release(uri
);
8693 static void test_IUriBuilder_GetHost(IUriBuilder
*builder
, const uri_builder_test
*test
,
8697 LPCWSTR received
= NULL
;
8699 const uri_builder_property
*prop
= NULL
;
8701 /* Check if the property was set earlier. */
8702 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8703 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_HOST
)
8704 prop
= &(test
->properties
[i
]);
8708 /* Use expected_value unless it's NULL, then use value. */
8709 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8710 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8713 ok(hr
== (expected
? S_OK
: S_FALSE
),
8714 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8715 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8719 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8720 expected
, wine_dbgstr_w(received
), test_index
);
8723 ok(lstrlen(expected
) == len
,
8724 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8725 lstrlen(expected
), len
, test_index
);
8729 ok(hr
== (expected
? S_OK
: S_FALSE
),
8730 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8731 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8732 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8733 expected
, wine_dbgstr_w(received
), test_index
);
8734 ok(lstrlen(expected
) == len
,
8735 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8736 lstrlen(expected
), len
, test_index
);
8739 /* The property wasn't set earlier, so it should return whatever
8740 * the base IUri contains (if anything).
8743 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8745 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8746 hr
, S_OK
, test_index
);
8749 received
= (void*) 0xdeadbeef;
8752 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8754 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8755 hr
, S_FALSE
, test_index
);
8757 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8759 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8760 received
, test_index
);
8763 BOOL has_prop
= FALSE
;
8764 BSTR expected
= NULL
;
8766 hr
= IUri_GetHost(uri
, &expected
);
8768 "Error: Expected IUri_GetHost to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8770 has_prop
= hr
== S_OK
;
8772 hr
= IUriBuilder_GetHost(builder
, &len
, &received
);
8775 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8776 hr
, S_OK
, test_index
);
8778 ok(!lstrcmpW(expected
, received
),
8779 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8780 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8781 ok(lstrlenW(expected
) == len
,
8782 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8783 lstrlenW(expected
), len
, test_index
);
8787 "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8788 hr
, S_FALSE
, test_index
);
8790 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8791 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8795 SysFreeString(expected
);
8798 if(uri
) IUri_Release(uri
);
8802 static void test_IUriBuilder_GetPassword(IUriBuilder
*builder
, const uri_builder_test
*test
,
8806 LPCWSTR received
= NULL
;
8808 const uri_builder_property
*prop
= NULL
;
8810 /* Check if the property was set earlier. */
8811 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8812 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PASSWORD
)
8813 prop
= &(test
->properties
[i
]);
8817 /* Use expected_value unless it's NULL, then use value. */
8818 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8819 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8822 ok(hr
== (expected
? S_OK
: S_FALSE
),
8823 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8824 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8828 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8829 expected
, wine_dbgstr_w(received
), test_index
);
8832 ok(lstrlen(expected
) == len
,
8833 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8834 lstrlen(expected
), len
, test_index
);
8838 ok(hr
== (expected
? S_OK
: S_FALSE
),
8839 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8840 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8841 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8842 expected
, wine_dbgstr_w(received
), test_index
);
8843 ok(lstrlen(expected
) == len
,
8844 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8845 lstrlen(expected
), len
, test_index
);
8848 /* The property wasn't set earlier, so it should return whatever
8849 * the base IUri contains (if anything).
8852 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8854 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8855 hr
, S_OK
, test_index
);
8858 received
= (void*) 0xdeadbeef;
8861 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8863 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8864 hr
, S_FALSE
, test_index
);
8866 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8868 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8869 received
, test_index
);
8872 BOOL has_prop
= FALSE
;
8873 BSTR expected
= NULL
;
8875 hr
= IUri_GetPassword(uri
, &expected
);
8877 "Error: Expected IUri_GetPassword to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8879 has_prop
= hr
== S_OK
;
8881 hr
= IUriBuilder_GetPassword(builder
, &len
, &received
);
8884 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8885 hr
, S_OK
, test_index
);
8887 ok(!lstrcmpW(expected
, received
),
8888 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8889 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8890 ok(lstrlenW(expected
) == len
,
8891 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8892 lstrlenW(expected
), len
, test_index
);
8896 "Error: IUriBuilder_GetPassword returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8897 hr
, S_FALSE
, test_index
);
8899 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
8900 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
8904 SysFreeString(expected
);
8907 if(uri
) IUri_Release(uri
);
8911 static void test_IUriBuilder_GetPath(IUriBuilder
*builder
, const uri_builder_test
*test
,
8915 LPCWSTR received
= NULL
;
8917 const uri_builder_property
*prop
= NULL
;
8919 /* Check if the property was set earlier. */
8920 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
8921 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_PATH
)
8922 prop
= &(test
->properties
[i
]);
8926 /* Use expected_value unless it's NULL, then use value. */
8927 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
8928 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8931 ok(hr
== (expected
? S_OK
: S_FALSE
),
8932 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8933 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8937 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8938 expected
, wine_dbgstr_w(received
), test_index
);
8941 ok(lstrlen(expected
) == len
,
8942 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8943 lstrlen(expected
), len
, test_index
);
8947 ok(hr
== (expected
? S_OK
: S_FALSE
),
8948 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8949 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
8950 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
8951 expected
, wine_dbgstr_w(received
), test_index
);
8952 ok(lstrlen(expected
) == len
,
8953 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
8954 lstrlen(expected
), len
, test_index
);
8957 /* The property wasn't set earlier, so it should return whatever
8958 * the base IUri contains (if anything).
8961 hr
= IUriBuilder_GetIUri(builder
, &uri
);
8963 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8964 hr
, S_OK
, test_index
);
8967 received
= (void*) 0xdeadbeef;
8970 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8972 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8973 hr
, S_FALSE
, test_index
);
8975 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
8977 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
8978 received
, test_index
);
8981 BOOL has_prop
= FALSE
;
8982 BSTR expected
= NULL
;
8984 hr
= IUri_GetPath(uri
, &expected
);
8986 "Error: Expected IUri_GetPath to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
8988 has_prop
= hr
== S_OK
;
8990 hr
= IUriBuilder_GetPath(builder
, &len
, &received
);
8993 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
8994 hr
, S_OK
, test_index
);
8996 ok(!lstrcmpW(expected
, received
),
8997 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
8998 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
8999 ok(lstrlenW(expected
) == len
,
9000 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9001 lstrlenW(expected
), len
, test_index
);
9005 "Error: IUriBuilder_GetPath returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9006 hr
, S_FALSE
, test_index
);
9008 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9009 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9013 SysFreeString(expected
);
9016 if(uri
) IUri_Release(uri
);
9020 static void test_IUriBuilder_GetPort(IUriBuilder
*builder
, const uri_builder_test
*test
,
9023 BOOL has_port
= FALSE
;
9024 DWORD received
= -1;
9026 if(test
->port_prop
.change
) {
9027 DWORD expected
= test
->port_prop
.value
;
9029 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9030 if(test
->port_prop
.todo
) {
9033 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9034 hr
, S_OK
, test_index
);
9038 ok(has_port
== test
->port_prop
.set
,
9039 "Error: Expected has_port to be %d but was %d instead on uri_builder_tests[%d].\n",
9040 test
->port_prop
.set
, has_port
, test_index
);
9043 ok(received
== expected
,
9044 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9045 expected
, received
, test_index
);
9050 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9051 hr
, S_OK
, test_index
);
9052 ok(has_port
== test
->port_prop
.set
,
9053 "Error: Expected has_port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9054 test
->port_prop
.set
, has_port
, test_index
);
9055 ok(received
== test
->port_prop
.value
,
9056 "Error: Expected port to be %d, but was %d instead on uri_builder_tests[%d].\n",
9057 test
->port_prop
.value
, received
, test_index
);
9062 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9064 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9065 hr
, S_OK
, test_index
);
9068 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9070 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9071 hr
, S_OK
, test_index
);
9073 ok(has_port
== FALSE
,
9074 "Error: Expected has_port to be FALSE, but was %d instead on uri_builder_tests[%d].\n",
9075 has_port
, test_index
);
9076 ok(!received
, "Error: Expected received to be 0, but was %d instead on uri_builder_tests[%d].\n",
9077 received
, test_index
);
9082 hr
= IUri_GetPort(uri
, &expected
);
9084 "Error: Expected IUri_Port to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9087 hr
= IUriBuilder_GetPort(builder
, &has_port
, &received
);
9089 "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9090 hr
, S_OK
, test_index
);
9093 "Error: Expected has_port to be FALSE but was TRUE instead on uri_builder_tests[%d].\n",
9095 ok(received
== expected
,
9096 "Error: Expected received to be %d, but was %d instead on uri_builder_tests[%d].\n",
9097 expected
, received
, test_index
);
9101 if(uri
) IUri_Release(uri
);
9105 static void test_IUriBuilder_GetQuery(IUriBuilder
*builder
, const uri_builder_test
*test
,
9109 LPCWSTR received
= NULL
;
9111 const uri_builder_property
*prop
= NULL
;
9113 /* Check if the property was set earlier. */
9114 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9115 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_QUERY
)
9116 prop
= &(test
->properties
[i
]);
9120 /* Use expected_value unless it's NULL, then use value. */
9121 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9122 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9125 ok(hr
== (expected
? S_OK
: S_FALSE
),
9126 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9127 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9131 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9132 expected
, wine_dbgstr_w(received
), test_index
);
9135 ok(lstrlen(expected
) == len
,
9136 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9137 lstrlen(expected
), len
, test_index
);
9141 ok(hr
== (expected
? S_OK
: S_FALSE
),
9142 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9143 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9144 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9145 expected
, wine_dbgstr_w(received
), test_index
);
9146 ok(lstrlen(expected
) == len
,
9147 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9148 lstrlen(expected
), len
, test_index
);
9151 /* The property wasn't set earlier, so it should return whatever
9152 * the base IUri contains (if anything).
9155 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9157 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9158 hr
, S_OK
, test_index
);
9161 received
= (void*) 0xdeadbeef;
9164 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9166 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9167 hr
, S_FALSE
, test_index
);
9169 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9171 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9172 received
, test_index
);
9175 BOOL has_prop
= FALSE
;
9176 BSTR expected
= NULL
;
9178 hr
= IUri_GetQuery(uri
, &expected
);
9180 "Error: Expected IUri_GetQuery to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9182 has_prop
= hr
== S_OK
;
9184 hr
= IUriBuilder_GetQuery(builder
, &len
, &received
);
9187 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9188 hr
, S_OK
, test_index
);
9190 ok(!lstrcmpW(expected
, received
),
9191 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9192 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9193 ok(lstrlenW(expected
) == len
,
9194 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9195 lstrlenW(expected
), len
, test_index
);
9199 "Error: IUriBuilder_GetQuery returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9200 hr
, S_FALSE
, test_index
);
9202 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9203 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9207 SysFreeString(expected
);
9210 if(uri
) IUri_Release(uri
);
9214 static void test_IUriBuilder_GetSchemeName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9218 LPCWSTR received
= NULL
;
9220 const uri_builder_property
*prop
= NULL
;
9222 /* Check if the property was set earlier. */
9223 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9224 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_SCHEME_NAME
)
9225 prop
= &(test
->properties
[i
]);
9229 /* Use expected_value unless it's NULL, then use value. */
9230 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9231 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9234 ok(hr
== (expected
? S_OK
: S_FALSE
),
9235 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9236 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9240 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9241 expected
, wine_dbgstr_w(received
), test_index
);
9244 ok(lstrlen(expected
) == len
,
9245 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9246 lstrlen(expected
), len
, test_index
);
9250 ok(hr
== (expected
? S_OK
: S_FALSE
),
9251 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9252 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9253 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9254 expected
, wine_dbgstr_w(received
), test_index
);
9255 ok(lstrlen(expected
) == len
,
9256 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9257 lstrlen(expected
), len
, test_index
);
9260 /* The property wasn't set earlier, so it should return whatever
9261 * the base IUri contains (if anything).
9264 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9266 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9267 hr
, S_OK
, test_index
);
9270 received
= (void*) 0xdeadbeef;
9273 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9275 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9276 hr
, S_FALSE
, test_index
);
9278 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9280 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9281 received
, test_index
);
9284 BOOL has_prop
= FALSE
;
9285 BSTR expected
= NULL
;
9287 hr
= IUri_GetSchemeName(uri
, &expected
);
9289 "Error: Expected IUri_GetSchemeName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9291 has_prop
= hr
== S_OK
;
9293 hr
= IUriBuilder_GetSchemeName(builder
, &len
, &received
);
9296 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9297 hr
, S_OK
, test_index
);
9299 ok(!lstrcmpW(expected
, received
),
9300 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9301 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9302 ok(lstrlenW(expected
) == len
,
9303 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9304 lstrlenW(expected
), len
, test_index
);
9308 "Error: IUriBuilder_GetSchemeName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9309 hr
, S_FALSE
, test_index
);
9311 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9312 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9316 SysFreeString(expected
);
9319 if(uri
) IUri_Release(uri
);
9323 static void test_IUriBuilder_GetUserName(IUriBuilder
*builder
, const uri_builder_test
*test
,
9327 LPCWSTR received
= NULL
;
9329 const uri_builder_property
*prop
= NULL
;
9331 /* Check if the property was set earlier. */
9332 for(i
= 0; i
< sizeof(test
->properties
)/sizeof(test
->properties
[0]); ++i
) {
9333 if(test
->properties
[i
].change
&& test
->properties
[i
].property
== Uri_PROPERTY_USER_NAME
)
9334 prop
= &(test
->properties
[i
]);
9337 if(prop
&& prop
->value
&& *prop
->value
) {
9338 /* Use expected_value unless it's NULL, then use value. */
9339 LPCSTR expected
= prop
->expected_value
? prop
->expected_value
: prop
->value
;
9340 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9343 ok(hr
== (expected
? S_OK
: S_FALSE
),
9344 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9345 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9349 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9350 expected
, wine_dbgstr_w(received
), test_index
);
9353 ok(lstrlen(expected
) == len
,
9354 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9355 lstrlen(expected
), len
, test_index
);
9359 ok(hr
== (expected
? S_OK
: S_FALSE
),
9360 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9361 hr
, (expected
? S_OK
: S_FALSE
), test_index
);
9362 ok(!strcmp_aw(expected
, received
), "Error: Expected %s but got %s on uri_builder_tests[%d].\n",
9363 expected
, wine_dbgstr_w(received
), test_index
);
9364 ok(lstrlen(expected
) == len
,
9365 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9366 lstrlen(expected
), len
, test_index
);
9369 /* The property wasn't set earlier, so it should return whatever
9370 * the base IUri contains (if anything).
9373 hr
= IUriBuilder_GetIUri(builder
, &uri
);
9375 "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9376 hr
, S_OK
, test_index
);
9379 received
= (void*) 0xdeadbeef;
9382 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9384 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9385 hr
, S_FALSE
, test_index
);
9387 ok(!len
, "Error: Expected len to be 0, but was %d instead on uri_builder_tests[%d].\n",
9389 ok(!received
, "Error: Expected received to be NULL, but was %p instead on uri_builder_tests[%d].\n",
9390 received
, test_index
);
9393 BSTR expected
= NULL
;
9394 BOOL has_prop
= FALSE
;
9396 hr
= IUri_GetUserName(uri
, &expected
);
9398 "Error: Expected IUri_GetUserName to succeed, but got 0x%08x instead on uri_builder_tests[%d].\n",
9400 has_prop
= hr
== S_OK
;
9402 hr
= IUriBuilder_GetUserName(builder
, &len
, &received
);
9405 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9406 hr
, S_OK
, test_index
);
9408 ok(!lstrcmpW(expected
, received
),
9409 "Error: Expected %s but got %s instead on uri_builder_tests[%d].\n",
9410 wine_dbgstr_w(expected
), wine_dbgstr_w(received
), test_index
);
9411 ok(lstrlenW(expected
) == len
,
9412 "Error: Expected the length to be %d, but was %d instead on uri_builder_tests[%d].\n",
9413 lstrlenW(expected
), len
, test_index
);
9417 "Error: IUriBuilder_GetUserName returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9418 hr
, S_FALSE
, test_index
);
9420 ok(!received
, "Error: Expected received to be NULL on uri_builder_tests[%d].\n", test_index
);
9421 ok(!len
, "Error: Expected the length to be 0, but was %d instead on uri_builder_tests[%d].\n",
9425 SysFreeString(expected
);
9428 if(uri
) IUri_Release(uri
);
9432 /* Tests IUriBuilder functions. */
9433 static void test_IUriBuilder(void) {
9435 IUriBuilder
*builder
;
9438 for(i
= 0; i
< sizeof(uri_builder_tests
)/sizeof(uri_builder_tests
[0]); ++i
) {
9440 uri_builder_test test
= uri_builder_tests
[i
];
9444 uriW
= a2w(test
.uri
);
9445 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9446 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9448 if(FAILED(hr
)) continue;
9450 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9451 if(test
.create_builder_todo
) {
9453 ok(hr
== test
.create_builder_expected
,
9454 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9455 hr
, test
.create_builder_expected
, i
);
9458 ok(hr
== test
.create_builder_expected
,
9459 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9460 hr
, test
.create_builder_expected
, i
);
9464 BOOL modified
= FALSE
, received
= FALSE
;
9466 /* Perform all the string property changes. */
9467 for(j
= 0; j
< URI_BUILDER_STR_PROPERTY_COUNT
; ++j
) {
9468 uri_builder_property prop
= test
.properties
[j
];
9470 change_property(builder
, &prop
, i
);
9471 if(prop
.property
!= Uri_PROPERTY_SCHEME_NAME
&&
9472 prop
.property
!= Uri_PROPERTY_HOST
)
9474 else if(prop
.value
&& *prop
.value
)
9476 else if(prop
.value
&& !*prop
.value
&& prop
.property
== Uri_PROPERTY_HOST
)
9477 /* Host name property can't be NULL, but it can be empty. */
9482 if(test
.port_prop
.change
) {
9483 hr
= IUriBuilder_SetPort(builder
, test
.port_prop
.set
, test
.port_prop
.value
);
9485 if(test
.port_prop
.todo
) {
9487 ok(hr
== test
.port_prop
.expected
,
9488 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9489 hr
, test
.port_prop
.expected
, i
);
9492 ok(hr
== test
.port_prop
.expected
,
9493 "Error: IUriBuilder_SetPort returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9494 hr
, test
.port_prop
.expected
, i
);
9498 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9500 "Error IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x on uri_builder_tests[%d].\n",
9503 ok(received
== modified
,
9504 "Error: Expected received to be %d but was %d instead on uri_builder_tests[%d].\n",
9505 modified
, received
, i
);
9507 /* Test the "Get*" functions. */
9508 test_IUriBuilder_GetFragment(builder
, &test
, i
);
9509 test_IUriBuilder_GetHost(builder
, &test
, i
);
9510 test_IUriBuilder_GetPassword(builder
, &test
, i
);
9511 test_IUriBuilder_GetPath(builder
, &test
, i
);
9512 test_IUriBuilder_GetPort(builder
, &test
, i
);
9513 test_IUriBuilder_GetQuery(builder
, &test
, i
);
9514 test_IUriBuilder_GetSchemeName(builder
, &test
, i
);
9515 test_IUriBuilder_GetUserName(builder
, &test
, i
);
9517 test_IUriBuilder_CreateUri(builder
, &test
, i
);
9518 test_IUriBuilder_CreateUriSimple(builder
, &test
, i
);
9519 test_IUriBuilder_CreateUriWithFlags(builder
, &test
, i
);
9521 if(builder
) IUriBuilder_Release(builder
);
9522 if(uri
) IUri_Release(uri
);
9527 static void test_IUriBuilder_HasBeenModified(void) {
9529 IUriBuilder
*builder
= NULL
;
9531 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9532 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9534 static const WCHAR hostW
[] = {'g','o','o','g','l','e','.','c','o','m',0};
9538 hr
= IUriBuilder_HasBeenModified(builder
, NULL
);
9539 ok(hr
== E_POINTER
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9542 hr
= IUriBuilder_SetHost(builder
, hostW
);
9543 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n",
9546 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9547 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9550 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9552 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9553 ok(hr
== S_OK
, "Error: CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9558 hr
= IUriBuilder_SetIUri(builder
, uri
);
9559 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n",
9562 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9563 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9566 ok(received
== FALSE
, "Error: Expected received to be FALSE.\n");
9568 /* Test what happens with you call SetIUri with the same IUri again. */
9569 hr
= IUriBuilder_SetHost(builder
, hostW
);
9570 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9572 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9573 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9576 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9578 hr
= IUriBuilder_SetIUri(builder
, uri
);
9579 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9581 /* IUriBuilder already had 'uri' as it's IUri property and so Windows doesn't
9582 * reset any of the changes that were made to the IUriBuilder.
9584 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9585 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9587 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9589 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9590 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9592 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9593 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9594 ok(len
== lstrlenW(hostW
), "Error: Expected len to be %d, but was %d instead.\n",
9595 lstrlenW(hostW
), len
);
9598 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9599 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9601 hr
= IUriBuilder_SetHost(builder
, hostW
);
9602 ok(hr
== S_OK
, "Error: IUriBuilder_SetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9603 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9604 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9607 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9609 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9610 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%09x.\n", hr
, S_OK
);
9612 hr
= IUriBuilder_HasBeenModified(builder
, &received
);
9613 ok(hr
== S_OK
, "Error: IUriBuilder_HasBeenModified returned 0x%08x, expected 0x%08x.\n",
9616 ok(received
== TRUE
, "Error: Expected received to be TRUE.\n");
9618 hr
= IUriBuilder_GetHost(builder
, &len
, &prop
);
9619 ok(hr
== S_OK
, "Error: IUriBuilder_GetHost returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9621 ok(!lstrcmpW(prop
, hostW
), "Error: Expected %s but got %s instead.\n",
9622 wine_dbgstr_w(hostW
), wine_dbgstr_w(prop
));
9623 ok(len
== lstrlenW(hostW
), "Error: Expected len to %d, but was %d instead.\n",
9624 lstrlenW(hostW
), len
);
9627 if(uri
) IUri_Release(uri
);
9629 if(builder
) IUriBuilder_Release(builder
);
9632 /* Test IUriBuilder {Get,Set}IUri functions. */
9633 static void test_IUriBuilder_IUriProperty(void) {
9634 IUriBuilder
*builder
= NULL
;
9637 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9638 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9642 hr
= IUriBuilder_GetIUri(builder
, NULL
);
9643 ok(hr
== E_POINTER
, "Error: IUriBuilder_GetIUri returned 0x%08x, expected 0x%08x.\n",
9646 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9649 ULONG cur_count
, orig_count
;
9651 /* IUriBuilder doesn't clone the IUri, it use the same IUri. */
9652 orig_count
= get_refcnt(uri
);
9653 hr
= IUriBuilder_SetIUri(builder
, uri
);
9654 cur_count
= get_refcnt(uri
);
9656 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9657 orig_count
+1, cur_count
);
9659 hr
= IUriBuilder_SetIUri(builder
, NULL
);
9660 cur_count
= get_refcnt(uri
);
9662 ok(cur_count
== orig_count
, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9663 orig_count
, cur_count
);
9665 /* CreateUri* functions will return back the same IUri if nothing has changed. */
9666 hr
= IUriBuilder_SetIUri(builder
, uri
);
9667 ok(hr
== S_OK
, "Error: IUriBuilder_SetIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9668 orig_count
= get_refcnt(uri
);
9670 hr
= IUriBuilder_CreateUri(builder
, 0, 0, 0, &test
);
9671 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9673 cur_count
= get_refcnt(uri
);
9674 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9675 orig_count
+1, cur_count
);
9676 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n",
9679 if(test
) IUri_Release(test
);
9682 hr
= IUriBuilder_CreateUri(builder
, -1, 0, 0, &test
);
9683 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9685 cur_count
= get_refcnt(uri
);
9686 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9687 orig_count
+1, cur_count
);
9688 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9690 if(test
) IUri_Release(test
);
9692 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9696 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, &test
);
9697 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9699 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9701 if(test
) IUri_Release(test
);
9703 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9704 * explicitly set (because it's a default flags).
9707 hr
= IUriBuilder_CreateUri(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, &test
);
9708 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9710 cur_count
= get_refcnt(uri
);
9711 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9712 orig_count
+1, cur_count
);
9713 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9715 if(test
) IUri_Release(test
);
9718 hr
= IUriBuilder_CreateUriSimple(builder
, 0, 0, &test
);
9719 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriSimple returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9721 cur_count
= get_refcnt(uri
);
9722 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9723 orig_count
+1, cur_count
);
9724 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9726 if(test
) IUri_Release(test
);
9729 hr
= IUriBuilder_CreateUriWithFlags(builder
, 0, 0, 0, 0, &test
);
9730 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n",
9733 cur_count
= get_refcnt(uri
);
9734 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9735 orig_count
+1, cur_count
);
9736 ok(test
== uri
, "Error: Expected test to be %p, but was %p instead.\n", uri
, test
);
9738 if(test
) IUri_Release(test
);
9740 /* Doesn't return the same IUri, if the flag combination is different then the one that created
9744 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_ALLOW_RELATIVE
, 0, 0, 0, &test
);
9745 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9747 ok(test
!= uri
, "Error: Wasn't expecting 'test' to be 'uri'\n");
9749 if(test
) IUri_Release(test
);
9751 /* Still returns the same IUri, even though the base one wasn't created with CREATE_CANONICALIZE
9752 * explicitly set (because it's a default flags).
9755 hr
= IUriBuilder_CreateUriWithFlags(builder
, Uri_CREATE_CANONICALIZE
, 0, 0, 0, &test
);
9756 ok(hr
== S_OK
, "Error: IUriBuilder_CreateUriWithFlags returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9758 cur_count
= get_refcnt(uri
);
9759 ok(cur_count
== orig_count
+1, "Error: Expected uri ref count to be %d, but was %d instead.\n",
9760 orig_count
+1, cur_count
);
9761 ok(test
== uri
, "Error: Expected 'test' to be %p, but was %p instead.\n", uri
, test
);
9763 if(test
) IUri_Release(test
);
9765 if(uri
) IUri_Release(uri
);
9767 if(builder
) IUriBuilder_Release(builder
);
9770 static void test_IUriBuilder_RemoveProperties(void) {
9771 IUriBuilder
*builder
= NULL
;
9775 hr
= pCreateIUriBuilder(NULL
, 0, 0, &builder
);
9776 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9778 /* Properties that can't be removed. */
9779 const DWORD invalid
= Uri_HAS_ABSOLUTE_URI
|Uri_HAS_DISPLAY_URI
|Uri_HAS_RAW_URI
|Uri_HAS_HOST_TYPE
|
9780 Uri_HAS_SCHEME
|Uri_HAS_ZONE
;
9782 for(i
= Uri_PROPERTY_STRING_START
; i
<= Uri_PROPERTY_DWORD_LAST
; ++i
) {
9783 hr
= IUriBuilder_RemoveProperties(builder
, i
<< 1);
9784 if((i
<< 1) & invalid
) {
9785 ok(hr
== E_INVALIDARG
,
9786 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9787 hr
, E_INVALIDARG
, i
);
9790 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x with prop=%d.\n",
9795 /* Also doesn't accept anything that's outside the range of the
9798 hr
= IUriBuilder_RemoveProperties(builder
, (Uri_PROPERTY_DWORD_LAST
+1) << 1);
9799 ok(hr
== E_INVALIDARG
, "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x.\n",
9802 if(builder
) IUriBuilder_Release(builder
);
9804 for(i
= 0; i
< sizeof(uri_builder_remove_tests
)/sizeof(uri_builder_remove_tests
[0]); ++i
) {
9805 uri_builder_remove_test test
= uri_builder_remove_tests
[i
];
9809 uriW
= a2w(test
.uri
);
9810 hr
= pCreateUri(uriW
, test
.create_flags
, 0, &uri
);
9814 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9815 if(test
.create_builder_todo
) {
9817 ok(hr
== test
.create_builder_expected
,
9818 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9819 hr
, test
.create_builder_expected
, i
);
9822 ok(hr
== test
.create_builder_expected
,
9823 "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9824 hr
, test
.create_builder_expected
, i
);
9827 hr
= IUriBuilder_RemoveProperties(builder
, test
.remove_properties
);
9828 if(test
.remove_todo
) {
9830 ok(hr
== test
.remove_expected
,
9831 "Error: IUriBuilder_RemoveProperties returned 0x%08x, expected 0x%08x on test %d.\n",
9832 hr
, test
.remove_expected
, i
);
9835 ok(hr
== test
.remove_expected
,
9836 "Error: IUriBuilder returned 0x%08x, expected 0x%08x on test %d.\n",
9837 hr
, test
.remove_expected
, i
);
9840 IUri
*result
= NULL
;
9842 hr
= IUriBuilder_CreateUri(builder
, test
.expected_flags
, 0, 0, &result
);
9843 if(test
.expected_todo
) {
9845 ok(hr
== test
.expected_hres
,
9846 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9847 hr
, test
.expected_hres
, i
);
9850 ok(hr
== test
.expected_hres
,
9851 "Error: IUriBuilder_CreateUri returned 0x%08x, expected 0x%08x on test %d.\n",
9852 hr
, test
.expected_hres
, i
);
9855 BSTR received
= NULL
;
9857 hr
= IUri_GetAbsoluteUri(result
, &received
);
9858 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
9859 ok(!strcmp_aw(test
.expected_uri
, received
),
9860 "Error: Expected %s but got %s instead on test %d.\n",
9861 test
.expected_uri
, wine_dbgstr_w(received
), i
);
9862 SysFreeString(received
);
9864 if(result
) IUri_Release(result
);
9867 if(builder
) IUriBuilder_Release(builder
);
9869 if(uri
) IUri_Release(uri
);
9874 static void test_IUriBuilder_Misc(void) {
9878 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9880 IUriBuilder
*builder
;
9882 hr
= pCreateIUriBuilder(uri
, 0, 0, &builder
);
9883 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9888 hr
= IUriBuilder_GetPort(builder
, &has
, &port
);
9889 ok(hr
== S_OK
, "Error: IUriBuilder_GetPort returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
9891 /* 'has' will be set to FALSE, even though uri had a port. */
9892 ok(has
== FALSE
, "Error: Expected 'has' to be FALSE, was %d instead.\n", has
);
9893 /* Still sets 'port' to 80. */
9894 ok(port
== 80, "Error: Expected the port to be 80, but, was %d instead.\n", port
);
9897 if(builder
) IUriBuilder_Release(builder
);
9899 if(uri
) IUri_Release(uri
);
9902 static void test_IUriBuilderFactory(void) {
9905 IUriBuilderFactory
*factory
;
9906 IUriBuilder
*builder
;
9908 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
9909 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
9912 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&factory
);
9913 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x.\n", hr
);
9914 ok(factory
!= NULL
, "Error: Expected 'factory' to not be NULL.\n");
9917 builder
= (void*) 0xdeadbeef;
9918 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 10, 0, &builder
);
9919 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9921 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9923 builder
= (void*) 0xdeadbeef;
9924 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 10, &builder
);
9925 ok(hr
== E_INVALIDARG
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9927 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9929 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, NULL
);
9930 ok(hr
== E_POINTER
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9934 hr
= IUriBuilderFactory_CreateIUriBuilder(factory
, 0, 0, &builder
);
9935 ok(hr
== S_OK
, "Error: CreateInitializedIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9938 IUri
*tmp
= (void*) 0xdeadbeef;
9942 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9943 ok(hr
== S_OK
, "Error: GetIUri returned 0x%08x, expected 0x%08x.\n",
9945 ok(!tmp
, "Error: Expected 'tmp' to be NULL, but was %p instead.\n", tmp
);
9947 hr
= IUriBuilder_GetHost(builder
, &result_len
, &result
);
9948 ok(hr
== S_FALSE
, "Error: GetHost returned 0x%08x, expected 0x%08x.\n",
9951 if(builder
) IUriBuilder_Release(builder
);
9953 builder
= (void*) 0xdeadbeef;
9954 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 10, 0, &builder
);
9955 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9957 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9959 builder
= (void*) 0xdeadbeef;
9960 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 10, &builder
);
9961 ok(hr
== E_INVALIDARG
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9963 ok(!builder
, "Error: Expected 'builder' to be NULL, but was %p.\n", builder
);
9965 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, NULL
);
9966 ok(hr
== E_POINTER
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9970 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(factory
, 0, 0, &builder
);
9971 ok(hr
== S_OK
, "Error: CreateIUriBuilder returned 0x%08x, expected 0x%08x.\n",
9976 hr
= IUriBuilder_GetIUri(builder
, &tmp
);
9977 ok(hr
== S_OK
, "Error: GetIUri return 0x%08x, expected 0x%08x.\n",
9979 ok(tmp
== uri
, "Error: Expected tmp to be %p, but was %p.\n", uri
, tmp
);
9980 if(uri
) IUri_Release(uri
);
9982 if(builder
) IUriBuilder_Release(builder
);
9984 if(factory
) IUriBuilderFactory_Release(factory
);
9986 if(uri
) IUri_Release(uri
);
9989 static void test_CoInternetCombineIUri(void) {
9991 IUri
*base
, *relative
, *result
;
9995 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
9996 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
9998 result
= (void*) 0xdeadbeef;
9999 hr
= pCoInternetCombineIUri(base
, NULL
, 0, &result
, 0);
10000 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10001 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10005 hr
= pCreateUri(http_urlW
, 0, 0, &relative
);
10006 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x.\n", hr
);
10007 if(SUCCEEDED(hr
)) {
10008 result
= (void*) 0xdeadbeef;
10009 hr
= pCoInternetCombineIUri(NULL
, relative
, 0, &result
, 0);
10010 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10011 ok(!result
, "Error: Expected 'result' to be NULL, was %p.\n", result
);
10014 hr
= pCoInternetCombineIUri(base
, relative
, 0, NULL
, 0);
10015 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, E_INVALIDARG
);
10017 if(base
) IUri_Release(base
);
10018 if(relative
) IUri_Release(relative
);
10020 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10021 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10023 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10024 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10025 if(SUCCEEDED(hr
)) {
10026 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10028 hr
= pCreateUri(relativeW
, uri_combine_tests
[i
].relative_create_flags
, 0, &relative
);
10029 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, got 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10030 if(SUCCEEDED(hr
)) {
10033 hr
= pCoInternetCombineIUri(base
, relative
, uri_combine_tests
[i
].combine_flags
, &result
, 0);
10034 if(uri_combine_tests
[i
].todo
) {
10036 ok(hr
== uri_combine_tests
[i
].expected
,
10037 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10038 hr
, uri_combine_tests
[i
].expected
, i
);
10041 ok(hr
== uri_combine_tests
[i
].expected
,
10042 "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10043 hr
, uri_combine_tests
[i
]. expected
, i
);
10045 if(SUCCEEDED(hr
)) {
10048 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10049 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10052 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10055 ok(hr
== prop
.expected
,
10056 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10057 hr
, prop
.expected
, i
, j
);
10060 ok(!strcmp_aw(prop
.value
, received
) ||
10061 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10062 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10063 prop
.value
, wine_dbgstr_w(received
), i
, j
);
10066 ok(hr
== prop
.expected
,
10067 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10068 hr
, prop
.expected
, i
, j
);
10069 ok(!strcmp_aw(prop
.value
, received
) ||
10070 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10071 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10072 prop
.value
, wine_dbgstr_w(received
), i
, j
);
10074 SysFreeString(received
);
10077 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10078 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10081 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10084 ok(hr
== prop
.expected
,
10085 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10086 hr
, prop
.expected
, i
, j
);
10089 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10090 prop
.value
, received
, i
, j
);
10093 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10094 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10095 hr
, prop
.expected
, i
, j
);
10096 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10097 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10098 prop
.value
, received
, i
, j
);
10102 if(result
) IUri_Release(result
);
10104 if(relative
) IUri_Release(relative
);
10105 heap_free(relativeW
);
10107 if(base
) IUri_Release(base
);
10112 static HRESULT WINAPI
InternetProtocolInfo_QueryInterface(IInternetProtocolInfo
*iface
,
10113 REFIID riid
, void **ppv
)
10115 ok(0, "unexpected call\n");
10116 return E_NOINTERFACE
;
10119 static ULONG WINAPI
InternetProtocolInfo_AddRef(IInternetProtocolInfo
*iface
)
10124 static ULONG WINAPI
InternetProtocolInfo_Release(IInternetProtocolInfo
*iface
)
10129 static HRESULT WINAPI
InternetProtocolInfo_ParseUrl(IInternetProtocolInfo
*iface
, LPCWSTR pwzUrl
,
10130 PARSEACTION ParseAction
, DWORD dwParseFlags
, LPWSTR pwzResult
, DWORD cchResult
,
10131 DWORD
*pcchResult
, DWORD dwReserved
)
10133 CHECK_EXPECT(ParseUrl
);
10134 ok(!lstrcmpW(pwzUrl
, parse_urlW
), "Error: Expected %s, but got %s instead.\n",
10135 wine_dbgstr_w(parse_urlW
), wine_dbgstr_w(pwzUrl
));
10136 ok(ParseAction
== parse_action
, "Error: Expected %d, but got %d.\n", parse_action
, ParseAction
);
10137 ok(dwParseFlags
== parse_flags
, "Error: Expected 0x%08x, but got 0x%08x.\n", parse_flags
, dwParseFlags
);
10138 ok(cchResult
== 200, "Error: Got %d.\n", cchResult
);
10140 memcpy(pwzResult
, parse_resultW
, sizeof(parse_resultW
));
10141 *pcchResult
= lstrlenW(parse_resultW
);
10146 static HRESULT WINAPI
InternetProtocolInfo_CombineUrl(IInternetProtocolInfo
*iface
,
10147 LPCWSTR pwzBaseUrl
, LPCWSTR pwzRelativeUrl
, DWORD dwCombineFlags
,
10148 LPWSTR pwzResult
, DWORD cchResult
, DWORD
*pcchResult
, DWORD dwReserved
)
10150 CHECK_EXPECT(CombineUrl
);
10151 ok(!lstrcmpW(pwzBaseUrl
, combine_baseW
), "Error: Expected %s, but got %s instead.\n",
10152 wine_dbgstr_w(combine_baseW
), wine_dbgstr_w(pwzBaseUrl
));
10153 ok(!lstrcmpW(pwzRelativeUrl
, combine_relativeW
), "Error: Expected %s, but got %s instead.\n",
10154 wine_dbgstr_w(combine_relativeW
), wine_dbgstr_w(pwzRelativeUrl
));
10155 ok(dwCombineFlags
== (URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
),
10156 "Error: Expected 0, but got 0x%08x.\n", dwCombineFlags
);
10157 ok(cchResult
== INTERNET_MAX_URL_LENGTH
+1, "Error: Got %d.\n", cchResult
);
10159 memcpy(pwzResult
, combine_resultW
, sizeof(combine_resultW
));
10160 *pcchResult
= lstrlenW(combine_resultW
);
10165 static HRESULT WINAPI
InternetProtocolInfo_CompareUrl(IInternetProtocolInfo
*iface
,
10166 LPCWSTR pwzUrl1
, LPCWSTR pwzUrl2
, DWORD dwCompareFlags
)
10168 ok(0, "unexpected call\n");
10172 static HRESULT WINAPI
InternetProtocolInfo_QueryInfo(IInternetProtocolInfo
*iface
,
10173 LPCWSTR pwzUrl
, QUERYOPTION OueryOption
, DWORD dwQueryFlags
, LPVOID pBuffer
,
10174 DWORD cbBuffer
, DWORD
*pcbBuf
, DWORD dwReserved
)
10176 ok(0, "unexpected call\n");
10180 static const IInternetProtocolInfoVtbl InternetProtocolInfoVtbl
= {
10181 InternetProtocolInfo_QueryInterface
,
10182 InternetProtocolInfo_AddRef
,
10183 InternetProtocolInfo_Release
,
10184 InternetProtocolInfo_ParseUrl
,
10185 InternetProtocolInfo_CombineUrl
,
10186 InternetProtocolInfo_CompareUrl
,
10187 InternetProtocolInfo_QueryInfo
10190 static IInternetProtocolInfo protocol_info
= { &InternetProtocolInfoVtbl
};
10192 static HRESULT WINAPI
ClassFactory_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
10194 if(IsEqualGUID(&IID_IInternetProtocolInfo
, riid
)) {
10195 *ppv
= &protocol_info
;
10199 ok(0, "unexpected call\n");
10200 return E_NOINTERFACE
;
10203 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
10208 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
10213 static HRESULT WINAPI
ClassFactory_CreateInstance(IClassFactory
*iface
, IUnknown
*pOuter
,
10214 REFIID riid
, void **ppv
)
10216 ok(0, "unexpected call\n");
10220 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL dolock
)
10222 ok(0, "unexpected call\n");
10226 static const IClassFactoryVtbl ClassFactoryVtbl
= {
10227 ClassFactory_QueryInterface
,
10228 ClassFactory_AddRef
,
10229 ClassFactory_Release
,
10230 ClassFactory_CreateInstance
,
10231 ClassFactory_LockServer
10234 static IClassFactory protocol_cf
= { &ClassFactoryVtbl
};
10236 static void register_protocols(void)
10238 IInternetSession
*session
;
10241 hres
= pCoInternetGetSession(0, &session
, 0);
10242 ok(hres
== S_OK
, "CoInternetGetSession failed: %08x\n", hres
);
10246 hres
= IInternetSession_RegisterNameSpace(session
, &protocol_cf
, &IID_NULL
,
10247 winetestW
, 0, NULL
, 0);
10248 ok(hres
== S_OK
, "RegisterNameSpace failed: %08x\n", hres
);
10250 IInternetSession_Release(session
);
10253 static void unregister_protocols(void) {
10254 IInternetSession
*session
;
10257 hr
= pCoInternetGetSession(0, &session
, 0);
10258 ok(hr
== S_OK
, "CoInternetGetSession failed: 0x%08x\n", hr
);
10262 hr
= IInternetSession_UnregisterNameSpace(session
, &protocol_cf
, winetestW
);
10263 ok(hr
== S_OK
, "UnregisterNameSpace failed: 0x%08x\n", hr
);
10265 IInternetSession_Release(session
);
10268 static void test_CoInternetCombineIUri_Pluggable(void) {
10272 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10273 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10274 if(SUCCEEDED(hr
)) {
10275 IUri
*relative
= NULL
;
10277 hr
= pCreateUri(combine_relativeW
, Uri_CREATE_ALLOW_RELATIVE
, 0, &relative
);
10278 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10279 if(SUCCEEDED(hr
)) {
10280 IUri
*result
= NULL
;
10282 SET_EXPECT(CombineUrl
);
10284 hr
= pCoInternetCombineIUri(base
, relative
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10286 ok(hr
== S_OK
, "Error: CoInternetCombineIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10288 CHECK_CALLED(CombineUrl
);
10290 if(SUCCEEDED(hr
)) {
10291 BSTR received
= NULL
;
10292 hr
= IUri_GetAbsoluteUri(result
, &received
);
10293 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10294 if(SUCCEEDED(hr
)) {
10295 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10296 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10298 SysFreeString(received
);
10300 if(result
) IUri_Release(result
);
10302 if(relative
) IUri_Release(relative
);
10304 if(base
) IUri_Release(base
);
10307 static void test_CoInternetCombineUrlEx(void) {
10309 IUri
*base
, *result
;
10313 hr
= pCreateUri(http_urlW
, 0, 0, &base
);
10314 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10315 if(SUCCEEDED(hr
)) {
10316 result
= (void*) 0xdeadbeef;
10317 hr
= pCoInternetCombineUrlEx(base
, NULL
, 0, &result
, 0);
10318 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10320 ok(!result
, "Error: Expected 'result' to be NULL was %p instead.\n", result
);
10323 result
= (void*) 0xdeadbeef;
10324 hr
= pCoInternetCombineUrlEx(NULL
, http_urlW
, 0, &result
, 0);
10325 ok(hr
== E_INVALIDARG
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10327 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10329 result
= (void*) 0xdeadbeef;
10330 hr
= pCoInternetCombineUrlEx(NULL
, NULL
, 0, &result
, 0);
10331 ok(hr
== E_UNEXPECTED
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10333 ok(!result
, "Error: Expected 'result' to be NULL, but was %p instead.\n", result
);
10335 hr
= pCoInternetCombineUrlEx(base
, http_urlW
, 0, NULL
, 0);
10336 ok(hr
== E_POINTER
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n",
10338 if(base
) IUri_Release(base
);
10340 for(i
= 0; i
< sizeof(uri_combine_tests
)/sizeof(uri_combine_tests
[0]); ++i
) {
10341 LPWSTR baseW
= a2w(uri_combine_tests
[i
].base_uri
);
10343 hr
= pCreateUri(baseW
, uri_combine_tests
[i
].base_create_flags
, 0, &base
);
10344 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_combine_tests[%d].\n", hr
, i
);
10345 if(SUCCEEDED(hr
)) {
10346 LPWSTR relativeW
= a2w(uri_combine_tests
[i
].relative_uri
);
10348 hr
= pCoInternetCombineUrlEx(base
, relativeW
, uri_combine_tests
[i
].combine_flags
,
10350 if(uri_combine_tests
[i
].todo
) {
10352 ok(hr
== uri_combine_tests
[i
].expected
,
10353 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10354 hr
, uri_combine_tests
[i
].expected
, i
);
10357 ok(hr
== uri_combine_tests
[i
].expected
,
10358 "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].\n",
10359 hr
, uri_combine_tests
[i
]. expected
, i
);
10361 if(SUCCEEDED(hr
)) {
10364 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].str_props
)/sizeof(uri_combine_tests
[i
].str_props
[0]); ++j
) {
10365 uri_combine_str_property prop
= uri_combine_tests
[i
].str_props
[j
];
10367 LPCSTR value
= (prop
.value_ex
) ? prop
.value_ex
: prop
.value
;
10369 hr
= IUri_GetPropertyBSTR(result
, j
, &received
, 0);
10372 ok(hr
== prop
.expected
,
10373 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10374 hr
, prop
.expected
, i
, j
);
10377 ok(!strcmp_aw(value
, received
) ||
10378 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10379 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10380 value
, wine_dbgstr_w(received
), i
, j
);
10383 ok(hr
== prop
.expected
,
10384 "Error: IUri_GetPropertyBSTR returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].str_props[%d].\n",
10385 hr
, prop
.expected
, i
, j
);
10386 ok(!strcmp_aw(value
, received
) ||
10387 broken(prop
.broken_value
&& !strcmp_aw(prop
.broken_value
, received
)),
10388 "Error: Expected %s but got %s instead on uri_combine_tests[%d].str_props[%d].\n",
10389 value
, wine_dbgstr_w(received
), i
, j
);
10391 SysFreeString(received
);
10394 for(j
= 0; j
< sizeof(uri_combine_tests
[i
].dword_props
)/sizeof(uri_combine_tests
[i
].dword_props
[0]); ++j
) {
10395 uri_dword_property prop
= uri_combine_tests
[i
].dword_props
[j
];
10398 hr
= IUri_GetPropertyDWORD(result
, j
+Uri_PROPERTY_DWORD_START
, &received
, 0);
10401 ok(hr
== prop
.expected
,
10402 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10403 hr
, prop
.expected
, i
, j
);
10406 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10407 prop
.value
, received
, i
, j
);
10410 ok(hr
== prop
.expected
|| broken(prop
.broken_combine_hres
&& hr
== S_FALSE
),
10411 "Error: IUri_GetPropertyDWORD returned 0x%08x, expected 0x%08x on uri_combine_tests[%d].dword_props[%d].\n",
10412 hr
, prop
.expected
, i
, j
);
10413 if(!prop
.broken_combine_hres
|| hr
!= S_FALSE
)
10414 ok(prop
.value
== received
, "Error: Expected %d, but got %d instead on uri_combine_tests[%d].dword_props[%d].\n",
10415 prop
.value
, received
, i
, j
);
10419 if(result
) IUri_Release(result
);
10420 heap_free(relativeW
);
10422 if(base
) IUri_Release(base
);
10427 static void test_CoInternetCombineUrlEx_Pluggable(void) {
10431 hr
= pCreateUri(combine_baseW
, 0, 0, &base
);
10432 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10433 if(SUCCEEDED(hr
)) {
10434 IUri
*result
= NULL
;
10436 SET_EXPECT(CombineUrl
);
10438 hr
= pCoInternetCombineUrlEx(base
, combine_relativeW
, URL_DONT_SIMPLIFY
|URL_FILE_USE_PATHURL
|URL_DONT_UNESCAPE_EXTRA_INFO
,
10440 ok(hr
== S_OK
, "Error: CoInternetCombineUrlEx returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10442 CHECK_CALLED(CombineUrl
);
10444 if(SUCCEEDED(hr
)) {
10445 BSTR received
= NULL
;
10446 hr
= IUri_GetAbsoluteUri(result
, &received
);
10447 ok(hr
== S_OK
, "Error: Expected S_OK, but got 0x%08x instead.\n", hr
);
10448 if(SUCCEEDED(hr
)) {
10449 ok(!lstrcmpW(combine_resultW
, received
), "Error: Expected %s, but got %s.\n",
10450 wine_dbgstr_w(combine_resultW
), wine_dbgstr_w(received
));
10452 SysFreeString(received
);
10454 if(result
) IUri_Release(result
);
10456 if(base
) IUri_Release(base
);
10459 static void test_CoInternetParseIUri_InvalidArgs(void) {
10465 hr
= pCoInternetParseIUri(NULL
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10466 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10468 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10470 hr
= pCreateUri(http_urlW
, 0, 0, &uri
);
10471 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x.\n", hr
);
10472 if(SUCCEEDED(hr
)) {
10473 DWORD expected_len
;
10476 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, NULL
, 0, &result
, 0);
10477 ok(hr
== E_INVALIDARG
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10479 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10481 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, NULL
, 0);
10482 ok(hr
== E_POINTER
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10486 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_URL
, 0, tmp
, 3, &result
, 0);
10487 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x expected 0x%08x.\n",
10489 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10492 hr
= pCoInternetParseIUri(uri
, PARSE_MIME
, 0, tmp
, 3, &result
, 0);
10493 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10495 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10498 hr
= pCoInternetParseIUri(uri
, PARSE_SERVER
, 0, tmp
, 3, &result
, 0);
10499 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10501 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10504 hr
= pCoInternetParseIUri(uri
, PARSE_SECURITY_DOMAIN
, 0, tmp
, 3, &result
, 0);
10505 ok(hr
== E_FAIL
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10507 ok(!result
, "Error: Expected 'result' to be 0, but was %d.\n", result
);
10509 expected_len
= lstrlenW(http_urlW
);
10511 hr
= pCoInternetParseIUri(uri
, PARSE_CANONICALIZE
, 0, tmp
, 3, &result
, 0);
10512 ok(hr
== STRSAFE_E_INSUFFICIENT_BUFFER
,
10513 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n",
10514 hr
, STRSAFE_E_INSUFFICIENT_BUFFER
);
10515 ok(result
== expected_len
, "Error: Expected 'result' to be %d, but was %d instead.\n",
10516 expected_len
, result
);
10518 if(uri
) IUri_Release(uri
);
10521 static void test_CoInternetParseIUri(void) {
10524 for(i
= 0; i
< sizeof(uri_parse_tests
)/sizeof(uri_parse_tests
[0]); ++i
) {
10528 uri_parse_test test
= uri_parse_tests
[i
];
10530 uriW
= a2w(test
.uri
);
10531 hr
= pCreateUri(uriW
, test
.uri_flags
, 0, &uri
);
10532 ok(SUCCEEDED(hr
), "Error: CreateUri returned 0x%08x on uri_parse_tests[%d].\n", hr
, i
);
10533 if(SUCCEEDED(hr
)) {
10534 WCHAR result
[INTERNET_MAX_URL_LENGTH
+1];
10535 DWORD result_len
= -1;
10537 hr
= pCoInternetParseIUri(uri
, test
.action
, test
.flags
, result
, INTERNET_MAX_URL_LENGTH
+1, &result_len
, 0);
10540 ok(hr
== test
.expected
,
10541 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10542 hr
, test
.expected
, i
);
10545 ok(hr
== test
.expected
,
10546 "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x on uri_parse_tests[%d].\n",
10547 hr
, test
.expected
, i
);
10549 if(SUCCEEDED(hr
)) {
10550 DWORD len
= lstrlenA(test
.property
);
10551 ok(!strcmp_aw(test
.property
, result
),
10552 "Error: Expected %s but got %s instead on uri_parse_tests[%d].\n",
10553 test
.property
, wine_dbgstr_w(result
), i
);
10554 ok(len
== result_len
,
10555 "Error: Expected %d, but got %d instead on uri_parse_tests[%d].\n",
10556 len
, result_len
, i
);
10559 "Error: Expected 'result_len' to be 0, but was %d on uri_parse_tests[%d].\n",
10563 if(uri
) IUri_Release(uri
);
10568 static void test_CoInternetParseIUri_Pluggable(void) {
10572 hr
= pCreateUri(parse_urlW
, 0, 0, &uri
);
10573 ok(SUCCEEDED(hr
), "Error: Expected CreateUri to succeed, but got 0x%08x.\n", hr
);
10574 if(SUCCEEDED(hr
)) {
10578 SET_EXPECT(ParseUrl
);
10580 parse_action
= PARSE_CANONICALIZE
;
10581 parse_flags
= URL_UNESCAPE
|URL_ESCAPE_UNSAFE
;
10583 hr
= pCoInternetParseIUri(uri
, parse_action
, parse_flags
, result
, 200, &result_len
, 0);
10584 ok(hr
== S_OK
, "Error: CoInternetParseIUri returned 0x%08x, expected 0x%08x.\n", hr
, S_OK
);
10586 CHECK_CALLED(ParseUrl
);
10588 if(SUCCEEDED(hr
)) {
10589 ok(result_len
== lstrlenW(parse_resultW
), "Error: Expected %d, but got %d.\n",
10590 lstrlenW(parse_resultW
), result_len
);
10591 ok(!lstrcmpW(result
, parse_resultW
), "Error: Expected %s, but got %s.\n",
10592 wine_dbgstr_w(parse_resultW
), wine_dbgstr_w(result
));
10595 if(uri
) IUri_Release(uri
);
10601 const char *base_url
;
10602 DWORD base_uri_flags
;
10603 const char *legacy_url
;
10604 const char *uniform_url
;
10605 const char *no_canon_url
;
10606 const char *uri_url
;
10607 } create_urlmon_test_t
;
10609 static const create_urlmon_test_t create_urlmon_tests
[] = {
10611 "http://www.winehq.org",Uri_CREATE_NO_CANONICALIZE
,
10613 "http://www.winehq.org/",
10614 "http://www.winehq.org/",
10615 "http://www.winehq.org",
10616 "http://www.winehq.org"
10619 "file://c:\\dir\\file.txt",Uri_CREATE_NO_CANONICALIZE
,
10621 "file://c:\\dir\\file.txt",
10622 "file:///c:/dir/file.txt",
10623 "file:///c:/dir/file.txt",
10624 "file:///c:/dir/file.txt"
10627 "file://c:\\dir\\file.txt",Uri_CREATE_FILE_USE_DOS_PATH
,
10629 "file://c:\\dir\\file.txt",
10630 "file:///c:/dir/file.txt",
10631 "file:///c:/dir/file.txt",
10632 "file://c:\\dir\\file.txt"
10635 "dat%61",Uri_CREATE_ALLOW_RELATIVE
,
10636 "http://www.winehq.org",0,
10637 "http://www.winehq.org/data",
10638 "http://www.winehq.org/data",
10639 "http://www.winehq.org:80/data",
10642 "file.txt",Uri_CREATE_ALLOW_RELATIVE
,
10643 "file://c:\\dir\\x.txt",Uri_CREATE_NO_CANONICALIZE
,
10644 "file://c:\\dir\\file.txt",
10645 "file:///c:/dir/file.txt",
10646 "file:///c:/dir/file.txt",
10649 "",Uri_CREATE_ALLOW_RELATIVE
,
10657 "test",Uri_CREATE_ALLOW_RELATIVE
,
10665 "c:\\dir\\file.txt",Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME
,
10667 "file://c:\\dir\\file.txt",
10668 "file:///c:/dir/file.txt",
10669 "file:///c:/dir/file.txt",
10670 "file:///c:/dir/file.txt",
10674 #define test_urlmon_display_name(a,b) _test_urlmon_display_name(__LINE__,a,b)
10675 static void _test_urlmon_display_name(unsigned line
, IMoniker
*mon
, const char *exurl
)
10677 WCHAR
*display_name
;
10680 hres
= IMoniker_GetDisplayName(mon
, NULL
, NULL
, &display_name
);
10681 ok_(__FILE__
,line
)(hres
== S_OK
, "GetDisplayName failed: %08x\n", hres
);
10682 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_name
), "unexpected display name: %s, expected %s\n",
10683 wine_dbgstr_w(display_name
), exurl
);
10685 CoTaskMemFree(display_name
);
10688 #define test_display_uri(a,b) _test_display_uri(__LINE__,a,b)
10689 static void _test_display_uri(unsigned line
, IMoniker
*mon
, const char *exurl
)
10691 IUriContainer
*uri_container
;
10696 hres
= IMoniker_QueryInterface(mon
, &IID_IUriContainer
, (void**)&uri_container
);
10697 ok(hres
== S_OK
, "Could not get IUriContainer iface: %08x\n", hres
);
10700 hres
= IUriContainer_GetIUri(uri_container
, &uri
);
10701 IUriContainer_Release(uri_container
);
10702 ok(hres
== S_OK
, "GetIUri failed: %08x\n", hres
);
10703 ok(uri
!= NULL
, "uri == NULL\n");
10705 hres
= IUri_GetDisplayUri(uri
, &display_uri
);
10707 ok(hres
== S_OK
, "GetDisplayUri failed: %08x\n", hres
);
10708 ok_(__FILE__
,line
)(!strcmp_aw(exurl
, display_uri
), "unexpected display uri: %s, expected %s\n",
10709 wine_dbgstr_w(display_uri
), exurl
);
10710 SysFreeString(display_uri
);
10713 static void test_CreateURLMoniker(void)
10715 const create_urlmon_test_t
*test
;
10716 IMoniker
*mon
, *base_mon
;
10717 WCHAR
*url
, *base_url
;
10718 IUri
*uri
, *base_uri
;
10721 for(test
= create_urlmon_tests
; test
< create_urlmon_tests
+ sizeof(create_urlmon_tests
)/sizeof(*create_urlmon_tests
); test
++) {
10722 url
= a2w(test
->url
);
10723 base_url
= a2w(test
->base_url
);
10726 hres
= pCreateUri(base_url
, test
->base_uri_flags
, 0, &base_uri
);
10727 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10729 hres
= pCreateURLMonikerEx2(NULL
, base_uri
, &base_mon
, URL_MK_NO_CANONICALIZE
);
10730 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10736 hres
= CreateURLMoniker(base_mon
, url
, &mon
);
10737 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10738 test_urlmon_display_name(mon
, test
->legacy_url
);
10739 test_display_uri(mon
, test
->legacy_url
);
10740 IMoniker_Release(mon
);
10742 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_LEGACY
);
10743 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10744 test_urlmon_display_name(mon
, test
->legacy_url
);
10745 test_display_uri(mon
, test
->legacy_url
);
10746 IMoniker_Release(mon
);
10748 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_UNIFORM
);
10749 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10750 test_urlmon_display_name(mon
, test
->uniform_url
);
10751 test_display_uri(mon
, test
->uniform_url
);
10752 IMoniker_Release(mon
);
10754 hres
= pCreateURLMonikerEx(base_mon
, url
, &mon
, URL_MK_NO_CANONICALIZE
);
10755 ok(hres
== S_OK
, "CreateURLMoniker failed: %08x\n", hres
);
10756 test_urlmon_display_name(mon
, test
->no_canon_url
);
10757 test_display_uri(mon
, test
->no_canon_url
);
10758 IMoniker_Release(mon
);
10760 hres
= pCreateUri(url
, test
->uri_flags
, 0, &uri
);
10761 ok(hres
== S_OK
, "CreateUri failed: %08x\n", hres
);
10763 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_LEGACY
);
10764 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10765 test_urlmon_display_name(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10766 test_display_uri(mon
, base_url
? test
->legacy_url
: test
->uri_url
);
10767 IMoniker_Release(mon
);
10769 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_UNIFORM
);
10770 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10771 test_urlmon_display_name(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10772 test_display_uri(mon
, base_url
? test
->uniform_url
: test
->uri_url
);
10773 IMoniker_Release(mon
);
10775 hres
= pCreateURLMonikerEx2(base_mon
, uri
, &mon
, URL_MK_NO_CANONICALIZE
);
10776 ok(hres
== S_OK
, "CreateURLMonikerEx2 failed: %08x\n", hres
);
10777 test_urlmon_display_name(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10778 test_display_uri(mon
, base_url
? test
->no_canon_url
: test
->uri_url
);
10779 IMoniker_Release(mon
);
10783 heap_free(base_url
);
10785 IUri_Release(base_uri
);
10787 IMoniker_Release(base_mon
);
10791 static int add_default_flags(DWORD flags
) {
10792 if(!(flags
& Uri_CREATE_NO_CANONICALIZE
))
10793 flags
|= Uri_CREATE_CANONICALIZE
;
10794 if(!(flags
& Uri_CREATE_NO_DECODE_EXTRA_INFO
))
10795 flags
|= Uri_CREATE_DECODE_EXTRA_INFO
;
10796 if(!(flags
& Uri_CREATE_NO_CRACK_UNKNOWN_SCHEMES
))
10797 flags
|= Uri_CREATE_CRACK_UNKNOWN_SCHEMES
;
10798 if(!(flags
& Uri_CREATE_NO_PRE_PROCESS_HTML_URI
))
10799 flags
|= Uri_CREATE_PRE_PROCESS_HTML_URI
;
10800 if(!(flags
& Uri_CREATE_IE_SETTINGS
))
10801 flags
|= Uri_CREATE_NO_IE_SETTINGS
;
10806 static void test_IPersistStream(void)
10808 int i
, props_order
[Uri_PROPERTY_DWORD_LAST
+1] = { 0 };
10810 props_order
[Uri_PROPERTY_RAW_URI
] = 1;
10811 props_order
[Uri_PROPERTY_FRAGMENT
] = 2;
10812 props_order
[Uri_PROPERTY_HOST
] = 3;
10813 props_order
[Uri_PROPERTY_PASSWORD
] = 4;
10814 props_order
[Uri_PROPERTY_PATH
] = 5;
10815 props_order
[Uri_PROPERTY_PORT
] = 6;
10816 props_order
[Uri_PROPERTY_QUERY
] = 7;
10817 props_order
[Uri_PROPERTY_SCHEME_NAME
] = 8;
10818 props_order
[Uri_PROPERTY_USER_NAME
] = 9;
10820 for(i
=0; i
<sizeof(uri_tests
)/sizeof(*uri_tests
); i
++) {
10821 const uri_properties
*test
= uri_tests
+i
;
10824 IPersistStream
*persist_stream
;
10827 DWORD props
, props_no
, dw_data
[6];
10828 WCHAR str_data
[1024];
10829 ULARGE_INTEGER size
, max_size
;
10830 LARGE_INTEGER no_off
;
10835 if(test
->create_todo
|| test
->create_expected
!=S_OK
)
10838 uriW
= a2w(test
->uri
);
10839 hr
= pCreateUri(uriW
, test
->create_flags
, 0, &uri
);
10840 ok(hr
== S_OK
, "%d) CreateUri failed 0x%08x, expected S_OK..\n", i
, hr
);
10842 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
10843 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10845 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &stream
);
10846 ok(hr
== S_OK
, "CreateStreamOnHGlobal failed 0x%08x.\n", hr
);
10847 hr
= IPersistStream_IsDirty(persist_stream
);
10848 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10849 hr
= IPersistStream_Save(persist_stream
, stream
, FALSE
);
10850 ok(hr
== S_OK
, "%d) Save failed 0x%08x, expected S_OK.\n", i
, hr
);
10851 hr
= IPersistStream_IsDirty(persist_stream
);
10852 ok(hr
== S_FALSE
, "%d) IsDirty returned 0x%08x, expected S_FALSE.\n", i
, hr
);
10853 no_off
.QuadPart
= 0;
10854 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
10855 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10856 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10857 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10858 hr
= IPersistStream_GetSizeMax(persist_stream
, &max_size
);
10859 ok(hr
== S_OK
, "%d) GetSizeMax failed 0x%08x, expected S_OK.\n", i
, hr
);
10860 ok(U(size
).LowPart
+2 == U(max_size
).LowPart
,
10861 "%d) Written data size is %d, max_size %d.\n",
10862 i
, U(size
).LowPart
, U(max_size
).LowPart
);
10864 hr
= IStream_Read(stream
, (void*)dw_data
, sizeof(DWORD
), NULL
);
10865 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10866 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
10867 i
, dw_data
[0]-2, U(size
).LowPart
);
10868 hr
= IStream_Read(stream
, (void*)dw_data
, 6*sizeof(DWORD
), NULL
);
10869 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10870 ok(dw_data
[0] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[0]);
10871 ok(dw_data
[1] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[1]);
10872 ok(dw_data
[2] == add_default_flags(test
->create_flags
),
10873 "%d) Incorrect value %x, expected %x (creation flags).\n",
10874 i
, dw_data
[2], add_default_flags(test
->create_flags
));
10875 ok(dw_data
[3] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[3]);
10876 ok(dw_data
[4] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[4]);
10877 ok(dw_data
[5] == 0, "%d) Incorrect value %x, expected 0 (unknown).\n", i
, dw_data
[5]);
10880 for(props
=0; props
<=Uri_PROPERTY_DWORD_LAST
; props
++) {
10881 if(!props_order
[props
])
10884 if(props
<= Uri_PROPERTY_STRING_LAST
) {
10885 if(test
->str_props
[props
].expected
== S_OK
)
10888 if(test
->dword_props
[props
-Uri_PROPERTY_DWORD_START
].expected
== S_OK
)
10892 if(test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTP
10893 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_FTP
10894 && test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
!= URL_SCHEME_HTTPS
)
10897 hr
= IStream_Read(stream
, (void*)&props
, sizeof(DWORD
), NULL
);
10898 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10899 ok(props
== props_no
, "%d) Properties no is %d, expected %d.\n", i
, props
, props_no
);
10904 hr
= IStream_Read(stream
, (void*)dw_data
, 2*sizeof(DWORD
), NULL
);
10905 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10907 ok(dw_data
[2]<props_order
[dw_data
[0]],
10908 "%d) Incorrect properties order (%d, %d)\n",
10909 i
, dw_data
[0], dw_data
[3]);
10910 dw_data
[2] = props_order
[dw_data
[0]];
10911 dw_data
[3] = dw_data
[0];
10913 if(dw_data
[0]<=Uri_PROPERTY_STRING_LAST
) {
10914 const uri_str_property
*prop
= test
->str_props
+dw_data
[0];
10915 hr
= IStream_Read(stream
, (void*)str_data
, dw_data
[1], NULL
);
10916 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10917 ok(!strcmp_aw(prop
->value
, str_data
) || broken(prop
->broken_value
&& !strcmp_aw(prop
->broken_value
, str_data
)),
10918 "%d) Expected %s but got %s (%d).\n", i
, prop
->value
, wine_dbgstr_w(str_data
), dw_data
[0]);
10919 } else if(dw_data
[0]>=Uri_PROPERTY_DWORD_START
&& dw_data
[0]<=Uri_PROPERTY_DWORD_LAST
) {
10920 const uri_dword_property
*prop
= test
->dword_props
+dw_data
[0]-Uri_PROPERTY_DWORD_START
;
10921 ok(dw_data
[1] == sizeof(DWORD
), "%d) Size of dword property is %d (%d)\n", i
, dw_data
[1], dw_data
[0]);
10922 hr
= IStream_Read(stream
, (void*)&dw_data
[1], sizeof(DWORD
), NULL
);
10923 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10924 ok(prop
->value
== dw_data
[1], "%d) Expected %d but got %d (%d).\n", i
, prop
->value
, dw_data
[1], dw_data
[0]);
10926 ok(FALSE
, "%d) Incorrect property type (%d)\n", i
, dw_data
[0]);
10930 ok(props
== 0, "%d) No all properties were processed %d. Next property type: %d\n",
10931 i
, props
, dw_data
[0]);
10933 IPersistStream_Release(persist_stream
);
10936 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10937 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10938 hr
= IPersistStream_GetClassID(persist_stream
, &curi
);
10939 ok(hr
== S_OK
, "%d) GetClassID failed 0x%08x, expected S_OK.\n", i
, hr
);
10940 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetClassID returned incorrect CLSID.\n", i
);
10941 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
10942 &IID_IUri
, (void**)&uri
);
10943 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
10944 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&persist_stream
);
10945 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10946 hr
= IPersistStream_Load(persist_stream
, stream
);
10947 ok(hr
== S_OK
, "%d) Load failed 0x%08x, expected S_OK.\n", i
, hr
);
10948 hr
= IUri_GetRawUri(uri
, &raw_uri
);
10949 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
10950 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
10951 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
10952 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
10953 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
10954 wine_dbgstr_w(raw_uri
));
10955 SysFreeString(raw_uri
);
10957 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
10958 ok(hr
== S_OK
, "%d) QueryInterface(IID_IMarshal) failed 0x%08x, expected S_OK.\n", i
, hr
);
10959 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10960 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10961 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10962 MSHCTX_DIFFERENTMACHINE
, NULL
, MSHLFLAGS_NORMAL
);
10963 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10964 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10965 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
);
10966 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10967 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10968 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLESTRONG
);
10969 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10970 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10971 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_TABLEWEAK
);
10972 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10973 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10974 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NOPING
);
10975 ok(hr
== E_INVALIDARG
, "%d) MarshalInterface returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10976 hr
= IMarshal_MarshalInterface(marshal
, stream
, &IID_IUri
, (void*)uri
,
10977 MSHCTX_LOCAL
, NULL
, MSHLFLAGS_NORMAL
);
10978 ok(hr
== S_OK
, "%d) MarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
10979 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
10980 MSHCTX_CROSSCTX
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
10981 ok(hr
== E_INVALIDARG
, "%d) GetUnmarshalClass returned 0x%08x, expected E_INVALIDARG.\n", i
, hr
);
10982 hr
= IMarshal_GetUnmarshalClass(marshal
, &IID_IUri
, (void*)uri
,
10983 MSHCTX_INPROC
, NULL
, MSHLFLAGS_NORMAL
, &curi
);
10984 ok(hr
== S_OK
, "%d) GetUnmarshalClass failed 0x%08x, expected S_OK.\n", i
, hr
);
10985 ok(IsEqualCLSID(&curi
, &CLSID_CUri
), "%d) GetUnmarshalClass returned incorrect CLSID.\n", i
);
10987 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_CUR
, &size
);
10988 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10989 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
10990 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
10991 hr
= IStream_Read(stream
, (void*)dw_data
, 3*sizeof(DWORD
), NULL
);
10992 ok(hr
== S_OK
, "%d) Read failed 0x%08x, expected S_OK.\n", i
, hr
);
10993 ok(dw_data
[0]-2 == U(size
).LowPart
, "%d) Structure size is %d, expected %d\n",
10994 i
, dw_data
[0]-2, U(size
).LowPart
);
10995 ok(dw_data
[1] == MSHCTX_LOCAL
, "%d) Incorrect value %d, expected MSHCTX_LOCAL.\n",
10997 ok(dw_data
[2] == dw_data
[0]-8, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
10998 i
, dw_data
[2], dw_data
[0]-8);
10999 if(!test
->str_props
[Uri_PROPERTY_PATH
].value
[0] &&
11000 (test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTP
11001 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_FTP
11002 || test
->dword_props
[Uri_PROPERTY_SCHEME
-Uri_PROPERTY_DWORD_START
].value
== URL_SCHEME_HTTPS
))
11003 U(max_size
).LowPart
+= 3*sizeof(DWORD
);
11004 ok(dw_data
[2] == U(max_size
).LowPart
, "%d) Incorrect value %d, expected %d (PersistStream size).\n",
11005 i
, dw_data
[2], U(max_size
).LowPart
);
11006 IMarshal_Release(marshal
);
11009 hr
= IStream_Seek(stream
, no_off
, STREAM_SEEK_SET
, NULL
);
11010 ok(hr
== S_OK
, "%d) Seek failed 0x%08x, expected S_OK.\n", i
, hr
);
11011 hr
= CoCreateInstance(&curi
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11012 &IID_IUri
, (void**)&uri
);
11013 ok(hr
== S_OK
, "%d) Error creating uninitialized Uri: 0x%08x.\n", i
, hr
);
11014 hr
= IUri_QueryInterface(uri
, &IID_IMarshal
, (void**)&marshal
);
11015 ok(hr
== S_OK
, "%d) QueryInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11016 hr
= IMarshal_UnmarshalInterface(marshal
, stream
, &IID_IUri
, (void**)&uri
);
11017 ok(hr
== S_OK
, "%d) UnmarshalInterface failed 0x%08x, expected S_OK.\n", i
, hr
);
11018 hr
= IUri_GetRawUri(uri
, &raw_uri
);
11019 ok(hr
== S_OK
, "%d) GetRawUri failed 0x%08x, expected S_OK.\n", i
, hr
);
11020 ok(!strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].value
, raw_uri
)
11021 || broken(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
11022 && !strcmp_aw(test
->str_props
[Uri_PROPERTY_RAW_URI
].broken_value
, raw_uri
)),
11023 "%d) Expected %s but got %s.\n", i
, test
->str_props
[Uri_PROPERTY_RAW_URI
].value
,
11024 wine_dbgstr_w(raw_uri
));
11025 SysFreeString(raw_uri
);
11027 IMarshal_Release(marshal
);
11028 IStream_Release(stream
);
11029 IPersistStream_Release(persist_stream
);
11035 static void test_UninitializedUri(void)
11038 IUriBuilderFactory
*ubf
;
11039 IPersistStream
*ps
;
11047 hr
= CoCreateInstance(&CLSID_CUri
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
11048 &IID_IUri
, (void**)&uri
);
11050 win_skip("Skipping uninitialized Uri tests.\n");
11054 hr
= IUri_QueryInterface(uri
, &IID_IUriBuilderFactory
, (void**)&ubf
);
11055 ok(hr
== S_OK
, "QueryInterface(IID_IUriBuillderFactory) failed: %x.\n", hr
);
11056 hr
= IUri_QueryInterface(uri
, &IID_IPersistStream
, (void**)&ps
);
11057 ok(hr
== S_OK
, "QueryInterface(IID_IPersistStream) failed: %x.\n", hr
);
11059 hr
= IUri_GetAbsoluteUri(uri
, NULL
);
11060 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11061 hr
= IUri_GetAbsoluteUri(uri
, &bstr
);
11062 ok(hr
== E_UNEXPECTED
, "GetAbsoluteUri returned %x, expected E_UNEXPECTED.\n", hr
);
11063 hr
= IUri_GetAuthority(uri
, &bstr
);
11064 ok(hr
== E_UNEXPECTED
, "GetAuthority returned %x, expected E_UNEXPECTED.\n", hr
);
11065 hr
= IUri_GetDisplayUri(uri
, &bstr
);
11066 ok(hr
== E_UNEXPECTED
, "GetDisplayUri returned %x, expected E_UNEXPECTED.\n", hr
);
11067 hr
= IUri_GetDomain(uri
, &bstr
);
11068 ok(hr
== E_UNEXPECTED
, "GetDomain returned %x, expected E_UNEXPECTED.\n", hr
);
11069 hr
= IUri_GetExtension(uri
, &bstr
);
11070 ok(hr
== E_UNEXPECTED
, "GetExtension returned %x, expected E_UNEXPECTED.\n", hr
);
11071 hr
= IUri_GetFragment(uri
, &bstr
);
11072 ok(hr
== E_UNEXPECTED
, "GetFragment returned %x, expected E_UNEXPECTED.\n", hr
);
11073 hr
= IUri_GetHost(uri
, &bstr
);
11074 ok(hr
== E_UNEXPECTED
, "GetHost returned %x, expected E_UNEXPECTED.\n", hr
);
11075 hr
= IUri_GetHostType(uri
, &dword
);
11076 ok(hr
== E_UNEXPECTED
, "GetHostType returned %x, expected E_UNEXPECTED.\n", hr
);
11077 hr
= IUri_GetPassword(uri
, &bstr
);
11078 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11079 hr
= IUri_GetPassword(uri
, &bstr
);
11080 ok(hr
== E_UNEXPECTED
, "GetPassword returned %x, expected E_UNEXPECTED.\n", hr
);
11081 hr
= IUri_GetPathAndQuery(uri
, &bstr
);
11082 ok(hr
== E_UNEXPECTED
, "GetPathAndQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11083 hr
= IUri_GetPort(uri
, &dword
);
11084 ok(hr
== E_UNEXPECTED
, "GetPort returned %x, expected E_UNEXPECTED.\n", hr
);
11085 hr
= IUri_GetProperties(uri
, &dword
);
11086 ok(hr
== E_UNEXPECTED
, "GetProperties returned %x, expected E_UNEXPECTED.\n", hr
);
11087 hr
= IUri_GetPropertyBSTR(uri
, Uri_PROPERTY_RAW_URI
, &bstr
, 0);
11088 ok(hr
== E_UNEXPECTED
, "GetPropertyBSTR returned %x, expected E_UNEXPECTED.\n", hr
);
11089 hr
= IUri_GetPropertyDWORD(uri
, Uri_PROPERTY_PORT
, &dword
, 0);
11090 ok(hr
== E_UNEXPECTED
, "GetPropertyDWORD returned %x, expected E_UNEXPECTED.\n", hr
);
11091 hr
= IUri_GetPropertyLength(uri
, Uri_PROPERTY_RAW_URI
, &dword
, 0);
11092 ok(hr
== E_UNEXPECTED
, "GetPropertyLength returned %x, expected E_UNEXPECTED.\n", hr
);
11093 hr
= IUri_GetQuery(uri
, &bstr
);
11094 ok(hr
== E_UNEXPECTED
, "GetQuery returned %x, expected E_UNEXPECTED.\n", hr
);
11095 hr
= IUri_GetRawUri(uri
, &bstr
);
11096 ok(hr
== E_UNEXPECTED
, "GetRawUri returned %x, expected E_UNEXPECTED.\n", hr
);
11097 hr
= IUri_GetScheme(uri
, &dword
);
11098 ok(hr
== E_UNEXPECTED
, "GetScheme returned %x, expected E_UNEXPECTED.\n", hr
);
11099 hr
= IUri_GetSchemeName(uri
, &bstr
);
11100 ok(hr
== E_UNEXPECTED
, "GetSchemeName returned %x, expected E_UNEXPECTED.\n", hr
);
11101 hr
= IUri_GetUserInfo(uri
, &bstr
);
11102 ok(hr
== E_UNEXPECTED
, "GetUserInfo returned %x, expected E_UNEXPECTED.\n", hr
);
11103 hr
= IUri_GetUserName(uri
, &bstr
);
11104 ok(hr
== E_UNEXPECTED
, "GetUserName returned %x, expected E_UNEXPECTED.\n", hr
);
11105 hr
= IUri_GetZone(uri
, &dword
);
11106 ok(hr
== E_UNEXPECTED
, "GetZone returned %x, expected E_UNEXPECTED.\n", hr
);
11107 hr
= IUri_IsEqual(uri
, uri
, &eq
);
11108 ok(hr
== E_UNEXPECTED
, "IsEqual returned %x, expected E_UNEXPECTED.\n", hr
);
11110 hr
= IUriBuilderFactory_CreateInitializedIUriBuilder(ubf
, 0, 0, &ub
);
11111 ok(hr
== E_UNEXPECTED
, "CreateInitializedIUriBuilder returned %x, expected E_UNEXPECTED.\n", hr
);
11112 hr
= IUriBuilderFactory_CreateIUriBuilder(ubf
, 0, 0, &ub
);
11113 ok(hr
== S_OK
, "CreateIUriBuilder returned %x, expected S_OK.\n", hr
);
11114 IUriBuilder_Release(ub
);
11116 hr
= IPersistStream_GetSizeMax(ps
, &ui
);
11117 ok(hr
== S_OK
, "GetSizeMax returned %x, expected S_OK.\n", hr
);
11118 ok(ui
.u
.LowPart
== 34, "ui.LowPart = %d, expected 34.\n", ui
.u
.LowPart
);
11119 hr
= IPersistStream_IsDirty(ps
);
11120 ok(hr
== S_FALSE
, "IsDirty returned %x, expected S_FALSE.\n", hr
);
11122 IPersistStream_Release(ps
);
11123 IUriBuilderFactory_Release(ubf
);
11130 hurlmon
= GetModuleHandle("urlmon.dll");
11131 pCoInternetGetSession
= (void*) GetProcAddress(hurlmon
, "CoInternetGetSession");
11132 pCreateUri
= (void*) GetProcAddress(hurlmon
, "CreateUri");
11133 pCreateUriWithFragment
= (void*) GetProcAddress(hurlmon
, "CreateUriWithFragment");
11134 pCreateIUriBuilder
= (void*) GetProcAddress(hurlmon
, "CreateIUriBuilder");
11135 pCoInternetCombineIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineIUri");
11136 pCoInternetCombineUrlEx
= (void*) GetProcAddress(hurlmon
, "CoInternetCombineUrlEx");
11137 pCoInternetParseIUri
= (void*) GetProcAddress(hurlmon
, "CoInternetParseIUri");
11138 pCreateURLMonikerEx
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx");
11139 pCreateURLMonikerEx2
= (void*) GetProcAddress(hurlmon
, "CreateURLMonikerEx2");
11142 win_skip("CreateUri is not present, skipping tests.\n");
11146 trace("test CreateUri invalid flags...\n");
11147 test_CreateUri_InvalidFlags();
11149 trace("test CreateUri invalid args...\n");
11150 test_CreateUri_InvalidArgs();
11152 trace("test CreateUri invalid URIs...\n");
11153 test_CreateUri_InvalidUri();
11155 trace("test IUri_GetPropertyBSTR...\n");
11156 test_IUri_GetPropertyBSTR();
11158 trace("test IUri_GetPropertyDWORD...\n");
11159 test_IUri_GetPropertyDWORD();
11161 trace("test IUri_GetStrProperties...\n");
11162 test_IUri_GetStrProperties();
11164 trace("test IUri_GetDwordProperties...\n");
11165 test_IUri_GetDwordProperties();
11167 trace("test IUri_GetPropertyLength...\n");
11168 test_IUri_GetPropertyLength();
11170 trace("test IUri_GetProperties...\n");
11171 test_IUri_GetProperties();
11173 trace("test IUri_HasProperty...\n");
11174 test_IUri_HasProperty();
11176 trace("test IUri_IsEqual...\n");
11177 test_IUri_IsEqual();
11179 trace("test CreateUriWithFragment invalid args...\n");
11180 test_CreateUriWithFragment_InvalidArgs();
11182 trace("test CreateUriWithFragment invalid flags...\n");
11183 test_CreateUriWithFragment_InvalidFlags();
11185 trace("test CreateUriWithFragment...\n");
11186 test_CreateUriWithFragment();
11188 trace("test CreateIUriBuilder...\n");
11189 test_CreateIUriBuilder();
11191 trace("test IUriBuilder_CreateInvalidArgs...\n");
11192 test_IUriBuilder_CreateInvalidArgs();
11194 trace("test IUriBuilder...\n");
11195 test_IUriBuilder();
11197 trace("test IUriBuilder_GetInvalidArgs...\n");
11198 test_IUriBuilder_GetInvalidArgs();
11200 trace("test IUriBuilder_HasBeenModified...\n");
11201 test_IUriBuilder_HasBeenModified();
11203 trace("test IUriBuilder_IUriProperty...\n");
11204 test_IUriBuilder_IUriProperty();
11206 trace("test IUriBuilder_RemoveProperties...\n");
11207 test_IUriBuilder_RemoveProperties();
11209 trace("test IUriBuilder miscellaneous...\n");
11210 test_IUriBuilder_Misc();
11212 trace("test IUriBuilderFactory...\n");
11213 test_IUriBuilderFactory();
11215 trace("test CoInternetCombineIUri...\n");
11216 test_CoInternetCombineIUri();
11218 trace("test CoInternetCombineUrlEx...\n");
11219 test_CoInternetCombineUrlEx();
11221 trace("test CoInternetParseIUri Invalid Args...\n");
11222 test_CoInternetParseIUri_InvalidArgs();
11224 trace("test CoInternetParseIUri...\n");
11225 test_CoInternetParseIUri();
11227 register_protocols();
11229 trace("test CoInternetCombineIUri pluggable...\n");
11230 test_CoInternetCombineIUri_Pluggable();
11232 trace("test CoInternetCombineUrlEx Pluggable...\n");
11233 test_CoInternetCombineUrlEx_Pluggable();
11235 trace("test CoInternetParseIUri pluggable...\n");
11236 test_CoInternetParseIUri_Pluggable();
11238 trace("test CreateURLMoniker...\n");
11239 test_CreateURLMoniker();
11241 CoInitialize(NULL
);
11243 trace("test IPersistStream...\n");
11244 test_IPersistStream();
11246 trace("test uninitialized Uri...\n");
11247 test_UninitializedUri();
11250 unregister_protocols();