Commit b84f3093 authored by Mikołaj Zalewski's avatar Mikołaj Zalewski Committed by Alexandre Julliard

shell32: Avoid Unicode->ANSI conversion when deleting a file.

parent 9879a47f
...@@ -147,8 +147,8 @@ void FreeChangeNotifications(void); ...@@ -147,8 +147,8 @@ void FreeChangeNotifications(void);
#define ASK_CREATE_FOLDER 4 #define ASK_CREATE_FOLDER 4
#define ASK_OVERWRITE_FILE 5 #define ASK_OVERWRITE_FILE 5
BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI); BOOL SHELL_DeleteDirectoryW(LPCWSTR pwszDir, BOOL bShowUI);
BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI); BOOL SHELL_DeleteFileW(LPCWSTR pwszFile, BOOL bShowUI);
BOOL SHELL_ConfirmDialog(int nKindOfDialog, LPCSTR szDir); BOOL SHELL_ConfirmDialog(int nKindOfDialog, LPCSTR szDir);
/* 16-bit functions */ /* 16-bit functions */
......
...@@ -1164,7 +1164,8 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl) ...@@ -1164,7 +1164,8 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
{ {
IGenericSFImpl *This = impl_from_ISFHelper(iface); IGenericSFImpl *This = impl_from_ISFHelper(iface);
UINT i; UINT i;
char szPath[MAX_PATH]; WCHAR wszPath[MAX_PATH];
int iPathLen;
BOOL bConfirm = TRUE; BOOL bConfirm = TRUE;
TRACE ("(%p)(%u %p)\n", This, cidl, apidl); TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
...@@ -1179,18 +1180,22 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl) ...@@ -1179,18 +1180,22 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
bConfirm = FALSE; bConfirm = FALSE;
} }
if (This->sPathTarget)
lstrcpynW(wszPath, This->sPathTarget, MAX_PATH);
else
wszPath[0] = '\0';
PathAddBackslashW(wszPath);
iPathLen = lstrlenW(wszPath);
for (i = 0; i < cidl; i++) { for (i = 0; i < cidl; i++) {
if (!WideCharToMultiByte(CP_ACP, 0, This->sPathTarget, -1, szPath, MAX_PATH, NULL, NULL)) _ILSimpleGetTextW (apidl[i], wszPath+iPathLen, MAX_PATH-iPathLen);
szPath[0] = '\0';
PathAddBackslashA (szPath);
_ILSimpleGetText (apidl[i], szPath + strlen (szPath), MAX_PATH);
if (_ILIsFolder (apidl[i])) { if (_ILIsFolder (apidl[i])) {
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
TRACE ("delete %s\n", szPath); TRACE ("delete %s\n", debugstr_w(wszPath));
if (!SHELL_DeleteDirectoryA (szPath, bConfirm)) { if (!SHELL_DeleteDirectoryW (wszPath, bConfirm)) {
TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm); TRACE ("delete %s failed, bConfirm=%d\n", debugstr_w(wszPath), bConfirm);
return E_FAIL; return E_FAIL;
} }
pidl = ILCombine (This->pidlRoot, apidl[i]); pidl = ILCombine (This->pidlRoot, apidl[i]);
...@@ -1199,9 +1204,9 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl) ...@@ -1199,9 +1204,9 @@ ISFHelper_fnDeleteItems (ISFHelper * iface, UINT cidl, LPCITEMIDLIST * apidl)
} else if (_ILIsValue (apidl[i])) { } else if (_ILIsValue (apidl[i])) {
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
TRACE ("delete %s\n", szPath); TRACE ("delete %s\n", debugstr_w(wszPath));
if (!SHELL_DeleteFileA (szPath, bConfirm)) { if (!SHELL_DeleteFileW (wszPath, bConfirm)) {
TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm); TRACE ("delete %s failed, bConfirm=%d\n", debugstr_w(wszPath), bConfirm);
return E_FAIL; return E_FAIL;
} }
pidl = ILCombine (This->pidlRoot, apidl[i]); pidl = ILCombine (This->pidlRoot, apidl[i]);
......
...@@ -55,7 +55,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); ...@@ -55,7 +55,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
static const WCHAR wWildcardFile[] = {'*',0}; static const WCHAR wWildcardFile[] = {'*',0};
static const WCHAR wWildcardChars[] = {'*','?',0}; static const WCHAR wWildcardChars[] = {'*','?',0};
static BOOL SHELL_DeleteDirectoryW(LPCWSTR path, BOOL bShowUI);
static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec);
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec); static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec);
static DWORD SHNotifyRemoveDirectoryA(LPCSTR path); static DWORD SHNotifyRemoveDirectoryA(LPCSTR path);
...@@ -170,7 +169,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI) ...@@ -170,7 +169,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI)
return ret; return ret;
} }
static BOOL SHELL_DeleteDirectoryW(LPCWSTR pszDir, BOOL bShowUI) BOOL SHELL_DeleteDirectoryW(LPCWSTR pszDir, BOOL bShowUI)
{ {
BOOL ret = TRUE; BOOL ret = TRUE;
HANDLE hFind; HANDLE hFind;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment