* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "config.h"
-#include "wine/port.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdio.h>
-
-#define COBJMACROS
-#define NONAMELESSUNION
-#define NONAMELESSSTRUCT
-
-#include "winerror.h"
-#include "windef.h"
-#include "winbase.h"
-#include "winreg.h"
-#include "wingdi.h"
-#include "winuser.h"
-
-#include "ole2.h"
-#include "shlguid.h"
-
-#include "enumidlist.h"
-#include "pidl.h"
-#include "undocshell.h"
-#include "shell32_main.h"
-#include "shresdef.h"
-#include "shlwapi.h"
-#include "shellfolder.h"
-#include "wine/debug.h"
-#include "debughlp.h"
-#include "shfldr.h"
+#include <precomp.h>
WINE_DEFAULT_DEBUG_CHANNEL (shell);
UINT cfShellIDList; /* clipboardformat for IDropTarget */
BOOL fAcceptFmt; /* flag for pending Drop */
-} IGenericSFImpl;
+} IGenericSFImpl, *LPIGenericSFImpl;
static const IUnknownVtbl unkvt;
static const IShellFolder2Vtbl sfvt;
static const IDropTargetVtbl dtvt;
static const ISFHelperVtbl shvt;
-static inline IGenericSFImpl *impl_from_IShellFolder2( IShellFolder2 *iface )
+static LPIGenericSFImpl __inline impl_from_IShellFolder2( IShellFolder2 *iface )
{
- return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblShellFolder));
+ return (LPIGenericSFImpl)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblShellFolder));
}
-static inline IGenericSFImpl *impl_from_IPersistFolder3( IPersistFolder3 *iface )
+static LPIGenericSFImpl __inline impl_from_IPersistFolder3( IPersistFolder3 *iface )
{
- return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblPersistFolder3));
+ return (LPIGenericSFImpl)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblPersistFolder3));
}
-static inline IGenericSFImpl *impl_from_IDropTarget( IDropTarget *iface )
+static LPIGenericSFImpl __inline impl_from_IDropTarget( IDropTarget *iface )
{
- return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblDropTarget));
+ return (LPIGenericSFImpl)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblDropTarget));
}
-static inline IGenericSFImpl *impl_from_ISFHelper( ISFHelper *iface )
+static LPIGenericSFImpl __inline impl_from_ISFHelper( ISFHelper *iface )
{
- return (IGenericSFImpl *)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblSFHelper));
+ return (LPIGenericSFImpl)((char*)iface - FIELD_OFFSET(IGenericSFImpl, lpvtblSFHelper));
}
/* build the full pathname to the element */
lstrcpynW(szPath, This->sPathTarget, MAX_PATH - 1);
PathAddBackslashW(szPath);
- len = lstrlenW(szPath);
+ len = wcslen(szPath);
lstrcpynW(szPath + len, szElement, MAX_PATH - len);
/* get the pidl */
{
lstrcpynW(pszPath, This->sPathTarget, MAX_PATH);
PathAddBackslashW(pszPath);
- len = lstrlenW(pszPath);
+ len = wcslen(pszPath);
}
_ILSimpleGetTextW(pidl, pszPath + len, MAX_PATH + 1 - len);
if (!_ILIsFolder(pidl)) SHELL_FS_ProcessDisplayFilename(pszPath, dwFlags);
if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
WCHAR *ext = PathFindExtensionW(szSrc);
if(*ext != '\0') {
- INT len = strlenW(szDest);
+ INT len = wcslen(szDest);
lstrcpynW(szDest + len, ext, MAX_PATH - len);
}
}
dwFetched) {
_ILSimpleGetTextW (pidl, wszText, MAX_PATH);
if (0 == lstrcmpiW (wszText, pwszName)) {
- snprintfW (pwszName, uLen, wszFormat, wszNewFolder, i++);
+ _snwprintf (pwszName, uLen, wszFormat, wszNewFolder, i++);
if (i > 99) {
hr = E_FAIL;
break;
sizeof (wszTempText));
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption,
sizeof (wszCaption));
- sprintfW (wszText, wszTempText, wszNewDir);
+ swprintf (wszText, wszTempText, wszNewDir);
MessageBoxW (hwnd, wszText, wszCaption, MB_OK | MB_ICONEXCLAMATION);
}
int iPathLen;
int i;
- iPathLen = lstrlenW(wszBasePath);
+ iPathLen = wcslen(wszBasePath);
wszPathsList = HeapAlloc(GetProcessHeap(), 0, MAX_PATH*sizeof(WCHAR)*cidl+1);
wszListPos = wszPathsList;
lstrcpynW(wszListPos, wszBasePath, MAX_PATH);
/* FIXME: abort if path too long */
_ILSimpleGetTextW(pidls[i], wszListPos+iPathLen, MAX_PATH-iPathLen);
- wszListPos += lstrlenW(wszListPos)+1;
+ wszListPos += wcslen(wszListPos)+1;
}
*wszListPos=0;
return wszPathsList;
SHFree(pidl);
}
- wszCurrentPath += lstrlenW(wszCurrentPath)+1;
+ wszCurrentPath += wcslen(wszCurrentPath)+1;
}
HeapFree(GetProcessHeap(), 0, wszPathsList);
return ret;
WCHAR szTargetPath[MAX_PATH];
SHFILEOPSTRUCTW op;
LPITEMIDLIST pidl;
- LPWSTR pszSrc, pszTarget, pszSrcList, pszTargetList;
- int res;
+ LPWSTR pszSrc, pszTarget, pszSrcList, pszTargetList, pszFileName;
+ int res, length;
+ HRESULT hr;
STRRET strRet;
IGenericSFImpl *This = impl_from_ISFHelper(iface);
TRACE ("(%p)->(%p,%u,%p)\n", This, pSFFrom, cidl, apidl);
- IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2, (LPVOID *) & ppf2);
- if (ppf2)
+ hr = IShellFolder_QueryInterface (pSFFrom, &IID_IPersistFolder2, (LPVOID *) & ppf2);
+ if (SUCCEEDED(hr))
{
if (FAILED(IPersistFolder2_GetCurFolder (ppf2, &pidl)))
{
res = SHFileOperationW(&op);
- HeapFree(GetProcessHeap(), 0, pszSrc);
- HeapFree(GetProcessHeap(), 0, pszTarget);
+ if (res == DE_SAMEFILE)
+ {
+ length = wcslen(szTargetPath);
+
+ pszFileName = wcsrchr(pszSrcList, '\\');
+ pszFileName++;
+
+ if (LoadStringW(shell32_hInstance, IDS_COPY_OF, pszTarget, MAX_PATH - length))
+ {
+ wcscat(szTargetPath, L" ");
+ }
+
+ wcscat(szTargetPath, pszFileName);
+ op.pTo = szTargetPath;
+
+ res = SHFileOperationW(&op);
+ }
+
+ HeapFree(GetProcessHeap(), 0, pszSrcList);
+ HeapFree(GetProcessHeap(), 0, pszTargetList);
if (res)
return E_FAIL;
/* set my path */
if (SHGetPathFromIDListW (pidl, wszTemp)) {
- int len = strlenW(wszTemp);
+ int len = wcslen(wszTemp);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget)
return E_OUTOFMEMORY;
if (ppfti->csidl != -1) {
if (SHGetSpecialFolderPathW (0, wszTemp, ppfti->csidl,
ppfti->csidl & CSIDL_FLAG_CREATE)) {
- int len = strlenW(wszTemp);
+ int len = wcslen(wszTemp);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget)
return E_OUTOFMEMORY;
memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
}
} else if (ppfti->szTargetParsingName[0]) {
- int len = strlenW(ppfti->szTargetParsingName);
+ int len = wcslen(ppfti->szTargetParsingName);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget)
return E_OUTOFMEMORY;
(len + 1) * sizeof(WCHAR));
} else if (ppfti->pidlTargetFolder) {
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) {
- int len = strlenW(wszTemp);
+ int len = wcslen(wszTemp);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget)
return E_OUTOFMEMORY;