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

This commit is contained in:
Octavian Voicu 2011-07-29 02:29:39 +03:00 committed by Alexandre Julliard
parent db35da7335
commit 907f94e144
2 changed files with 27 additions and 3 deletions

View File

@ -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];
WCHAR wszDrive[] = { '?', ':', '\\', 0 }, dospath[PATH_MAX], *dospath_end;
int cDriveSymlinkLen;
void *redir;
TRACE("(pszDosPath=%s, pszCanonicalPath=%p)\n", debugstr_w(pszDosPath), pszCanonicalPath);
if (!pszDosPath || pszDosPath[1] != ':')
@ -392,6 +393,7 @@ 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);
while(!(pszUnixPath = wine_get_unix_file_name(dospath))){
if(has_failed){
*dospath_end = '/';
@ -405,6 +407,7 @@ static BOOL UNIXFS_get_unix_path(LPCWSTR pszDosPath, char *pszCanonicalPath)
}
*dospath_end = '\0';
}
Wow64RevertWow64FsRedirection(redir);
if(dospath_end < dospath)
return FALSE;
strcat(szPath, pszUnixPath + cDriveSymlinkLen);

View File

@ -70,6 +70,7 @@ static HRESULT (WINAPI *pSHGetItemFromDataObject)(IDataObject*,DATAOBJ_GET_ITEM_
static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*);
static HRESULT (WINAPI *pSHGetItemFromObject)(IUnknown*,REFIID,void**);
static BOOL (WINAPI *pIsWow64Process)(HANDLE, PBOOL);
static UINT (WINAPI *pGetSystemWow64DirectoryW)(LPWSTR, UINT);
static WCHAR *make_wstr(const char *str)
{
@ -165,7 +166,9 @@ static void init_function_pointers(void)
hmod = GetModuleHandleA("shlwapi.dll");
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);
ok(hr == S_OK, "SHGetMalloc failed %08x\n", hr);
@ -3727,7 +3730,7 @@ static void test_SHParseDisplayName(void)
WCHAR dirW[MAX_PATH];
WCHAR nameW[10];
HRESULT hr;
BOOL ret;
BOOL ret, is_wow64;
if (!pSHParseDisplayName)
{
@ -3775,6 +3778,24 @@ if (0)
pILFree(pidl1);
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);
}