[USETUP]
authorGabriel Ilardi <gabrielilardi@hotmail.it>
Mon, 24 May 2010 20:53:32 +0000 (20:53 +0000)
committerGabriel Ilardi <gabrielilardi@hotmail.it>
Mon, 24 May 2010 20:53:32 +0000 (20:53 +0000)
- Check for required minimum disk space eventually warn the user.
- Added Italian and Spanish warnings, the other languages need translation.
- Patch by R.T.Sivakumar modified by me.
See issue #3302 for more details.

svn path=/trunk/; revision=47341

16 files changed:
reactos/base/setup/usetup/errorcode.h
reactos/base/setup/usetup/interface/usetup.c
reactos/base/setup/usetup/lang/bg-BG.h
reactos/base/setup/usetup/lang/en-US.h
reactos/base/setup/usetup/lang/es-ES.h
reactos/base/setup/usetup/lang/et-EE.h
reactos/base/setup/usetup/lang/fr-FR.h
reactos/base/setup/usetup/lang/it-IT.h
reactos/base/setup/usetup/lang/ja-JP.h
reactos/base/setup/usetup/lang/lt-LT.h
reactos/base/setup/usetup/lang/nl-NL.h
reactos/base/setup/usetup/lang/pl-PL.h
reactos/base/setup/usetup/lang/ru-RU.h
reactos/base/setup/usetup/lang/sk-SK.h
reactos/base/setup/usetup/lang/sv-SE.h
reactos/base/setup/usetup/lang/uk-UA.h

index 4ecc11d..79461a7 100644 (file)
@@ -65,6 +65,7 @@ typedef enum
     ERROR_UPDATE_LOCALESETTINGS,
     ERROR_ADDING_KBLAYOUTS,
     ERROR_UPDATE_GEOID,
+    ERROR_INSUFFICIENT_DISKSPACE,
 
     ERROR_LAST_ERROR_CODE
 }ERROR_NUMBER;
index f2bbd64..5284d28 100644 (file)
@@ -31,6 +31,9 @@
 #define NDEBUG
 #include <debug.h>
 
+/* required free disk space in MB */
+#define MINIMUMDISKSIZE    350
+
 /* GLOBALS ******************************************************************/
 
 HANDLE ProcessHeap;
@@ -1381,6 +1384,31 @@ LayoutSettingsPage(PINPUT_RECORD Ir)
     return DISPLAY_SETTINGS_PAGE;
 }
 
+static BOOL IsDiskSizeValid(PPARTENTRY PartEntry)
+{
+    ULONGLONG m;
+    /*  check for unpartitioned space  */
+    m = PartEntry->UnpartitionedLength; 
+    m = (m + (1 << 19)) >> 20;  /* in MBytes (rounded) */
+    if( m > MINIMUMDISKSIZE) 
+    {
+        return TRUE;
+    }
+       
+    // check for partitioned space 
+    m = PartEntry->PartInfo[0].PartitionLength.QuadPart;
+    m = (m + (1 << 19)) >> 20;  /* in MBytes (rounded) */
+    if( m < MINIMUMDISKSIZE) 
+    {
+        /* partition is too small so ask for another partion */
+        DPRINT1("Partition too small");
+        return FALSE;
+    }
+    else
+    {
+        return TRUE;
+    }
+}
 
 static PAGE_NUMBER
 SelectPartitionPage(PINPUT_RECORD Ir)
@@ -1434,9 +1462,13 @@ SelectPartitionPage(PINPUT_RECORD Ir)
         {
             if (AutoPartition)
             {
-                PPARTENTRY PartEntry = PartEntry = PartitionList->CurrentPartition;
+                PPARTENTRY PartEntry = PartitionList->CurrentPartition;
                 ULONG MaxSize = (PartEntry->UnpartitionedLength + (1 << 19)) >> 20;  /* in MBytes (rounded) */
-
+                if(!IsDiskSizeValid(PartitionList->CurrentPartition))
+                {
+                    MUIDisplayError(ERROR_INSUFFICIENT_DISKSPACE, Ir, POPUP_WAIT_ANY_KEY);
+                    return SELECT_PARTITION_PAGE; /* let the user select another partition */
+                }
                 CreateNewPartition(PartitionList,
                                    MaxSize,
                                    TRUE);
@@ -1446,6 +1478,11 @@ SelectPartitionPage(PINPUT_RECORD Ir)
         }
         else
         {
+            if(!IsDiskSizeValid(PartitionList->CurrentPartition))
+            {
+                MUIDisplayError(ERROR_INSUFFICIENT_DISKSPACE, Ir, POPUP_WAIT_ANY_KEY);
+                return SELECT_PARTITION_PAGE; /* let the user select another partition */
+            }
             return(SELECT_FILE_SYSTEM_PAGE);
         }
     }
@@ -1489,6 +1526,11 @@ SelectPartitionPage(PINPUT_RECORD Ir)
         }
         else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN)  /* ENTER */
         {
+            if(!IsDiskSizeValid(PartitionList->CurrentPartition))
+            {
+                MUIDisplayError(ERROR_INSUFFICIENT_DISKSPACE, Ir, POPUP_WAIT_ANY_KEY);
+                return SELECT_PARTITION_PAGE; /* let the user select another partition */
+            }
             if (PartitionList->CurrentPartition == NULL ||
                 PartitionList->CurrentPartition->Unpartitioned == TRUE)
             {
index 23bd1f4..7063a4d 100644 (file)
@@ -1483,6 +1483,12 @@ MUI_ERROR bgBGErrorEntries[] =
         "\8d¥ãᯥ譮 ¤®¡ ¢ï­¥ ­  ª« ¢¨ âã୨⥠¯®¤à¥¤¡¨ ¢ à¥£¨áâêà .\n"
         "ENTER = \8f१ ¯ã᪠­¥ ­  ª®¬¯îâêà "
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * \8d â¨á­¥â¥ ª« ¢¨è, §  ¤  ¯à®¤ê«¦¨â¥.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "\8d áâனª â  ­¥ ¬®¦  ¤  ãáâ ­®¢¨ ®§­ ç¨â¥«ï ­  £¥®£à ä᪮⮠¯®«®¦¥­¨¥.\n"
index ac694c9..ece3f47 100644 (file)
@@ -1476,6 +1476,12 @@ MUI_ERROR enUSErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         NULL,
         NULL
index d951d6b..16ce0d1 100644 (file)
@@ -18,7 +18,7 @@ static MUI_ENTRY esESLanguagePageEntries[] =
     {
         6,
         8,
-        "Selecci¢n de idioma",
+        "Selecci¢n del idioma",
         TEXT_STYLE_NORMAL
     },
     {
@@ -1472,6 +1472,12 @@ MUI_ERROR esESErrorEntries[] =
         "Setup failed to add keyboard layouts to registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "No hay suficiente espacio disponible en la partici¢n seleccionada.\n"
+        "  * Presione una tecla para continuar.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index 4a1f7bd..19d0242 100644 (file)
@@ -1468,6 +1468,12 @@ MUI_ERROR etEEErrorEntries[] =
         "Klaviatuuriasetusi ei ännestunud registrisse lisada.\n"
         "ENTER = Taask\84ivita arvuti"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Geograafilist asukohta ei ännestunud seadistada.\n"
index ae037ab..8e7eb59 100644 (file)
@@ -1484,6 +1484,12 @@ MUI_ERROR frFRErrorEntries[] =
         "Setup failed to add keyboard layouts to registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index bb22000..bc30ae4 100644 (file)
@@ -1472,6 +1472,12 @@ MUI_ERROR itITErrorEntries[] =
         "Impossibile aggiungere le nazionalit\85 di tastiera al registro.\n"
         "INVIO = Riavviare il computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Lo spazio disponibile nella partizione selezionata \8a insufficiente.\n"
+        "  * Premere un tasto qualsiasi per continuare.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index af7ccdf..a697a19 100644 (file)
@@ -1477,6 +1477,12 @@ MUI_ERROR jaJPErrorEntries[] =
         "¾¯Ä±¯ÌßÊ geo id ¦ ¾¯Ã² Ã޷ϾݠÃÞ¼À¡\n"
         "ENTER = ºÝËß­°ÀÉ »²·ÄÞ³"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         NULL,
         NULL
index a0a9eb4..a35dca3 100644 (file)
@@ -1481,6 +1481,12 @@ MUI_ERROR ltLTErrorEntries[] =
         "Setup failed to add keyboard layouts to registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index eba2d93..0f0e865 100644 (file)
@@ -1499,6 +1499,12 @@ MUI_ERROR nlNLErrorEntries[] =
         "Setup kan de toetsenbord indelingen niet toevoegen aan de registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup kan de geografische positie niet instellen.\n"
index 8d4262d..4fd8b99 100644 (file)
@@ -1480,6 +1480,12 @@ MUI_ERROR plPLErrorEntries[] =
         "Instalator nie m¢g\88 doda\86 uk\88ad¢w klawiatury do rejestru.\n"
         "ENTER = Restart komputera"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Instalator nie m¢g\88 ustawi\86 lokalizacji geograficznej.\n"
index 7e55b97..1fb4137 100644 (file)
@@ -1472,6 +1472,12 @@ MUI_ERROR ruRUErrorEntries[] =
         "Setup failed to add keyboard layouts to registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index 5078f08..355c494 100644 (file)
@@ -1482,6 +1482,12 @@ MUI_ERROR skSKErrorEntries[] =
         "Inçtal tor zlyhal pri prid van¡ rozlo§en¡ kl vesnice do registrov.\n"
         "ENTER = Reçtart po\9f¡ta\9fa"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Inçtal tor nemohol nastavi\9c geo id.\n"
index 0dbffdc..cc3c356 100644 (file)
@@ -1472,6 +1472,12 @@ MUI_ERROR svSEErrorEntries[] =
         "Setup failed to add keyboard layouts to registry.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "Setup could not set the geo id.\n"
index ba3fd00..ebdea92 100644 (file)
@@ -1478,6 +1478,12 @@ MUI_ERROR ukUAErrorEntries[] =
         "\8d¥ ¢¤ «®áì ¤®¤ â¨ à®§ª« ¤ª¨ ª« ¢i âãਠ¤® à¥óáâàã.\n"
         "ENTER = \8f¥à¥§ ¢ ­â ¦¨â¨ ª®¬¯'îâ¥à"
     },
+    {
+        //ERROR_INSUFFICIENT_DISKSPACE,
+        "Not enough free space in the selected partition.\n"
+        "  * Press any key to continue.",
+        NULL
+    },
     {
         //ERROR_UPDATE_GEOID,
         "\8d¥ ¢¤ «®áì ¢áâ ­®¢¨â¨ geo id.\n"