[1/2] shell32: Check IsWow64Process() before calling Wow64 functions.
Olivier F. R. Dierick
o.dierick at piezo-forte.be
Wed Apr 20 19:12:07 CDT 2016
See bug 36838 for comments and discussion.
Supersedes patch submission 121402.
Better version of the patch. Call IsWow64Process() only once on dll
initialization and setup a global variable.
>From e7b7317755faff75b960f9143b2195344113a9a4 Mon Sep 17 00:00:00 2001
From: "Olivier F. R. Dierick" <o.dierick at piezo-forte.be>
Date: Wed, 20 Apr 2016 06:45:38 +0200
Subject: shell32: Check IsWow64Process() before calling Wow64 functions.
Signed-off-by: Olivier F. R. Dierick <o.dierick at piezo-forte.be>
---
dlls/shell32/shell32_main.c | 3 +++
dlls/shell32/shell32_main.h | 1 +
dlls/shell32/shfldr_unixfs.c | 6 ++++--
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c
index 74deecd..98e7fbf 100644
--- a/dlls/shell32/shell32_main.c
+++ b/dlls/shell32/shell32_main.c
@@ -1255,6 +1255,7 @@ HRESULT WINAPI DllGetVersion (DLLVERSIONINFO
*pdvi)
*
*/
HINSTANCE shell32_hInstance = 0;
+BOOL is_wow64 = FALSE;
/*************************************************************************
@@ -1277,6 +1278,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD
fdwReason, LPVOID fImpLoad)
GetModuleFileNameW(hinstDLL, swShell32Name, MAX_PATH);
swShell32Name[MAX_PATH - 1] = '\0';
+ if (!IsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64
= FALSE;
+
InitChangeNotifications();
break;
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 492f79f..7a4d9b2 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -42,6 +42,7 @@
*/
extern HMODULE huser32 DECLSPEC_HIDDEN;
extern HINSTANCE shell32_hInstance DECLSPEC_HIDDEN;
+extern BOOL is_wow64 DECLSPEC_HIDDEN;
/* Iconcache */
#define INVALID_INDEX -1
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index be1ba81..d9b1320 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -414,7 +414,8 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath,
char *pszCanonicalPath)
dospath_end = dospath + lstrlenW(dospath);
/* search for the most valid UNIX path possible, then append
missing
* path parts */
- Wow64DisableWow64FsRedirection(&redir);
+ if(is_wow64)
+ Wow64DisableWow64FsRedirection(&redir);
while(!(pszUnixPath = wine_get_unix_file_name(dospath))){
if(has_failed){
*dospath_end = '/';
@@ -428,7 +429,8 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath,
char *pszCanonicalPath)
}
*dospath_end = '\0';
}
- Wow64RevertWow64FsRedirection(redir);
+ if(is_wow64)
+ Wow64RevertWow64FsRedirection(redir);
if(dospath_end < dospath)
return FALSE;
strcat(szPath, pszUnixPath + cDriveSymlinkLen);
--
1.7.10.4
--
Olivier F. R. Dierick
o.dierick at piezo-forte.be
More information about the wine-patches
mailing list