DEFINE_EXPECT(CreateInstance);
DEFINE_EXPECT(unk_Release);
-static const char *debugstr_w(LPCWSTR str)
-{
- static char buf[1024];
- WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
- return buf;
-}
-
static void test_CreateFormatEnum(void)
{
IEnumFORMATETC *fenum = NULL, *fenum2 = NULL;
static const struct {
BYTE *data;
DWORD size;
- LPCWSTR mime;
+ LPCWSTR mime, mime_alt;
} mime_tests2[] = {
{data1, sizeof(data1), mimeTextPlain},
{data2, sizeof(data2), mimeAppOctetStream},
{data4, sizeof(data4), mimeAppOctetStream},
{data5, sizeof(data5), mimeTextPlain},
{data6, sizeof(data6), mimeTextPlain},
- {data7, sizeof(data7), mimeTextHtml},
- {data8, sizeof(data8), mimeTextHtml},
- {data9, sizeof(data9), mimeTextHtml},
- {data10, sizeof(data10), mimeTextHtml},
- {data11, sizeof(data11), mimeTextHtml},
- {data12, sizeof(data12), mimeTextHtml},
+ {data7, sizeof(data7), mimeTextHtml, mimeTextPlain /* IE8 */},
+ {data8, sizeof(data8), mimeTextHtml, mimeTextPlain /* IE8 */},
+ {data9, sizeof(data9), mimeTextHtml, mimeImagePjpeg /* IE8 */},
+ {data10, sizeof(data10), mimeTextHtml, mimeTextPlain /* IE8 */},
+ {data11, sizeof(data11), mimeTextHtml, mimeTextPlain /* IE8 */},
+ {data12, sizeof(data12), mimeTextHtml, mimeTextPlain /* IE8 */},
{data13, sizeof(data13), mimeTextPlain},
{data14, sizeof(data14), mimeTextPlain},
{data15, sizeof(data15), mimeTextPlain},
{data23, sizeof(data23), mimeTextPlain},
{data24, sizeof(data24), mimeImageGif},
{data25, sizeof(data25), mimeImageGif},
- {data26, sizeof(data26), mimeTextHtml},
+ {data26, sizeof(data26), mimeTextHtml, mimeImageGif /* IE8 */},
{data27, sizeof(data27), mimeTextPlain},
{data28, sizeof(data28), mimeImageBmp},
{data29, sizeof(data29), mimeImageBmp},
{data30, sizeof(data30), mimeAppOctetStream},
- {data31, sizeof(data31), mimeTextHtml},
+ {data31, sizeof(data31), mimeTextHtml, mimeImageBmp /* IE8 */},
{data32, sizeof(data32), mimeAppOctetStream},
{data33, sizeof(data33), mimeAppOctetStream},
{data34, sizeof(data34), mimeImageXPng},
{data35, sizeof(data35), mimeImageXPng},
{data36, sizeof(data36), mimeAppOctetStream},
- {data37, sizeof(data37), mimeTextHtml},
+ {data37, sizeof(data37), mimeTextHtml, mimeImageXPng /* IE8 */},
{data38, sizeof(data38), mimeAppOctetStream},
{data39, sizeof(data39), mimeImageTiff},
- {data40, sizeof(data40), mimeTextHtml},
+ {data40, sizeof(data40), mimeTextHtml, mimeImageTiff /* IE8 */},
{data41, sizeof(data41), mimeImageTiff},
{data42, sizeof(data42), mimeTextPlain},
{data43, sizeof(data43), mimeAppOctetStream},
{data45, sizeof(data45), mimeTextPlain},
{data46, sizeof(data46), mimeTextPlain},
{data47, sizeof(data47), mimeTextPlain},
- {data48, sizeof(data48), mimeTextHtml},
+ {data48, sizeof(data48), mimeTextHtml, mimeVideoAvi /* IE8 */},
{data49, sizeof(data49), mimeVideoAvi},
{data50, sizeof(data50), mimeVideoMpeg},
{data51, sizeof(data51), mimeVideoMpeg},
{data52, sizeof(data52), mimeAppOctetStream},
{data53, sizeof(data53), mimeAppOctetStream},
- {data54, sizeof(data54), mimeTextHtml},
+ {data54, sizeof(data54), mimeTextHtml, mimeVideoMpeg /* IE8 */},
{data55, sizeof(data55), mimeAppXGzip},
{data56, sizeof(data56), mimeTextPlain},
- {data57, sizeof(data57), mimeTextHtml},
+ {data57, sizeof(data57), mimeTextHtml, mimeAppXGzip /* IE8 */},
{data58, sizeof(data58), mimeAppOctetStream},
{data59, sizeof(data59), mimeAppXZip},
{data60, sizeof(data60), mimeTextPlain},
- {data61, sizeof(data61), mimeTextHtml},
+ {data61, sizeof(data61), mimeTextHtml, mimeAppXZip /* IE8 */},
{data62, sizeof(data62), mimeAppJava},
{data63, sizeof(data63), mimeTextPlain},
- {data64, sizeof(data64), mimeTextHtml},
+ {data64, sizeof(data64), mimeTextHtml, mimeAppJava /* IE8 */},
{data65, sizeof(data65), mimeAppPdf},
{data66, sizeof(data66), mimeTextPlain},
- {data67, sizeof(data67), mimeTextHtml},
+ {data67, sizeof(data67), mimeTextHtml, mimeAppPdf /* IE8 */},
{data68, sizeof(data68), mimeAppXMSDownload},
{data69, sizeof(data69), mimeTextPlain},
- {data70, sizeof(data70), mimeTextHtml},
+ {data70, sizeof(data70), mimeTextHtml, mimeAppXMSDownload /* IE8 */},
{data71, sizeof(data71), mimeTextRichtext},
{data72, sizeof(data72), mimeTextPlain},
{data73, sizeof(data73), mimeTextPlain},
- {data74, sizeof(data74), mimeTextHtml},
+ {data74, sizeof(data74), mimeTextHtml, mimeTextRichtext /* IE8 */},
{data75, sizeof(data75), mimeAudioWav},
{data76, sizeof(data76), mimeTextPlain},
{data77, sizeof(data77), mimeTextPlain},
- {data78, sizeof(data78), mimeTextHtml},
+ {data78, sizeof(data78), mimeTextHtml, mimeTextPlain /* IE8 */},
{data79, sizeof(data79), mimeAppPostscript},
{data80, sizeof(data80), mimeTextPlain},
- {data81, sizeof(data81), mimeTextHtml},
+ {data81, sizeof(data81), mimeTextHtml, mimeAppPostscript /* IE8 */},
{data82, sizeof(data82), mimeAudioBasic},
{data83, sizeof(data83), mimeTextPlain},
- {data84, sizeof(data84), mimeTextHtml},
+ {data84, sizeof(data84), mimeTextHtml, mimeAudioBasic /* IE8 */},
{data85, sizeof(data85), mimeTextPlain}
};
hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
NULL, 0, &mime, 0);
ok(hres == S_OK, "[%d] FindMimeFromData failed: %08x\n", i, hres);
- ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, debugstr_w(mime));
+ ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime: %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime);
hres = FindMimeFromData(NULL, NULL, mime_tests2[i].data, mime_tests2[i].size,
if(!lstrcmpW(mimeAppOctetStream, mime_tests2[i].mime) || i == 17)
ok(!lstrcmpW(mime, mimeImagePjpeg), "[%d] wrong mime\n", i);
else
- ok(!lstrcmpW(mime, mime_tests2[i].mime), "[%d] wrong mime\n", i);
+ ok(!lstrcmpW(mime, mime_tests2[i].mime) ||
+ (mime_tests2[i].mime_alt && !lstrcmpW(mime, mime_tests2[i].mime_alt)),
+ "[%d] wrong mime, got %s\n", i, wine_dbgstr_w(mime));
CoTaskMemFree(mime);
}
ok(hres == E_INVALIDARG, "FindMimeFromData failed: %08x, expected E_INVALIDARG\n", hres);
}
-static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0};
-static const BYTE secid5[] = {'h','t','t','p',':','w','w','w','.','w','i','n','e','h','q',
- '.','o','r','g',3,0,0,0};
-static const BYTE secid6[] = {'a','b','o','u','t',':','b','l','a','n','k',3,0,0,0};
-static const BYTE secid7[] = {'f','t','p',':','w','i','n','e','h','q','.','o','r','g',
- 3,0,0,0};
-static const BYTE secid10[] =
- {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e','.','j','p','g',3,0,0,0};
-static const BYTE secid10_2[] =
- {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e','.','j','p','g',3,0,0,0};
-
-static struct secmgr_test {
- LPCWSTR url;
- DWORD zone;
- HRESULT zone_hres;
- DWORD secid_size;
- const BYTE *secid;
- HRESULT secid_hres;
-} secmgr_tests[] = {
- {url1, 0, S_OK, sizeof(secid1), secid1, S_OK},
- {url2, 100, 0x80041001, 0, NULL, E_INVALIDARG},
- {url3, 0, S_OK, sizeof(secid1), secid1, S_OK},
- {url5, 3, S_OK, sizeof(secid5), secid5, S_OK},
- {url6, 3, S_OK, sizeof(secid6), secid6, S_OK},
- {url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
-};
-
-static void test_SecurityManager(void)
-{
- int i;
- IInternetSecurityManager *secmgr = NULL;
- BYTE buf[512];
- DWORD zone, size, policy;
- HRESULT hres;
-
- hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
- ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
- if(FAILED(hres))
- return;
-
- for(i=0; i < sizeof(secmgr_tests)/sizeof(secmgr_tests[0]); i++) {
- zone = 100;
- hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url,
- &zone, 0);
- ok(hres == secmgr_tests[i].zone_hres /* IE <=6 */
- || (FAILED(secmgr_tests[i].zone_hres) && hres == E_INVALIDARG), /* IE7 */
- "[%d] MapUrlToZone failed: %08x, expected %08x\n",
- i, hres, secmgr_tests[i].zone_hres);
- if(SUCCEEDED(hres))
- ok(zone == secmgr_tests[i].zone, "[%d] zone=%d, expected %d\n", i, zone,
- secmgr_tests[i].zone);
- else
- ok(zone == secmgr_tests[i].zone || zone == -1, "[%d] zone=%d\n", i, zone);
-
- size = sizeof(buf);
- memset(buf, 0xf0, sizeof(buf));
- hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[i].url,
- buf, &size, 0);
- ok(hres == secmgr_tests[i].secid_hres,
- "[%d] GetSecurityId failed: %08x, expected %08x\n",
- i, hres, secmgr_tests[i].secid_hres);
- if(secmgr_tests[i].secid) {
- ok(size == secmgr_tests[i].secid_size, "[%d] size=%d, expected %d\n",
- i, size, secmgr_tests[i].secid_size);
- ok(!memcmp(buf, secmgr_tests[i].secid, size), "[%d] wrong secid\n", i);
- }
- }
-
- zone = 100;
- hres = IInternetSecurityManager_MapUrlToZone(secmgr, url10, &zone, 0);
- ok(hres == S_OK, "MapUrlToZone failed: %08x, expected S_OK\n", hres);
- ok(zone == 3, "zone=%d, expected 3\n", zone);
-
- /* win2k3 translates %20 into a space */
- size = sizeof(buf);
- memset(buf, 0xf0, sizeof(buf));
- hres = IInternetSecurityManager_GetSecurityId(secmgr, url10, buf, &size, 0);
- ok(hres == S_OK, "GetSecurityId failed: %08x, expected S_OK\n", hres);
- ok(size == sizeof(secid10) ||
- size == sizeof(secid10_2), /* win2k3 */
- "size=%d\n", size);
- ok(!memcmp(buf, secid10, size) ||
- !memcmp(buf, secid10_2, size), /* win2k3 */
- "wrong secid\n");
-
- zone = 100;
- hres = IInternetSecurityManager_MapUrlToZone(secmgr, NULL, &zone, 0);
- ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08x, expected E_INVALIDARG\n", hres);
- ok(zone == 100 || zone == -1, "zone=%d\n", zone);
-
- size = sizeof(buf);
- hres = IInternetSecurityManager_GetSecurityId(secmgr, NULL, buf, &size, 0);
- ok(hres == E_INVALIDARG,
- "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
- hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
- NULL, &size, 0);
- ok(hres == E_INVALIDARG,
- "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
- hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
- buf, NULL, 0);
- ok(hres == E_INVALIDARG,
- "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
-
- hres = IInternetSecurityManager_ProcessUrlAction(secmgr, NULL, URLACTION_SCRIPT_RUN, (BYTE*)&policy,
- sizeof(WCHAR), NULL, 0, 0, 0);
- ok(hres == E_INVALIDARG, "ProcessUrlAction failed: %08x, expected E_INVALIDARG\n", hres);
-
- IInternetSecurityManager_Release(secmgr);
-}
-
-/* Check if Internet Explorer is configured to run in "Enhanced Security Configuration" (aka hardened mode) */
-/* Note: this code is duplicated in dlls/mshtml/tests/dom.c, dlls/mshtml/tests/script.c and dlls/urlmon/tests/misc.c */
-static BOOL is_ie_hardened(void)
-{
- HKEY zone_map;
- DWORD ie_harden, type, size;
-
- ie_harden = 0;
- if(RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap",
- 0, KEY_QUERY_VALUE, &zone_map) == ERROR_SUCCESS) {
- size = sizeof(DWORD);
- if (RegQueryValueEx(zone_map, "IEHarden", NULL, &type, (LPBYTE) &ie_harden, &size) != ERROR_SUCCESS ||
- type != REG_DWORD) {
- ie_harden = 0;
- }
- RegCloseKey(zone_map);
- }
-
- return ie_harden != 0;
-}
-
-static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
-{
- DWORD res, size, policy, reg_policy;
- char buf[10];
- HKEY hkey;
- HRESULT hres;
-
- /* FIXME: HKEY_CURRENT_USER is most of the time the default but this can be changed on a system.
- * The test should be changed to cope with that, if need be.
- */
- res = RegOpenKeyA(HKEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey);
- if(res != ERROR_SUCCESS) {
- ok(0, "Could not open zone key\n");
- return;
- }
-
- wsprintf(buf, "%X", action);
- size = sizeof(DWORD);
- res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)®_policy, &size);
- RegCloseKey(hkey);
- if(res != ERROR_SUCCESS || size != sizeof(DWORD)) {
- policy = 0xdeadbeef;
- hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
- sizeof(WCHAR), NULL, 0, 0, 0);
- ok(hres == E_FAIL, "ProcessUrlAction(%x) failed: %08x, expected E_FAIL\n", action, hres);
- ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
-
- policy = 0xdeadbeef;
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres);
- ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
- return;
- }
-
- policy = 0xdeadbeef;
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
- ok(policy == reg_policy, "(%x) policy=%x, expected %x\n", action, policy, reg_policy);
-
- if(policy != URLPOLICY_QUERY) {
- if(winetest_interactive || ! is_ie_hardened()) {
- policy = 0xdeadbeef;
- hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
- sizeof(WCHAR), NULL, 0, 0, 0);
- if(reg_policy == URLPOLICY_DISALLOW)
- ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
- else
- ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
- ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
- }else {
- skip("IE running in Enhanced Security Configuration\n");
- }
- }
-}
-
-static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
-{
- DWORD policy;
- HRESULT hres;
-
- policy = 0xdeadbeef;
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
- ok(policy == URLPOLICY_DISALLOW, "(%x) policy=%x, expected URLPOLIVY_DISALLOW\n", action, policy);
-
- policy = 0xdeadbeef;
- hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
- sizeof(WCHAR), NULL, 0, 0, 0);
- ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
-}
-
-static void test_polices(void)
-{
- IInternetZoneManager *zonemgr = NULL;
- IInternetSecurityManager *secmgr = NULL;
- HRESULT hres;
-
- hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
- ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
- hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
- ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
-
- test_url_action(secmgr, zonemgr, URLACTION_SCRIPT_RUN);
- test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY);
- test_url_action(secmgr, zonemgr, URLACTION_CHANNEL_SOFTDIST_PERMISSIONS);
- test_url_action(secmgr, zonemgr, 0xdeadbeef);
-
- test_special_url_action(secmgr, zonemgr, URLACTION_SCRIPT_OVERRIDE_SAFETY);
-
- IInternetSecurityManager_Release(secmgr);
- IInternetZoneManager_Release(zonemgr);
-}
-
-static void test_ZoneManager(void)
-{
- IInternetZoneManager *zonemgr = NULL;
- BYTE buf[32];
- HRESULT hres;
- DWORD action = URLACTION_CREDENTIALS_USE; /* Implemented on all IE versions */
-
- hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
- ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
- if(FAILED(hres))
- return;
-
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
- ok(*(DWORD*)buf == URLPOLICY_CREDENTIALS_SILENT_LOGON_OK ||
- *(DWORD*)buf == URLPOLICY_CREDENTIALS_MUST_PROMPT_USER ||
- *(DWORD*)buf == URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT ||
- *(DWORD*)buf == URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY,
- "unexpected policy=%d\n", *(DWORD*)buf);
-
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, NULL,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
-
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
- 2, URLZONEREG_DEFAULT);
- ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
-
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1fff, buf,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres);
-
- hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 13, action, buf,
- sizeof(DWORD), URLZONEREG_DEFAULT);
- ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
-
- IInternetZoneManager_Release(zonemgr);
-}
-
static void register_protocols(void)
{
IInternetSession *session;
ok(encoding == 0xdeadbeef, "encoding = %08x, exepcted 0xdeadbeef\n", encoding);
}
-static void test_ObtainUserAgentString(void)
+static void test_user_agent(void)
{
static const CHAR expected[] = "Mozilla/4.0 (compatible; MSIE ";
+ static char test_str[] = "test";
+ static char test2_str[] = "test\0test";
static CHAR str[3];
LPSTR str2 = NULL;
HRESULT hres;
ok(size > 0, "size=%d, expected non-zero\n", size);
str2 = HeapAlloc(GetProcessHeap(), 0, (size+20)*sizeof(CHAR));
- if (!str2)
- {
- skip("skipping rest of ObtainUserAgent tests, out of memory\n");
- }
- else
- {
- saved = size;
- hres = ObtainUserAgentString(0, str2, &size);
- ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
- ok(size == saved, "size=%d, expected %d\n", size, saved);
- ok(strlen(expected) <= strlen(str2) &&
- !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
- "user agent was \"%s\", expected to start with \"%s\"\n",
- str2, expected);
-
- size = saved+10;
- hres = ObtainUserAgentString(0, str2, &size);
- ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
- ok(size == saved, "size=%d, expected %d\n", size, saved);
- }
+ saved = size;
+ hres = ObtainUserAgentString(0, str2, &size);
+ ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
+ ok(size == saved, "size=%d, expected %d\n", size, saved);
+ ok(strlen(expected) <= strlen(str2) &&
+ !memcmp(expected, str2, strlen(expected)*sizeof(CHAR)),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = saved+10;
+ hres = ObtainUserAgentString(0, str2, &size);
+ ok(hres == S_OK, "ObtainUserAgentString failed: %08x\n", hres);
+ ok(size == saved, "size=%d, expected %d\n", size, saved);
+
+ size = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size, "size == 0\n");
+
+ size = 0xdeadbeef;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, NULL, 1000, &size, 0);
+ ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size, "size == 0\n");
+
+ saved = size;
+ size = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved+10, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(sizeof(expected) <= strlen(str2) && !memcmp(expected, str2, sizeof(expected)-1),
+ "user agent was \"%s\", expected to start with \"%s\"\n",
+ str2, expected);
+
+ size = saved;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved-1, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == saved, "size = %d, expected %d\n", size, saved);
+ ok(!str2[0], "buf changed\n");
+
+ size = saved;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, NULL, 0);
+ ok(hres == E_INVALIDARG, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(!str2[0], "buf changed\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, sizeof(test_str), 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test2_str, sizeof(test2_str), 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == sizeof(test_str) && !memcmp(str2, test_str, sizeof(test_str)), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 2, 0);
+ ok(hres == S_OK, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ size = 0;
+ str2[0] = 0;
+ hres = UrlMkGetSessionOption(URLMON_OPTION_USERAGENT, str2, saved, &size, 0);
+ ok(hres == E_OUTOFMEMORY, "UrlMkGetSessionOption failed: %08x\n", hres);
+ ok(size == 3 && !strcmp(str2, "te"), "wrong user agent\n");
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, test_str, 0, 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, sizeof(test_str), 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
+ hres = UrlMkSetSessionOption(URLMON_OPTION_USERAGENT, NULL, 0, 0);
+ ok(hres == E_INVALIDARG, "UrlMkSetSessionOption failed: %08x\n", hres);
+
HeapFree(GetProcessHeap(), 0, str2);
}
hres = IMoniker_GetDisplayName(mon, NULL, 0, &name);
ok(hres == S_OK, "GetDiasplayName failed: %08x\n", hres);
- ok(!lstrcmpW(name, url9), "wrong display name %s\n", debugstr_w(name));
+ ok(!lstrcmpW(name, url9), "wrong display name %s\n", wine_dbgstr_w(name));
CoTaskMemFree(name);
hres = IMoniker_IsSystemMoniker(mon, &issys);
IBindCtx_Release(bctx);
}
+static void test_IsValidURL(void)
+{
+ HRESULT hr;
+
+ hr = IsValidURL(NULL, 0, 0);
+ ok(hr == E_INVALIDARG, "Expected E_INVALIDARG, got %08x\n", hr);
+}
+
START_TEST(misc)
{
OleInitialize(NULL);
test_CoInternetCompareUrl();
test_CoInternetQueryInfo();
test_FindMimeFromData();
- test_SecurityManager();
- test_polices();
- test_ZoneManager();
test_NameSpace();
test_MimeFilter();
test_ReleaseBindInfo();
test_CopyStgMedium();
test_UrlMkGetSessionOption();
- test_ObtainUserAgentString();
+ test_user_agent();
test_MkParseDisplayNameEx();
+ test_IsValidURL();
OleUninitialize();
}
/*
- * Copyright 2005-2007 Jacek Caban for CodeWeavers
+ * Copyright 2005-2009 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
DEFINE_EXPECT(ReportProgress_ENCODING);
DEFINE_EXPECT(ReportProgress_ACCEPTRANGES);
DEFINE_EXPECT(ReportProgress_PROXYDETECTING);
+DEFINE_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+DEFINE_EXPECT(ReportProgress_DECODING);
DEFINE_EXPECT(ReportData);
+DEFINE_EXPECT(ReportData2);
DEFINE_EXPECT(ReportResult);
DEFINE_EXPECT(GetBindString_ACCEPT_MIMES);
DEFINE_EXPECT(GetBindString_USER_AGENT);
DEFINE_EXPECT(GetBindString_POST_COOKIE);
+DEFINE_EXPECT(GetBindString_URL);
DEFINE_EXPECT(QueryService_HttpNegotiate);
DEFINE_EXPECT(QueryService_InternetProtocol);
DEFINE_EXPECT(QueryService_HttpSecurity);
+DEFINE_EXPECT(QueryInterface_IWinInetInfo);
+DEFINE_EXPECT(QueryInterface_IWinInetHttpInfo);
DEFINE_EXPECT(BeginningTransaction);
DEFINE_EXPECT(GetRootSecurityId);
DEFINE_EXPECT(OnResponse);
DEFINE_EXPECT(Start);
DEFINE_EXPECT(Terminate);
DEFINE_EXPECT(Read);
+DEFINE_EXPECT(Read2);
DEFINE_EXPECT(SetPriority);
DEFINE_EXPECT(LockRequest);
DEFINE_EXPECT(UnlockRequest);
+DEFINE_EXPECT(MimeFilter_CreateInstance);
+DEFINE_EXPECT(MimeFilter_Start);
+DEFINE_EXPECT(MimeFilter_ReportProgress);
+DEFINE_EXPECT(MimeFilter_ReportData);
+DEFINE_EXPECT(MimeFilter_ReportResult);
+DEFINE_EXPECT(MimeFilter_Terminate);
+DEFINE_EXPECT(MimeFilter_LockRequest);
+DEFINE_EXPECT(MimeFilter_UnlockRequest);
+DEFINE_EXPECT(MimeFilter_Read);
+DEFINE_EXPECT(MimeFilter_Switch);
+DEFINE_EXPECT(MimeFilter_Continue);
static const WCHAR wszIndexHtml[] = {'i','n','d','e','x','.','h','t','m','l',0};
static const WCHAR index_url[] =
static const WCHAR hostW[] = {'w','w','w','.','w','i','n','e','h','q','.','o','r','g',0};
static const WCHAR winehq_ipW[] = {'2','0','9','.','4','6','.','2','5','.','1','3','4',0};
static const WCHAR emptyW[] = {0};
+static const WCHAR gzipW[] = {'g','z','i','p',0};
static HRESULT expect_hrResult;
static LPCWSTR file_name, http_url, expect_wsz;
static IInternetProtocol *async_protocol = NULL;
-static BOOL first_data_notif = FALSE, http_is_first = FALSE,
- http_post_test = FALSE;
-static int state = 0, prot_state;
-static DWORD bindf = 0, ex_priority = 0;
-static IInternetProtocol *binding_protocol;
+static BOOL first_data_notif, http_is_first, http_post_test;
+static int state = 0, prot_state, read_report_data;
+static DWORD bindf, ex_priority , pi;
+static IInternetProtocol *binding_protocol, *filtered_protocol;
static IInternetBindInfo *prot_bind_info;
-static IInternetProtocolSink *binding_sink;
+static IInternetProtocolSink *binding_sink, *filtered_sink;
static void *expect_pv;
-static HANDLE event_complete, event_complete2;
+static HANDLE event_complete, event_complete2, event_continue, event_continue_done;
static BOOL binding_test;
-static PROTOCOLDATA protocoldata, *pdata;
-static DWORD prot_read;
-static BOOL security_problem = FALSE;
+static PROTOCOLDATA protocoldata, *pdata, continue_protdata;
+static DWORD prot_read, pi, filter_state;
+static BOOL security_problem;
+static BOOL async_read_pending, mimefilter_test, direct_read, wait_for_switch, emulate_prot, short_read;
static enum {
FILE_TEST,
static const WCHAR binding_urls[][130] = {
{'f','i','l','e',':','t','e','s','t','.','h','t','m','l',0},
- {'h','t','t','p',':','/','/','t','e','s','t','/','t','e','s','t','.','h','t','m','l',0},
+ {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.',
+ 'o','r','g','/','s','i','t','e','/','a','b','o','u','t',0},
{'h','t','t','p','s',':','/','/','w','w','w','.','c','o','d','e','w','e','a','v','e','r','s',
'.','c','o','m','/','t','e','s','t','.','h','t','m','l',0},
{'f','t','p',':','/','/','f','t','p','.','w','i','n','e','h','q','.','o','r','g',
{'t','e','s','t',':','/','/','f','i','l','e','.','h','t','m','l',0}
};
-static const char *debugstr_w(LPCWSTR str)
-{
- static char buf[512];
- if(!str)
- return "(null)";
- WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
- return buf;
-}
-
static const char *debugstr_guid(REFIID riid)
{
static char buf[50];
static int strcmp_wa(LPCWSTR strw, const char *stra)
{
- WCHAR buf[512];
- MultiByteToWideChar(CP_ACP, 0, stra, -1, buf, sizeof(buf)/sizeof(WCHAR));
- return lstrcmpW(strw, buf);
+ CHAR buf[512];
+ WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
+ return lstrcmpA(stra, buf);
+}
+
+/* lstrcmpW is not implemented on Win9x */
+static int strcmp_ww(LPCWSTR strw1, LPCWSTR strw2)
+{
+ CHAR stra1[512], stra2[512];
+ WideCharToMultiByte(CP_ACP, 0, strw1, -1, stra1, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(CP_ACP, 0, strw2, -1, stra2, MAX_PATH, NULL, NULL);
+ return lstrcmpA(stra1, stra2);
}
static HRESULT WINAPI HttpSecurity_QueryInterface(IHttpSecurity *iface, REFIID riid, void **ppv)
CHECK_EXPECT(BeginningTransaction);
if(binding_test)
- ok(!lstrcmpW(szURL, binding_urls[tested_protocol]), "szURL != http_url\n");
+ ok(!strcmp_ww(szURL, binding_urls[tested_protocol]), "szURL != http_url\n");
else
- ok(!lstrcmpW(szURL, http_url), "szURL != http_url\n");
+ ok(!strcmp_ww(szURL, http_url), "szURL != http_url\n");
ok(!dwReserved, "dwReserved=%d, expected 0\n", dwReserved);
ok(pszAdditionalHeaders != NULL, "pszAdditionalHeaders == NULL\n");
if(pszAdditionalHeaders)
skip("Out of memory\n");
return E_OUTOFMEMORY;
}
- lstrcpyW(addl_headers, wszHeaders);
+ memcpy(addl_headers, wszHeaders, sizeof(wszHeaders));
*pszAdditionalHeaders = addl_headers;
}
}
return 1;
}
-static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
+static void call_continue(PROTOCOLDATA *protocol_data)
{
HRESULT hres;
- if(tested_protocol == FTP_TEST)
- CHECK_EXPECT2(Switch);
- else
- CHECK_EXPECT(Switch);
- ok(pProtocolData != NULL, "pProtocolData == NULL\n");
-
- pdata = pProtocolData;
-
- if(binding_test) {
- SetEvent(event_complete);
- WaitForSingleObject(event_complete2, INFINITE);
- return S_OK;
- }
-
- if (!state) {
+ if(!state) {
+ if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST)
+ CLEAR_CALLED(ReportProgress_COOKIE_SENT);
if(tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST || tested_protocol == FTP_TEST) {
if (http_is_first) {
CLEAR_CALLED(ReportProgress_FINDINGRESOURCE);
}
SET_EXPECT(ReportData);
- hres = IInternetProtocol_Continue(async_protocol, pProtocolData);
+ hres = IInternetProtocol_Continue(async_protocol, protocol_data);
ok(hres == S_OK, "Continue failed: %08x\n", hres);
if(tested_protocol == FTP_TEST)
CLEAR_CALLED(ReportData);
SET_EXPECT(ReportProgress_CONNECTING);
}
}
+}
- SetEvent(event_complete);
+static HRESULT WINAPI ProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
+{
+ if(tested_protocol == FTP_TEST)
+ CHECK_EXPECT2(Switch);
+ else
+ CHECK_EXPECT(Switch);
+
+ ok(pProtocolData != NULL, "pProtocolData == NULL\n");
+ if(binding_test) {
+ ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
+ ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
+ pProtocolData->grfFlags, protocoldata.grfFlags );
+ ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
+ pProtocolData->dwState, protocoldata.dwState );
+ ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
+ pProtocolData->pData, protocoldata.pData );
+ ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
+ pProtocolData->cbData, protocoldata.cbData );
+ }
+
+ pdata = pProtocolData;
+
+ if(binding_test) {
+ SetEvent(event_complete);
+ WaitForSingleObject(event_complete2, INFINITE);
+ return S_OK;
+ }if(direct_read) {
+ continue_protdata = *pProtocolData;
+ SetEvent(event_continue);
+ WaitForSingleObject(event_continue_done, INFINITE);
+ }else {
+ call_continue(pProtocolData);
+ SetEvent(event_complete);
+ }
return S_OK;
}
switch(ulStatusCode) {
case BINDSTATUS_MIMETYPEAVAILABLE:
CHECK_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ if(tested_protocol != FILE_TEST && !mimefilter_test && (pi & PI_MIMEVERIFICATION)) {
+ if(!short_read || !direct_read)
+ CHECK_CALLED(Read); /* set in Continue */
+ else if(short_read)
+ CHECK_CALLED(Read2); /* set in Read */
+ }
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText) {
if(tested_protocol == BIND_TEST)
ok(lstrlenW(text_plain) <= lstrlenW(szStatusText) &&
!memcmp(szStatusText, text_plain, lstrlenW(text_plain)*sizeof(WCHAR)),
"szStatusText != text/plain\n");
- else
+ else if(!mimefilter_test)
ok(lstrlenW(text_htmlW) <= lstrlenW(szStatusText) &&
!memcmp(szStatusText, text_htmlW, lstrlenW(text_htmlW)*sizeof(WCHAR)),
"szStatusText != text/html\n");
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText) {
if(binding_test)
- ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText\n");
+ ok(!strcmp_ww(szStatusText, expect_wsz), "unexpected szStatusText\n");
else if(tested_protocol == FILE_TEST)
- ok(!lstrcmpW(szStatusText, file_name), "szStatusText = \"%s\"\n", debugstr_w(szStatusText));
+ ok(!strcmp_ww(szStatusText, file_name), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
else
ok(szStatusText != NULL, "szStatusText == NULL\n");
}
CHECK_EXPECT(ReportProgress_VERIFIEDMIMETYPEAVAILABLE);
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText)
- ok(!lstrcmpW(szStatusText, text_htmlW), "szStatusText != text/html\n");
+ ok(!strcmp_ww(szStatusText, text_htmlW), "szStatusText != text/html\n");
break;
case BINDSTATUS_PROTOCOLCLASSID:
CHECK_EXPECT(ReportProgress_PROTOCOLCLASSID);
ok(szStatusText != NULL, "szStatusText == NULL\n");
- ok(!lstrcmpW(szStatusText, null_guid), "unexpected szStatusText\n");
+ ok(!strcmp_ww(szStatusText, null_guid), "unexpected classid %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_COOKIE_SENT:
CHECK_EXPECT(ReportProgress_COOKIE_SENT);
break;
case BINDSTATUS_REDIRECTING:
CHECK_EXPECT(ReportProgress_REDIRECTING);
- ok(szStatusText == NULL, "szStatusText = %s\n", debugstr_w(szStatusText));
+ ok(szStatusText == NULL, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_ENCODING:
CHECK_EXPECT(ReportProgress_ENCODING);
- ok(!strcmp_wa(szStatusText, "gzip"), "szStatusText = %s\n", debugstr_w(szStatusText));
+ ok(!strcmp_wa(szStatusText, "gzip"), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_ACCEPTRANGES:
CHECK_EXPECT(ReportProgress_ACCEPTRANGES);
- ok(!szStatusText, "szStatusText = %s\n", debugstr_w(szStatusText));
+ ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_PROXYDETECTING:
CHECK_EXPECT(ReportProgress_PROXYDETECTING);
SET_EXPECT(ReportProgress_CONNECTING);
- ok(!szStatusText, "szStatusText = %s\n", debugstr_w(szStatusText));
+ ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
+ break;
+ case BINDSTATUS_LOADINGMIMEHANDLER:
+ CHECK_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+ ok(!szStatusText, "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
+ break;
+ case BINDSTATUS_DECODING:
+ CHECK_EXPECT(ReportProgress_DECODING);
+ ok(!strcmp_ww(szStatusText, gzipW), "szStatusText = %s\n", wine_dbgstr_w(szStatusText));
break;
default:
ok(0, "Unexpected status %d\n", ulStatusCode);
static HRESULT WINAPI ProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF,
ULONG ulProgress, ULONG ulProgressMax)
{
- if(tested_protocol == FILE_TEST) {
+ HRESULT hres;
+
+ static int rec_depth;
+ rec_depth++;
+
+ if(!mimefilter_test && tested_protocol == FILE_TEST) {
CHECK_EXPECT2(ReportData);
ok(ulProgress == ulProgressMax, "ulProgress (%d) != ulProgressMax (%d)\n",
ok((grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION)) ||
(grfBSCF == (BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION | BSCF_SKIPDRAINDATAFORFILEURLS)),
"grcfBSCF = %08x\n", grfBSCF);
- }else if(!binding_test && (tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST || tested_protocol == FTP_TEST)) {
+ }else if(direct_read) {
+ BYTE buf[14096];
+ ULONG read;
+
+ if(!read_report_data && rec_depth == 1) {
+ BOOL reported_all_data = called_ReportData2;
+
+ CHECK_EXPECT2(ReportData);
+
+ if(short_read) {
+ ok(grfBSCF == (BSCF_FIRSTDATANOTIFICATION|BSCF_LASTDATANOTIFICATION|BSCF_DATAFULLYAVAILABLE)
+ || grfBSCF == BSCF_FIRSTDATANOTIFICATION, /* < IE8 */
+ "grcfBSCF = %08x\n", grfBSCF);
+ CHECK_CALLED(Read); /* Set in Continue */
+ first_data_notif = FALSE;
+ }else if(first_data_notif) {
+ ok(grfBSCF == BSCF_FIRSTDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
+ first_data_notif = FALSE;
+ }else if(reported_all_data) {
+ ok(grfBSCF == (BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION),
+ "grcfBSCF = %08x\n", grfBSCF);
+ }else if(!direct_read) {
+ ok(grfBSCF == BSCF_INTERMEDIATEDATANOTIFICATION, "grcfBSCF = %08x\n", grfBSCF);
+ }
+
+ do {
+ read = 0;
+ if(emulate_prot)
+ SET_EXPECT(Read);
+ else
+ SET_EXPECT(ReportData2);
+ SET_EXPECT(ReportResult);
+ hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
+ if(hres == S_OK)
+ ok(read, "read == 0\n");
+ if(reported_all_data) {
+ ok(hres == S_FALSE, "Read failed: %08x, expected S_FALSE\n", hres);
+ }
+ if(emulate_prot)
+ CHECK_CALLED(Read);
+ if(!reported_all_data && called_ReportData2) {
+ if(!emulate_prot)
+ CHECK_CALLED(ReportData2);
+ CHECK_CALLED(ReportResult);
+ ok(hres == S_OK, "Read failed: %08x\n", hres);
+ reported_all_data = TRUE;
+ }else {
+ if(!emulate_prot)
+ CHECK_NOT_CALLED(ReportData2);
+ CHECK_NOT_CALLED(ReportResult);
+ }
+ }while(hres == S_OK);
+ if(hres == S_FALSE)
+ wait_for_switch = FALSE;
+ }else {
+ CHECK_EXPECT(ReportData2);
+
+ ok(grfBSCF & BSCF_LASTDATANOTIFICATION, "grfBSCF = %08x\n", grfBSCF);
+
+ read = 0xdeadbeef;
+ if(emulate_prot)
+ SET_EXPECT(Read2);
+ hres = IInternetProtocol_Read(binding_test ? binding_protocol : async_protocol, expect_pv = buf, sizeof(buf), &read);
+ if(emulate_prot)
+ CHECK_CALLED(Read2);
+ ok(hres == S_FALSE, "Read returned: %08x, expected E_FALSE\n", hres);
+ ok(!read, "read = %d\n", read);
+ }
+ }else if(!binding_test && (tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST
+ || tested_protocol == FTP_TEST)) {
if(!(grfBSCF & BSCF_LASTDATANOTIFICATION) || (grfBSCF & BSCF_DATAFULLYAVAILABLE))
CHECK_EXPECT(ReportData);
else if (http_post_test)
}
SetEvent(event_complete);
}
- }else {
+ }else if(!read_report_data) {
BYTE buf[1000];
ULONG read;
HRESULT hres;
CHECK_EXPECT(ReportData);
- if(tested_protocol == BIND_TEST)
- return S_OK;
-
- do {
- SET_EXPECT(Read);
- hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
- CHECK_CALLED(Read);
- }while(hres == S_OK);
+ if(tested_protocol != BIND_TEST) {
+ do {
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Read);
+ else if(rec_depth > 1)
+ SET_EXPECT(Read2);
+ else
+ SET_EXPECT(Read);
+ hres = IInternetProtocol_Read(binding_protocol, expect_pv=buf, sizeof(buf), &read);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Read);
+ else if(rec_depth > 1)
+ CHECK_CALLED(Read2);
+ else
+ CHECK_CALLED(Read);
+ }while(hres == S_OK);
+ }
}
+ rec_depth--;
return S_OK;
}
"dwError == ERROR_SUCCESS\n");
ok(!szResult, "szResult != NULL\n");
+ if(direct_read)
+ SET_EXPECT(ReportData); /* checked after main loop */
+
return S_OK;
}
static IInternetProtocolSink protocol_sink = { &protocol_sink_vtbl };
+static HRESULT WINAPI MimeProtocolSink_QueryInterface(IInternetProtocolSink *iface, REFIID riid, void **ppv)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static ULONG WINAPI MimeProtocolSink_AddRef(IInternetProtocolSink *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI MimeProtocolSink_Release(IInternetProtocolSink *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI MimeProtocolSink_Switch(IInternetProtocolSink *iface, PROTOCOLDATA *pProtocolData)
+{
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_Switch);
+
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(filtered_sink, pProtocolData);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ CHECK_CALLED(Switch);
+
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeProtocolSink_ReportProgress(IInternetProtocolSink *iface, ULONG ulStatusCode,
+ LPCWSTR szStatusText)
+{
+ CHECK_EXPECT(MimeFilter_ReportProgress);
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeProtocolSink_ReportData(IInternetProtocolSink *iface, DWORD grfBSCF,
+ ULONG ulProgress, ULONG ulProgressMax)
+{
+ DWORD read = 0;
+ BYTE buf[8192];
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_ReportData);
+
+ if(!filter_state) {
+ SET_EXPECT(Read);
+ hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
+ if(tested_protocol == HTTP_TEST)
+ ok(hres == S_OK || hres == E_PENDING || hres == S_FALSE, "Read failed: %08x\n", hres);
+ else
+ ok(hres == S_OK, "Read failed: %08x\n", hres);
+ CHECK_CALLED(Read);
+
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ hres = IInternetProtocolSink_ReportProgress(filtered_sink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE, text_htmlW);
+ ok(hres == S_OK, "ReportProgress failed: %08x\n", hres);
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+
+ /* FIXME: test BINDSTATUS_CACHEFILENAMEAVAILABLE */
+ }
+
+ if(!read_report_data)
+ SET_EXPECT(ReportData);
+ hres = IInternetProtocolSink_ReportData(filtered_sink, grfBSCF, ulProgress, ulProgressMax);
+ ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+ if(!read_report_data)
+ CHECK_CALLED(ReportData);
+
+ if(!filter_state)
+ filter_state = 1;
+
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeProtocolSink_ReportResult(IInternetProtocolSink *iface, HRESULT hrResult,
+ DWORD dwError, LPCWSTR szResult)
+{
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_ReportResult);
+
+ ok(hrResult == S_OK, "hrResult = %08x\n", hrResult);
+ ok(dwError == ERROR_SUCCESS, "dwError = %u\n", dwError);
+ ok(!szResult, "szResult = %s\n", wine_dbgstr_w(szResult));
+
+ SET_EXPECT(ReportResult);
+ hres = IInternetProtocolSink_ReportResult(filtered_sink, hrResult, dwError, szResult);
+ ok(SUCCEEDED(hres), "ReportResult failed: %08x\n", hres);
+ CHECK_CALLED(ReportResult);
+
+ return S_OK;
+}
+
+static IInternetProtocolSinkVtbl mime_protocol_sink_vtbl = {
+ MimeProtocolSink_QueryInterface,
+ MimeProtocolSink_AddRef,
+ MimeProtocolSink_Release,
+ MimeProtocolSink_Switch,
+ MimeProtocolSink_ReportProgress,
+ MimeProtocolSink_ReportData,
+ MimeProtocolSink_ReportResult
+};
+
+static IInternetProtocolSink mime_protocol_sink = { &mime_protocol_sink_vtbl };
+
static HRESULT QueryInterface(REFIID riid, void **ppv)
{
+ static const IID IID_undocumented = {0x58DFC7D0,0x5381,0x43E5,{0x9D,0x72,0x4C,0xDD,0xE4,0xCB,0x0F,0x1A}};
+
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocolSink, riid))
*ppv = &protocol_sink;
if(IsEqualGUID(&IID_IServiceProvider, riid))
*ppv = &service_provider;
+ if(IsEqualGUID(&IID_IUriContainer, riid))
+ return E_NOINTERFACE; /* TODO */
+
+ /* NOTE: IE8 queries for undocumented {58DFC7D0-5381-43E5-9D72-4CDDE4CB0F1A} interface. */
+ if(IsEqualGUID(&IID_undocumented, riid))
+ return E_NOINTERFACE;
if(*ppv)
return S_OK;
+ ok(0, "unexpected call %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
if(pcElFetched)
ok(*pcElFetched == 0, "*pcElFetch=%d, expectd 0\n", *pcElFetched);
return S_OK;
+ case BINDSTRING_URL: {
+ DWORD size;
+
+ CHECK_EXPECT(GetBindString_URL);
+ ok(cEl == 1, "cEl=%d, expected 1\n", cEl);
+ ok(*pcElFetched == 0, "*pcElFetch=%d, expectd 0\n", *pcElFetched);
+ *pcElFetched = 1;
+
+ size = (lstrlenW(binding_urls[tested_protocol])+1)*sizeof(WCHAR);
+ *ppwzStr = CoTaskMemAlloc(size);
+ memcpy(*ppwzStr, binding_urls[tested_protocol], size);
+ return S_OK;
+ }
default:
ok(0, "unexpected call\n");
}
static IInternetPriority InternetPriority = { &InternetPriorityVtbl };
-static HRESULT WINAPI Protocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
+static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
+{
+ return 2;
+}
+
+static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
+{
+ return 1;
+}
+
+static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
+ DWORD dwOptions)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
+ LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
+{
+ ok(0, "unexpected call\n");
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ProtocolEmul_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
{
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
*ppv = iface;
return S_OK;
}
+ if(IsEqualGUID(&IID_IWinInetInfo, riid)) {
+ CHECK_EXPECT(QueryInterface_IWinInetInfo);
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ if(IsEqualGUID(&IID_IWinInetHttpInfo, riid)) {
+ CHECK_EXPECT(QueryInterface_IWinInetHttpInfo);
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
ok(0, "unexpected riid %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
-static ULONG WINAPI Protocol_AddRef(IInternetProtocol *iface)
-{
- return 2;
-}
-
-static ULONG WINAPI Protocol_Release(IInternetProtocol *iface)
-{
- return 1;
-}
-
static DWORD WINAPI thread_proc(PVOID arg)
{
HRESULT hres;
CHECK_CALLED(Switch);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
- prot_state = 2;
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
- CHECK_CALLED(Switch);
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(!short_read) {
+ prot_state = 2;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
+ CHECK_CALLED(Switch);
- prot_state = 2;
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
- CHECK_CALLED(Switch);
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ prot_state = 2;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
+ CHECK_CALLED(Switch);
- prot_state = 3;
- SET_EXPECT(Switch);
- hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
- CHECK_CALLED(Switch);
- ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ prot_state = 3;
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Switch);
+ else
+ SET_EXPECT(Switch);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == S_OK, "Switch failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_Switch);
+ else
+ CHECK_CALLED(Switch);
+ }
SetEvent(event_complete);
return 0;
}
-static HRESULT WINAPI Protocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
+static HRESULT WINAPI ProtocolEmul_Start(IInternetProtocol *iface, LPCWSTR szUrl,
IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
DWORD grfPI, HANDLE_PTR dwReserved)
{
ok(!grfPI, "grfPI = %x\n", grfPI);
ok(!dwReserved, "dwReserved = %lx\n", dwReserved);
+ if(binding_test)
+ ok(pOIProtSink == binding_sink, "pOIProtSink != binding_sink\n");
+
memset(&bindinfo, 0, sizeof(bindinfo));
bindinfo.cbSize = sizeof(bindinfo);
memcpy(&exp_bindinfo, &bindinfo, sizeof(bindinfo));
ok(hres == S_OK, "GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
ok(fetched == 1, "fetched = %d, expected 254\n", fetched);
ok(ua != NULL, "ua = %p\n", ua);
- ok(!lstrcmpW(ua, user_agentW), "unexpected user agent %s\n", debugstr_w(ua));
+ ok(!strcmp_ww(ua, user_agentW), "unexpected user agent %s\n", wine_dbgstr_w(ua));
CoTaskMemFree(ua);
fetched = 256;
ok(hres == S_OK,
"GetBindString(BINDSTRING_ACCEPT_MIMES) failed: %08x\n", hres);
ok(fetched == 1, "fetched = %d, expected 1\n", fetched);
- ok(!lstrcmpW(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", debugstr_w(accept_mimes[0]));
+ ok(!strcmp_ww(acc_mimeW, accept_mimes[0]), "unexpected mimes %s\n", wine_dbgstr_w(accept_mimes[0]));
hres = IInternetBindInfo_QueryInterface(pOIBindInfo, &IID_IServiceProvider,
(void**)&service_provider);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
CHECK_CALLED(ReportProgress_CACHEFILENAMEAVAILABLE);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_CreateInstance);
+ SET_EXPECT(MimeFilter_Start);
+ SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+ }
SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE,
- expect_wsz = text_htmlW);
+ mimefilter_test ? gzipW : (expect_wsz = text_htmlW));
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE) failed: %08x\n", hres);
- CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test) {
+ CHECK_CALLED(MimeFilter_CreateInstance);
+ CHECK_CALLED(MimeFilter_Start);
+ CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
+ todo_wine CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }else {
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
- SET_EXPECT(ReportData);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportData);
+ else
+ SET_EXPECT(ReportData);
hres = IInternetProtocolSink_ReportData(pOIProtSink,
BSCF_FIRSTDATANOTIFICATION | BSCF_LASTDATANOTIFICATION, 13, 13);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
- CHECK_CALLED(ReportData);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportData);
+ else
+ CHECK_CALLED(ReportData);
if(tested_protocol == BIND_TEST) {
hres = IInternetProtocol_Terminate(binding_protocol, 0);
ok(hres == E_FAIL, "Termiante failed: %08x\n", hres);
}
- SET_EXPECT(ReportResult);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportResult);
+ else
+ SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(pOIProtSink, S_OK, 0, NULL);
ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
- CHECK_CALLED(ReportResult);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportResult);
+ else
+ CHECK_CALLED(ReportResult);
return S_OK;
}
-static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
+static HRESULT WINAPI ProtocolEmul_Continue(IInternetProtocol *iface,
PROTOCOLDATA *pProtocolData)
{
- DWORD bscf = 0;
+ DWORD bscf = 0, pr;
HRESULT hres;
CHECK_EXPECT(Continue);
ok(pProtocolData != NULL, "pProtocolData == NULL\n");
if(!pProtocolData || tested_protocol == BIND_TEST)
return S_OK;
+ if(binding_test) {
+ ok(pProtocolData != &protocoldata, "pProtocolData == &protocoldata\n");
+ ok(pProtocolData->grfFlags == protocoldata.grfFlags, "grfFlags wrong %x/%x\n",
+ pProtocolData->grfFlags, protocoldata.grfFlags );
+ ok(pProtocolData->dwState == protocoldata.dwState, "dwState wrong %x/%x\n",
+ pProtocolData->dwState, protocoldata.dwState );
+ ok(pProtocolData->pData == protocoldata.pData, "pData wrong %p/%p\n",
+ pProtocolData->pData, protocoldata.pData );
+ ok(pProtocolData->cbData == protocoldata.cbData, "cbData wrong %x/%x\n",
+ pProtocolData->cbData, protocoldata.cbData );
+ }
switch(prot_state) {
case 1: {
IHttpNegotiate_Release(http_negotiate);
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
- SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_CreateInstance);
+ SET_EXPECT(MimeFilter_Start);
+ SET_EXPECT(ReportProgress_LOADINGMIMEHANDLER);
+ }else if(!(pi & PI_MIMEVERIFICATION)) {
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
hres = IInternetProtocolSink_ReportProgress(binding_sink,
- BINDSTATUS_MIMETYPEAVAILABLE, text_htmlW);
- CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ BINDSTATUS_MIMETYPEAVAILABLE, mimefilter_test ? gzipW : text_htmlW);
+ if(mimefilter_test) {
+ CHECK_CALLED(MimeFilter_CreateInstance);
+ CHECK_CALLED(MimeFilter_Start);
+ CHECK_CALLED(ReportProgress_LOADINGMIMEHANDLER);
+ }else if(!(pi & PI_MIMEVERIFICATION)) {
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
ok(hres == S_OK,
"ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE) failed: %08x\n", hres);
break;
}
- SET_EXPECT(ReportData);
- hres = IInternetProtocolSink_ReportData(binding_sink, bscf, 100, 400);
- CHECK_CALLED(ReportData);
+ pr = prot_read;
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_ReportData);
+ }else if(pi & PI_MIMEVERIFICATION) {
+ if(pr < 200)
+ SET_EXPECT(Read); /* checked in ReportData for short_read */
+ if(pr == 200) {
+ if(!mimefilter_test)
+ SET_EXPECT(Read); /* checked in BINDSTATUS_MIMETYPEAVAILABLE or ReportData */
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ if(pr >= 200)
+ SET_EXPECT(ReportData);
+ }else {
+ SET_EXPECT(ReportData);
+ }
+
+ hres = IInternetProtocolSink_ReportData(binding_sink, bscf, pr, 400);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+ if(mimefilter_test) {
+ SET_EXPECT(MimeFilter_ReportData);
+ }else if(pi & PI_MIMEVERIFICATION) {
+ if(!short_read && pr < 200)
+ CHECK_CALLED(Read);
+ if(pr == 200) {
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ }else {
+ CHECK_CALLED(ReportData);
+ }
+
if(prot_state == 3)
prot_state = 4;
return S_OK;
}
-static HRESULT WINAPI Protocol_Abort(IInternetProtocol *iface, HRESULT hrReason,
- DWORD dwOptions)
-{
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI Protocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
+static HRESULT WINAPI ProtocolEmul_Terminate(IInternetProtocol *iface, DWORD dwOptions)
{
CHECK_EXPECT(Terminate);
ok(!dwOptions, "dwOptions=%d\n", dwOptions);
return S_OK;
}
-static HRESULT WINAPI Protocol_Suspend(IInternetProtocol *iface)
-{
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI Protocol_Resume(IInternetProtocol *iface)
-{
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI Protocol_Read(IInternetProtocol *iface, void *pv,
+static HRESULT WINAPI ProtocolEmul_Read(IInternetProtocol *iface, void *pv,
ULONG cb, ULONG *pcbRead)
{
- static BOOL b = TRUE;
+ if(read_report_data)
+ CHECK_EXPECT2(Read2);
- CHECK_EXPECT(Read);
+ if(mimefilter_test || short_read) {
+ if(!read_report_data)
+ CHECK_EXPECT2(Read);
+ }else if((pi & PI_MIMEVERIFICATION)) {
+ if(!read_report_data)
+ CHECK_EXPECT2(Read);
- ok(pv == expect_pv, "pv != expect_pv\n");
- ok(cb == 1000, "cb=%d\n", cb);
+ if(prot_read < 300) {
+ ok(pv != expect_pv, "pv == expect_pv\n");
+ if(prot_read < 300)
+ ok(cb == 2048-prot_read, "cb=%d\n", cb);
+ else
+ ok(cb == 700, "cb=%d\n", cb);
+ }else {
+ ok(expect_pv <= pv && (BYTE*)pv < (BYTE*)expect_pv + cb, "pv != expect_pv\n");
+ }
+ }else {
+ if(!read_report_data)
+ CHECK_EXPECT(Read);
+
+ ok(pv == expect_pv, "pv != expect_pv\n");
+ ok(cb == 1000, "cb=%d\n", cb);
+ ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
+ }
ok(pcbRead != NULL, "pcbRead == NULL\n");
- ok(!*pcbRead, "*pcbRead = %d\n", *pcbRead);
- if(prot_state == 3) {
+ if(prot_state == 3 || (short_read && prot_state != 4)) {
HRESULT hres;
- SET_EXPECT(ReportResult);
+ prot_state = 4;
+ if(short_read) {
+ SET_EXPECT(Read2); /* checked in BINDSTATUS_MIMETYPEAVAILABLE */
+ SET_EXPECT(ReportProgress_MIMETYPEAVAILABLE);
+ }
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportData);
+ else if(direct_read)
+ SET_EXPECT(ReportData2);
+ read_report_data++;
+ hres = IInternetProtocolSink_ReportData(binding_sink,
+ BSCF_LASTDATANOTIFICATION|BSCF_INTERMEDIATEDATANOTIFICATION, 0, 0);
+ read_report_data--;
+ ok(hres == S_OK, "ReportData failed: %08x\n", hres);
+ if(short_read)
+ CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportData);
+ else if(direct_read)
+ CHECK_CALLED(ReportData2);
+
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_ReportResult);
+ else
+ SET_EXPECT(ReportResult);
hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
- CHECK_CALLED(ReportResult);
+ ok(hres == S_OK, "ReportResult failed: %08x\n", hres);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_ReportResult);
+ else
+ CHECK_CALLED(ReportResult);
+ memset(pv, 'x', 100);
+ prot_read += *pcbRead = 100;
+ return S_OK;
+ }if(prot_state == 4) {
+ *pcbRead = 0;
return S_FALSE;
}
- if((b = !b))
+ if((async_read_pending = !async_read_pending)) {
+ *pcbRead = 0;
return tested_protocol == HTTP_TEST || tested_protocol == HTTPS_TEST ? E_PENDING : S_FALSE;
+ }
memset(pv, 'x', 100);
prot_read += *pcbRead = 100;
return S_OK;
}
-static HRESULT WINAPI Protocol_Seek(IInternetProtocol *iface,
- LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition)
-{
- ok(0, "unexpected call\n");
- return E_NOTIMPL;
-}
-
-static HRESULT WINAPI Protocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
+static HRESULT WINAPI ProtocolEmul_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
{
CHECK_EXPECT(LockRequest);
ok(dwOptions == 0, "dwOptions=%x\n", dwOptions);
return S_OK;
}
-static HRESULT WINAPI Protocol_UnlockRequest(IInternetProtocol *iface)
+static HRESULT WINAPI ProtocolEmul_UnlockRequest(IInternetProtocol *iface)
{
CHECK_EXPECT(UnlockRequest);
return S_OK;
}
static const IInternetProtocolVtbl ProtocolVtbl = {
- Protocol_QueryInterface,
+ ProtocolEmul_QueryInterface,
Protocol_AddRef,
Protocol_Release,
- Protocol_Start,
- Protocol_Continue,
+ ProtocolEmul_Start,
+ ProtocolEmul_Continue,
Protocol_Abort,
- Protocol_Terminate,
+ ProtocolEmul_Terminate,
Protocol_Suspend,
Protocol_Resume,
- Protocol_Read,
+ ProtocolEmul_Read,
Protocol_Seek,
- Protocol_LockRequest,
- Protocol_UnlockRequest
+ ProtocolEmul_LockRequest,
+ ProtocolEmul_UnlockRequest
};
static IInternetProtocol Protocol = { &ProtocolVtbl };
+static HRESULT WINAPI MimeProtocol_QueryInterface(IInternetProtocol *iface, REFIID riid, void **ppv)
+{
+ if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IInternetProtocol, riid)) {
+ *ppv = iface;
+ return S_OK;
+ }
+
+ if(IsEqualGUID(&IID_IInternetProtocolSink, riid)) {
+ *ppv = &mime_protocol_sink;
+ return S_OK;
+ }
+
+ ok(0, "unexpected riid %s\n", debugstr_guid(riid));
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static HRESULT WINAPI MimeProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl,
+ IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo,
+ DWORD grfPI, HANDLE_PTR dwReserved)
+{
+ PROTOCOLFILTERDATA *data;
+ LPOLESTR url_str = NULL;
+ DWORD fetched = 0;
+ BINDINFO bindinfo;
+ DWORD cbindf = 0;
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_Start);
+
+ ok(!strcmp_ww(szUrl, gzipW), "wrong url %s\n", wine_dbgstr_w(szUrl));
+ ok(grfPI == (PI_FILTER_MODE|PI_FORCE_ASYNC), "grfPI=%x, expected PI_FILTER_MODE|PI_FORCE_ASYNC\n", grfPI);
+ ok(dwReserved, "dwReserved == 0\n");
+ ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
+ ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
+
+ if(binding_test) {
+ ok(pOIProtSink != binding_sink, "pOIProtSink == protocol_sink\n");
+ ok(pOIBindInfo == prot_bind_info, "pOIBindInfo != bind_info\n");
+ }else {
+ ok(pOIProtSink == &protocol_sink, "pOIProtSink != protocol_sink\n");
+ ok(pOIBindInfo == &bind_info, "pOIBindInfo != bind_info\n");
+ }
+
+ data = (void*)dwReserved;
+ ok(data->cbSize == sizeof(*data), "data->cbSize = %d\n", data->cbSize);
+ ok(!data->pProtocolSink, "data->pProtocolSink != NULL\n");
+ ok(data->pProtocol != NULL, "data->pProtocol == NULL\n");
+ ok(!data->pUnk, "data->pUnk != NULL\n");
+ ok(!data->dwFilterFlags, "data->dwProtocolFlags = %x\n", data->dwFilterFlags);
+ if(binding_test) {
+ IInternetProtocolSink *prot_sink;
+
+ IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocolSink, (void**)&prot_sink);
+ ok(prot_sink == pOIProtSink, "QI(data->pProtocol, IID_IInternetProtocolSink) != pOIProtSink\n");
+ IInternetProtocolSink_Release(prot_sink);
+
+ ok(data->pProtocol != binding_protocol, "data->pProtocol == binding_protocol\n");
+
+ filtered_protocol = data->pProtocol;
+ IInternetProtocol_AddRef(filtered_protocol);
+ }else {
+ IInternetProtocol *prot;
+
+ IInternetProtocol_QueryInterface(data->pProtocol, &IID_IInternetProtocol, (void**)&prot);
+ ok(prot == async_protocol, "QI(data->pProtocol, IID_IInternetProtocol) != async_protocol\n");
+ IInternetProtocol_Release(prot);
+
+ ok(data->pProtocol != async_protocol, "data->pProtocol == async_protocol\n");
+ }
+
+ filtered_sink = pOIProtSink;
+
+ SET_EXPECT(ReportProgress_DECODING);
+ hres = IInternetProtocolSink_ReportProgress(pOIProtSink, BINDSTATUS_DECODING, gzipW);
+ ok(hres == S_OK, "ReportProgress(BINDSTATUS_DECODING) failed: %08x\n", hres);
+ CHECK_CALLED(ReportProgress_DECODING);
+
+ SET_EXPECT(GetBindInfo);
+ memset(&bindinfo, 0, sizeof(bindinfo));
+ bindinfo.cbSize = sizeof(bindinfo);
+ hres = IInternetBindInfo_GetBindInfo(pOIBindInfo, &cbindf, &bindinfo);
+ ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+ ok(cbindf == (bindf|BINDF_FROMURLMON), "cbindf = %x, expected %x\n", cbindf, bindf);
+ CHECK_CALLED(GetBindInfo);
+
+ SET_EXPECT(GetBindString_URL);
+ hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_URL, &url_str, 1, &fetched);
+ ok(hres == S_OK, "GetBindString(BINDSTRING_URL) failed: %08x\n", hres);
+ ok(fetched == 1, "fetched = %d\n", fetched);
+ ok(!strcmp_ww(url_str, binding_urls[tested_protocol]), "wrong url_str %s\n", wine_dbgstr_w(url_str));
+ CoTaskMemFree(url_str);
+ CHECK_CALLED(GetBindString_URL);
+
+ return S_OK;
+}
+
+static HRESULT WINAPI Protocol_Continue(IInternetProtocol *iface,
+ PROTOCOLDATA *pProtocolData)
+{
+ CHECK_EXPECT(MimeFilter_Continue);
+ return E_NOTIMPL;
+}
+
+static HRESULT WINAPI MimeProtocol_Terminate(IInternetProtocol *iface, DWORD dwOptions)
+{
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_Terminate);
+
+ ok(!dwOptions, "dwOptions = %x\n", dwOptions);
+
+ SET_EXPECT(Terminate);
+ hres = IInternetProtocol_Terminate(filtered_protocol, dwOptions);
+ ok(hres == S_OK, "Terminate failed: %08x\n", hres);
+ CHECK_CALLED(Terminate);
+
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeProtocol_Read(IInternetProtocol *iface, void *pv,
+ ULONG cb, ULONG *pcbRead)
+{
+ BYTE buf[2096];
+ DWORD read = 0;
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_Read);
+
+ ok(pv != NULL, "pv == NULL\n");
+ ok(cb != 0, "cb == 0\n");
+ ok(pcbRead != NULL, "pcbRead == NULL\n");
+
+ if(read_report_data)
+ SET_EXPECT(Read2);
+ else
+ SET_EXPECT(Read);
+ hres = IInternetProtocol_Read(filtered_protocol, buf, sizeof(buf), &read);
+ ok(hres == S_OK || hres == S_FALSE || hres == E_PENDING, "Read failed: %08x\n", hres);
+ if(read_report_data)
+ CHECK_CALLED(Read2);
+ else
+ CHECK_CALLED(Read);
+
+ if(pcbRead) {
+ ok(*pcbRead == 0, "*pcbRead=%d, expected 0\n", *pcbRead);
+ *pcbRead = read;
+ }
+
+ memset(pv, 'x', read);
+ return hres;
+}
+
+static HRESULT WINAPI MimeProtocol_LockRequest(IInternetProtocol *iface, DWORD dwOptions)
+{
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_LockRequest);
+
+ ok(!dwOptions, "dwOptions = %x\n", dwOptions);
+
+ SET_EXPECT(LockRequest);
+ hres = IInternetProtocol_LockRequest(filtered_protocol, dwOptions);
+ ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
+ CHECK_CALLED(LockRequest);
+
+ return S_OK;
+}
+
+static HRESULT WINAPI MimeProtocol_UnlockRequest(IInternetProtocol *iface)
+{
+ HRESULT hres;
+
+ CHECK_EXPECT(MimeFilter_UnlockRequest);
+
+ SET_EXPECT(UnlockRequest);
+ hres = IInternetProtocol_UnlockRequest(filtered_protocol);
+ ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
+ CHECK_CALLED(UnlockRequest);
+
+ return S_OK;
+}
+
+static const IInternetProtocolVtbl MimeProtocolVtbl = {
+ MimeProtocol_QueryInterface,
+ Protocol_AddRef,
+ Protocol_Release,
+ MimeProtocol_Start,
+ Protocol_Continue,
+ Protocol_Abort,
+ MimeProtocol_Terminate,
+ Protocol_Suspend,
+ Protocol_Resume,
+ MimeProtocol_Read,
+ Protocol_Seek,
+ MimeProtocol_LockRequest,
+ MimeProtocol_UnlockRequest
+};
+
+static IInternetProtocol MimeProtocol = { &MimeProtocolVtbl };
+
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
{
ok(0, "unexpected call\n");
static IClassFactory ClassFactory = { &ClassFactoryVtbl };
+static HRESULT WINAPI MimeFilter_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
+{
+ CHECK_EXPECT(MimeFilter_CreateInstance);
+
+ ok(!outer, "outer = %p\n", outer);
+ ok(IsEqualGUID(&IID_IInternetProtocol, riid), "unexpected riid %s\n", debugstr_guid(riid));
+
+ *ppv = &MimeProtocol;
+ return S_OK;
+}
+
+static const IClassFactoryVtbl MimeFilterCFVtbl = {
+ ClassFactory_QueryInterface,
+ ClassFactory_AddRef,
+ ClassFactory_Release,
+ MimeFilter_CreateInstance,
+ ClassFactory_LockServer
+};
+
+static IClassFactory mimefilter_cf = { &MimeFilterCFVtbl };
+
+#define TEST_BINDING 0x01
+#define TEST_FILTER 0x02
+#define TEST_FIRST_HTTP 0x04
+#define TEST_DIRECT_READ 0x08
+#define TEST_POST 0x10
+#define TEST_EMULATEPROT 0x20
+#define TEST_SHORT_READ 0x40
+
+static void init_test(int prot, DWORD flags)
+{
+ tested_protocol = prot;
+ binding_test = (flags & TEST_BINDING) != 0;
+ first_data_notif = TRUE;
+ prot_read = 0;
+ prot_state = 0;
+ async_read_pending = TRUE;
+ mimefilter_test = (flags & TEST_FILTER) != 0;
+ filter_state = 0;
+ ResetEvent(event_complete);
+ ResetEvent(event_complete2);
+ ResetEvent(event_continue);
+ ResetEvent(event_continue_done);
+ async_protocol = binding_protocol = filtered_protocol = NULL;
+ filtered_sink = NULL;
+ http_is_first = (flags & TEST_FIRST_HTTP) != 0;
+ first_data_notif = TRUE;
+ state = 0;
+ direct_read = (flags & TEST_DIRECT_READ) != 0;
+ http_post_test = (flags & TEST_POST) != 0;
+ emulate_prot = (flags & TEST_EMULATEPROT) != 0;
+ wait_for_switch = TRUE;
+ short_read = (flags & TEST_SHORT_READ) != 0;
+}
+
static void test_priority(IInternetProtocol *protocol)
{
IInternetPriority *priority;
static const char html_doc[] = "<HTML></HTML>";
trace("Testing file protocol...\n");
- tested_protocol = FILE_TEST;
+ init_test(FILE_TEST, 0);
SetLastError(0xdeadbeef);
file = CreateFileW(wszIndexHtml, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
test_file_protocol_fail();
}
-static BOOL http_protocol_start(LPCWSTR url, BOOL is_first)
+static BOOL http_protocol_start(LPCWSTR url)
{
static BOOL got_user_agent = FALSE;
HRESULT hres;
- first_data_notif = TRUE;
- state = 0;
-
SET_EXPECT(GetBindInfo);
if (!(bindf & BINDF_FROMURLMON))
SET_EXPECT(ReportProgress_DIRECTBIND);
- SET_EXPECT(GetBindString_USER_AGENT);
+ if(!got_user_agent)
+ SET_EXPECT(GetBindString_USER_AGENT);
SET_EXPECT(GetBindString_ACCEPT_MIMES);
SET_EXPECT(QueryService_HttpNegotiate);
SET_EXPECT(BeginningTransaction);
CHECK_CALLED(GetBindString_USER_AGENT);
got_user_agent = TRUE;
}
- else todo_wine
- {
- /* user agent only retrieved once, even with different URLs */
- CHECK_NOT_CALLED(GetBindString_USER_AGENT);
- }
CHECK_CALLED(GetBindString_ACCEPT_MIMES);
CHECK_CALLED(QueryService_HttpNegotiate);
CHECK_CALLED(BeginningTransaction);
/* is_first refers to whether this is the first call to this function
* _for this url_ */
-static void test_http_protocol_url(LPCWSTR url, BOOL is_https, BOOL is_first)
+static void test_http_protocol_url(LPCWSTR url, int prot, DWORD flags)
{
IInternetProtocolInfo *protocol_info;
IClassFactory *factory;
IUnknown *unk;
HRESULT hres;
+ init_test(prot, flags);
http_url = url;
- http_is_first = is_first;
- hres = CoGetClassObject(is_https ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
+ hres = CoGetClassObject(prot == HTTPS_TEST ? &CLSID_HttpSProtocol : &CLSID_HttpProtocol,
CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void**)&unk);
ok(hres == S_OK, "CoGetClassObject failed: %08x\n", hres);
if(FAILED(hres))
test_priority(async_protocol);
test_http_info(async_protocol);
+ SET_EXPECT(ReportProgress_COOKIE_SENT);
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
SET_EXPECT(ReportProgress_CONNECTING);
SET_EXPECT(ReportProgress_SENDINGREQUEST);
SET_EXPECT(ReportProgress_PROXYDETECTING);
- if(! is_https)
+ if(prot == HTTP_TEST)
SET_EXPECT(ReportProgress_CACHEFILENAMEAVAILABLE);
else
SET_EXPECT(QueryService_HttpSecurity);
SET_EXPECT(Switch);
}
- if(!http_protocol_start(url, is_first))
+ if(!http_protocol_start(url))
return;
- SET_EXPECT(ReportResult);
+ if(!direct_read)
+ SET_EXPECT(ReportResult);
expect_hrResult = S_OK;
- hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
- ok((hres == E_PENDING && cb==0) ||
- (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
-
- WaitForSingleObject(event_complete, INFINITE);
- if(bindf & BINDF_FROMURLMON)
- CHECK_CALLED(Switch);
- else
- CHECK_CALLED(ReportData);
- if (is_https)
- CLEAR_CALLED(QueryService_HttpSecurity);
+ if(direct_read) {
+ while(wait_for_switch) {
+ SET_EXPECT(Switch);
+ WaitForSingleObject(event_continue, INFINITE);
+ CHECK_CALLED(Switch);
+ call_continue(&continue_protdata);
+ SetEvent(event_continue_done);
+ }
+ }else {
+ hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
- while(1) {
+ WaitForSingleObject(event_complete, INFINITE);
if(bindf & BINDF_FROMURLMON)
- SET_EXPECT(Switch);
+ CHECK_CALLED(Switch);
else
- SET_EXPECT(ReportData);
- hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
- if(hres == E_PENDING) {
- hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
- ok((hres == E_PENDING && cb==0) ||
- (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
- WaitForSingleObject(event_complete, INFINITE);
- if(bindf & BINDF_FROMURLMON)
- CHECK_CALLED(Switch);
- else
- CHECK_CALLED(ReportData);
- }else {
+ CHECK_CALLED(ReportData);
+ if(prot == HTTPS_TEST)
+ CLEAR_CALLED(QueryService_HttpSecurity);
+
+ while(1) {
if(bindf & BINDF_FROMURLMON)
- CHECK_NOT_CALLED(Switch);
+ SET_EXPECT(Switch);
else
- CHECK_NOT_CALLED(ReportData);
- if(cb == 0) break;
+ SET_EXPECT(ReportData);
+ hres = IInternetProtocol_Read(async_protocol, buf, sizeof(buf), &cb);
+ if(hres == E_PENDING) {
+ hres = IInternetProtocol_Read(async_protocol, buf, 1, &cb);
+ ok((hres == E_PENDING && cb==0) ||
+ (hres == S_OK && cb==1), "Read failed: %08x (%d bytes)\n", hres, cb);
+ WaitForSingleObject(event_complete, INFINITE);
+ if(bindf & BINDF_FROMURLMON)
+ CHECK_CALLED(Switch);
+ else
+ CHECK_CALLED(ReportData);
+ }else {
+ if(bindf & BINDF_FROMURLMON)
+ CHECK_NOT_CALLED(Switch);
+ else
+ CHECK_NOT_CALLED(ReportData);
+ if(cb == 0) break;
+ }
}
+ ok(hres == S_FALSE, "Read failed: %08x\n", hres);
+ CHECK_CALLED(ReportResult);
}
- ok(hres == S_FALSE, "Read failed: %08x\n", hres);
- CHECK_CALLED(ReportResult);
- if (is_https)
+ if(prot == HTTPS_TEST)
CLEAR_CALLED(ReportProgress_SENDINGREQUEST);
test_protocol_terminate(async_protocol);
'p','o','s','t','t','e','s','t','.','p','h','p',0};
trace("Testing http protocol (not from urlmon)...\n");
- tested_protocol = HTTP_TEST;
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
- test_http_protocol_url(winehq_url, FALSE, TRUE);
+ test_http_protocol_url(winehq_url, HTTP_TEST, TEST_FIRST_HTTP);
trace("Testing http protocol (from urlmon)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
- test_http_protocol_url(winehq_url, FALSE, FALSE);
+ test_http_protocol_url(winehq_url, HTTP_TEST, 0);
trace("Testing http protocol (to file)...\n");
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NEEDFILE;
- test_http_protocol_url(winehq_url, FALSE, FALSE);
+ test_http_protocol_url(winehq_url, HTTP_TEST, 0);
trace("Testing http protocol (post data)...\n");
- http_post_test = TRUE;
/* Without this flag we get a ReportProgress_CACHEFILENAMEAVAILABLE
* notification with BINDVERB_POST */
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
- test_http_protocol_url(posttest_url, FALSE, TRUE);
- http_post_test = FALSE;
+ test_http_protocol_url(posttest_url, HTTP_TEST, TEST_FIRST_HTTP|TEST_POST);
+
+ trace("Testing http protocol (direct read)...\n");
+ bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON;
+ test_http_protocol_url(winehq_url, HTTP_TEST, TEST_DIRECT_READ);
}
static void test_https_protocol(void)
'.','c','o','m','/','t','e','s','t','.','h','t','m','l',0};
trace("Testing https protocol (from urlmon)...\n");
- tested_protocol = HTTPS_TEST;
bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA | BINDF_FROMURLMON | BINDF_NOWRITECACHE;
- test_http_protocol_url(codeweavers_url, TRUE, TRUE);
+ test_http_protocol_url(codeweavers_url, HTTPS_TEST, TEST_FIRST_HTTP);
}
test_http_info(async_protocol);
SET_EXPECT(GetBindInfo);
- SET_EXPECT(GetBindString_USER_AGENT);
SET_EXPECT(ReportProgress_FINDINGRESOURCE);
SET_EXPECT(ReportProgress_CONNECTING);
SET_EXPECT(ReportProgress_SENDINGREQUEST);
hres = IInternetProtocol_Start(async_protocol, ftp_urlW, &protocol_sink, &bind_info, 0, 0);
ok(hres == S_OK, "Start failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo);
- todo_wine CHECK_NOT_CALLED(GetBindString_USER_AGENT);
SET_EXPECT(ReportResult);
static const WCHAR wrong_url2[] = {'m','k',':','/','t','e','s','t','.','h','t','m','l',0};
trace("Testing mk protocol...\n");
- tested_protocol = MK_TEST;
+ init_test(MK_TEST, 0);
hres = CoGetClassObject(&CLSID_MkProtocol, CLSCTX_INPROC_SERVER, NULL,
&IID_IUnknown, (void**)&unk);
static void test_CreateBinding(void)
{
- IInternetProtocolSink *sink;
IInternetProtocol *protocol;
IInternetPriority *priority;
IInternetSession *session;
+ IWinInetHttpInfo *http_info;
+ IWinInetInfo *inet_info;
LONG p;
BYTE buf[1000];
DWORD read;
static const WCHAR wsz_test[] = {'t','e','s','t',0};
trace("Testing CreateBinding...\n");
- tested_protocol = BIND_TEST;
- binding_test = TRUE;
+ init_test(BIND_TEST, TEST_BINDING);
hres = CoInternetGetSession(0, &session, 0);
ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetBindInfo, (void**)&prot_bind_info);
ok(hres == S_OK, "QueryInterface(IID_IInternetBindInfo) failed: %08x\n", hres);
- hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&sink);
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IInternetProtocolSink, (void**)&binding_sink);
ok(hres == S_OK, "Could not get IInternetProtocolSink: %08x\n", hres);
hres = IInternetProtocol_Start(protocol, test_url, NULL, &bind_info, 0, 0);
ok(hres == S_OK, "GetPriority failed: %08x\n", hres);
ok(p == 100, "p=%d\n", p);
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
+ ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+
SET_EXPECT(QueryService_InternetProtocol);
SET_EXPECT(CreateInstance);
SET_EXPECT(ReportProgress_PROTOCOLCLASSID);
CHECK_CALLED(SetPriority);
CHECK_CALLED(Start);
+ SET_EXPECT(QueryInterface_IWinInetInfo);
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
+ ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IWinInetInfo);
+
+ SET_EXPECT(QueryInterface_IWinInetInfo);
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetInfo, (void**)&inet_info);
+ ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IWinInetInfo);
+
+ SET_EXPECT(QueryInterface_IWinInetHttpInfo);
+ hres = IInternetProtocol_QueryInterface(protocol, &IID_IWinInetHttpInfo, (void**)&http_info);
+ ok(hres == E_NOINTERFACE, "Could not get IWinInetInfo protocol: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IWinInetHttpInfo);
+
SET_EXPECT(Read);
read = 0xdeadbeef;
hres = IInternetProtocol_Read(protocol, expect_pv = buf, sizeof(buf), &read);
CHECK_CALLED(Terminate);
SET_EXPECT(Continue);
- hres = IInternetProtocolSink_Switch(sink, &protocoldata);
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
ok(hres == S_OK, "Switch failed: %08x\n", hres);
CHECK_CALLED(Continue);
- hres = IInternetProtocolSink_ReportProgress(sink,
+ hres = IInternetProtocolSink_ReportProgress(binding_sink,
BINDSTATUS_CACHEFILENAMEAVAILABLE, expect_wsz = emptyW);
ok(hres == S_OK, "ReportProgress(BINDSTATUS_CACHEFILENAMEAVAILABLE) failed: %08x\n", hres);
- hres = IInternetProtocolSink_ReportResult(sink, S_OK, ERROR_SUCCESS, NULL);
+ hres = IInternetProtocolSink_ReportResult(binding_sink, S_OK, ERROR_SUCCESS, NULL);
ok(hres == E_FAIL, "ReportResult failed: %08x, expected E_FAIL\n", hres);
- hres = IInternetProtocolSink_ReportData(sink, 0, 0, 0);
+ hres = IInternetProtocolSink_ReportData(binding_sink, 0, 0, 0);
ok(hres == S_OK, "ReportData failed: %08x\n", hres);
- IInternetProtocolSink_Release(sink);
+ IInternetProtocolSink_Release(binding_sink);
IInternetPriority_Release(priority);
IInternetBindInfo_Release(prot_bind_info);
IInternetProtocol_Release(protocol);
+
+ hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, wsz_test);
+ ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+
IInternetSession_Release(session);
}
-static void test_binding(int prot)
+static void test_binding(int prot, DWORD grf_pi, DWORD test_flags)
{
IInternetProtocol *protocol;
IInternetSession *session;
ULONG ref;
HRESULT hres;
- trace("Testing %s binding...\n", debugstr_w(protocol_names[prot]));
+ pi = grf_pi;
- tested_protocol = prot;
- binding_test = TRUE;
- first_data_notif = TRUE;
- prot_read = 0;
+ init_test(prot, test_flags|TEST_BINDING);
hres = CoInternetGetSession(0, &session, 0);
ok(hres == S_OK, "CoInternetGetSession failed: %08x\n", hres);
- hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
- ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+ if(test_flags & TEST_EMULATEPROT) {
+ hres = IInternetSession_RegisterNameSpace(session, &ClassFactory, &IID_NULL, protocol_names[prot], 0, NULL, 0);
+ ok(hres == S_OK, "RegisterNameSpace failed: %08x\n", hres);
+ }
hres = IInternetSession_CreateBinding(session, NULL, binding_urls[prot], NULL, NULL, &protocol, 0);
binding_protocol = protocol;
- IInternetSession_Release(session);
ok(hres == S_OK, "CreateBinding failed: %08x\n", hres);
ok(protocol != NULL, "protocol == NULL\n");
SET_EXPECT(Start);
expect_hrResult = S_OK;
- hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, 0, 0);
+ hres = IInternetProtocol_Start(protocol, binding_urls[prot], &protocol_sink, &bind_info, pi, 0);
ok(hres == S_OK, "Start failed: %08x\n", hres);
CHECK_CALLED(QueryService_InternetProtocol);
if(prot == HTTP_TEST || prot == HTTPS_TEST) {
while(prot_state < 4) {
WaitForSingleObject(event_complete, INFINITE);
- SET_EXPECT(Continue);
- IInternetProtocol_Continue(protocol, pdata);
- CHECK_CALLED(Continue);
+ if(mimefilter_test && filtered_protocol) {
+ SET_EXPECT(Continue);
+ IInternetProtocol_Continue(filtered_protocol, pdata);
+ CHECK_CALLED(Continue);
+ }else {
+ SET_EXPECT(Continue);
+ IInternetProtocol_Continue(protocol, pdata);
+ CHECK_CALLED(Continue);
+ }
SetEvent(event_complete2);
}
-
+ if(direct_read)
+ CHECK_CALLED(ReportData); /* Set in ReportResult */
WaitForSingleObject(event_complete, INFINITE);
}else {
- SET_EXPECT(LockRequest);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_LockRequest);
+ else
+ SET_EXPECT(LockRequest);
hres = IInternetProtocol_LockRequest(protocol, 0);
ok(hres == S_OK, "LockRequest failed: %08x\n", hres);
- CHECK_CALLED(LockRequest);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_LockRequest);
+ else
+ CHECK_CALLED(LockRequest);
- SET_EXPECT(UnlockRequest);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_UnlockRequest);
+ else
+ SET_EXPECT(UnlockRequest);
hres = IInternetProtocol_UnlockRequest(protocol);
ok(hres == S_OK, "UnlockRequest failed: %08x\n", hres);
- CHECK_CALLED(UnlockRequest);
+ if(mimefilter_test)
+ CHECK_CALLED(MimeFilter_UnlockRequest);
+ else
+ CHECK_CALLED(UnlockRequest);
}
- SET_EXPECT(Terminate);
+ if(mimefilter_test)
+ SET_EXPECT(MimeFilter_Terminate);
+ else
+ SET_EXPECT(Terminate);
hres = IInternetProtocol_Terminate(protocol, 0);
ok(hres == S_OK, "Terminate failed: %08x\n", hres);
- CHECK_CALLED(Terminate);
+ if(mimefilter_test)
+ CLEAR_CALLED(MimeFilter_Terminate);
+ else
+ CHECK_CALLED(Terminate);
+ if(filtered_protocol)
+ IInternetProtocol_Release(filtered_protocol);
IInternetBindInfo_Release(prot_bind_info);
IInternetProtocolSink_Release(binding_sink);
ref = IInternetProtocol_Release(protocol);
ok(!ref, "ref=%u, expected 0\n", ref);
+
+ if(test_flags & TEST_EMULATEPROT) {
+ hres = IInternetSession_UnregisterNameSpace(session, &ClassFactory, protocol_names[prot]);
+ ok(hres == S_OK, "UnregisterNameSpace failed: %08x\n", hres);
+ }
+
+ IInternetSession_Release(session);
+}
+
+static void register_filter(void)
+{
+ IInternetSession *session;
+ HRESULT hres;
+
+ static const WCHAR gzipW[] = {'g','z','i','p',0};
+
+ CoInternetGetSession(0, &session, 0);
+
+ hres = IInternetSession_RegisterMimeFilter(session, &mimefilter_cf, &IID_IInternetProtocol, gzipW);
+ ok(hres == S_OK, "RegisterMimeFilter failed: %08x\n", hres);
+
+ IInternetSession_Release(session);
}
START_TEST(protocol)
event_complete = CreateEvent(NULL, FALSE, FALSE, NULL);
event_complete2 = CreateEvent(NULL, FALSE, FALSE, NULL);
+ event_continue = CreateEvent(NULL, FALSE, FALSE, NULL);
+ event_continue_done = CreateEvent(NULL, FALSE, FALSE, NULL);
+
+ register_filter();
test_file_protocol();
test_http_protocol();
test_gopher_protocol();
test_mk_protocol();
test_CreateBinding();
- test_binding(FILE_TEST);
- test_binding(HTTP_TEST);
+
+ bindf &= ~BINDF_FROMURLMON;
+ trace("Testing file binding (mime verification, emulate prot)...\n");
+ test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
+ trace("Testing http binding (mime verification, emulate prot)...\n");
+ test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT);
+ trace("Testing http binding (mime verification, emulate prot, short read, direct read)...\n");
+ test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_SHORT_READ|TEST_DIRECT_READ);
+ trace("Testing file binding (mime verification, emulate prot, mime filter)...\n");
+ test_binding(FILE_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
+ trace("Testing http binding (mime verification, emulate prot, mime filter)...\n");
+ test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_FILTER);
+ trace("Testing http binding (mime verification, emulate prot, direct read)...\n");
+ test_binding(HTTP_TEST, PI_MIMEVERIFICATION, TEST_EMULATEPROT|TEST_DIRECT_READ);
CloseHandle(event_complete);
CloseHandle(event_complete2);
+ CloseHandle(event_continue);
+ CloseHandle(event_continue_done);
OleUninitialize();
}
--- /dev/null
+/*
+ * Copyright 2005-2006 Jacek Caban for CodeWeavers
+ * Copyright 2009 Detlef Riekenberg
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#define COBJMACROS
+#define CONST_VTABLE
+#define NONAMELESSUNION
+
+/* needed for IInternetZoneManagerEx2 */
+#define _WIN32_IE 0x0700
+
+#include <wine/test.h>
+#include <stdarg.h>
+#include <stddef.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "ole2.h"
+#include "urlmon.h"
+
+#include "initguid.h"
+
+static const WCHAR url1[] = {'r','e','s',':','/','/','m','s','h','t','m','l','.','d','l','l',
+ '/','b','l','a','n','k','.','h','t','m',0};
+static const WCHAR url2[] = {'i','n','d','e','x','.','h','t','m',0};
+static const WCHAR url3[] = {'f','i','l','e',':','/','/','c',':','\\','I','n','d','e','x','.','h','t','m',0};
+static const WCHAR url4[] = {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e',
+ '%','2','e','j','p','g',0};
+static const WCHAR url5[] = {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q',
+ '.','o','r','g',0};
+static const WCHAR url6[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
+static const WCHAR url7[] = {'f','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g','/',
+ 'f','i','l','e','.','t','e','s','t',0};
+static const WCHAR url8[] = {'t','e','s','t',':','1','2','3','a','b','c',0};
+static const WCHAR url9[] =
+ {'h','t','t','p',':','/','/','w','w','w','.','w','i','n','e','h','q','.','o','r','g',
+ '/','s','i','t','e','/','a','b','o','u','t',0};
+static const WCHAR url10[] = {'f','i','l','e',':','/','/','s','o','m','e','%','2','0','f','i','l','e',
+ '.','j','p','g',0};
+
+static const WCHAR url4e[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e',
+ '.','j','p','g',0};
+
+
+static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0};
+static const BYTE secid5[] = {'h','t','t','p',':','w','w','w','.','w','i','n','e','h','q',
+ '.','o','r','g',3,0,0,0};
+static const BYTE secid6[] = {'a','b','o','u','t',':','b','l','a','n','k',3,0,0,0};
+static const BYTE secid7[] = {'f','t','p',':','w','i','n','e','h','q','.','o','r','g',
+ 3,0,0,0};
+static const BYTE secid10[] =
+ {'f','i','l','e',':','s','o','m','e','%','2','0','f','i','l','e','.','j','p','g',3,0,0,0};
+static const BYTE secid10_2[] =
+ {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e','.','j','p','g',3,0,0,0};
+
+static const GUID CLSID_TestActiveX =
+ {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}};
+
+/* Defined as extern in urlmon.idl, but not exported by uuid.lib */
+const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY =
+ {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}};
+
+static struct secmgr_test {
+ LPCWSTR url;
+ DWORD zone;
+ HRESULT zone_hres;
+ DWORD secid_size;
+ const BYTE *secid;
+ HRESULT secid_hres;
+} secmgr_tests[] = {
+ {url1, 0, S_OK, sizeof(secid1), secid1, S_OK},
+ {url2, 100, 0x80041001, 0, NULL, E_INVALIDARG},
+ {url3, 0, S_OK, sizeof(secid1), secid1, S_OK},
+ {url5, 3, S_OK, sizeof(secid5), secid5, S_OK},
+ {url6, 3, S_OK, sizeof(secid6), secid6, S_OK},
+ {url7, 3, S_OK, sizeof(secid7), secid7, S_OK}
+};
+
+static void test_SecurityManager(void)
+{
+ int i;
+ IInternetSecurityManager *secmgr = NULL;
+ BYTE buf[512];
+ DWORD zone, size, policy;
+ HRESULT hres;
+
+ hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
+ ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+ if(FAILED(hres))
+ return;
+
+ for(i=0; i < sizeof(secmgr_tests)/sizeof(secmgr_tests[0]); i++) {
+ zone = 100;
+ hres = IInternetSecurityManager_MapUrlToZone(secmgr, secmgr_tests[i].url,
+ &zone, 0);
+ ok(hres == secmgr_tests[i].zone_hres /* IE <=6 */
+ || (FAILED(secmgr_tests[i].zone_hres) && hres == E_INVALIDARG), /* IE7 */
+ "[%d] MapUrlToZone failed: %08x, expected %08x\n",
+ i, hres, secmgr_tests[i].zone_hres);
+ if(SUCCEEDED(hres))
+ ok(zone == secmgr_tests[i].zone, "[%d] zone=%d, expected %d\n", i, zone,
+ secmgr_tests[i].zone);
+ else
+ ok(zone == secmgr_tests[i].zone || zone == -1, "[%d] zone=%d\n", i, zone);
+
+ size = sizeof(buf);
+ memset(buf, 0xf0, sizeof(buf));
+ hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[i].url,
+ buf, &size, 0);
+ ok(hres == secmgr_tests[i].secid_hres,
+ "[%d] GetSecurityId failed: %08x, expected %08x\n",
+ i, hres, secmgr_tests[i].secid_hres);
+ if(secmgr_tests[i].secid) {
+ ok(size == secmgr_tests[i].secid_size, "[%d] size=%d, expected %d\n",
+ i, size, secmgr_tests[i].secid_size);
+ ok(!memcmp(buf, secmgr_tests[i].secid, size), "[%d] wrong secid\n", i);
+ }
+ }
+
+ zone = 100;
+ hres = IInternetSecurityManager_MapUrlToZone(secmgr, url10, &zone, 0);
+ ok(hres == S_OK, "MapUrlToZone failed: %08x, expected S_OK\n", hres);
+ ok(zone == 3, "zone=%d, expected 3\n", zone);
+
+ /* win2k3 translates %20 into a space */
+ size = sizeof(buf);
+ memset(buf, 0xf0, sizeof(buf));
+ hres = IInternetSecurityManager_GetSecurityId(secmgr, url10, buf, &size, 0);
+ ok(hres == S_OK, "GetSecurityId failed: %08x, expected S_OK\n", hres);
+ ok(size == sizeof(secid10) ||
+ size == sizeof(secid10_2), /* win2k3 */
+ "size=%d\n", size);
+ ok(!memcmp(buf, secid10, size) ||
+ !memcmp(buf, secid10_2, size), /* win2k3 */
+ "wrong secid\n");
+
+ zone = 100;
+ hres = IInternetSecurityManager_MapUrlToZone(secmgr, NULL, &zone, 0);
+ ok(hres == E_INVALIDARG, "MapUrlToZone failed: %08x, expected E_INVALIDARG\n", hres);
+ ok(zone == 100 || zone == -1, "zone=%d\n", zone);
+
+ size = sizeof(buf);
+ hres = IInternetSecurityManager_GetSecurityId(secmgr, NULL, buf, &size, 0);
+ ok(hres == E_INVALIDARG,
+ "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+ hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
+ NULL, &size, 0);
+ ok(hres == E_INVALIDARG,
+ "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+ hres = IInternetSecurityManager_GetSecurityId(secmgr, secmgr_tests[1].url,
+ buf, NULL, 0);
+ ok(hres == E_INVALIDARG,
+ "GetSecurityId failed: %08x, expected E_INVALIDARG\n", hres);
+
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, NULL, URLACTION_SCRIPT_RUN, (BYTE*)&policy,
+ sizeof(WCHAR), NULL, 0, 0, 0);
+ ok(hres == E_INVALIDARG, "ProcessUrlAction failed: %08x, expected E_INVALIDARG\n", hres);
+
+ IInternetSecurityManager_Release(secmgr);
+}
+
+/* Check if Internet Explorer is configured to run in "Enhanced Security Configuration" (aka hardened mode) */
+/* Note: this code is duplicated in dlls/mshtml/tests/mshtml_test.h and dlls/urlmon/tests/sec_mgr.c */
+static BOOL is_ie_hardened(void)
+{
+ HKEY zone_map;
+ DWORD ie_harden, type, size;
+
+ ie_harden = 0;
+ if(RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\ZoneMap",
+ 0, KEY_QUERY_VALUE, &zone_map) == ERROR_SUCCESS) {
+ size = sizeof(DWORD);
+ if (RegQueryValueExA(zone_map, "IEHarden", NULL, &type, (LPBYTE) &ie_harden, &size) != ERROR_SUCCESS ||
+ type != REG_DWORD) {
+ ie_harden = 0;
+ }
+ RegCloseKey(zone_map);
+ }
+
+ return ie_harden != 0;
+}
+
+static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
+{
+ DWORD res, size, policy, reg_policy;
+ char buf[10];
+ HKEY hkey;
+ HRESULT hres;
+
+ /* FIXME: HKEY_CURRENT_USER is most of the time the default but this can be changed on a system.
+ * The test should be changed to cope with that, if need be.
+ */
+ res = RegOpenKeyA(HKEY_CURRENT_USER,
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Zones\\3", &hkey);
+ if(res != ERROR_SUCCESS) {
+ ok(0, "Could not open zone key\n");
+ return;
+ }
+
+ wsprintf(buf, "%X", action);
+ size = sizeof(DWORD);
+ res = RegQueryValueExA(hkey, buf, NULL, NULL, (BYTE*)®_policy, &size);
+ RegCloseKey(hkey);
+ if(res != ERROR_SUCCESS || size != sizeof(DWORD)) {
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+ sizeof(WCHAR), NULL, 0, 0, 0);
+ ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
+ "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
+ ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+
+ policy = 0xdeadbeef;
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
+ "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
+ ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+ return;
+ }
+
+ policy = 0xdeadbeef;
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
+ ok(policy == reg_policy, "(%x) policy=%x, expected %x\n", action, policy, reg_policy);
+
+ if(policy != URLPOLICY_QUERY) {
+ if(winetest_interactive || ! is_ie_hardened()) {
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+ sizeof(WCHAR), NULL, 0, 0, 0);
+ if(reg_policy == URLPOLICY_DISALLOW)
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+ else
+ ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
+ ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+ 2, NULL, 0, 0, 0);
+ if(reg_policy == URLPOLICY_DISALLOW)
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+ else
+ ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
+ ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+ sizeof(DWORD), NULL, 0, 0, 0);
+ if(reg_policy == URLPOLICY_DISALLOW)
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+ else
+ ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
+ ok(policy == reg_policy, "(%x) policy=%x\n", action, policy);
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy,
+ sizeof(WCHAR), (BYTE*)0xdeadbeef, 16, 0, 0);
+ if(reg_policy == URLPOLICY_DISALLOW)
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+ else
+ ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres);
+ ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy);
+ }else {
+ skip("IE running in Enhanced Security Configuration\n");
+ }
+ }
+}
+
+static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZoneManager *zonemgr, DWORD action)
+{
+ DWORD policy;
+ HRESULT hres;
+
+ policy = 0xdeadbeef;
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
+ ok(policy == URLPOLICY_DISALLOW, "(%x) policy=%x, expected URLPOLICY_DISALLOW\n", action, policy);
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
+ sizeof(WCHAR), NULL, 0, 0, 0);
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy,
+ sizeof(DWORD), NULL, 0, 0, 0);
+ ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres);
+ ok(policy == URLPOLICY_DISALLOW, "policy = %x\n", policy);
+}
+
+static void test_activex(IInternetSecurityManager *secmgr)
+{
+ DWORD policy, policy_size;
+ struct CONFIRMSAFETY cs;
+ BYTE *ppolicy;
+ HRESULT hres;
+
+ policy = 0xdeadbeef;
+ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, URLACTION_ACTIVEX_RUN, (BYTE*)&policy,
+ sizeof(DWORD), (BYTE*)&CLSID_TestActiveX, sizeof(CLSID), 0, 0);
+ ok(hres == S_OK, "ProcessUrlAction(URLACTION_ACTIVEX_RUN) failed: %08x\n", hres);
+ ok(policy == URLPOLICY_ALLOW || policy == URLPOLICY_DISALLOW, "policy = %x\n", policy);
+
+ cs.clsid = CLSID_TestActiveX;
+ cs.pUnk = (IUnknown*)0xdeadbeef;
+ cs.dwFlags = 0;
+ hres = IInternetSecurityManager_QueryCustomPolicy(secmgr, url1, &GUID_CUSTOM_CONFIRMOBJECTSAFETY,
+ &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0);
+ ok(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "QueryCusromPolicy failed: %08x\n", hres);
+}
+
+static void test_polices(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ IInternetSecurityManager *secmgr = NULL;
+ HRESULT hres;
+
+ hres = CoInternetCreateSecurityManager(NULL, &secmgr, 0);
+ ok(hres == S_OK, "CoInternetCreateSecurityManager failed: %08x\n", hres);
+ hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
+
+ test_url_action(secmgr, zonemgr, URLACTION_SCRIPT_RUN);
+ test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_RUN);
+ test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY);
+ test_url_action(secmgr, zonemgr, URLACTION_CHANNEL_SOFTDIST_PERMISSIONS);
+ test_url_action(secmgr, zonemgr, 0xdeadbeef);
+
+ test_special_url_action(secmgr, zonemgr, URLACTION_SCRIPT_OVERRIDE_SAFETY);
+ test_special_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY);
+
+ test_activex(secmgr);
+
+ IInternetSecurityManager_Release(secmgr);
+ IInternetZoneManager_Release(zonemgr);
+}
+
+static void test_CoInternetCreateZoneManager(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ IUnknown *punk = NULL;
+ HRESULT hr;
+
+ hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+ if (FAILED(hr))
+ return;
+
+ hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IUnknown, (void **) &punk);
+ ok(SUCCEEDED(hr), "got 0x%x with %p (expected Success)\n", hr, punk);
+ if (punk)
+ IUnknown_Release(punk);
+
+ hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IInternetZoneManager, (void **) &punk);
+ ok(SUCCEEDED(hr), "got 0x%x with %p (expected Success)\n", hr, punk);
+ if (punk)
+ IUnknown_Release(punk);
+
+
+ hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IInternetZoneManagerEx, (void **) &punk);
+ if (SUCCEEDED(hr)) {
+ IUnknown_Release(punk);
+
+ hr = IInternetZoneManager_QueryInterface(zonemgr, &IID_IInternetZoneManagerEx2, (void **) &punk);
+ if (punk)
+ IUnknown_Release(punk);
+ else
+ win_skip("InternetZoneManagerEx2 not supported\n");
+
+ }
+ else
+ win_skip("InternetZoneManagerEx not supported\n");
+
+ hr = IInternetZoneManager_Release(zonemgr);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+}
+
+static void test_CreateZoneEnumerator(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ HRESULT hr;
+ DWORD dwEnum;
+ DWORD dwEnum2;
+ DWORD dwCount;
+ DWORD dwCount2;
+
+ hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+ if (FAILED(hr))
+ return;
+
+ dwEnum=0xdeadbeef;
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, NULL, 0);
+ ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef),
+ "got 0x%x with 0x%x (expected E_INVALIDARG with 0xdeadbeef)\n", hr, dwEnum);
+
+ dwCount=0xdeadbeef;
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, NULL, &dwCount, 0);
+ ok((hr == E_INVALIDARG) && (dwCount == 0xdeadbeef),
+ "got 0x%x and 0x%x (expected E_INVALIDARG and 0xdeadbeef)\n", hr, dwCount);
+
+ dwEnum=0xdeadbeef;
+ dwCount=0xdeadbeef;
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0xffffffff);
+ ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
+ "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+ hr, dwEnum, dwCount);
+
+ dwEnum=0xdeadbeef;
+ dwCount=0xdeadbeef;
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 1);
+ ok((hr == E_INVALIDARG) && (dwEnum == 0xdeadbeef) && (dwCount == 0xdeadbeef),
+ "got 0x%x with 0x%x and 0x%x (expected E_INVALIDARG with 0xdeadbeef and 0xdeadbeef)\n",
+ hr, dwEnum, dwCount);
+
+ dwEnum=0xdeadbeef;
+ dwCount=0xdeadbeef;
+ /* Normal use */
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ if (SUCCEEDED(hr)) {
+ dwEnum2=0xdeadbeef;
+ dwCount2=0xdeadbeef;
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum2, &dwCount2, 0);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ if (SUCCEEDED(hr)) {
+ /* native urlmon has an incrementing counter for dwEnum */
+ hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum2);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ }
+
+ hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+ /* Destroy the Enumerator twice is detected and handled in native urlmon */
+ hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
+ ok((hr == E_INVALIDARG), "got 0x%x (expected E_INVALIDARG)\n", hr);
+ }
+
+ /* ::Release succeed also, when a ::DestroyZoneEnumerator is missing */
+ hr = IInternetZoneManager_Release(zonemgr);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+}
+
+static void test_GetZoneActionPolicy(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ BYTE buf[32];
+ HRESULT hres;
+ DWORD action = URLACTION_CREDENTIALS_USE; /* Implemented on all IE versions */
+
+ hres = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres);
+ if(FAILED(hres))
+ return;
+
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == S_OK, "GetZoneActionPolicy failed: %08x\n", hres);
+ ok(*(DWORD*)buf == URLPOLICY_CREDENTIALS_SILENT_LOGON_OK ||
+ *(DWORD*)buf == URLPOLICY_CREDENTIALS_MUST_PROMPT_USER ||
+ *(DWORD*)buf == URLPOLICY_CREDENTIALS_CONDITIONAL_PROMPT ||
+ *(DWORD*)buf == URLPOLICY_CREDENTIALS_ANONYMOUS_ONLY,
+ "unexpected policy=%d\n", *(DWORD*)buf);
+
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, NULL,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, buf,
+ 2, URLZONEREG_DEFAULT);
+ ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1fff, buf,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)),
+ "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres);
+
+ hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 13, action, buf,
+ sizeof(DWORD), URLZONEREG_DEFAULT);
+ ok(hres == E_INVALIDARG, "GetZoneActionPolicy failed: %08x, expected E_INVALIDARG\n", hres);
+
+ IInternetZoneManager_Release(zonemgr);
+}
+
+static void test_GetZoneAt(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ HRESULT hr;
+ DWORD dwEnum;
+ DWORD dwCount;
+ DWORD dwZone;
+ DWORD i;
+
+ hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+ if (FAILED(hr))
+ return;
+
+ hr = IInternetZoneManager_CreateZoneEnumerator(zonemgr, &dwEnum, &dwCount, 0);
+ if (FAILED(hr))
+ goto cleanup;
+
+ if (0) {
+ /* this crashes with native urlmon */
+ hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, 0, NULL);
+ }
+
+ dwZone = 0xdeadbeef;
+ hr = IInternetZoneManager_GetZoneAt(zonemgr, 0xdeadbeef, 0, &dwZone);
+ ok(hr == E_INVALIDARG,
+ "got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
+
+ for (i = 0; i < dwCount; i++)
+ {
+ dwZone = 0xdeadbeef;
+ hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, i, &dwZone);
+ ok(hr == S_OK, "#%d: got x%x with %d (expected S_OK)\n", i, hr, dwZone);
+ }
+
+ dwZone = 0xdeadbeef;
+ /* MSDN (index .. must be .. less than or equal to) is wrong */
+ hr = IInternetZoneManager_GetZoneAt(zonemgr, dwEnum, dwCount, &dwZone);
+ ok(hr == E_INVALIDARG,
+ "got 0x%x with 0x%x (expected E_INVALIDARG)\n", hr, dwZone);
+
+ hr = IInternetZoneManager_DestroyZoneEnumerator(zonemgr, dwEnum);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+
+cleanup:
+ hr = IInternetZoneManager_Release(zonemgr);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+}
+
+static void test_GetZoneAttributes(void)
+{
+ IInternetZoneManager *zonemgr = NULL;
+ CHAR buffer [sizeof(ZONEATTRIBUTES) + 32];
+ ZONEATTRIBUTES* pZA = (ZONEATTRIBUTES*) buffer;
+ HRESULT hr;
+ DWORD i;
+
+ hr = CoInternetCreateZoneManager(NULL, &zonemgr, 0);
+ ok(hr == S_OK, "CoInternetCreateZoneManager result: 0x%x\n", hr);
+ if (FAILED(hr))
+ return;
+
+ /* native urlmon has Zone "0" up to Zone "4" since IE4 */
+ for (i = 0; i < 5; i++) {
+ memset(buffer, -1, sizeof(buffer));
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, i, pZA);
+ ok(hr == S_OK, "#%d: got 0x%x (expected S_OK)\n", i, hr);
+ }
+
+ /* IE8 no longer set cbSize */
+ memset(buffer, -1, sizeof(buffer));
+ pZA->cbSize = 0;
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ ok((pZA->cbSize == 0) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
+ "got cbSize = %d (expected 0)\n", pZA->cbSize);
+
+ memset(buffer, -1, sizeof(buffer));
+ pZA->cbSize = 64;
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ ok((pZA->cbSize == 64) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
+ "got cbSize = %d (expected 64)\n", pZA->cbSize);
+
+ memset(buffer, -1, sizeof(buffer));
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, pZA);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+ ok((pZA->cbSize == 0xffffffff) || (pZA->cbSize == sizeof(ZONEATTRIBUTES)),
+ "got cbSize = 0x%x (expected 0xffffffff)\n", pZA->cbSize);
+
+ /* IE8 no longer fail on invalid zones */
+ memset(buffer, -1, sizeof(buffer));
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0xdeadbeef, pZA);
+ ok(hr == S_OK || (hr == E_FAIL),
+ "got 0x%x (expected S_OK or E_FAIL)\n", hr);
+
+ hr = IInternetZoneManager_GetZoneAttributes(zonemgr, 0, NULL);
+ ok(hr == E_INVALIDARG, "got 0x%x (expected E_INVALIDARG)\n", hr);
+
+ hr = IInternetZoneManager_Release(zonemgr);
+ ok(hr == S_OK, "got 0x%x (expected S_OK)\n", hr);
+}
+
+
+START_TEST(sec_mgr)
+{
+ OleInitialize(NULL);
+
+ test_SecurityManager();
+ test_polices();
+ test_CoInternetCreateZoneManager();
+ test_CreateZoneEnumerator();
+ test_GetZoneActionPolicy();
+ test_GetZoneAt();
+ test_GetZoneAttributes();
+
+ OleUninitialize();
+}
extern void func_generated(void);
extern void func_misc(void);
extern void func_protocol(void);
+extern void func_sec_mgr(void);
extern void func_stream(void);
extern void func_url(void);
{ "generated", func_generated },
{ "misc", func_misc },
{ "protocol", func_protocol },
+ { "sec_mgr", func_sec_mgr },
{ "stream", func_stream },
{ "url", func_url },
{ 0, 0 }
DEFINE_EXPECT(QueryInterface_IServiceProvider);
DEFINE_EXPECT(QueryInterface_IHttpNegotiate);
DEFINE_EXPECT(QueryInterface_IBindStatusCallback);
+DEFINE_EXPECT(QueryInterface_IBindStatusCallbackEx);
DEFINE_EXPECT(QueryInterface_IBindStatusCallbackHolder);
DEFINE_EXPECT(QueryInterface_IInternetBindInfo);
DEFINE_EXPECT(QueryInterface_IAuthenticate);
DEFINE_EXPECT(QueryInterface_IInternetProtocol);
+DEFINE_EXPECT(QueryInterface_IWindowForBindingUI);
DEFINE_EXPECT(QueryService_IAuthenticate);
DEFINE_EXPECT(QueryService_IInternetProtocol);
DEFINE_EXPECT(QueryService_IInternetBindInfo);
+DEFINE_EXPECT(QueryService_IWindowForBindingUI);
DEFINE_EXPECT(BeginningTransaction);
DEFINE_EXPECT(OnResponse);
DEFINE_EXPECT(QueryInterface_IHttpNegotiate2);
DEFINE_EXPECT(GetRootSecurityId);
DEFINE_EXPECT(GetBindInfo);
+DEFINE_EXPECT(GetBindInfoEx);
DEFINE_EXPECT(OnStartBinding);
DEFINE_EXPECT(OnProgress_FINDINGRESOURCE);
DEFINE_EXPECT(OnProgress_CONNECTING);
static IBinding *current_binding;
static HANDLE complete_event, complete_event2;
static HRESULT binding_hres;
-static BOOL have_IHttpNegotiate2;
+static BOOL have_IHttpNegotiate2, use_bscex;
static LPCWSTR urls[] = {
WINE_ABOUT_URL,
END_DOWNLOAD
} download_state;
-static const char *debugstr_w(LPCWSTR str)
-{
- static char buf[1024];
- WideCharToMultiByte(CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL);
- return buf;
-}
-
static const char *debugstr_guid(REFIID riid)
{
static char buf[50];
return 1;
}
+static void test_switch_fail(void)
+{
+ IInternetProtocolSink *binding_sink;
+ PROTOCOLDATA protocoldata;
+ HRESULT hres;
+
+ static BOOL tested_switch_fail;
+
+ if(tested_switch_fail)
+ return;
+
+ tested_switch_fail = TRUE;
+
+ hres = IBinding_QueryInterface(current_binding, &IID_IInternetProtocolSink, (void**)&binding_sink);
+ ok(hres == S_OK, "Could not get IInternetProtocolSink iface: %08x\n", hres);
+ if(SUCCEEDED(hres)) {
+ hres = IInternetProtocolSink_Switch(binding_sink, &protocoldata);
+ ok(hres == E_FAIL, "Switch failed: %08x, expected E_FAIL\n", hres);
+ IInternetProtocolSink_Release(binding_sink);
+ }
+}
+
static DWORD WINAPI thread_proc(PVOID arg)
{
PROTOCOLDATA protocoldata;
else
CHECK_CALLED(OnProgress_SENDINGREQUEST);
+ test_switch_fail();
+
SET_EXPECT(Continue);
prot_state = 1;
hres = IInternetProtocolSink_Switch(protocol_sink, &protocoldata);
read = 0;
if(!filedwl_api) /* FIXME */
- ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", debugstr_w(szUrl));
+ ok(szUrl && !lstrcmpW(szUrl, urls[test_protocol]), "wrong url %s\n", wine_dbgstr_w(szUrl));
ok(pOIProtSink != NULL, "pOIProtSink == NULL\n");
ok(pOIBindInfo != NULL, "pOIBindInfo == NULL\n");
ok(grfPI == 0, "grfPI=%d, expected 0\n", grfPI);
SET_EXPECT(QueryService_IInternetBindInfo);
hres = IInternetBindInfo_GetBindString(pOIBindInfo, BINDSTRING_USER_AGENT,
&ua, 1, &fetched);
- todo_wine {
- CHECK_CALLED(QueryInterface_IInternetBindInfo);
- CHECK_CALLED(QueryService_IInternetBindInfo);
- }
+ CLEAR_CALLED(QueryInterface_IInternetBindInfo); /* IE <8 */
+ CLEAR_CALLED(QueryService_IInternetBindInfo); /* IE <8 */
+
ok(hres == E_NOINTERFACE,
"GetBindString(BINDSTRING_USER_AGETNT) failed: %08x\n", hres);
ok(fetched == 256, "fetched = %d, expected 254\n", fetched);
SET_EXPECT(QueryInterface_IHttpNegotiate);
hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate,
&IID_IHttpNegotiate, (void**)&http_negotiate);
- CHECK_CALLED(QueryInterface_IHttpNegotiate);
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate); /* IE <8 */
ok(hres == S_OK, "QueryService failed: %08x\n", hres);
SET_EXPECT(BeginningTransaction);
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate, urls[test_protocol],
NULL, 0, &additional_headers);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
CHECK_CALLED(BeginningTransaction);
IHttpNegotiate_Release(http_negotiate);
ok(hres == S_OK, "BeginningTransction failed: %08x\n", hres);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
hres = IServiceProvider_QueryService(service_provider, &IID_IHttpNegotiate2,
&IID_IHttpNegotiate2, (void**)&http_negotiate2);
- CHECK_CALLED(QueryInterface_IHttpNegotiate2);
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate2); /* IE <8 */
ok(hres == S_OK, "QueryService failed: %08x\n", hres);
size = 512;
+ SET_EXPECT(QueryInterface_IHttpNegotiate2);
SET_EXPECT(GetRootSecurityId);
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, sec_id, &size, 0);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2);
CHECK_CALLED(GetRootSecurityId);
IHttpNegotiate2_Release(http_negotiate2);
ok(hres == E_FAIL, "GetRootSecurityId failed: %08x, expected E_FAIL\n", hres);
&IID_IHttpNegotiate, (void**)&http_negotiate);
ok(hres == S_OK, "Could not get IHttpNegotiate\n");
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(OnResponse);
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, header, NULL, NULL);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate);
CHECK_CALLED(OnResponse);
IHttpNegotiate_Release(http_negotiate);
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
return E_NOTIMPL;
}
+ if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
+ CHECK_EXPECT(QueryService_IWindowForBindingUI);
+ return E_NOTIMPL;
+ }
+
ok(0, "unexpected service %s\n", debugstr_guid(guidService));
return E_NOINTERFACE;
}
static IServiceProvider ServiceProvider = { &ServiceProviderVtbl };
-static IBindStatusCallback objbsc;
+static IBindStatusCallbackEx objbsc;
-static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
+static HRESULT WINAPI statusclb_QueryInterface(IBindStatusCallbackEx *iface, REFIID riid, void **ppv)
{
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
}
else if (IsEqualGUID(&IID_IHttpNegotiate, riid))
{
- CHECK_EXPECT(QueryInterface_IHttpNegotiate);
+ CHECK_EXPECT2(QueryInterface_IHttpNegotiate);
*ppv = &HttpNegotiate;
return S_OK;
}
CHECK_EXPECT2(QueryInterface_IBindStatusCallbackHolder);
return E_NOINTERFACE;
}
+ else if(IsEqualGUID(&IID_IBindStatusCallbackEx, riid))
+ {
+ CHECK_EXPECT(QueryInterface_IBindStatusCallbackEx);
+ if(!use_bscex)
+ return E_NOINTERFACE;
+ *ppv = iface;
+ return S_OK;
+ }
else if(IsEqualGUID(&IID_IInternetBindInfo, riid))
{
/* TODO */
CHECK_EXPECT2(QueryInterface_IInternetBindInfo);
}
+ else if(IsEqualGUID(&IID_IWindowForBindingUI, riid))
+ {
+ CHECK_EXPECT2(QueryInterface_IWindowForBindingUI);
+ return E_NOINTERFACE;
+ }
else
{
ok(0, "unexpected interface %s\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
-static ULONG WINAPI statusclb_AddRef(IBindStatusCallback *iface)
+static ULONG WINAPI statusclb_AddRef(IBindStatusCallbackEx *iface)
{
return 2;
}
-static ULONG WINAPI statusclb_Release(IBindStatusCallback *iface)
+static ULONG WINAPI statusclb_Release(IBindStatusCallbackEx *iface)
{
return 1;
}
-static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved,
+static HRESULT WINAPI statusclb_OnStartBinding(IBindStatusCallbackEx *iface, DWORD dwReserved,
IBinding *pib)
{
IWinInetHttpInfo *http_info;
return S_OK;
}
-static HRESULT WINAPI statusclb_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
+static HRESULT WINAPI statusclb_GetPriority(IBindStatusCallbackEx *iface, LONG *pnPriority)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
-static HRESULT WINAPI statusclb_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
+static HRESULT WINAPI statusclb_OnLowResource(IBindStatusCallbackEx *iface, DWORD reserved)
{
ok(0, "unexpected call\n");
return E_NOTIMPL;
}
-static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallback *iface, ULONG ulProgress,
+static HRESULT WINAPI statusclb_OnProgress(IBindStatusCallbackEx *iface, ULONG ulProgress,
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
{
ok(GetCurrentThreadId() == thread_id, "wrong thread %d\n", GetCurrentThreadId());
if(filedwl_api) {
/* FIXME */
}else {
- ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText));
+ ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
}
}
if(!bind_to_object)
if(filedwl_api) {
/* FIXME */
}else {
- ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", debugstr_w(szStatusText));
+ ok(!lstrcmpW(szStatusText, urls[test_protocol]), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
}
}
ok(download_state == DOWNLOADING, "Download state was %d, expected DOWNLOADING\n",
ok(szStatusText != NULL, "szStatusText == NULL\n");
if(szStatusText && test_protocol == FILE_TEST)
- ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", debugstr_w(szStatusText));
+ ok(!lstrcmpW(file_url+8, szStatusText), "wrong szStatusText %s\n", wine_dbgstr_w(szStatusText));
break;
case BINDSTATUS_CLASSIDAVAILABLE:
{
return S_OK;
}
-static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
+static HRESULT WINAPI statusclb_OnStopBinding(IBindStatusCallbackEx *iface, HRESULT hresult, LPCWSTR szError)
{
if(iface == &objbsc) {
CHECK_EXPECT(Obj_OnStopBinding);
return S_OK;
}
-static HRESULT WINAPI statusclb_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
+static HRESULT WINAPI statusclb_GetBindInfo(IBindStatusCallbackEx *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
{
DWORD cbSize;
return S_OK;
}
-static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF,
+static HRESULT WINAPI statusclb_OnDataAvailable(IBindStatusCallbackEx *iface, DWORD grfBSCF,
DWORD dwSize, FORMATETC* pformatetc, STGMEDIUM* pstgmed)
{
HRESULT hres;
case TYMED_FILE:
if(test_protocol == FILE_TEST)
ok(!lstrcmpW(pstgmed->u.lpszFileName, INDEX_HTML+7),
- "unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName));
+ "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName));
else if(emulate_protocol)
ok(!lstrcmpW(pstgmed->u.lpszFileName, cache_fileW),
- "unexpected file name %s\n", debugstr_w(pstgmed->u.lpszFileName));
+ "unexpected file name %s\n", wine_dbgstr_w(pstgmed->u.lpszFileName));
else
ok(pstgmed->u.lpszFileName != NULL, "lpszFileName == NULL\n");
}
return S_OK;
}
-static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
+static HRESULT WINAPI statusclb_OnObjectAvailable(IBindStatusCallbackEx *iface, REFIID riid, IUnknown *punk)
{
CHECK_EXPECT(OnObjectAvailable);
return S_OK;
}
-static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
+static HRESULT WINAPI statusclb_GetBindInfoEx(IBindStatusCallbackEx *iface, DWORD *grfBINDF, BINDINFO *pbindinfo,
+ DWORD *grfBINDF2, DWORD *pdwReserved)
+{
+ CHECK_EXPECT(GetBindInfoEx);
+
+ ok(grfBINDF != NULL, "grfBINDF == NULL\n");
+ ok(grfBINDF2 != NULL, "grfBINDF2 == NULL\n");
+ ok(pbindinfo != NULL, "pbindinfo == NULL\n");
+ ok(pdwReserved != NULL, "dwReserved == NULL\n");
+
+ return S_OK;
+}
+
+static const IBindStatusCallbackExVtbl BindStatusCallbackVtbl = {
statusclb_QueryInterface,
statusclb_AddRef,
statusclb_Release,
statusclb_OnStopBinding,
statusclb_GetBindInfo,
statusclb_OnDataAvailable,
- statusclb_OnObjectAvailable
+ statusclb_OnObjectAvailable,
+ statusclb_GetBindInfoEx
};
-static IBindStatusCallback bsc = { &BindStatusCallbackVtbl };
-static IBindStatusCallback objbsc = { &BindStatusCallbackVtbl };
+static IBindStatusCallbackEx bsc = { &BindStatusCallbackVtbl };
+static IBindStatusCallbackEx objbsc = { &BindStatusCallbackVtbl };
static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
{
switch(mkp) {
case MIMETYPEPROP:
CHECK_EXPECT(PutProperty_MIMETYPEPROP);
- ok(!lstrcmpW(val, wszTextHtml), "val = %s\n", debugstr_w(val));
+ ok(!lstrcmpW(val, wszTextHtml), "val = %s\n", wine_dbgstr_w(val));
break;
case CLASSIDPROP:
CHECK_EXPECT(PutProperty_CLASSIDPROP);
}
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = RegisterBindStatusCallback(pibc, &bsc, NULL, 0);
+ hres = RegisterBindStatusCallback(pibc, (IBindStatusCallback*)&bsc, NULL, 0);
ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
SET_EXPECT(GetBindInfo);
SET_EXPECT(OnStartBinding);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
hres = IMoniker_BindToStorage(pimkName, pibc, NULL, &IID_IStream, (void**)&unk);
ok(hres == S_OK, "Load failed: %08x\n", hres);
+ CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(OnStartBinding);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
ok(hres == E_INVALIDARG, "CreateAsyncBindCtx failed. expected: E_INVALIDARG, got: %08x\n", hres);
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
+ hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
IBindCtx_Release(bctx_arg);
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = CreateAsyncBindCtxEx(NULL, 0, &bsc, NULL, &bctx, 0);
+ hres = CreateAsyncBindCtxEx(NULL, 0, (IBindStatusCallback*)&bsc, NULL, &bctx, 0);
ok(hres == S_OK, "CreateAsyncBindCtxEx failed: %08x\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
IBindCtx_Release(bctx2);
}
+static void test_GetBindInfoEx(IBindStatusCallback *holder)
+{
+ IBindStatusCallbackEx *bscex;
+ BINDINFO bindinfo = {sizeof(bindinfo)};
+ DWORD bindf, bindf2, dw;
+ HRESULT hres;
+
+ hres = IBindStatusCallback_QueryInterface(holder, &IID_IBindStatusCallbackEx, (void**)&bscex);
+ if(FAILED(hres)) {
+ win_skip("IBindStatusCallbackEx not supported\n");
+ return;
+ }
+
+ use_bscex = TRUE;
+
+ bindf = 0;
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
+ SET_EXPECT(GetBindInfoEx);
+ hres = IBindStatusCallback_GetBindInfo(holder, &bindf, &bindinfo);
+ ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
+ CHECK_CALLED(GetBindInfoEx);
+
+ bindf = bindf2 = dw = 0;
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
+ SET_EXPECT(GetBindInfoEx);
+ hres = IBindStatusCallbackEx_GetBindInfoEx(bscex, &bindf, &bindinfo, &bindf2, &dw);
+ ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
+ CHECK_CALLED(GetBindInfoEx);
+
+ use_bscex = FALSE;
+
+ bindf = bindf2 = dw = 0xdeadbeef;
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
+ SET_EXPECT(GetBindInfo);
+ hres = IBindStatusCallbackEx_GetBindInfoEx(bscex, &bindf, &bindinfo, &bindf2, &dw);
+ ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+ CHECK_CALLED(QueryInterface_IBindStatusCallbackEx);
+ CHECK_CALLED(GetBindInfo);
+ ok(bindf2 == 0xdeadbeef, "bindf2 = %x\n", bindf2);
+ ok(dw == 0xdeadbeef, "dw = %x\n", dw);
+
+ IBindStatusCallbackEx_Release(bscex);
+}
+
static BOOL test_bscholder(IBindStatusCallback *holder)
{
IServiceProvider *serv_prov;
ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres);
dw = 0xdeadbeef;
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
SET_EXPECT(GetBindInfo);
hres = IBindStatusCallback_GetBindInfo(holder, &dw, &bindinfo);
ok(hres == S_OK, "GetBindInfo failed: %08x\n", hres);
+ CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
CHECK_CALLED(GetBindInfo);
+ test_GetBindInfoEx(holder);
+
SET_EXPECT(OnStartBinding);
hres = IBindStatusCallback_OnStartBinding(holder, 0, (void*)0xdeadbeef);
ok(hres == S_OK, "OnStartBinding failed: %08x\n", hres);
hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate, (void**)&http_negotiate);
ok(hres == S_OK, "Could not get IHttpNegotiate interface: %08x\n", hres);
- wstr = (void*)0xdeadbeef;
- hres = IHttpNegotiate_BeginningTransaction(http_negotiate, urls[test_protocol], (void*)0xdeadbeef, 0xff, &wstr);
- ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
- ok(wstr == NULL, "wstr = %p\n", wstr);
-
SET_EXPECT(QueryInterface_IHttpNegotiate);
hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate, &IID_IHttpNegotiate,
(void**)&http_negotiate_serv);
ok(hres == S_OK, "Could not get IHttpNegotiate service: %08x\n", hres);
- CHECK_CALLED(QueryInterface_IHttpNegotiate);
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate); /* IE <8 */
ok(http_negotiate == http_negotiate_serv, "http_negotiate != http_negotiate_serv\n");
wstr = (void*)0xdeadbeef;
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(BeginningTransaction);
hres = IHttpNegotiate_BeginningTransaction(http_negotiate_serv, urls[test_protocol], emptyW, 0, &wstr);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
CHECK_CALLED(BeginningTransaction);
ok(hres == S_OK, "BeginningTransaction failed: %08x\n", hres);
ok(wstr == NULL, "wstr = %p\n", wstr);
hres = IBindStatusCallback_QueryInterface(holder, &IID_IHttpNegotiate2, (void**)&http_negotiate2);
if(SUCCEEDED(hres)) {
have_IHttpNegotiate2 = TRUE;
- hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
- ok(hres == E_FAIL, "GetRootSecurityId failed: %08x\n", hres);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
hres = IServiceProvider_QueryService(serv_prov, &IID_IHttpNegotiate2, &IID_IHttpNegotiate2,
(void**)&http_negotiate2_serv);
ok(hres == S_OK, "Could not get IHttpNegotiate2 service: %08x\n", hres);
- CHECK_CALLED(QueryInterface_IHttpNegotiate2);
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate2); /* IE <8 */
ok(http_negotiate2 == http_negotiate2_serv, "http_negotiate != http_negotiate_serv\n");
+ SET_EXPECT(QueryInterface_IHttpNegotiate2);
SET_EXPECT(GetRootSecurityId);
hres = IHttpNegotiate2_GetRootSecurityId(http_negotiate2, (void*)0xdeadbeef, (void*)0xdeadbeef, 0);
ok(hres == E_NOTIMPL, "GetRootSecurityId failed: %08x\n", hres);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate2); /* IE8 */
CHECK_CALLED(GetRootSecurityId);
IHttpNegotiate_Release(http_negotiate2_serv);
ok(hres == S_OK, "OnProgress failed: %08x\n", hres);
CHECK_CALLED(OnProgress_FINDINGRESOURCE);
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(OnResponse);
wstr = (void*)0xdeadbeef;
hres = IHttpNegotiate_OnResponse(http_negotiate, 200, emptyW, NULL, NULL);
ok(hres == S_OK, "OnResponse failed: %08x\n", hres);
+ CHECK_CALLED_BROKEN(QueryInterface_IHttpNegotiate); /* IE8 */
CHECK_CALLED(OnResponse);
IHttpNegotiate_Release(http_negotiate);
hres = IServiceProvider_QueryService(serv_prov, &IID_IAuthenticate, &IID_IAuthenticate,
(void**)&authenticate_serv);
ok(hres == S_OK, "Could not get IAuthenticate service: %08x\n", hres);
- CHECK_CALLED(QueryInterface_IAuthenticate);
- CHECK_CALLED(QueryService_IAuthenticate);
+ CLEAR_CALLED(QueryInterface_IAuthenticate); /* IE <8 */
+ CLEAR_CALLED(QueryService_IAuthenticate); /* IE <8 */
ok(authenticate == authenticate_serv, "authenticate != authenticate_serv\n");
IAuthenticate_Release(authenticate_serv);
SET_EXPECT(QueryInterface_IBindStatusCallback);
SET_EXPECT(QueryInterface_IBindStatusCallbackHolder);
prevbsc = (void*)0xdeadbeef;
- hres = RegisterBindStatusCallback(bindctx, &bsc, &prevbsc, 0);
+ hres = RegisterBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc, &prevbsc, 0);
ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
- ok(prevbsc == &bsc, "prevbsc=%p\n", prevbsc);
+ ok(prevbsc == (IBindStatusCallback*)&bsc, "prevbsc=%p\n", prevbsc);
CHECK_CALLED(QueryInterface_IBindStatusCallback);
CHECK_CALLED(QueryInterface_IBindStatusCallbackHolder);
hres = IUnknown_QueryInterface(unk, &IID_IBindStatusCallback, (void**)&clb);
IUnknown_Release(unk);
ok(hres == S_OK, "QueryInterface(IID_IBindStatusCallback) failed: %08x\n", hres);
- ok(clb != &bsc, "bsc == clb\n");
+ ok(clb != (IBindStatusCallback*)&bsc, "bsc == clb\n");
if(!test_bscholder(clb))
ret = FALSE;
IBindStatusCallback_Release(clb);
- hres = RevokeBindStatusCallback(bindctx, &bsc);
+ hres = RevokeBindStatusCallback(bindctx, (IBindStatusCallback*)&bsc);
ok(hres == S_OK, "RevokeBindStatusCallback failed: %08x\n", hres);
unk = (void*)0xdeadbeef;
init_bind_test(protocol, emul ? BINDTEST_EMULATE : 0, t);
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
+ hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
if(FAILED(hres))
return;
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = RegisterBindStatusCallback(bctx, &bsc, &previousclb, 0);
+ hres = RegisterBindStatusCallback(bctx, (IBindStatusCallback*)&bsc, &previousclb, 0);
ok(hres == S_OK, "RegisterBindStatusCallback failed: %08x\n", hres);
- ok(previousclb == &bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc);
+ ok(previousclb == (IBindStatusCallback*)&bsc, "previousclb(%p) != sclb(%p)\n", previousclb, &bsc);
CHECK_CALLED(QueryInterface_IServiceProvider);
if(previousclb)
IBindStatusCallback_Release(previousclb);
hres = IMoniker_GetDisplayName(mon, bctx, NULL, &display_name);
ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
ok(!lstrcmpW(display_name, urls[test_protocol]),
- "GetDisplayName got wrong name %s\n", debugstr_w(display_name));
+ "GetDisplayName got wrong name %s\n", wine_dbgstr_w(display_name));
CoTaskMemFree(display_name);
if(tymed == TYMED_FILE && (test_protocol == ABOUT_TEST || test_protocol == ITS_TEST))
binding_hres = INET_E_DATA_NOT_AVAILABLE;
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
SET_EXPECT(GetBindInfo);
SET_EXPECT(QueryInterface_IInternetProtocol);
if(!emulate_protocol)
SET_EXPECT(QueryInterface_IInternetBindInfo);
SET_EXPECT(QueryService_IInternetBindInfo);
SET_EXPECT(QueryInterface_IHttpNegotiate);
+ SET_EXPECT(QueryInterface_IWindowForBindingUI);
+ SET_EXPECT(QueryService_IWindowForBindingUI);
SET_EXPECT(BeginningTransaction);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
SET_EXPECT(GetRootSecurityId);
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FTP_TEST
|| test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_SENDINGREQUEST);
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(OnResponse);
+ }
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
DispatchMessage(&msg);
}
+ CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(QueryInterface_IInternetProtocol);
if(!emulate_protocol)
CLEAR_CALLED(QueryInterface_IInternetBindInfo);
CLEAR_CALLED(QueryService_IInternetBindInfo);
CHECK_CALLED(QueryInterface_IHttpNegotiate);
+ CLEAR_CALLED(QueryInterface_IWindowForBindingUI);
+ CLEAR_CALLED(QueryService_IWindowForBindingUI);
CHECK_CALLED(BeginningTransaction);
if (have_IHttpNegotiate2)
{
CHECK_CALLED(OnProgress_SENDINGREQUEST);
else if(test_protocol == FTP_TEST)
todo_wine CHECK_CALLED(OnProgress_SENDINGREQUEST);
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(OnResponse);
+ }
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, ®id);
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = CreateAsyncBindCtx(0, &objbsc, NULL, &bctx);
+ hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&objbsc, NULL, &bctx);
ok(SUCCEEDED(hres), "CreateAsyncBindCtx failed: %08x\n\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
if(FAILED(hres))
ok(hres == S_OK, "GetDisplayName failed %08x\n", hres);
ok(!lstrcmpW(display_name, urls[test_protocol]), "GetDisplayName got wrong name\n");
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
SET_EXPECT(Obj_GetBindInfo);
SET_EXPECT(QueryInterface_IInternetProtocol);
if(!emulate_protocol)
SET_EXPECT(GetRootSecurityId);
SET_EXPECT(Obj_OnProgress_FINDINGRESOURCE);
SET_EXPECT(Obj_OnProgress_CONNECTING);
+ SET_EXPECT(QueryInterface_IWindowForBindingUI);
+ SET_EXPECT(QueryService_IWindowForBindingUI);
}
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FILE_TEST)
SET_EXPECT(Obj_OnProgress_SENDINGREQUEST);
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(OnResponse);
+ }
SET_EXPECT(Obj_OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
DispatchMessage(&msg);
}
+ CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx);
CHECK_CALLED(Obj_GetBindInfo);
CHECK_CALLED(QueryInterface_IInternetProtocol);
if(!emulate_protocol)
/* IE7 does call this */
CLEAR_CALLED(Obj_OnProgress_CONNECTING);
}
+ CLEAR_CALLED(QueryInterface_IWindowForBindingUI);
+ CLEAR_CALLED(QueryService_IWindowForBindingUI);
}
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FILE_TEST) {
if(urls[test_protocol] == SHORT_RESPONSE_URL)
else
CHECK_CALLED(Obj_OnProgress_SENDINGREQUEST);
}
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(OnResponse);
+ }
CHECK_CALLED(Obj_OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(Obj_OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
CHECK_CALLED(Obj_OnStopBinding);
}
- if(test_protocol != HTTP_TEST || test_protocol == HTTPS_TEST || emul || urls[test_protocol] == SHORT_RESPONSE_URL) {
+ if(test_protocol != HTTP_TEST || emul || urls[test_protocol] == SHORT_RESPONSE_URL || !(bindf & BINDF_ASYNCHRONOUS)) {
ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n");
ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n");
}else {
todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n");
-
- if(bindf & BINDF_ASYNCHRONOUS)
- IBindCtx_Release(bctx);
- else
- todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n");
+ IBindCtx_Release(bctx);
}
if(emul)
SET_EXPECT(BeginningTransaction);
SET_EXPECT(QueryInterface_IHttpNegotiate2);
SET_EXPECT(GetRootSecurityId);
+ SET_EXPECT(QueryInterface_IWindowForBindingUI);
}
if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST || test_protocol == FILE_TEST)
SET_EXPECT(OnProgress_SENDINGREQUEST);
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ SET_EXPECT(QueryInterface_IHttpNegotiate);
SET_EXPECT(OnResponse);
+ }
SET_EXPECT(OnProgress_MIMETYPEAVAILABLE);
SET_EXPECT(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
SET_EXPECT(OnStopBinding);
}
- hres = URLDownloadToFileW(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol], dwl_htmlW, 0, &bsc);
+ hres = URLDownloadToFileW(NULL, test_protocol == FILE_TEST ? file_url : urls[test_protocol],
+ dwl_htmlW, 0, (IBindStatusCallback*)&bsc);
ok(hres == S_OK, "URLDownloadToFile failed: %08x\n", hres);
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(QueryInterface_IHttpNegotiate2);
CHECK_CALLED(GetRootSecurityId);
}
+ CLEAR_CALLED(QueryInterface_IWindowForBindingUI);
}
if(test_protocol == FILE_TEST)
CHECK_CALLED(OnProgress_SENDINGREQUEST);
else if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
CLEAR_CALLED(OnProgress_SENDINGREQUEST); /* not called by IE7 */
- if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST)
+ if(test_protocol == HTTP_TEST || test_protocol == HTTPS_TEST) {
+ CLEAR_CALLED(QueryInterface_IHttpNegotiate);
CHECK_CALLED(OnResponse);
+ }
CHECK_CALLED(OnProgress_MIMETYPEAVAILABLE);
CHECK_CALLED(OnProgress_BEGINDOWNLOADDATA);
if(test_protocol == FILE_TEST)
ok(hres == S_OK, "CreateURLMoniker failed: %08x\n", hres);
SET_EXPECT(QueryInterface_IServiceProvider);
- hres = CreateAsyncBindCtx(0, &bsc, NULL, &bctx);
+ hres = CreateAsyncBindCtx(0, (IBindStatusCallback*)&bsc, NULL, &bctx);
ok(hres == S_OK, "CreateAsyncBindCtx failed: %08x\n\n", hres);
CHECK_CALLED(QueryInterface_IServiceProvider);
+ SET_EXPECT(QueryInterface_IBindStatusCallbackEx);
SET_EXPECT(GetBindInfo);
SET_EXPECT(QueryInterface_IInternetProtocol);
SET_EXPECT(OnStartBinding);
ok(hres == exhres || hres == MK_S_ASYNCHRONOUS,
"BindToStorage failed: %08x, expected %08x or MK_S_ASYNCHRONOUS\n", hres, exhres);
+ CLEAR_CALLED(QueryInterface_IBindStatusCallbackEx); /* IE 8 */
CHECK_CALLED(GetBindInfo);
CHECK_CALLED(QueryInterface_IInternetProtocol);
CHECK_CALLED(OnStartBinding);
create_file();
test_create();
+
+ trace("test CreateAsyncBindCtx...\n");
test_CreateAsyncBindCtx();
+
+ trace("test CreateAsyncBindCtxEx...\n");
test_CreateAsyncBindCtxEx();
+ trace("test RegisterBindStatusCallback...\n");
if(test_RegisterBindStatusCallback()) {
+ trace("test BindToStorage failures...\n");
test_BindToStorage_fail();
trace("synchronous http test (COM not initialised)...\n");
<file>generated.c</file>
<file>misc.c</file>
<file>protocol.c</file>
+ <file>sec_mgr.c</file>
<file>stream.c</file>
<file>url.c</file>
<file>testlist.c</file>