Jacek Caban : urlmon: Set BINDF_NEEDFILE flag for all not urlmon protocols.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 7 16:00:21 CST 2007


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Feb  7 17:27:35 2007 +0100

urlmon: Set BINDF_NEEDFILE flag for all not urlmon protocols.

---

 dlls/urlmon/binding.c |   41 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c
index edf3bd2..bba7af4 100644
--- a/dlls/urlmon/binding.c
+++ b/dlls/urlmon/binding.c
@@ -1089,14 +1089,46 @@ static HRESULT get_protocol(Binding *Thi
     return hres;
 }
 
+static BOOL is_urlmon_protocol(LPCWSTR url)
+{
+    static const WCHAR wszCdl[] = {'c','d','l'};
+    static const WCHAR wszFile[] = {'f','i','l','e'};
+    static const WCHAR wszFtp[]  = {'f','t','p'};
+    static const WCHAR wszGopher[] = {'g','o','p','h','e','r'};
+    static const WCHAR wszHttp[] = {'h','t','t','p'};
+    static const WCHAR wszHttps[] = {'h','t','t','p','s'};
+    static const WCHAR wszMk[]   = {'m','k'};
+
+    static const struct {
+        LPCWSTR scheme;
+        int len;
+    } protocol_list[] = {
+        {wszCdl,    sizeof(wszCdl)   /sizeof(WCHAR)},
+        {wszFile,   sizeof(wszFile)  /sizeof(WCHAR)},
+        {wszFtp,    sizeof(wszFtp)   /sizeof(WCHAR)},
+        {wszGopher, sizeof(wszGopher)/sizeof(WCHAR)},
+        {wszHttp,   sizeof(wszHttp)  /sizeof(WCHAR)},
+        {wszHttps,  sizeof(wszHttps) /sizeof(WCHAR)},
+        {wszMk,     sizeof(wszMk)    /sizeof(WCHAR)}
+    };
+
+    int i, len = strlenW(url);
+
+    for(i=0; i < sizeof(protocol_list)/sizeof(protocol_list[0]); i++) {
+        if(len >= protocol_list[i].len
+           && !memcmp(url, protocol_list[i].scheme, protocol_list[i].len*sizeof(WCHAR)))
+            return TRUE;
+    }
+
+    return FALSE;
+}
+
 static HRESULT Binding_Create(LPCWSTR url, IBindCtx *pbc, REFIID riid, Binding **binding)
 {
     Binding *ret;
     int len;
     HRESULT hres;
 
-    static const WCHAR wszFile[] = {'f','i','l','e',':'};
-
     if(!IsEqualGUID(&IID_IStream, riid)) {
         FIXME("Unsupported riid %s\n", debugstr_guid(riid));
         return E_NOTIMPL;
@@ -1159,11 +1191,10 @@ static HRESULT Binding_Create(LPCWSTR ur
 
     ret->bindf |= BINDF_FROMURLMON;
 
-    len = strlenW(url)+1;
-
-    if(len < sizeof(wszFile)/sizeof(WCHAR) || memcmp(wszFile, url, sizeof(wszFile)))
+    if(!is_urlmon_protocol(url))
         ret->bindf |= BINDF_NEEDFILE;
 
+    len = strlenW(url)+1;
     ret->url = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
     memcpy(ret->url, url, len*sizeof(WCHAR));
 




More information about the wine-cvs mailing list