Module: wine Branch: master Commit: a77fb7f5508c268fbc82c30da1774d97586ccb67 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a77fb7f5508c268fbc82c30da1...
Author: Andrew Eikum aeikum@codeweavers.com Date: Mon Jun 28 12:06:27 2010 -0500
shell32: UNIX paths should be parsed by unixfs.
Some tests show that trying to create a PIDL from a path starting with '/' fails in Windows, so this change shouldn't cause a conflict with the shell namespace.
---
dlls/shell32/shfldr_desktop.c | 37 ++++++++++++++++++++++++++----------- 1 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index 46a725f..e3798a6 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -213,21 +213,36 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
if (*lpszDisplayName) { - WCHAR szPath[MAX_PATH]; - LPWSTR pathPtr; - - /* build a complete path to create a simple pidl */ - lstrcpynW(szPath, This->sPathTarget, MAX_PATH); - pathPtr = PathAddBackslashW(szPath); - if (pathPtr) + if (*lpszDisplayName == '/') { - lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath)); - hr = _ILCreateFromPathW(szPath, &pidlTemp); + /* UNIX paths should be parsed by unixfs */ + IShellFolder *unixFS; + hr = UnixFolder_Constructor(NULL, &IID_IShellFolder, (LPVOID*)&unixFS); + if (SUCCEEDED(hr)) + { + hr = IShellFolder_ParseDisplayName(unixFS, NULL, NULL, + lpszDisplayName, NULL, &pidlTemp, NULL); + IShellFolder_Release(unixFS); + } } else { - /* should never reach here, but for completeness */ - hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + /* build a complete path to create a simple pidl */ + WCHAR szPath[MAX_PATH]; + LPWSTR pathPtr; + + lstrcpynW(szPath, This->sPathTarget, MAX_PATH); + pathPtr = PathAddBackslashW(szPath); + if (pathPtr) + { + lstrcpynW(pathPtr, lpszDisplayName, MAX_PATH - (pathPtr - szPath)); + hr = _ILCreateFromPathW(szPath, &pidlTemp); + } + else + { + /* should never reach here, but for completeness */ + hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER); + } } } else