From 25493b94b16c431c902556806770715d0cb86669 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 27 Dec 2015 18:53:48 +0100 Subject: [PATCH] Added patch to check IsWoW64Process before calling Wow64 functions in UNIXFS_get_unix_path. --- README.md | 3 +- patches/patchinstall.sh | 16 +++++ ...WoW64Process-before-calling-Wow64-fu.patch | 63 +++++++++++++++++++ .../shell32-UNIXFS_get_unix_path/definition | 1 + staging/changelog | 2 + 5 files changed, 84 insertions(+), 1 deletion(-) create mode 100644 patches/shell32-UNIXFS_get_unix_path/0001-shell32-Check-IsWoW64Process-before-calling-Wow64-fu.patch create mode 100644 patches/shell32-UNIXFS_get_unix_path/definition diff --git a/README.md b/README.md index 65119e2a..439771c4 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,10 @@ Wine. All those differences are also documented on the Included bug fixes and improvements ----------------------------------- -**Bug fixes and features included in the next upcoming release [3]:** +**Bug fixes and features included in the next upcoming release [4]:** * Avoid corruption of caret when SetCaretPos() is called +* Check IsWoW64Process before calling Wow64 functions in UNIXFS_get_unix_path * SHMapHandle should not set error when NULL is passed as hShared * SysAllocStringByteLen should align terminating null WCHAR diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 683c4e83..51ab0d5c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -274,6 +274,7 @@ patch_enable_all () enable_shell32_SHCreateSessionKey="$1" enable_shell32_SHFileOperation_Move="$1" enable_shell32_SHFileOperation_Win9x="$1" + enable_shell32_UNIXFS_get_unix_path="$1" enable_shell32_UnixFS="$1" enable_shlwapi_AssocGetPerceivedType="$1" enable_shlwapi_SHMapHandle="$1" @@ -934,6 +935,9 @@ patch_enable () shell32-SHFileOperation_Win9x) enable_shell32_SHFileOperation_Win9x="$2" ;; + shell32-UNIXFS_get_unix_path) + enable_shell32_UNIXFS_get_unix_path="$2" + ;; shell32-UnixFS) enable_shell32_UnixFS="$2" ;; @@ -5437,6 +5441,18 @@ if test "$enable_shell32_SHFileOperation_Win9x" -eq 1; then ) >> "$patchlist" fi +# Patchset shell32-UNIXFS_get_unix_path +# | +# | Modified files: +# | * dlls/shell32/shfldr_unixfs.c +# | +if test "$enable_shell32_UNIXFS_get_unix_path" -eq 1; then + patch_apply shell32-UNIXFS_get_unix_path/0001-shell32-Check-IsWoW64Process-before-calling-Wow64-fu.patch + ( + echo '+ { "Olivier F. R. Dierick", "shell32: Check IsWoW64Process before calling Wow64 functions.", 2 },'; + ) >> "$patchlist" +fi + # Patchset shell32-UnixFS # | # | Modified files: diff --git a/patches/shell32-UNIXFS_get_unix_path/0001-shell32-Check-IsWoW64Process-before-calling-Wow64-fu.patch b/patches/shell32-UNIXFS_get_unix_path/0001-shell32-Check-IsWoW64Process-before-calling-Wow64-fu.patch new file mode 100644 index 00000000..b0ba6499 --- /dev/null +++ b/patches/shell32-UNIXFS_get_unix_path/0001-shell32-Check-IsWoW64Process-before-calling-Wow64-fu.patch @@ -0,0 +1,63 @@ +From 4ff58d5b7b2bef1db7dc151976e111ddea9b91a3 Mon Sep 17 00:00:00 2001 +From: "Olivier F. R. Dierick" +Date: Sat, 28 Nov 2015 06:25:33 +0100 +Subject: shell32: Check IsWoW64Process before calling Wow64 functions (try 2) + +Replace patch entry 116937. + +Fix one of the error leak source that prevents the installer to succeed +(bug 36838). + +On 32 bit Wine, the original code did set last error to +ERROR_CALL_NOT_IMPLEMENTED when calling wow64 functions. The game +installer chokes at some point when the last error is anything but zero +and fails to complete the installation. Checking if wow64 is available +before calling wow64 functions avoids that. The affected wow64 function +calls themselves are not required for proper operation on 32 bit +systems. + +Signed-off-by: Olivier F. R. Dierick +--- + dlls/shell32/shfldr_unixfs.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c +index 85383e8..7de38ba 100644 +--- a/dlls/shell32/shfldr_unixfs.c ++++ b/dlls/shell32/shfldr_unixfs.c +@@ -392,6 +392,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) + BOOL has_failed = FALSE; + WCHAR wszDrive[] = { '?', ':', '\\', 0 }, dospath[MAX_PATH], *dospath_end; + int cDriveSymlinkLen; ++ BOOL is_wow64; + void *redir; + + TRACE("(pszDosPath=%s, pszCanonicalPath=%p)\n", debugstr_w(pszDosPath), pszCanonicalPath); +@@ -408,13 +409,14 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) + HeapFree(GetProcessHeap(), 0, pszUnixPath); + if (!pElement) return FALSE; + if (szPath[strlen(szPath)-1] != '/') strcat(szPath, "/"); ++ if (!IsWow64Process(GetCurrentProcess(), &is_wow64)) is_wow64 = FALSE; + + /* Append the part relative to the drive symbolic link target. */ + lstrcpyW(dospath, pszDosPath); + 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 +430,7 @@ 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); +-- +2.6.4 + diff --git a/patches/shell32-UNIXFS_get_unix_path/definition b/patches/shell32-UNIXFS_get_unix_path/definition new file mode 100644 index 00000000..11d4df23 --- /dev/null +++ b/patches/shell32-UNIXFS_get_unix_path/definition @@ -0,0 +1 @@ +Fixes: Check IsWoW64Process before calling Wow64 functions in UNIXFS_get_unix_path diff --git a/staging/changelog b/staging/changelog index 29333316..b7c25b44 100644 --- a/staging/changelog +++ b/staging/changelog @@ -2,6 +2,8 @@ wine-staging (1.9.0) UNRELEASED; urgency=low * Added patch to align terminating null WCHAR in SysAllocStringByteLen. * Added patch to avoid corruption of caret when SetCaretPos() is called. * Added patch to avoid setting error when NULL is passed to SHMapHandle. + * Added patch to check IsWoW64Process before calling Wow64 functions in + UNIXFS_get_unix_path. * Removed patch to add a stub driver for tdi.sys (accepted upstream). * Removed patch to implement support for ws2_32.dll.WSAPoll (accepted upstream).