Joachim Priesner : ieframe: shellbrowser: Strip 'file://' from file URLs in BEFORENAVIGATE2 callbacks.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jun 10 10:09:19 CDT 2015


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

Author: Joachim Priesner <joachim.priesner at web.de>
Date:   Tue Jun  9 16:42:42 2015 +0200

ieframe: shellbrowser: Strip 'file://' from file URLs in BEFORENAVIGATE2 callbacks.

This is a straightforward port of commit 8eb70459a18f6d8a80c9570875e2c664e6afbb56
which does the same thing for the matching method in navigate.c.

---

 dlls/ieframe/shellbrowser.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/ieframe/shellbrowser.c b/dlls/ieframe/shellbrowser.c
index 4d5a818..8145536 100644
--- a/dlls/ieframe/shellbrowser.c
+++ b/dlls/ieframe/shellbrowser.c
@@ -23,6 +23,7 @@
 
 #include "ieframe.h"
 #include "exdispid.h"
+#include "shlwapi.h"
 
 #include "wine/debug.h"
 
@@ -656,6 +657,8 @@ static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
     DISPPARAMS dp = {params, NULL, 7, 0};
     VARIANT_BOOL cancel = VARIANT_FALSE;
     SAFEARRAY *post_data;
+    WCHAR file_path[MAX_PATH];
+    DWORD file_path_len = sizeof(file_path) / sizeof(*file_path);
 
     TRACE("%p %p %s %x %s %p %d %s %d %p\n", This, pDispatch, debugstr_w(lpszUrl),
             dwFlags, debugstr_w(lpszFrameName), pPostData, cbPostData,
@@ -703,7 +706,10 @@ static HRESULT WINAPI DocObjectService_FireBeforeNavigate2(
     V_VT(params+5) = (VT_BYREF|VT_VARIANT);
     V_VARIANTREF(params+5) = &var_url;
     V_VT(&var_url) = VT_BSTR;
-    V_BSTR(&var_url) = SysAllocString(lpszUrl);
+    if(PathCreateFromUrlW(lpszUrl, file_path, &file_path_len, 0) == S_OK)
+        V_BSTR(&var_url) = SysAllocString(file_path);
+    else
+        V_BSTR(&var_url) = SysAllocString(lpszUrl);
 
     V_VT(params+6) = (VT_DISPATCH);
     V_DISPATCH(params+6) = (IDispatch*)This->doc_host->wb;




More information about the wine-cvs mailing list