Module: wine Branch: master Commit: 872c07a967f374e5216911f28863e5166e245bd0 URL: http://source.winehq.org/git/wine.git/?a=commit;h=872c07a967f374e5216911f288...
Author: Jay Yang jkelleyy@gmail.com Date: Tue Jul 19 12:25:15 2011 -0400
shell32: Make ISFHelper_fnCopyItems actually copy the items.
---
dlls/shell32/shfldr_fs.c | 48 +++++++++++++++++++++++++++------------------ 1 files changed, 29 insertions(+), 19 deletions(-)
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index c0e9ae5..969f18d 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -1383,13 +1383,15 @@ static HRESULT WINAPI ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPCITEMIDLIST * apidl) { - UINT i; + HRESULT ret=E_FAIL; IPersistFolder2 *ppf2 = NULL; - char szSrcPath[MAX_PATH], - szDstPath[MAX_PATH]; - + WCHAR wszSrcPathRoot[MAX_PATH], + wszDstPath[MAX_PATH+1]; + WCHAR *wszSrcPathsList; IGenericSFImpl *This = impl_from_ISFHelper(iface);
+ SHFILEOPSTRUCTW fop; + TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2, @@ -1398,24 +1400,32 @@ ISFHelper_fnCopyItems (ISFHelper * iface, IShellFolder * pSFFrom, UINT cidl, LPITEMIDLIST pidl;
if (SUCCEEDED (IPersistFolder2_GetCurFolder (ppf2, &pidl))) { - for (i = 0; i < cidl; i++) { - SHGetPathFromIDListA (pidl, szSrcPath); - PathAddBackslashA (szSrcPath); - _ILSimpleGetText (apidl[i], szSrcPath + strlen (szSrcPath), - MAX_PATH); - - if (!WideCharToMultiByte(CP_ACP, 0, This->sPathTarget, -1, szDstPath, MAX_PATH, NULL, NULL)) - szDstPath[0] = '\0'; - PathAddBackslashA (szDstPath); - _ILSimpleGetText (apidl[i], szDstPath + strlen (szDstPath), - MAX_PATH); - MESSAGE ("would copy %s to %s\n", szSrcPath, szDstPath); + SHGetPathFromIDListW (pidl, wszSrcPathRoot); + ZeroMemory(wszDstPath, MAX_PATH+1); + if (This->sPathTarget) + lstrcpynW(wszDstPath, This->sPathTarget, MAX_PATH); + PathAddBackslashW(wszSrcPathRoot); + PathAddBackslashW(wszDstPath); + wszSrcPathsList = build_paths_list(wszSrcPathRoot, cidl, apidl); + ZeroMemory(&fop, sizeof(fop)); + fop.hwnd = GetActiveWindow(); + fop.wFunc = FO_COPY; + fop.pFrom = wszSrcPathsList; + fop.pTo = wszDstPath; + fop.fFlags = FOF_ALLOWUNDO; + ret = S_OK; + if(SHFileOperationW(&fop)) + { + WARN("Copy failed\n"); + ret = E_FAIL; } - SHFree (pidl); + HeapFree(GetProcessHeap(), 0, wszSrcPathsList); + } - IPersistFolder2_Release (ppf2); + SHFree(pidl); + IPersistFolder2_Release(ppf2); } - return S_OK; + return ret; }
static const ISFHelperVtbl shvt =