diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 547f735a2e4..89669f9f3cb 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -26,6 +26,9 @@ #include "winreg.h" #include "wininet.h" +#define NO_SHLWAPI_REG +#include "shlwapi.h" + #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(urlmon); @@ -1332,11 +1335,37 @@ HRESULT WINAPI CoInternetGetSecurityUrl(LPCWSTR pwzUrl, LPWSTR *ppwzSecUrl, PSUA */ HRESULT WINAPI CoInternetGetSecurityUrlEx(IUri *pUri, IUri **ppSecUri, PSUACTION psuAction, DWORD_PTR dwReserved) { + HRESULT hres; + BSTR secure_uri; + URL_SCHEME scheme_type; + TRACE("(%p,%p,%u,%u)\n", pUri, ppSecUri, psuAction, (DWORD)dwReserved); if(!pUri || !ppSecUri) return E_INVALIDARG; - FIXME("(%p,%p,%u,%u)\n", pUri, ppSecUri, psuAction, (DWORD)dwReserved); - return E_NOTIMPL; + hres = IUri_GetScheme(pUri, (DWORD*)&scheme_type); + if(FAILED(hres)) + return hres; + + hres = IUri_GetDisplayUri(pUri, &secure_uri); + if(FAILED(hres)) + return hres; + + /* File URIs have to hierarchical. */ + if(scheme_type == URL_SCHEME_FILE) { + const WCHAR *tmp = secure_uri; + + /* Check and see if a "//" is after the scheme name. */ + tmp += sizeof(fileW)/sizeof(WCHAR); + if(*tmp != '/' || *(tmp+1) != '/') { + SysFreeString(secure_uri); + return E_INVALIDARG; + } + } + + hres = CreateUri(secure_uri, Uri_CREATE_ALLOW_IMPLICIT_WILDCARD_SCHEME, 0, ppSecUri); + SysFreeString(secure_uri); + + return hres; } diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c index 5d6dca37430..bbf0e39b7bc 100644 --- a/dlls/urlmon/tests/sec_mgr.c +++ b/dlls/urlmon/tests/sec_mgr.c @@ -719,16 +719,17 @@ static const struct { HRESULT default_hres; BOOL todo; } sec_url_ex_tests[] = { - {"index.htm",Uri_CREATE_ALLOW_RELATIVE,"*:index.html",S_OK,"*:index.htm",S_OK,TRUE}, - {"file://c:\\Index.htm",Uri_CREATE_FILE_USE_DOS_PATH,"file:///c:/Index.htm",S_OK,"file:///c:/Index.htm",S_OK,TRUE}, - {"file:some%20file%2ejpg",0,NULL,E_INVALIDARG,NULL,E_INVALIDARG,TRUE}, - {"http://www.zone3.winetest/",0,"http://www.zone3.winetest/",S_OK,"http://www.zone3.winetest/",S_OK,TRUE}, - {"about:blank",0,"about:blank",S_OK,"about:blank",S_OK,TRUE}, - {"ftp://zone3.winetest/file.test",0,"ftp://zone3.winetest/file.test",S_OK,"ftp://zone3.winetest/file.test",S_OK,TRUE}, - {"test:123abc",0,"test:123abc",S_OK,"test:123abc",S_OK,TRUE}, - {"http:google.com/test.file",0,"http:google.com/test.file",S_OK,"http:google.com/test.file",S_OK,TRUE}, - {"ftp://test@ftp.winehq.org/",0,"ftp://ftp.winehq.org/",S_OK,"ftp://ftp.winehq.org/",S_OK,TRUE}, - {"test://google@ftp.winehq.org/",0,"test://google@ftp.winehq.org/",S_OK,"test://google@ftp.winehq.org/",S_OK,TRUE} + {"index.htm",Uri_CREATE_ALLOW_RELATIVE,"*:index.html",S_OK,"*:index.htm",S_OK}, + {"file://c:\\Index.htm",Uri_CREATE_FILE_USE_DOS_PATH,"file:///c:/Index.htm",S_OK,"file:///c:/Index.htm",S_OK}, + {"file:some%20file%2ejpg",0,NULL,E_INVALIDARG,NULL,E_INVALIDARG}, + {"file:some file.jpg",0,NULL,E_INVALIDARG,NULL,E_INVALIDARG}, + {"http://www.zone3.winetest/",0,"http://www.zone3.winetest/",S_OK,"http://www.zone3.winetest/",S_OK}, + {"about:blank",0,"about:blank",S_OK,"about:blank",S_OK}, + {"ftp://zone3.winetest/file.test",0,"ftp://zone3.winetest/file.test",S_OK,"ftp://zone3.winetest/file.test",S_OK}, + {"test:123abc",0,"test:123abc",S_OK,"test:123abc",S_OK}, + {"http:google.com/test.file",0,"http:google.com/test.file",S_OK,"http:google.com/test.file",S_OK}, + {"ftp://test@ftp.winehq.org/",0,"ftp://ftp.winehq.org/",S_OK,"ftp://ftp.winehq.org/",S_OK}, + {"test://google@ftp.winehq.org/",0,"test://google@ftp.winehq.org/",S_OK,"test://google@ftp.winehq.org/",S_OK} }; static void test_InternetGetSecurityUrlEx(void)