[PATCH] mshtml: Make sure LoadLibraryEx() will search directory of xul.

Jactry Zeng jzeng at codeweavers.com
Wed Nov 28 08:17:08 CST 2018


Some applications call SetDefaultDllDirectories(0xc00) which will override
directory of xul and let xul can't find its dependence. So let's add
xul's path by AddDllDirectory() before calling LoadLibraryEx().

Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
 dlls/mshtml/nsembed.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index 9acb0d29e8..a157afc3e9 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -488,6 +488,7 @@ static BOOL load_xul(const PRUnichar *gre_path)
 {
     static const WCHAR xul_dllW[] = {'\\','x','u','l','.','d','l','l',0};
     WCHAR file_name[MAX_PATH];
+    DLL_DIRECTORY_COOKIE cookie;
 
     strcpyW(file_name, gre_path);
     strcatW(file_name, xul_dllW);
@@ -496,7 +497,9 @@ static BOOL load_xul(const PRUnichar *gre_path)
 
     set_environment(gre_path);
 
+    cookie = AddDllDirectory(gre_path);
     xul_handle = LoadLibraryExW(file_name, 0, LOAD_WITH_ALTERED_SEARCH_PATH);
+    RemoveDllDirectory(cookie);
     if(!xul_handle) {
         WARN("Could not load XUL: %d\n", GetLastError());
         return FALSE;
-- 
2.19.2




More information about the wine-devel mailing list