From 07e7a117ca119e629d784b0b2b98eb8e9bf7f0f5 Mon Sep 17 00:00:00 2001 From: Thomas Mullaly Date: Sun, 25 Jul 2010 18:36:49 -0400 Subject: [PATCH] urlmon: Implemented IUri_GetExtension. --- dlls/urlmon/tests/uri.c | 230 ++++++++++++++++++++-------------------- dlls/urlmon/uri.c | 33 ++++-- 2 files changed, 141 insertions(+), 122 deletions(-) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index 0d03fff1835..be437515361 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -98,7 +98,7 @@ static const uri_properties uri_tests[] = { {"www.winehq.org",S_OK,FALSE}, /* AUTHORITY */ {"http://www.winehq.org/",S_OK,TRUE}, /* DISPLAY_URI */ {"winehq.org",S_OK,FALSE}, /* DOMAIN */ - {"",S_FALSE,TRUE}, /* EXTENSION */ + {"",S_FALSE,FALSE}, /* EXTENSION */ {"",S_FALSE,TRUE}, /* FRAGMENT */ {"www.winehq.org",S_OK,FALSE}, /* HOST */ {"",S_FALSE,FALSE}, /* PASSWORD */ @@ -127,7 +127,7 @@ static const uri_properties uri_tests[] = { {"winehq.org",S_OK,FALSE}, {"http://winehq.org/tests",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -156,7 +156,7 @@ static const uri_properties uri_tests[] = { {"www.winehq.org",S_OK,FALSE}, {"http://www.winehq.org/?query=x&return=y",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.winehq.org",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -185,7 +185,7 @@ static const uri_properties uri_tests[] = { {"usEr%3Ainfo@example.com",S_OK,FALSE}, {"http://example.com/path/a/Forbidden'%3C%7C%3E%20Characters",S_OK,TRUE}, {"example.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"example.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -215,7 +215,7 @@ static const uri_properties uri_tests[] = { {"winepass:wine@ftp.winehq.org:9999",S_OK,FALSE}, {"ftp://ftp.winehq.org:9999/dir/foo%20bar.txt",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {".txt",S_OK,TRUE}, + {".txt",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"ftp.winehq.org",S_OK,FALSE}, {"wine",S_OK,FALSE}, @@ -243,7 +243,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///c:/tests/foo%2520bar.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -271,7 +271,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///tests/test%20file.README.txt",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".txt",S_OK,TRUE}, + {".txt",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -299,7 +299,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"urn:nothing:should:happen here",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -328,7 +328,7 @@ static const uri_properties uri_tests[] = { {"127.0.0.1",S_OK,FALSE}, {"http://127.0.0.1/test%20dir/test.txt",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".txt",S_OK,TRUE}, + {".txt",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"127.0.0.1",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -357,7 +357,7 @@ static const uri_properties uri_tests[] = { {"[fedc:ba98:7654:3210:fedc:ba98:7654:3210]",S_OK,FALSE}, {"http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"fedc:ba98:7654:3210:fedc:ba98:7654:3210",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -386,7 +386,7 @@ static const uri_properties uri_tests[] = { {"[::13.1.68.3]",S_OK,FALSE}, {"ftp://[::13.1.68.3]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"::13.1.68.3",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -415,7 +415,7 @@ static const uri_properties uri_tests[] = { {"[fedc:ba98::3210]",S_OK,FALSE}, {"http://[fedc:ba98::3210]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"fedc:ba98::3210",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -444,7 +444,7 @@ static const uri_properties uri_tests[] = { {"www.winehq.org",S_OK,FALSE}, {"1234://www.winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.winehq.org",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -473,7 +473,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///C:/test/test.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -503,7 +503,7 @@ static const uri_properties uri_tests[] = { {"server",S_OK,FALSE}, {"file://server/test.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"server",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -532,7 +532,7 @@ static const uri_properties uri_tests[] = { {"www.winehq.org",S_OK,FALSE}, {"*:www.winehq.org/test",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.winehq.org",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -562,7 +562,7 @@ static const uri_properties uri_tests[] = { {"www.winehq.org",S_OK,FALSE}, {"*:www.winehq.org/test",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.winehq.org",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -590,7 +590,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"/../some dir/test.ext",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".ext",S_OK,TRUE}, + {".ext",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -618,7 +618,7 @@ static const uri_properties uri_tests[] = { {"",S_OK,FALSE}, {"*://implicit/wildcard/uri%20scheme",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -648,7 +648,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"zip:/.//google.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -679,7 +679,7 @@ static const uri_properties uri_tests[] = { {"user:pass:word@winehq.org",S_OK,FALSE}, {"ftp://winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"pass:word",S_OK,FALSE}, @@ -710,7 +710,7 @@ static const uri_properties uri_tests[] = { {"wINe:PASS@ftp.google.com",S_OK,FALSE}, {"ftp://ftp.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ftp.google.com",S_OK,FALSE}, {"PASS",S_OK,FALSE}, @@ -741,7 +741,7 @@ static const uri_properties uri_tests[] = { {"w%5D%5Be:PA%7B%7D@ftp.google.com",S_OK,FALSE}, {"ftp://ftp.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ftp.google.com",S_OK,FALSE}, {"PA%7B%7D",S_OK,FALSE}, @@ -772,7 +772,7 @@ static const uri_properties uri_tests[] = { {"empty:@ftp.google.com",S_OK,FALSE}, {"ftp://ftp.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ftp.google.com",S_OK,FALSE}, {"",S_OK,FALSE}, @@ -803,7 +803,7 @@ static const uri_properties uri_tests[] = { {"%22%20%22weird@ftp.google.com",S_OK,FALSE}, {"ftp://ftp.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ftp.google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -834,7 +834,7 @@ static const uri_properties uri_tests[] = { {"\" \"weird@ftp.google.com",S_OK,FALSE}, {"ftp://ftp.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ftp.google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -864,7 +864,7 @@ static const uri_properties uri_tests[] = { {"%xy:word@winehq.org",S_OK,FALSE}, {"zip://%xy:word@winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"word",S_OK,FALSE}, @@ -896,7 +896,7 @@ static const uri_properties uri_tests[] = { {"%2E:%52%53ord@winehq.org",S_OK,FALSE}, {"zip://%2E:%52%53ord@winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"%52%53ord",S_OK,FALSE}, @@ -926,7 +926,7 @@ static const uri_properties uri_tests[] = { {"[](),'test':word@winehq.org",S_OK,FALSE}, {"ftp://winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"word",S_OK,FALSE}, @@ -955,7 +955,7 @@ static const uri_properties uri_tests[] = { {"test",S_OK,FALSE}, {"ftp://test/?:word@winehq.org/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"test",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -984,7 +984,7 @@ static const uri_properties uri_tests[] = { {"test",S_OK,FALSE}, {"ftp://test/#:word@winehq.org/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"#:word@winehq.org/",S_OK,TRUE}, {"test",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1014,7 +1014,7 @@ static const uri_properties uri_tests[] = { {"test\\:word@winehq.org",S_OK,FALSE}, {"zip://test\\:word@winehq.org/",S_OK,TRUE}, {"winehq.org",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"winehq.org",S_OK,FALSE}, {"word",S_OK,FALSE}, @@ -1044,7 +1044,7 @@ static const uri_properties uri_tests[] = { {"127.0.0.100",S_OK,FALSE}, {"http://127.0.0.100/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"127.0.0.100",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1074,7 +1074,7 @@ static const uri_properties uri_tests[] = { {"127.0.0.0",S_OK,FALSE}, {"http://127.0.0.0/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"127.0.0.0",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1104,7 +1104,7 @@ static const uri_properties uri_tests[] = { {"0.1.226.64",S_OK,FALSE}, {"http://0.1.226.64/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"0.1.226.64",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1134,7 +1134,7 @@ static const uri_properties uri_tests[] = { {"255.255.255.255",S_OK,FALSE}, {"http://255.255.255.255/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"255.255.255.255",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1164,7 +1164,7 @@ static const uri_properties uri_tests[] = { {"4294967296",S_OK,FALSE}, {"http://4294967296/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"4294967296",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1194,7 +1194,7 @@ static const uri_properties uri_tests[] = { {"4294967295",S_OK,FALSE}, {"1234://4294967295/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"4294967295",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1224,7 +1224,7 @@ static const uri_properties uri_tests[] = { {"127.001",S_OK,FALSE}, {"1234://127.001/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"127.001",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1253,7 +1253,7 @@ static const uri_properties uri_tests[] = { {"[fedc:ba98::3210]",S_OK,FALSE}, {"http://[fedc:ba98::3210]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"fedc:ba98::3210",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1282,7 +1282,7 @@ static const uri_properties uri_tests[] = { {"[::]",S_OK,FALSE}, {"http://[::]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"::",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1311,7 +1311,7 @@ static const uri_properties uri_tests[] = { {"[fedc:ba98::]",S_OK,FALSE}, {"http://[fedc:ba98::]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"fedc:ba98::",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1341,7 +1341,7 @@ static const uri_properties uri_tests[] = { {"[1:0:3:4:5:6:7:8]",S_OK,FALSE}, {"http://[1:0:3:4:5:6:7:8]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"1:0:3:4:5:6:7:8",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1370,7 +1370,7 @@ static const uri_properties uri_tests[] = { {"[v2.34]",S_OK,FALSE}, {"http://[v2.34]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"[v2.34]",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1400,7 +1400,7 @@ static const uri_properties uri_tests[] = { {"[xyz:12345.com",S_OK,FALSE}, {"http://[xyz:12345.com/test",S_OK,TRUE}, {"[xyz:12345.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"[xyz:12345.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1432,7 +1432,7 @@ static const uri_properties uri_tests[] = { {"www.[works].com",S_OK,FALSE}, {"ftp://www.[works].com/",S_OK,TRUE}, {"[works].com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.[works].com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1462,7 +1462,7 @@ static const uri_properties uri_tests[] = { {"www.google.com]:12345",S_OK,FALSE}, {"http://www.google.com]:12345/",S_OK,TRUE}, {"google.com]",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.google.com]",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1492,7 +1492,7 @@ static const uri_properties uri_tests[] = { {"w%XXw%GEw.google.com",S_OK,FALSE}, {"zip://w%XXw%GEw.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"w%XXw%GEw.google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1522,7 +1522,7 @@ static const uri_properties uri_tests[] = { {"GOOGLE.com",S_OK,FALSE}, {"zip://GOOGLE.com/",S_OK,TRUE}, {"GOOGLE.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"GOOGLE.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1552,7 +1552,7 @@ static const uri_properties uri_tests[] = { {"www.google.com",S_OK,FALSE}, {"http://www.google.com/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1584,7 +1584,7 @@ static const uri_properties uri_tests[] = { {"www.%7cgoogle%7c.com",S_OK,FALSE}, {"http://www.%7cgoogle%7c.com/",S_OK,TRUE}, {"%7cgoogle%7c.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.%7cgoogle%7c.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1614,7 +1614,7 @@ static const uri_properties uri_tests[] = { {"[1:2:3:4:5:6::]",S_OK,FALSE}, {"http://[1:2:3:4:5:6::]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"1:2:3:4:5:6::",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1644,7 +1644,7 @@ static const uri_properties uri_tests[] = { {"[::1.2.3.0]",S_OK,FALSE}, {"http://[::1.2.3.0]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"::1.2.3.0",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1674,7 +1674,7 @@ static const uri_properties uri_tests[] = { {"[0001:0:000:0004:0005:0006:001.002.003.000]",S_OK,FALSE}, {"zip://[0001:0:000:0004:0005:0006:001.002.003.000]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"0001:0:000:0004:0005:0006:001.002.003.000",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1704,7 +1704,7 @@ static const uri_properties uri_tests[] = { {"[ffff::c0de:6f20]",S_OK,FALSE}, {"http://[ffff::c0de:6f20]/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"ffff::c0de:6f20",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1734,7 +1734,7 @@ static const uri_properties uri_tests[] = { {"google.com:65535",S_OK,FALSE}, {"http://google.com:65535/",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1763,7 +1763,7 @@ static const uri_properties uri_tests[] = { {"google.com:65536",S_OK,FALSE}, {"zip://google.com:65536/",S_OK,TRUE}, {"google.com:65536",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com:65536",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1792,7 +1792,7 @@ static const uri_properties uri_tests[] = { {"google.com:65536:25",S_OK,FALSE}, {"zip://google.com:65536:25/",S_OK,TRUE}, {"google.com:65536:25",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com:65536:25",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1821,7 +1821,7 @@ static const uri_properties uri_tests[] = { {"[::ffff]:abcd",S_OK,FALSE}, {"zip://[::ffff]:abcd/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"[::ffff]:abcd",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1850,7 +1850,7 @@ static const uri_properties uri_tests[] = { {"127.0.0.1:abcd",S_OK,FALSE}, {"zip://127.0.0.1:abcd/",S_OK,TRUE}, {"0.1:abcd",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"127.0.0.1:abcd",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1879,7 +1879,7 @@ static const uri_properties uri_tests[] = { {"google.com:00035",S_OK,FALSE}, {"http://google.com:00035",S_OK,TRUE,"http://google.com:35"}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1908,7 +1908,7 @@ static const uri_properties uri_tests[] = { {"google.com:80",S_OK,FALSE}, {"http://google.com:80",S_OK,TRUE}, {"google.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1937,7 +1937,7 @@ static const uri_properties uri_tests[] = { {"google.com.uk",S_OK,FALSE}, {"http://google.com.uk/",S_OK,TRUE}, {"google.com.uk",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1966,7 +1966,7 @@ static const uri_properties uri_tests[] = { {"google.com.com",S_OK,FALSE}, {"http://google.com.com/",S_OK,TRUE}, {"com.com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.com.com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -1995,7 +1995,7 @@ static const uri_properties uri_tests[] = { {"google.uk.1",S_OK,FALSE}, {"http://google.uk.1/",S_OK,TRUE}, {"google.uk.1",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.uk.1",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2025,7 +2025,7 @@ static const uri_properties uri_tests[] = { {"google.foo.uk",S_OK,FALSE}, {"http://google.foo.uk/",S_OK,TRUE}, {"foo.uk",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"google.foo.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2054,7 +2054,7 @@ static const uri_properties uri_tests[] = { {".com",S_OK,FALSE}, {"http://.com/",S_OK,TRUE}, {".com",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {".com",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2083,7 +2083,7 @@ static const uri_properties uri_tests[] = { {".uk",S_OK,FALSE}, {"http://.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {".uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2112,7 +2112,7 @@ static const uri_properties uri_tests[] = { {"www.co.google.com.[]",S_OK,FALSE}, {"http://www.co.google.com.[]/",S_OK,TRUE}, {"google.com.[]",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.co.google.com.[]",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2141,7 +2141,7 @@ static const uri_properties uri_tests[] = { {"co.uk",S_OK,FALSE}, {"http://co.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"co.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2170,7 +2170,7 @@ static const uri_properties uri_tests[] = { {"www.co.google.us.test",S_OK,FALSE}, {"http://www.co.google.us.test/",S_OK,TRUE}, {"us.test",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.co.google.us.test",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2199,7 +2199,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2227,7 +2227,7 @@ static const uri_properties uri_tests[] = { {"www.google.com\\test",S_OK,FALSE}, {"zip://www.google.com\\test",S_OK,TRUE}, {"google.com\\test",S_OK,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"www.google.com\\test",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2255,7 +2255,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"urn:excepts:bad:%XY:encoded",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2286,7 +2286,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///C:/te%253Es%252Et/tes%25t.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2317,7 +2317,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///C:/te%3Es.t/t#es%25t.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2347,7 +2347,7 @@ static const uri_properties uri_tests[] = { {"[::1.2.3.0]",S_OK,FALSE}, {"http://[::1.2.3.0]/%3F%23.T/test",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"::1.2.3.0",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2376,7 +2376,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///C:/%22test%22/test.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2406,7 +2406,7 @@ static const uri_properties uri_tests[] = { {"4294967295",S_OK,FALSE}, {"1234://4294967295/<|>\" test<|>",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"4294967295",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2436,7 +2436,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/%3C%7C%3E%20test%3C%7C%3E",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2465,7 +2465,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2494,7 +2494,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2523,7 +2523,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2551,7 +2551,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"file:///c:/foo%2520bar.mp3",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".mp3",S_OK,TRUE}, + {".mp3",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2581,7 +2581,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"zip://gov.uk/",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {"",S_FALSE,TRUE}, + {"",S_FALSE,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2611,7 +2611,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"http://gov.uk/test/test2/../../.",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".",S_OK,TRUE}, + {".",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2641,7 +2641,7 @@ static const uri_properties uri_tests[] = { {"gov.uk",S_OK,FALSE}, {"*:gov.uk/test/test2/../../.",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".",S_OK,TRUE}, + {".",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"gov.uk",S_OK,FALSE}, {"",S_FALSE,FALSE}, @@ -2670,7 +2670,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"mailto:%22acco%3C%7C%3Eunt@example.com%22",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com%22",S_OK,TRUE}, + {".com%22",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2698,7 +2698,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"news:test.tes%3C%7C%3Et.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2727,7 +2727,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"news:test.tes<|>t.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2756,7 +2756,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"urn:test.tes<|>t.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2785,7 +2785,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"news:test.test.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2814,7 +2814,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"news:test.test.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -2843,7 +2843,7 @@ static const uri_properties uri_tests[] = { {"",S_FALSE,FALSE}, {"urn:test.%74%65%73%74.com",S_OK,TRUE}, {"",S_FALSE,FALSE}, - {".com",S_OK,TRUE}, + {".com",S_OK,FALSE}, {"",S_FALSE,TRUE}, {"",S_FALSE,FALSE}, {"",S_FALSE,FALSE}, @@ -3327,27 +3327,6 @@ static void test_IUri_GetStrProperties(void) { SysFreeString(received); received = NULL; - /* GetExtension() tests. */ - prop = test.str_props[Uri_PROPERTY_EXTENSION]; - hr = IUri_GetExtension(uri, &received); - if(prop.todo) { - todo_wine { - ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", - hr, prop.expected, i); - } - todo_wine { - ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", - prop.value, wine_dbgstr_w(received), i); - } - } else { - ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", - hr, prop.expected, i); - ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", - prop.value, wine_dbgstr_w(received), i); - } - SysFreeString(received); - received = NULL; - /* GetFragment() tests. */ prop = test.str_props[Uri_PROPERTY_FRAGMENT]; hr = IUri_GetFragment(uri, &received); @@ -3433,6 +3412,27 @@ static void test_IUri_GetStrProperties(void) { SysFreeString(received); received = NULL; + /* GetExtension() tests. */ + prop = test.str_props[Uri_PROPERTY_EXTENSION]; + hr = IUri_GetExtension(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetExtension returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + /* GetHost() tests. */ prop = test.str_props[Uri_PROPERTY_HOST]; hr = IUri_GetHost(uri, &received); diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index 20a2d87a175..49503317424 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -2831,6 +2831,20 @@ static HRESULT WINAPI Uri_GetPropertyBSTR(IUri *iface, Uri_PROPERTY uriProp, BST hres = S_FALSE; } + if(!(*pbstrProperty)) + hres = E_OUTOFMEMORY; + + break; + case Uri_PROPERTY_EXTENSION: + if(This->extension_offset > -1) { + *pbstrProperty = SysAllocStringLen(This->canon_uri+This->path_start+This->extension_offset, + This->path_len-This->extension_offset); + hres = S_OK; + } else { + *pbstrProperty = SysAllocStringLen(NULL, 0); + hres = S_FALSE; + } + if(!(*pbstrProperty)) hres = E_OUTOFMEMORY; @@ -2974,6 +2988,16 @@ static HRESULT WINAPI Uri_GetPropertyLength(IUri *iface, Uri_PROPERTY uriProp, D *pcchProperty = 0; hres = (This->domain_offset > -1) ? S_OK : S_FALSE; + break; + case Uri_PROPERTY_EXTENSION: + if(This->extension_offset > -1) { + *pcchProperty = This->path_len - This->extension_offset; + hres = S_OK; + } else { + *pcchProperty = 0; + hres = S_FALSE; + } + break; case Uri_PROPERTY_HOST: *pcchProperty = This->host_len; @@ -3115,13 +3139,8 @@ static HRESULT WINAPI Uri_GetDomain(IUri *iface, BSTR *pstrDomain) static HRESULT WINAPI Uri_GetExtension(IUri *iface, BSTR *pstrExtension) { - Uri *This = URI_THIS(iface); - FIXME("(%p)->(%p)\n", This, pstrExtension); - - if(!pstrExtension) - return E_POINTER; - - return E_NOTIMPL; + TRACE("(%p)->(%p)\n", iface, pstrExtension); + return Uri_GetPropertyBSTR(iface, Uri_PROPERTY_EXTENSION, pstrExtension, 0); } static HRESULT WINAPI Uri_GetFragment(IUri *iface, BSTR *pstrFragment)