switch to SHFileOperation() for file copy and move operations
Modified: trunk/reactos/subsys/system/winefile/winefile.c
Modified: trunk/reactos/subsys/system/winefile/winefile.dsp

Modified: trunk/reactos/subsys/system/winefile/winefile.c
--- trunk/reactos/subsys/system/winefile/winefile.c	2005-05-29 09:39:31 UTC (rev 15653)
+++ trunk/reactos/subsys/system/winefile/winefile.c	2005-05-29 09:58:47 UTC (rev 15654)
@@ -3811,7 +3811,6 @@
 }
 
 
-	
 static BOOL is_directory(LPCTSTR target)
 {
 	/*TODO correctly handle UNIX paths */
@@ -3844,7 +3843,8 @@
 			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 @@
 		_tsplitpath(source, NULL, NULL, fname, ext);
 
 		wsprintf(target, sAppend, path, fname, ext);
-	} else
-		lstrcpy(target, path);
+	}
 
 	return TRUE;
 }
@@ -3960,22 +3959,6 @@
 }
 
 
-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 @@
 					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 @@
 					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;}
 

Modified: trunk/reactos/subsys/system/winefile/winefile.dsp
--- trunk/reactos/subsys/system/winefile/winefile.dsp	2005-05-29 09:39:31 UTC (rev 15653)
+++ trunk/reactos/subsys/system/winefile/winefile.dsp	2005-05-29 09:58:47 UTC (rev 15654)
@@ -45,7 +45,7 @@
 # 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 @@
 # 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 @@
 # 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 @@
 # 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"