- error handling for network connection dialogs
- implement "format disk" dialog
Modified: trunk/reactos/subsys/system/winefile/Sv.rc
Modified: trunk/reactos/subsys/system/winefile/cz.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/pt.rc
Modified: trunk/reactos/subsys/system/winefile/resource.h
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-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/Sv.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -59,7 +59,7 @@
         MENUITEM "&Kopiera disk...",               201
         MENUITEM "&Namnge disk...",              202
         MENUITEM SEPARATOR
-        MENUITEM "&Formatera disk...",             203
+        MENUITEM "&Formatera disk...",             ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Skapa systemdisk...", -1	/*TODO*/
 #endif

Modified: trunk/reactos/subsys/system/winefile/cz.rc
--- trunk/reactos/subsys/system/winefile/cz.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/cz.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -58,7 +58,7 @@
 		MENUITEM "&KopÝrovat disk..." ,			201
 		MENUITEM "&Jmenovka disk..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formßtovat disk..." ,			203
+		MENUITEM "&Formßtovat disk..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Vytvo°it systemov² disk...", -1	/*TODO*/
 #endif

Modified: trunk/reactos/subsys/system/winefile/de.rc
--- trunk/reactos/subsys/system/winefile/de.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/de.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -56,7 +56,7 @@
 		MENUITEM "Datentrõger &kopieren..." ,			201
 		MENUITEM "Datentrõger &benennen..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "Datentrõger &formatieren..." ,			203
+		MENUITEM "Datentrõger &formatieren..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "...",			-1	/*TODO*/
 #endif

Modified: trunk/reactos/subsys/system/winefile/en.rc
--- trunk/reactos/subsys/system/winefile/en.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/en.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -60,7 +60,7 @@
 		MENUITEM "&Copy Disk..." ,			201
 		MENUITEM "&Label Disk..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Format Disk..." ,			203
+		MENUITEM "&Format Disk..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Make System Disk...", -1	/*TODO*/
 #endif

Modified: trunk/reactos/subsys/system/winefile/es.rc
--- trunk/reactos/subsys/system/winefile/es.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/es.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -56,7 +56,7 @@
 		MENUITEM "&Copiar disco..." ,			201
 		MENUITEM "E&tiquetar disco..." ,		202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formatear disco..." ,		203
+		MENUITEM "&Formatear disco..." ,		ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Hacer disco de sistema...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/fr.rc
--- trunk/reactos/subsys/system/winefile/fr.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/fr.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -59,7 +59,7 @@
 		MENUITEM "&Copier Disque..." ,			201
 		MENUITEM "&Nommer Disque..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formater Disque..." ,			203
+		MENUITEM "&Formater Disque..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "CrÚer un disque *systÞme...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/hu.rc
--- trunk/reactos/subsys/system/winefile/hu.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/hu.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -59,7 +59,7 @@
 		MENUITEM "Lemez &mßsolßsa..." ,			201
 		MENUITEM "&Lemezcimke..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formatßlßs..." ,			203
+		MENUITEM "&Formatßlßs..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Rendszerlemez kÚszÝtÚse...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/it.rc
--- trunk/reactos/subsys/system/winefile/it.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/it.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -59,7 +59,7 @@
 		MENUITEM "&Copia Disco..." ,			201
 		MENUITEM "&Etichetta Disco..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formatta Disco..." ,			203
+		MENUITEM "&Formatta Disco..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Crea Disco di Sistema...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/nl.rc
--- trunk/reactos/subsys/system/winefile/nl.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/nl.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -55,7 +55,7 @@
 		MENUITEM "Disk &kopiÙren..." ,          201
 		MENUITEM "Disklabel maken..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "Disk &formatteren..." ,       203
+		MENUITEM "Disk &formatteren..." ,       ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "Systeemdisk maken...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/pt.rc
--- trunk/reactos/subsys/system/winefile/pt.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/pt.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -58,7 +58,7 @@
 		MENUITEM "&Copiar disco..." ,			201
 		MENUITEM "&Nomear disco..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formatar disco..." ,			203
+		MENUITEM "&Formatar disco..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Gerar disco de sistema...", -1	/*@@ */
 #endif
@@ -186,7 +186,7 @@
 		MENUITEM "&Copiar disco..." ,			201
 		MENUITEM "&Nomear disco..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Formatar disco..." ,			203
+		MENUITEM "&Formatar disco..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Gerar disco de sistema...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/resource.h
--- trunk/reactos/subsys/system/winefile/resource.h	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/resource.h	2005-05-13 15:32:04 UTC (rev 15263)
@@ -43,6 +43,7 @@
 #define ID_EXECUTE						105
 #define ID_FILE_MOVE					106
 #define ID_FILE_EXIT					115
+#define	ID_FORMAT_DISK					203
 #define	ID_CONNECT_NETWORK_DRIVE		252
 #define	ID_DISCONNECT_NETWORK_DRIVE		253
 #define ID_VIEW_NAME					401

Modified: trunk/reactos/subsys/system/winefile/ru.rc
--- trunk/reactos/subsys/system/winefile/ru.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/ru.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -55,7 +55,7 @@
 		MENUITEM "&?¯´Þ­¯ÔÓ?³ õÞ±Û..." ,			201
 		MENUITEM "&?Õ?ÛÓ ?¯ýÓ..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&ȯ­ýÓ?Þ­¯ÔÓ?³..." ,			203
+		MENUITEM "&ȯ­ýÓ?Þ­¯ÔÓ?³..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&ЯþõÓ?³ ±Þ±?ÕýÝ¹Ú õÞ±Û...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/si.rc
--- trunk/reactos/subsys/system/winefile/si.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/si.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -56,7 +56,7 @@
 		MENUITEM "&Copy Disk..." ,			201
 		MENUITEM "&Label Disk..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "&Format Disk..." ,			203
+		MENUITEM "&Format Disk..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "&Make System Disk...", -1	/*@@ */
 #endif

Modified: trunk/reactos/subsys/system/winefile/winefile.c
--- trunk/reactos/subsys/system/winefile/winefile.c	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/winefile.c	2005-05-13 15:32:04 UTC (rev 15263)
@@ -260,6 +260,17 @@
 }
 
 
+/* display network error message using WNetGetLastError() */
+static void display_network_error(HWND hwnd)
+{
+	TCHAR msg[BUFFER_LEN], provider[BUFFER_LEN], b2[BUFFER_LEN];
+	DWORD error;
+
+	if (WNetGetLastError(&error, msg, BUFFER_LEN, provider, BUFFER_LEN) == NO_ERROR)
+		MessageBox(hwnd, msg, RS(b2,IDS_WINEFILE), MB_OK);
+}
+
+
 /* allocate and initialise a directory entry */
 static Entry* alloc_entry()
 {
@@ -2000,14 +2011,31 @@
 					}
 					break;}
 
-				case ID_CONNECT_NETWORK_DRIVE:
-					WNetConnectionDialog(hwnd, RESOURCETYPE_DISK);
-					break;
+				case ID_CONNECT_NETWORK_DRIVE: {
+					DWORD ret = WNetConnectionDialog(hwnd, RESOURCETYPE_DISK);
+					if (ret!=NO_ERROR && ret!=(DWORD)-1)
+						if (ret == ERROR_EXTENDED_ERROR)
+							display_network_error(hwnd);
+						else
+							display_error(hwnd, ret);
+					break;}
 
-				case ID_DISCONNECT_NETWORK_DRIVE:
-					WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK);
-					break;
+				case ID_DISCONNECT_NETWORK_DRIVE: {
+					DWORD ret = WNetDisconnectDialog(hwnd, RESOURCETYPE_DISK);
+					if (ret!=NO_ERROR && ret!=(DWORD)-1)
+						if (ret == ERROR_EXTENDED_ERROR)
+							display_network_error(hwnd);
+						else
+							display_error(hwnd, ret);
+					break;}
 
+				case ID_FORMAT_DISK: {
+					UINT sem_org = SetErrorMode(0); /* Get the current Error Mode settings. */
+					SetErrorMode(sem_org & ~SEM_FAILCRITICALERRORS); /* Force O/S to handle */
+					SHFormatDrive(hwnd, 0 /* A: */, SHFMT_ID_DEFAULT, 0);
+					SetErrorMode(sem_org); /* Put it back the way it was. */
+					break;}
+
 				case ID_HELP:
 					WinHelp(hwnd, RS(b1,IDS_WINEFILE), HELP_INDEX, 0);
 					break;

Modified: trunk/reactos/subsys/system/winefile/zh.rc
--- trunk/reactos/subsys/system/winefile/zh.rc	2005-05-13 14:53:40 UTC (rev 15262)
+++ trunk/reactos/subsys/system/winefile/zh.rc	2005-05-13 15:32:04 UTC (rev 15263)
@@ -56,7 +56,7 @@
 		MENUITEM "©?Íãú¿&Cú®..." ,			201
 		MENUITEM "?³?¹ú¿&Lú®..." ,			202
 		MENUITEM SEPARATOR
-		MENUITEM "©±?¢?»ú¿&ú®..." ,			203
+		MENUITEM "©±?¢?»ú¿&ú®..." ,			ID_FORMAT_DISK
 #ifdef _WIN95
 		MENUITEM "¢¿?ó¤Á????ú¿&Mú®...", -1	/*@@ */
 #endif