[SHELL32] Fix for BuildPathsList, this solves some problems showing while copying...
authorMark Jansen <mark.jansen@reactos.org>
Wed, 19 Apr 2017 18:45:33 +0000 (18:45 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Wed, 19 Apr 2017 18:45:33 +0000 (18:45 +0000)
svn path=/trunk/; revision=74380

reactos/dll/win32/shell32/droptargets/CFSDropTarget.cpp
reactos/dll/win32/shell32/droptargets/CFSDropTarget.h
reactos/dll/win32/shell32/folders/CRecycleBin.cpp

index 82de0a2..8a21cc3 100644 (file)
@@ -31,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell);
  * PIDLs relative to the given base folder
  */
 WCHAR *
-BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls)
+BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls, BOOL bRelative)
 {
     WCHAR *pwszPathsList;
     WCHAR *pwszListPos;
@@ -48,6 +48,10 @@ BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls)
 
         wcscpy(pwszListPos, wszBasePath);
         pwszListPos += iPathLen;
+
+        if (_ILIsFolder(pidls[i]) && bRelative)
+            continue;
+
         /* FIXME: abort if path too long */
         _ILSimpleGetTextW(pidls[i], pwszListPos, MAX_PATH - iPathLen);
         pwszListPos += wcslen(pwszListPos) + 1;
@@ -95,8 +99,8 @@ HRESULT WINAPI CFSDropTarget::CopyItems(IShellFolder * pSFFrom, UINT cidl,
         wcscpy(szTargetPath, sPathTarget);
         pszTarget = PathAddBackslashW(szTargetPath);
 
-        pszSrcList = BuildPathsList(szSrcPath, cidl, apidl);
-        pszTargetList = BuildPathsList(szTargetPath, cidl, apidl);
+        pszSrcList = BuildPathsList(szSrcPath, cidl, apidl, FALSE);
+        pszTargetList = BuildPathsList(szTargetPath, cidl, apidl, TRUE);
 
         if (!pszSrcList || !pszTargetList)
         {
index 61ed795..5e58204 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef _CFSDROPTARGET_H_
 #define _CFSDROPTARGET_H_
 
-WCHAR *BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls);
+WCHAR *BuildPathsList(LPCWSTR wszBasePath, int cidl, LPCITEMIDLIST *pidls, BOOL bRelative);
 
 class CFSDropTarget :
     public CComObjectRootEx<CComMultiThreadModelNoCS>,
index ba4d3c0..480d3ce 100644 (file)
@@ -1162,7 +1162,7 @@ HRESULT WINAPI DoDeleteDataObject(IDataObject *pda, DWORD fMask)
     *pwszFilename = L'\0';
 
     /* Build paths list */
-    LPWSTR pwszPaths = BuildPathsList(wszPath, lpcida->cidl, (LPCITEMIDLIST*) apidl);
+    LPWSTR pwszPaths = BuildPathsList(wszPath, lpcida->cidl, (LPCITEMIDLIST*) apidl, FALSE);
     if (!pwszPaths)
     {
         SHFree(pidl);