Use wine_get_dos_file_name rather than relying on GetFullPathNameW
hack.
This commit is contained in:
parent
6ab0b0194d
commit
8630b8ab6e
|
@ -1265,12 +1265,19 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
|
|||
/* special case for "My Documents", map to $HOME */
|
||||
if (home)
|
||||
{
|
||||
WCHAR homeW[MAX_PATH];
|
||||
LPWSTR homeW = wine_get_dos_file_name(home);
|
||||
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, home, -1, homeW, MAX_PATH);
|
||||
if (GetFullPathNameW(homeW, MAX_PATH, pszPath, NULL) != 0 &&
|
||||
PathIsDirectoryW(pszPath))
|
||||
hr = S_OK;
|
||||
if (homeW)
|
||||
{
|
||||
if (PathIsDirectoryW(homeW))
|
||||
{
|
||||
lstrcpynW(pszPath, homeW, MAX_PATH);
|
||||
hr = S_OK;
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, homeW);
|
||||
}
|
||||
else
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1282,13 +1289,22 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath)
|
|||
/* special case for Desktop, map to $HOME/Desktop if it exists */
|
||||
if (home)
|
||||
{
|
||||
WCHAR desktopW[MAX_PATH];
|
||||
LPWSTR homeW = wine_get_dos_file_name(home);
|
||||
|
||||
MultiByteToWideChar(CP_UNIXCP, 0, home, -1, desktopW, MAX_PATH);
|
||||
PathAppendW(desktopW, DesktopW);
|
||||
if (GetFullPathNameW(desktopW, MAX_PATH, pszPath, NULL) != 0 &&
|
||||
PathIsDirectoryW(pszPath))
|
||||
hr = S_OK;
|
||||
if (homeW)
|
||||
{
|
||||
lstrcpynW(pszPath, homeW, MAX_PATH);
|
||||
if (PathAppendW(pszPath, DesktopW))
|
||||
{
|
||||
if (PathIsDirectoryW(pszPath))
|
||||
hr = S_OK;
|
||||
}
|
||||
else
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
HeapFree(GetProcessHeap(), 0, homeW);
|
||||
}
|
||||
else
|
||||
hr = HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue