Module: wine Branch: master Commit: 2b3fea0249de423a3056a3ba3215fa86cb057e6e URL: http://source.winehq.org/git/wine.git/?a=commit;h=2b3fea0249de423a3056a3ba32...
Author: Andrew Eikum aeikum@codeweavers.com Date: Mon Jun 28 09:35:36 2010 -0500
shell32: Pass the file extension to ParseDisplayName in unixfs's SetNameOf.
---
dlls/shell32/shfldr_unixfs.c | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c index dfd7255..9c9f94a 100644 --- a/dlls/shell32/shfldr_unixfs.c +++ b/dlls/shell32/shfldr_unixfs.c @@ -1183,9 +1183,9 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H
static const WCHAR awcInvalidChars[] = { '\', '/', ':', '*', '?', '"', '<', '>', '|' }; char szSrc[FILENAME_MAX], szDest[FILENAME_MAX]; - WCHAR wszSrcRelative[MAX_PATH]; + WCHAR wszSrcRelative[MAX_PATH], *pwszExt = NULL; unsigned int i; - int cBasePathLen = lstrlenA(This->m_pszPath); + int cBasePathLen = lstrlenA(This->m_pszPath), cNameLen; struct stat statDest; LPITEMIDLIST pidlSrc, pidlDest, pidlRelativeDest; LPOLESTR lpwszName; @@ -1221,8 +1221,8 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H _ILSimpleGetTextW(pidl, wszSrcRelative, MAX_PATH) && SHELL_FS_HideExtension(wszSrcRelative)) { - WCHAR *pwszExt = PathFindExtensionW(wszSrcRelative); int cLenDest = strlen(szDest); + pwszExt = PathFindExtensionW(wszSrcRelative); WideCharToMultiByte(CP_UNIXCP, 0, pwszExt, -1, szDest + cLenDest, FILENAME_MAX - cLenDest, NULL, NULL); } @@ -1238,8 +1238,14 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_SetNameOf(IShellFolder2* iface, H return E_FAIL;
/* Build a pidl for the path of the renamed file */ - lpwszName = SHAlloc((lstrlenW(lpcwszName)+1)*sizeof(WCHAR)); /* due to const correctness. */ + cNameLen = lstrlenW(lpcwszName) + 1; + if(pwszExt) + cNameLen += lstrlenW(pwszExt); + lpwszName = SHAlloc(cNameLen*sizeof(WCHAR)); /* due to const correctness. */ lstrcpyW(lpwszName, lpcwszName); + if(pwszExt) + lstrcatW(lpwszName, pwszExt); + hr = IShellFolder2_ParseDisplayName(iface, NULL, NULL, lpwszName, NULL, &pidlRelativeDest, NULL); SHFree(lpwszName); if (FAILED(hr)) {