implement file copying
Modified: trunk/reactos/subsys/system/winefile/Sv.rc
Modified: trunk/reactos/subsys/system/winefile/cs.rc
Modified: trunk/reactos/subsys/system/winefile/de.rc
Modified: trunk/reactos/subsys/system/winefile/en.rc
Modified: trunk/reactos/subsys/system/winefile/es.rc
Modified: trunk/reactos/subsys/system/winefile/fr.rc
Modified: trunk/reactos/subsys/system/winefile/hu.rc
Modified: trunk/reactos/subsys/system/winefile/it.rc
Modified: trunk/reactos/subsys/system/winefile/nl.rc
Modified: trunk/reactos/subsys/system/winefile/pl.rc
Modified: trunk/reactos/subsys/system/winefile/pt.rc
Modified: trunk/reactos/subsys/system/winefile/resource.h
Modified: trunk/reactos/subsys/system/winefile/resource.rc
Modified: trunk/reactos/subsys/system/winefile/ru.rc
Modified: trunk/reactos/subsys/system/winefile/si.rc
Modified: trunk/reactos/subsys/system/winefile/winefile.c
Modified: trunk/reactos/subsys/system/winefile/zh.rc

Modified: trunk/reactos/subsys/system/winefile/Sv.rc
--- trunk/reactos/subsys/system/winefile/Sv.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/Sv.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -31,7 +31,7 @@
 	POPUP "&Arkiv"  {
         MENUITEM "&Íppna\tEnter",                ID_ACTIVATE
         MENUITEM "&Flytta...\tF7",                ID_FILE_MOVE
-        MENUITEM "&Kopiera...\tF8",                107
+        MENUITEM "&Kopiera...\tF8",                ID_FILE_COPY
         MENUITEM "&I urklipp...\tF9",        118
         MENUITEM "&Ta bort\tDel",                108
         MENUITEM "&Byt namn...",                  109

Modified: trunk/reactos/subsys/system/winefile/cs.rc
--- trunk/reactos/subsys/system/winefile/cs.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/cs.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -30,7 +30,7 @@
 	POPUP "&Soubor"  {
 		MENUITEM "&Otev°Ýt\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&P°esunout...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&KopÝrovat...\tF8" ,			107
+		MENUITEM "&KopÝrovat...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&Ve schrßnce...\tF9" ,		118
 		MENUITEM "&Smazat\tDel" ,			108
 		MENUITEM "P°&ejmenovat..." ,			109

Modified: trunk/reactos/subsys/system/winefile/de.rc
--- trunk/reactos/subsys/system/winefile/de.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/de.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -32,7 +32,7 @@
 	POPUP "&Datei"  {
 		MENUITEM "Í&ffnen\tEingabetaste" ,			ID_ACTIVATE
 		MENUITEM "&Verschieben...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Kopieren...\tF8" ,			107
+		MENUITEM "&Kopieren...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&In Zwischenablage...\tF9" ,		118
 		MENUITEM "&L÷schen\tEntf" ,			108
 		MENUITEM "&Umbenennen..." ,			109

Modified: trunk/reactos/subsys/system/winefile/en.rc
--- trunk/reactos/subsys/system/winefile/en.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/en.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -32,7 +32,7 @@
 	POPUP "&File"  {
 		MENUITEM "&Open\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&Move...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copy...\tF8" ,			107
+		MENUITEM "&Copy...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&In Clipboard...\tF9" ,		118
 		MENUITEM "&Delete\tDel" ,			108
 		MENUITEM "Re&name..." ,			109

Modified: trunk/reactos/subsys/system/winefile/es.rc
--- trunk/reactos/subsys/system/winefile/es.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/es.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -28,7 +28,7 @@
 	POPUP "&Archivo"  {
 		MENUITEM "&Abrir\tEnter" ,			ID_ACTIVATE
 		MENUITEM "Mo&ver...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copiar...\tF8" ,			107
+		MENUITEM "&Copiar...\tF8" ,			ID_FILE_COPY
 		MENUITEM "E&n portapapeles...\tF9" ,		118
 		MENUITEM "&Eliminar\tDel" ,			108
 		MENUITEM "&Renombrar..." ,			109

Modified: trunk/reactos/subsys/system/winefile/fr.rc
--- trunk/reactos/subsys/system/winefile/fr.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/fr.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -31,7 +31,7 @@
 	POPUP "&Fichier"  {
 		MENUITEM "&Ouvrir\tEntrÚe" ,			ID_ACTIVATE
 		MENUITEM "&DÚplacer...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copier...\tF8" ,			107
+		MENUITEM "&Copier...\tF8" ,			ID_FILE_COPY
 		MENUITEM "P&resse-Papiers...\tF9" ,		118
 		MENUITEM "&Effacer\tDel" ,			108
 		MENUITEM "Re&nommer..." ,			109

Modified: trunk/reactos/subsys/system/winefile/hu.rc
--- trunk/reactos/subsys/system/winefile/hu.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/hu.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -31,7 +31,7 @@
 	POPUP "&Fßjl"  {
 		MENUITEM "&Megynitßs\tEnter" ,			ID_ACTIVATE
 		MENUITEM "?t&helyezÚs...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Mßsolßs...\tF8" ,			107
+		MENUITEM "&Mßsolßs...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&Vßg¾lapon...\tF9" ,		118
 		MENUITEM "&T÷rlÚs\tDel" ,			108
 		MENUITEM "?t&nevezÚs..." ,			109

Modified: trunk/reactos/subsys/system/winefile/it.rc
--- trunk/reactos/subsys/system/winefile/it.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/it.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -31,7 +31,7 @@
 	POPUP "&File"  {
 		MENUITEM "&Apri\tInvio" ,			ID_ACTIVATE
 		MENUITEM "&Sposta...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copia...\tF8" ,			107
+		MENUITEM "&Copia...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&Negli Appunti...\tF9" ,		118
 		MENUITEM "&Cancella\tDel" ,			108
 		MENUITEM "Ri&nomina..." ,			109

Modified: trunk/reactos/subsys/system/winefile/nl.rc
--- trunk/reactos/subsys/system/winefile/nl.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/nl.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -27,7 +27,7 @@
 	POPUP "&Bestand"  {
 		MENUITEM "&Openen\tEnter" ,               ID_ACTIVATE
 		MENUITEM "&Verplaatsen...\tF7" ,          ID_FILE_MOVE
-		MENUITEM "&KopiÙren...\tF8" ,             107
+		MENUITEM "&KopiÙren...\tF8" ,             ID_FILE_COPY
 		MENUITEM "Naar &klembord...\tF9" ,        118
 		MENUITEM "Ver&wijderen\tDel" ,            108
 		MENUITEM "&Naam wijzigen..." ,            109

Modified: trunk/reactos/subsys/system/winefile/pl.rc
--- trunk/reactos/subsys/system/winefile/pl.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/pl.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -31,7 +31,7 @@
 	POPUP "&Plik"  {
 		MENUITEM "&Otw¾rz\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&Przenie£...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Kopiuj...\tF8" ,			107
+		MENUITEM "&Kopiuj...\tF8" ,			ID_FILE_COPY
 		MENUITEM "W s&chowku...\tF9" ,		118
 		MENUITEM "&Usu±\tDel" ,			108
 		MENUITEM "&Zmie± nazwÛ..." ,			109

Modified: trunk/reactos/subsys/system/winefile/pt.rc
--- trunk/reactos/subsys/system/winefile/pt.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/pt.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -30,7 +30,7 @@
 	POPUP "&Arquivo"  {
 		MENUITEM "A&brir\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&Mover...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copiar...\tF8" ,			107
+		MENUITEM "&Copiar...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&In Clipboard...\tF9" ,		118
 		MENUITEM "E&xcluir\tDel" ,			108
 		MENUITEM "Re&nomear..." ,			109
@@ -158,7 +158,7 @@
 	POPUP "&Ficheiro"  {
 		MENUITEM "A&brir\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&Mover...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copiar...\tF8" ,			107
+		MENUITEM "&Copiar...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&Na Area de Transferencia...\tF9" ,		118
 		MENUITEM "E&xcluir\tDel" ,			108
 		MENUITEM "Re&nomear..." ,			109

Modified: trunk/reactos/subsys/system/winefile/resource.h
--- trunk/reactos/subsys/system/winefile/resource.h	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/resource.h	2005-05-29 08:47:23 UTC (rev 15652)
@@ -43,6 +43,7 @@
 #define ID_ACTIVATE						101
 #define ID_EXECUTE						105
 #define ID_FILE_MOVE					106
+#define	ID_FILE_COPY					107
 #define ID_FILE_EXIT					115
 #define	ID_FORMAT_DISK					203
 #define	ID_CONNECT_NETWORK_DRIVE		252

Modified: trunk/reactos/subsys/system/winefile/resource.rc
--- trunk/reactos/subsys/system/winefile/resource.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/resource.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -21,6 +21,7 @@
 	VK_F1, ID_HELP, VIRTKEY, NOINVERT
 	VK_F5, ID_REFRESH, VIRTKEY, NOINVERT
 	VK_F7, ID_FILE_MOVE, VIRTKEY, NOINVERT
+	VK_F8, ID_FILE_COPY, VIRTKEY, NOINVERT
 	VK_RETURN, ID_ACTIVATE, VIRTKEY, NOINVERT
 #ifndef _NO_EXTENSIONS
 	"X", ID_FILE_EXIT, VIRTKEY, ALT, NOINVERT

Modified: trunk/reactos/subsys/system/winefile/ru.rc
--- trunk/reactos/subsys/system/winefile/ru.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/ru.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -27,7 +27,7 @@
 	POPUP "&ÈÓÚÙ"  {
 		MENUITEM "&??Û­¹?³\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&¤Õ­ÕýÕ±?Þ?³...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&?¯´Þ­¯ÔÓ?³...\tF8" ,			107
+		MENUITEM "&?¯´Þ­¯ÔÓ?³...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&? ß¾¶Õ­ ¯ßýÕÝÓ...\tF9" ,		118
 		MENUITEM "&ËõÓÙÞ?³\tDel" ,			108
 		MENUITEM "¤Õ­ÕÞýÕݯÔÓ?³..." ,			109

Modified: trunk/reactos/subsys/system/winefile/si.rc
--- trunk/reactos/subsys/system/winefile/si.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/si.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -28,7 +28,7 @@
 	POPUP "&File"  {
 		MENUITEM "&Open\tEnter" ,			ID_ACTIVATE
 		MENUITEM "&Move...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "&Copy...\tF8" ,			107
+		MENUITEM "&Copy...\tF8" ,			ID_FILE_COPY
 		MENUITEM "&In Clipboard...\tF9" ,		118
 		MENUITEM "&Delete\tDel" ,			108
 		MENUITEM "Re&name..." ,			109

Modified: trunk/reactos/subsys/system/winefile/winefile.c
--- trunk/reactos/subsys/system/winefile/winefile.c	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/winefile.c	2005-05-29 08:47:23 UTC (rev 15652)
@@ -3811,6 +3811,33 @@
 }
 
 
+BOOL prompt_target(Pane* pane, LPTSTR source, LPTSTR target)
+{
+	int len, ret;
+
+	get_path(pane->cur, target);
+
+	ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), pane->hwnd, DestinationDlgProc, (LPARAM)target);
+	if (ret != IDOK)
+		return FALSE;
+
+	if (target[0]!='/' && target[1]!=':') {
+		get_path(pane->cur->up, source);
+		len = lstrlen(source);
+
+		if (source[len-1]!='\\' && source[len-1]!='/')
+			source[len++] = '/';
+
+		lstrcpy(source+len, target);
+		lstrcpy(target, source);
+	}
+
+	get_path(pane->cur, source);
+
+	return TRUE;
+}
+
+
 static IContextMenu2* s_pctxmenu2 = NULL;
 
 #ifndef __MINGW32__	/* IContextMenu3 missing in MinGW (as of 6.2.2005) */
@@ -4099,39 +4126,25 @@
 					break;
 
 				case ID_FILE_MOVE: {
-					TCHAR new_name[BUFFER_LEN], old_name[BUFFER_LEN];
-					int len, ret;
+					TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
 
-					get_path(pane->cur, new_name);
-
-					ret = DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_SELECT_DESTINATION), hwnd, DestinationDlgProc, (LPARAM)new_name);
-					if (ret != IDOK)
-						break;
-
-					if (new_name[0]!='/' && new_name[1]!=':') {
-						get_path(pane->cur->up, old_name);
-						len = lstrlen(old_name);
-
-						if (old_name[len-1]!='\\' && old_name[len-1]!='/')
-							old_name[len++] = '/';
-
-						lstrcpy(old_name+len, new_name);
-						lstrcpy(new_name, old_name);
+					if (prompt_target(pane, source, target)) {
+						if (MoveFileEx(source, target, MOVEFILE_COPY_ALLOWED))
+							refresh_child(child);
+						else
+							display_error(hwnd, GetLastError());
 					}
+					break;}
 
-					get_path(pane->cur, old_name);
+				case ID_FILE_COPY: {
+					TCHAR source[BUFFER_LEN], target[BUFFER_LEN];
 
-					if (MoveFileEx(old_name, new_name, MOVEFILE_COPY_ALLOWED)) {
-						if (pane->treePane) {
-							pane->root->scanned = FALSE;
-							pane->cur = pane->root;
-							activate_entry(child, pane, hwnd);
-						}
+					if (prompt_target(pane, source, target)) {
+						if (CopyFileEx(source, target, NULL, NULL, NULL, COPY_FILE_RESTARTABLE|COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
+							refresh_child(child);
 						else
-							refresh_child(child);
+							display_error(hwnd, GetLastError());
 					}
-					else
-						display_error(hwnd, GetLastError());
 					break;}
 
 				case ID_VIEW_SORT_NAME:

Modified: trunk/reactos/subsys/system/winefile/zh.rc
--- trunk/reactos/subsys/system/winefile/zh.rc	2005-05-29 08:38:23 UTC (rev 15651)
+++ trunk/reactos/subsys/system/winefile/zh.rc	2005-05-29 08:47:23 UTC (rev 15652)
@@ -28,7 +28,7 @@
 	POPUP "????ú¿&Fú®"  {
 		MENUITEM "???¬ú¿&Oú®\tEnter" ,			ID_ACTIVATE
 		MENUITEM "Êã»ú¿&Mú®...\tF7" , 			ID_FILE_MOVE
-		MENUITEM "©?Íãú¿&Cú®...\tF8" ,			107
+		MENUITEM "©?Íãú¿&Cú®...\tF8" ,			ID_FILE_COPY
 		MENUITEM "??Ë??¶?¨?Õú¿&Iú®...\tF9" ,		118
 		MENUITEM "?¥?²ú¿&Dú®\tDel" ,			108
 		MENUITEM "©??¹ú¿&Nú®..." ,			109