mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
switch to SHFileOperation() for file copy and move operations
svn path=/trunk/; revision=15654
This commit is contained in:
parent
ff58b88eaf
commit
32ec815105
2 changed files with 19 additions and 38 deletions
|
@ -3811,7 +3811,6 @@ static void update_view_menu(ChildWnd* child)
|
|||
}
|
||||
|
||||
|
||||
|
||||
static BOOL is_directory(LPCTSTR target)
|
||||
{
|
||||
/*TODO correctly handle UNIX paths */
|
||||
|
@ -3844,7 +3843,8 @@ static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
|
|||
target[len++] = '/';
|
||||
|
||||
lstrcpy(target+len, path);
|
||||
}
|
||||
} else
|
||||
lstrcpy(target, path);
|
||||
|
||||
/* If the target already exists as directory, create a new target below this. */
|
||||
if (is_directory(path)) {
|
||||
|
@ -3854,8 +3854,7 @@ static BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
|
|||
_tsplitpath(source, NULL, NULL, fname, ext);
|
||||
|
||||
wsprintf(target, sAppend, path, fname, ext);
|
||||
} else
|
||||
lstrcpy(target, path);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -3960,22 +3959,6 @@ static HRESULT ShellFolderContextMenu(IShellFolder* shell_folder, HWND hwndParen
|
|||
}
|
||||
|
||||
|
||||
static DWORD CALLBACK CopyProgressRoutine(
|
||||
LARGE_INTEGER TotalFileSize,
|
||||
LARGE_INTEGER TotalBytesTransferred,
|
||||
LARGE_INTEGER StreamSize,
|
||||
LARGE_INTEGER StreamBytesTransferred,
|
||||
DWORD dwStreamNumber,
|
||||
DWORD dwCallbackReason,
|
||||
HANDLE hSourceFile,
|
||||
HANDLE hDestinationFile,
|
||||
LPVOID lpData
|
||||
)
|
||||
{
|
||||
return PROGRESS_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
ChildWnd* child = (ChildWnd*) GetWindowLong(hwnd, GWL_USERDATA);
|
||||
|
@ -4168,14 +4151,13 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
|
|||
TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
|
||||
|
||||
if (prompt_target(pane, source, target)) {
|
||||
/*TODO handle moving of directory trees
|
||||
if (is_directory(source) && drive_from_path(source)!=drive_from_path(target))
|
||||
...
|
||||
*/
|
||||
if (MoveFileWithProgress(source, target, CopyProgressRoutine, NULL, MOVEFILE_COPY_ALLOWED))
|
||||
SHFILEOPSTRUCT shfo = {hwnd, FO_MOVE, source, target};
|
||||
|
||||
source[lstrlen(source)+1] = '\0';
|
||||
target[lstrlen(target)+1] = '\0';
|
||||
|
||||
if (!SHFileOperation(&shfo))
|
||||
refresh_child(child);
|
||||
else
|
||||
display_error(hwnd, GetLastError());
|
||||
}
|
||||
break;}
|
||||
|
||||
|
@ -4183,14 +4165,13 @@ LRESULT CALLBACK ChildWndProc(HWND hwnd, UINT nmsg, WPARAM wparam, LPARAM lparam
|
|||
TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
|
||||
|
||||
if (prompt_target(pane, source, target)) {
|
||||
/*TODO handle copying of directory trees
|
||||
if (is_directory(source))
|
||||
...
|
||||
*/
|
||||
if (CopyFileEx(source, target, CopyProgressRoutine, NULL, NULL, COPY_FILE_RESTARTABLE|COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
|
||||
SHFILEOPSTRUCT shfo = {hwnd, FO_COPY, source, target};
|
||||
|
||||
source[lstrlen(source)+1] = '\0';
|
||||
target[lstrlen(target)+1] = '\0';
|
||||
|
||||
if (!SHFileOperation(&shfo))
|
||||
refresh_child(child);
|
||||
else
|
||||
display_error(hwnd, GetLastError());
|
||||
}
|
||||
break;}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ RSC=rc.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D WINE_UNUSED= /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D _WIN32_WINNT=0x0501 /D WINE_UNUSED= /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
|
@ -71,7 +71,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D WINE_UNUSED= /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "UNICODE" /D _WIN32_WINNT=0x0501 /D WINE_UNUSED= /FR /YX /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "_DEBUG"
|
||||
|
@ -98,7 +98,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D WINE_UNUSED= /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D _WIN32_WINNT=0x0501 /D WINE_UNUSED= /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
|
@ -125,7 +125,7 @@ LINK32=link.exe
|
|||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "UNICODE" /D WINE_UNUSED= /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D WINE_UNUSED= /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D _WIN32_WINNT=0x0501 /D WINE_UNUSED= /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x407 /d "NDEBUG"
|
||||
|
|
Loading…
Reference in a new issue