[USETUP]: Add basic installation directory validity check (only for whitespace for...
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 30 Mar 2015 23:32:32 +0000 (23:32 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Mon, 30 Mar 2015 23:32:32 +0000 (23:32 +0000)
Indeed, some ReactOS (and Windows as well) components do not support the system directory having spaces, in particular SMSS: this is due to the basic command-line parsing rules of SMSS that considers that the presence of a space in the command-line is equivalent to a separator, be it in or out a quoted string.

svn path=/trunk/; revision=66995

27 files changed:
reactos/base/setup/usetup/errorcode.h
reactos/base/setup/usetup/filesup.c
reactos/base/setup/usetup/filesup.h
reactos/base/setup/usetup/interface/usetup.c
reactos/base/setup/usetup/lang/bg-BG.h
reactos/base/setup/usetup/lang/bn-BD.h
reactos/base/setup/usetup/lang/cs-CZ.h
reactos/base/setup/usetup/lang/de-DE.h
reactos/base/setup/usetup/lang/el-GR.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/he-IL.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/pt-BR.h
reactos/base/setup/usetup/lang/ro-RO.h
reactos/base/setup/usetup/lang/ru-RU.h
reactos/base/setup/usetup/lang/sk-SK.h
reactos/base/setup/usetup/lang/sq-AL.h
reactos/base/setup/usetup/lang/sv-SE.h
reactos/base/setup/usetup/lang/tr-TR.h
reactos/base/setup/usetup/lang/uk-UA.h

index 2c8b943..373389d 100644 (file)
@@ -66,11 +66,12 @@ typedef enum
     ERROR_UPDATE_LOCALESETTINGS,
     ERROR_ADDING_KBLAYOUTS,
     ERROR_UPDATE_GEOID,
+    ERROR_DIRECTORY_NAME,
     ERROR_INSUFFICIENT_PARTITION_SIZE,
     ERROR_PARTITION_TABLE_FULL,
     ERROR_ONLY_ONE_EXTENDED,
 
     ERROR_LAST_ERROR_CODE
-}ERROR_NUMBER;
+} ERROR_NUMBER;
 
 /* EOF */
index b8461e6..2e70088 100644 (file)
@@ -130,6 +130,26 @@ DoesPathExist(
 }
 
 
+BOOLEAN
+IsValidPath(
+    PWCHAR InstallDir,
+    ULONG Length)
+{
+    UINT i;
+
+    // TODO: Add check for 8.3 too.
+
+    /* Check for whitespaces */
+    for (i = 0; i < Length; i++)
+    {
+        if (isspace(InstallDir[i]))
+            return FALSE;
+    }
+
+    return TRUE;
+}
+
+
 NTSTATUS
 SetupCreateDirectory(
     PWCHAR PathName)
index 5522321..a6ddc35 100644 (file)
@@ -46,4 +46,9 @@ DoesFileExist(
     PWSTR PathName,
     PWSTR FileName);
 
+BOOLEAN
+IsValidPath(
+    PWCHAR InstallDir,
+    ULONG Length);
+
 /* EOF */
index 8a5ccda..1f329ab 100644 (file)
@@ -2983,6 +2983,10 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
     CONSOLE_SetInputTextXY(8, 11, 51, InstallDir);
     MUIDisplayPage(INSTALL_DIRECTORY_PAGE);
 
+    // FIXME: Check the validity of the InstallDir; however what to do
+    // if it is invalid but we are in unattended setup? (case of somebody
+    // specified an invalid installation directory in the unattended file).
+
     if (IsUnattendedSetup)
     {
         return InstallDirectoryPage1(InstallDir,
@@ -3004,6 +3008,15 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
         }
         else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
         {
+            /*
+             * Check for the validity of the installation directory and pop up
+             * an error if it is not the case. Then the user can fix its input.
+             */
+            if (!IsValidPath(InstallDir, Length))
+            {
+                MUIDisplayError(ERROR_DIRECTORY_NAME, Ir, POPUP_WAIT_ENTER);
+                return INSTALL_DIRECTORY_PAGE;
+            }
             return InstallDirectoryPage1(InstallDir,
                                          DiskEntry,
                                          PartEntry);
index 23dc0bf..d349246 100644 (file)
@@ -1505,6 +1505,12 @@ MUI_ERROR bgBGErrorEntries[] =
         "\8d áâனª â  ­¥ ¬®¦  ¤  ãáâ ­®¢¨ ®§­ ç¨â¥«ï ­  £¥®£à ä᪮⮠¯®«®¦¥­¨¥.\n"
         "ENTER = \8f१ ¯ã᪠­¥ ­  ª®¬¯îâêà "
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 4218262..61d6dc6 100644 (file)
@@ -1492,6 +1492,12 @@ MUI_ERROR bnBDErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index f9612b8..09c8718 100644 (file)
@@ -1500,6 +1500,12 @@ MUI_ERROR csCZErrorEntries[] =
         "Nepodaýilo se nastavit geo id.\n"
         "ENTER = Restartovat po\9f¡ta\9f"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 7f1e3cc..9bc2f05 100644 (file)
@@ -1491,11 +1491,17 @@ MUI_ERROR deDEErrorEntries[] =
         "eingetragen werden.\n"
         "EINGABETASTE = Computer neu starten"
     },
-        {
+    {
         //ERROR_UPDATE_GEOID,
         "Der geografische Standort konnte nicht eingestellt werden.\n"
         "EINGABETASTE = Computer neu starten"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Unzul\84ssiger Verzeichnisname.\n"
+        "\n"
+        "  * Eine beliebige Taste zum Fortsetzen dr\81cken."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "Die gew\84hlten Partition ist nicht groá genug, um ReactOS zu installieren.\n"
index 52f6c3f..200b48d 100644 (file)
@@ -1523,6 +1523,12 @@ MUI_ERROR elGRErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_PARTITION_TABLE_FULL,
         "You can not create a new primary or extended partition in the\n"
index 4cdbb45..3b5d278 100644 (file)
@@ -1492,6 +1492,12 @@ MUI_ERROR enUSErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index c0d0d15..33eaf7b 100644 (file)
@@ -1500,6 +1500,12 @@ MUI_ERROR esESErrorEntries[] =
         "El instalador no ha podido configurar el ID geogr fico.\n"
         "INTRO = Reiniciar el equipo"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 4104224..96d829e 100644 (file)
@@ -1490,6 +1490,12 @@ MUI_ERROR etEEErrorEntries[] =
         "Geograafilist asukohta ei ännestunud seadistada.\n"
         "ENTER = Taask\84ivita arvuti"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index b83f658..09088ad 100644 (file)
@@ -1505,6 +1505,12 @@ MUI_ERROR frFRErrorEntries[] =
         "Setup n'a pas pu d\82finir la geo id.\n"
         "ENTR\90E = Red\82marrer l'ordinateur"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Nom de r\82pertoire invalide.\n"
+        "\n"
+        "  * Appuyer sur une touche pour continuer."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 8e779f8..6265ec0 100644 (file)
@@ -1493,6 +1493,12 @@ MUI_ERROR heILErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 185f91d..835a9d6 100644 (file)
@@ -1494,6 +1494,12 @@ MUI_ERROR itITErrorEntries[] =
         "Setup non ha potuto impostare l'id geografico.\n"
         "INVIO = Riavviare il computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 4d11d82..e70f60f 100644 (file)
@@ -1494,6 +1494,12 @@ MUI_ERROR jaJPErrorEntries[] =
         "¾¯Ä±¯ÌßÊ geo id ¦ ¾¯Ã² Ã޷ϾݠÃÞ¼À¡\n"
         "ENTER = ºÝËß­°ÀÉ »²·ÄÞ³"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index f24c844..db36891 100644 (file)
@@ -1502,6 +1502,12 @@ MUI_ERROR ltLTErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = Reboot computer"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index e1e9d45..1b1ab3e 100644 (file)
@@ -1538,6 +1538,12 @@ MUI_ERROR nlNLErrorEntries[] =
         "Setup kan de geografische positie niet instellen.\n"
         "ENTER = Computer opnieuw opstarten"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index c212ae5..036ccdf 100644 (file)
@@ -1502,6 +1502,12 @@ MUI_ERROR plPLErrorEntries[] =
         "Instalator nie m¢g\88 ustawi\86 lokalizacji geograficznej.\n"
         "ENTER = Restart komputera"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 9b32c9a..c292c42 100644 (file)
@@ -1530,6 +1530,12 @@ MUI_ERROR ptBRErrorEntries[] =
         "NÆo foi poss¡vel configurar a identifica\87Æo geogr fica.\n"
         "ENTER=Reiniciar"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index b920a29..84042ca 100644 (file)
@@ -1569,6 +1569,12 @@ MUI_ERROR roROErrorEntries[] =
         "Nu s-a reu­it setarea geo id.",
         "ENTER = Repornire calculator"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "Partiîia selectatÇ este prea micÇ pentru a instala ReactOS.\n"
index 42b8706..709905b 100644 (file)
@@ -1493,6 +1493,12 @@ MUI_ERROR ruRUErrorEntries[] =
         "Setup could not set the geo id.\n"
         "ENTER = \8f¥à¥§ £à㧪 "
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index f030e28..45fa1c8 100644 (file)
@@ -1504,6 +1504,12 @@ MUI_ERROR skSKErrorEntries[] =
         "Inçtal tor nemohol nastavi\9c geo id.\n"
         "ENTER = Reçtart po\9f¡ta\9fa"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index e340841..f6697d9 100644 (file)
@@ -1497,6 +1497,12 @@ MUI_ERROR sqALErrorEntries[] =
         "Instalimi nuk mund t\89 vendosni id geo.\n"
         "ENTER = Ristarto kompjuterin"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 6f1f2fe..8c19e78 100644 (file)
@@ -1500,6 +1500,12 @@ MUI_ERROR svSEErrorEntries[] =
         "Setup kunde inte stalla int 'geo id'.\n"
         "ENTER = Starta om datorn"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index 7bb8f98..3be9eca 100644 (file)
@@ -1480,6 +1480,12 @@ MUI_ERROR trTRErrorEntries[] =
         "Kur, co§r\83f\8c kimli§i ayarlayamad\8d.\n"
         "Giri\9f = Bilgisayar\8d Yeniden Ba\9flat"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"
index e83dd37..839d64b 100644 (file)
@@ -1500,6 +1500,12 @@ MUI_ERROR ukUAErrorEntries[] =
         "\8d¥ ¢¤ «®áì ¢áâ ­®¢¨â¨ geo id.\n"
         "ENTER = \8f¥à¥§ ¢ ­â ¦¨â¨ ª®¬¯'îâ¥à"
     },
+    {
+        //ERROR_DIRECTORY_NAME,
+        "Invalid directory name.\n"
+        "\n"
+        "  * Press any key to continue."
+    },
     {
         //ERROR_INSUFFICIENT_PARTITION_SIZE,
         "The selected partition is not large enough to install ReactOS.\n"