From de1816f9e3de7dd4847f1637744b66359b3c6504 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 14 Mar 2008 12:41:27 +0100 Subject: [PATCH] urlmon: Remove tests that fail on IE7 and make Wine behave like IE7. --- dlls/urlmon/sec_mgr.c | 34 ++++++++++++++++++++++++++++++---- dlls/urlmon/tests/misc.c | 10 ++++++---- 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 59b24485dca..027bec8b2f2 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -95,13 +95,39 @@ static HRESULT map_url_to_zone(LPCWSTR url, DWORD *zone, LPWSTR *ret_url) /* file protocol is a special case */ if(!strcmpW(schema, fileW)) { - WCHAR path[MAX_PATH]; + WCHAR path[MAX_PATH], root[20]; + WCHAR *ptr; hres = CoInternetParseUrl(secur_url, PARSE_PATH_FROM_URL, 0, path, sizeof(path)/sizeof(WCHAR), &size, 0); - if(SUCCEEDED(hres) && strchrW(path, '\\')) - *zone = 0; + if(SUCCEEDED(hres) && (ptr = strchrW(path, '\\')) && ptr-path < sizeof(root)/sizeof(WCHAR)) { + UINT type; + + memcpy(root, path, (ptr-path)*sizeof(WCHAR)); + root[ptr-path] = 0; + + type = GetDriveTypeW(root); + + switch(type) { + case DRIVE_UNKNOWN: + case DRIVE_NO_ROOT_DIR: + break; + case DRIVE_REMOVABLE: + case DRIVE_FIXED: + case DRIVE_CDROM: + case DRIVE_RAMDISK: + *zone = 0; + hres = S_OK; + break; + case DRIVE_REMOTE: + *zone = 3; + hres = S_OK; + break; + default: + FIXME("unsupported drive type %d\n", type); + } + } } if(*zone == -1) { @@ -305,7 +331,7 @@ static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManager *ifa /* file protocol is a special case */ if(strlenW(pwszUrl) >= sizeof(wszFile)/sizeof(WCHAR) - && !memcmp(url, wszFile, sizeof(wszFile))) { + && !memcmp(url, wszFile, sizeof(wszFile)) && strchrW(url, '\\')) { static const BYTE secidFile[] = {'f','i','l','e',':'}; diff --git a/dlls/urlmon/tests/misc.c b/dlls/urlmon/tests/misc.c index 01c5eaf9a7b..40701db163a 100644 --- a/dlls/urlmon/tests/misc.c +++ b/dlls/urlmon/tests/misc.c @@ -250,7 +250,7 @@ static void test_RegisterFormatEnumerator(void) 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 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', @@ -262,7 +262,8 @@ 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}; @@ -713,12 +714,13 @@ static void test_FindMimeFromData(void) } static const BYTE secid1[] = {'f','i','l','e',':',0,0,0,0}; -static const BYTE secid4[] ={'f','i','l','e',':',3,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 struct secmgr_test { LPCWSTR url; @@ -731,7 +733,7 @@ static struct secmgr_test { {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}, - {url4, 3, S_OK, sizeof(secid4), secid4, S_OK}, + {url10,3, S_OK, sizeof(secid10),secid10,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} -- 2.11.4.GIT