Commit 907f94e1 authored by Octavian Voicu's avatar Octavian Voicu Committed by Alexandre Julliard

shell32: Disable WOW64 redirection when converting pidls to UNIX paths.

parent db35da73
...@@ -371,7 +371,8 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) ...@@ -371,7 +371,8 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
char *pPathTail, *pElement, *pCanonicalTail, szPath[FILENAME_MAX], *pszUnixPath, has_failed = 0, mb_path[FILENAME_MAX]; char *pPathTail, *pElement, *pCanonicalTail, szPath[FILENAME_MAX], *pszUnixPath, has_failed = 0, mb_path[FILENAME_MAX];
WCHAR wszDrive[] = { '?', ':', '\\', 0 }, dospath[PATH_MAX], *dospath_end; WCHAR wszDrive[] = { '?', ':', '\\', 0 }, dospath[PATH_MAX], *dospath_end;
int cDriveSymlinkLen; int cDriveSymlinkLen;
void *redir;
TRACE("(pszDosPath=%s, pszCanonicalPath=%p)\n", debugstr_w(pszDosPath), pszCanonicalPath); TRACE("(pszDosPath=%s, pszCanonicalPath=%p)\n", debugstr_w(pszDosPath), pszCanonicalPath);
if (!pszDosPath || pszDosPath[1] != ':') if (!pszDosPath || pszDosPath[1] != ':')
...@@ -392,6 +393,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) ...@@ -392,6 +393,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
dospath_end = dospath + lstrlenW(dospath); dospath_end = dospath + lstrlenW(dospath);
/* search for the most valid UNIX path possible, then append missing /* search for the most valid UNIX path possible, then append missing
* path parts */ * path parts */
Wow64DisableWow64FsRedirection(&redir);
while(!(pszUnixPath = wine_get_unix_file_name(dospath))){ while(!(pszUnixPath = wine_get_unix_file_name(dospath))){
if(has_failed){ if(has_failed){
*dospath_end = '/'; *dospath_end = '/';
...@@ -405,6 +407,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath) ...@@ -405,6 +407,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
} }
*dospath_end = '\0'; *dospath_end = '\0';
} }
Wow64RevertWow64FsRedirection(redir);
if(dospath_end < dospath) if(dospath_end < dospath)
return FALSE; return FALSE;
strcat(szPath, pszUnixPath + cDriveSymlinkLen); strcat(szPath, pszUnixPath + cDriveSymlinkLen);
......
...@@ -70,6 +70,7 @@ static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_ ...@@ -70,6 +70,7 @@ static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_
static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*); static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*);
static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**); static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL); static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
static WCHAR *make_wstr(const char *str) static WCHAR *make_wstr(const char *str)
{ {
...@@ -165,7 +166,9 @@ static void init_function_pointers(void) ...@@ -165,7 +166,9 @@ static void init_function_pointers(void)
hmod = GetModuleHandleA("shlwapi.dll"); hmod = GetModuleHandleA("shlwapi.dll");
pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW"); pStrRetToBufW = (void*)GetProcAddress(hmod, "StrRetToBufW");
pIsWow64Process = (void*)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process"); hmod = GetModuleHandleA("kernel32.dll");
pIsWow64Process = (void*)GetProcAddress(hmod, "IsWow64Process");
pGetSystemWow64DirectoryW = (void*)GetProcAddress(hmod, "GetSystemWow64DirectoryW");
hr = SHGetMalloc(&ppM); hr = SHGetMalloc(&ppM);
ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr); ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);
...@@ -3727,7 +3730,7 @@ static void test_SHParseDisplayName(void) ...@@ -3727,7 +3730,7 @@ static void test_SHParseDisplayName(void)
WCHAR dirW[MAX_PATH]; WCHAR dirW[MAX_PATH];
WCHAR nameW[10]; WCHAR nameW[10];
HRESULT hr; HRESULT hr;
BOOL ret; BOOL ret, is_wow64;
if (!pSHParseDisplayName) if (!pSHParseDisplayName)
{ {
...@@ -3775,6 +3778,24 @@ if (0) ...@@ -3775,6 +3778,24 @@ if (0)
pILFree(pidl1); pILFree(pidl1);
pILFree(pidl2); pILFree(pidl2);
/* system32 is not redirected to syswow64 on WOW64 */
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
if (is_wow64 && pGetSystemWow64DirectoryW)
{
*dirW = 0;
ok(GetSystemDirectoryW(dirW, MAX_PATH) > 0, "GetSystemDirectoryW failed: %u\n", GetLastError());
hr = pSHParseDisplayName(dirW, NULL, &pidl1, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
*dirW = 0;
ok(pGetSystemWow64DirectoryW(dirW, MAX_PATH) > 0, "GetSystemWow64DirectoryW failed: %u\n", GetLastError());
hr = pSHParseDisplayName(dirW, NULL, &pidl2, 0, NULL);
ok(hr == S_OK, "failed %08x\n", hr);
ret = pILIsEqual(pidl1, pidl2);
ok(ret == FALSE, "expected different idls\n");
pILFree(pidl1);
pILFree(pidl2);
}
IShellFolder_Release(desktop); IShellFolder_Release(desktop);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment