Mikołaj Zalewski : shell32: Avoid Unicode-> ANSI conversion when deleting a file.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jun 2 14:11:52 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: b84f3093d56cab18771746b293fe6fe0f189669f
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=b84f3093d56cab18771746b293fe6fe0f189669f
Author: Mikołaj Zalewski <mikolaj at zalewski.pl>
Date: Fri Jun 2 17:08:58 2006 +0200
shell32: Avoid Unicode->ANSI conversion when deleting a file.
---
dlls/shell32/shell32_main.h | 4 ++--
dlls/shell32/shfldr_fs.c | 27 ++++++++++++++++-----------
dlls/shell32/shlfileop.c | 3 +--
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 8800a55..7ead345 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -147,8 +147,8 @@ #define ASK_DELETE_MULTIPLE_ITEM 3
#define ASK_CREATE_FOLDER 4
#define ASK_OVERWRITE_FILE 5
-BOOL SHELL_DeleteDirectoryA(LPCSTR pszDir, BOOL bShowUI);
-BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI);
+BOOL SHELL_DeleteDirectoryW(LPCWSTR pwszDir, BOOL bShowUI);
+BOOL SHELL_DeleteFileW(LPCWSTR pwszFile, BOOL bShowUI);
BOOL SHELL_ConfirmDialog(int nKindOfDialog, LPCSTR szDir);
/* 16-bit functions */
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 19c5bca..1ac8d0f 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -1164,7 +1164,8 @@ ISFHelper_fnDeleteItems (ISFHelper * ifa
{
IGenericSFImpl *This = impl_from_ISFHelper(iface);
UINT i;
- char szPath[MAX_PATH];
+ WCHAR wszPath[MAX_PATH];
+ int iPathLen;
BOOL bConfirm = TRUE;
TRACE ("(%p)(%u %p)\n", This, cidl, apidl);
@@ -1179,18 +1180,22 @@ ISFHelper_fnDeleteItems (ISFHelper * ifa
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++) {
- if (!WideCharToMultiByte(CP_ACP, 0, This->sPathTarget, -1, szPath, MAX_PATH, NULL, NULL))
- szPath[0] = '\0';
- PathAddBackslashA (szPath);
- _ILSimpleGetText (apidl[i], szPath + strlen (szPath), MAX_PATH);
+ _ILSimpleGetTextW (apidl[i], wszPath+iPathLen, MAX_PATH-iPathLen);
if (_ILIsFolder (apidl[i])) {
LPITEMIDLIST pidl;
- TRACE ("delete %s\n", szPath);
- if (!SHELL_DeleteDirectoryA (szPath, bConfirm)) {
- TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
+ TRACE ("delete %s\n", debugstr_w(wszPath));
+ if (!SHELL_DeleteDirectoryW (wszPath, bConfirm)) {
+ TRACE ("delete %s failed, bConfirm=%d\n", debugstr_w(wszPath), bConfirm);
return E_FAIL;
}
pidl = ILCombine (This->pidlRoot, apidl[i]);
@@ -1199,9 +1204,9 @@ ISFHelper_fnDeleteItems (ISFHelper * ifa
} else if (_ILIsValue (apidl[i])) {
LPITEMIDLIST pidl;
- TRACE ("delete %s\n", szPath);
- if (!SHELL_DeleteFileA (szPath, bConfirm)) {
- TRACE ("delete %s failed, bConfirm=%d\n", szPath, bConfirm);
+ TRACE ("delete %s\n", debugstr_w(wszPath));
+ if (!SHELL_DeleteFileW (wszPath, bConfirm)) {
+ TRACE ("delete %s failed, bConfirm=%d\n", debugstr_w(wszPath), bConfirm);
return E_FAIL;
}
pidl = ILCombine (This->pidlRoot, apidl[i]);
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index 3e087da..64e66e3 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -55,7 +55,6 @@ #define FO_MASK 0xF
static const WCHAR wWildcardFile[] = {'*',0};
static const WCHAR wWildcardChars[] = {'*','?',0};
-static BOOL SHELL_DeleteDirectoryW(LPCWSTR path, BOOL bShowUI);
static DWORD SHNotifyCreateDirectoryA(LPCSTR path, LPSECURITY_ATTRIBUTES sec);
static DWORD SHNotifyCreateDirectoryW(LPCWSTR path, LPSECURITY_ATTRIBUTES sec);
static DWORD SHNotifyRemoveDirectoryA(LPCSTR path);
@@ -170,7 +169,7 @@ BOOL SHELL_DeleteDirectoryA(LPCSTR pszDi
return ret;
}
-static BOOL SHELL_DeleteDirectoryW(LPCWSTR pszDir, BOOL bShowUI)
+BOOL SHELL_DeleteDirectoryW(LPCWSTR pszDir, BOOL bShowUI)
{
BOOL ret = TRUE;
HANDLE hFind;
More information about the wine-cvs
mailing list