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

Joachim Priesner joachim.priesner at web.de
Tue Jun 9 09:42:42 CDT 2015


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;
-- 
1.8.4.5




More information about the wine-patches mailing list