From 8630b8ab6e3b08d1189262f002f9f86ed68977a3 Mon Sep 17 00:00:00 2001 From: Juan Lang Date: Tue, 4 Oct 2005 15:50:35 +0000 Subject: [PATCH] Use wine_get_dos_file_name rather than relying on GetFullPathNameW hack. --- dlls/shell32/shellpath.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 4e3569d08c3..2611e9ec872 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -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; }