Thomas Mullaly : urlmon: Added basic CoInternetGetSecurityUrlEx implementation.

Alexandre Julliard julliard at winehq.org
Fri Jan 21 11:08:19 CST 2011


Module: wine
Branch: master
Commit: 540a56a66ecb94c5bde084dca084a73b074cb94c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=540a56a66ecb94c5bde084dca084a73b074cb94c

Author: Thomas Mullaly <thomas.mullaly at gmail.com>
Date:   Sun Jan 16 23:40:08 2011 -0500

urlmon: Added basic CoInternetGetSecurityUrlEx implementation.

---

 dlls/urlmon/sec_mgr.c       |   33 +++++++++++++++++++++++++++++++--
 dlls/urlmon/tests/sec_mgr.c |   21 +++++++++++----------
 2 files changed, 42 insertions(+), 12 deletions(-)

diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c
index 547f735..89669f9 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 5d6dca3..bbf0e39 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://[email protected]/",0,"ftp://ftp.winehq.org/",S_OK,"ftp://ftp.winehq.org/",S_OK,TRUE},
-    {"test://[email protected]/",0,"test://[email protected]/",S_OK,"test://[email protected]/",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://[email protected]/",0,"ftp://ftp.winehq.org/",S_OK,"ftp://ftp.winehq.org/",S_OK},
+    {"test://[email protected]/",0,"test://[email protected]/",S_OK,"test://[email protected]/",S_OK}
 };
 
 static void test_InternetGetSecurityUrlEx(void)




More information about the wine-cvs mailing list