[USETUP]: Add basic installation directory validity check (only for whitespace for now). Patch by Edijs Kolesnikovics, see CORE-6149.

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
This commit is contained in:
Hermès Bélusca-Maïto 2015-03-30 23:32:32 +00:00
parent 0181026801
commit d329fbebf0
27 changed files with 179 additions and 2 deletions

View 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 */

View 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)

View file

@ -46,4 +46,9 @@ DoesFileExist(
PWSTR PathName,
PWSTR FileName);
BOOLEAN
IsValidPath(
PWCHAR InstallDir,
ULONG Length);
/* EOF */

View 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);

View file

@ -1505,6 +1505,12 @@ MUI_ERROR bgBGErrorEntries[] =
"<EFBFBD> áâனª â  ­¥ ¬®¦  ¤  ãáâ ­®¢¨ ®§­ ç¨â¥«ï ­  £¥®£à ä᪮⮠¯®«®¦¥­¨¥.\n"
"ENTER = <20>१ ¯ã᪠­¥ ­  ª®¬¯îâêà "
},
{
//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"

View 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"

View file

@ -1500,6 +1500,12 @@ MUI_ERROR csCZErrorEntries[] =
"Nepodaýilo se nastavit geo id.\n"
"ENTER = Restartovat poŸ¡taŸ"
},
{
//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"

View 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„ssiger Verzeichnisname.\n"
"\n"
" * Eine beliebige Taste zum Fortsetzen dr<64>cken."
},
{
//ERROR_INSUFFICIENT_PARTITION_SIZE,
"Die gew„hlten Partition ist nicht groá genug, um ReactOS zu installieren.\n"

View 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"

View 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"

View 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"

View file

@ -1490,6 +1490,12 @@ MUI_ERROR etEEErrorEntries[] =
"Geograafilist asukohta ei ännestunud seadistada.\n"
"ENTER = Taask„ivita 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"

View file

@ -1505,6 +1505,12 @@ MUI_ERROR frFRErrorEntries[] =
"Setup n'a pas pu dfinir la geo id.\n"
"ENTR<EFBFBD>E = Redmarrer l'ordinateur"
},
{
//ERROR_DIRECTORY_NAME,
"Nom de rpertoire invalide.\n"
"\n"
" * Appuyer sur une touche pour continuer."
},
{
//ERROR_INSUFFICIENT_PARTITION_SIZE,
"The selected partition is not large enough to install ReactOS.\n"

View 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"

View 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"

View 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"

View 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"

View 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"

View file

@ -1502,6 +1502,12 @@ MUI_ERROR plPLErrorEntries[] =
"Instalator nie m¢gˆ ustawi† 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"

View file

@ -1530,6 +1530,12 @@ MUI_ERROR ptBRErrorEntries[] =
"N釅 foi poss」el configurar a identifica䄱o geogr霡ica.\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"

View 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"

View file

@ -1493,6 +1493,12 @@ MUI_ERROR ruRUErrorEntries[] =
"Setup could not set the geo id.\n"
"ENTER = <20><EFBFBD><E382A7><EFBFBD><E7A491>"
},
{
//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"

View file

@ -1504,6 +1504,12 @@ MUI_ERROR skSKErrorEntries[] =
"Inçtal tor nemohol nastaviœ geo id.\n"
"ENTER = Reçtart poŸ¡taŸa"
},
{
//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"

View file

@ -1497,6 +1497,12 @@ MUI_ERROR sqALErrorEntries[] =
"Instalimi nuk mund t‰ 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"

View 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"

View file

@ -1480,6 +1480,12 @@ MUI_ERROR trTRErrorEntries[] =
"Kur, co§rƒfŒ kimli§i ayarlayamad<61>.\n"
"GiriŸ = Bilgisayar<61> Yeniden BaŸlat"
},
{
//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"

View file

@ -1500,6 +1500,12 @@ MUI_ERROR ukUAErrorEntries[] =
"<EFBFBD>¥ ¢¤ «®áì ¢áâ ­®¢¨â¨ geo id.\n"
"ENTER = <20>¥à¥§ ¢ ­â ¦¨â¨ ª®¬¯'îâ¥à"
},
{
//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"