mirror of
https://github.com/reactos/reactos.git
synced 2025-05-11 13:27:47 +00:00
[USETUP] Add few checks to forbid the user to attempt installing ReactOS in the installation source directory, or a subdirectory thereof, or to delete the partition containing the installation source.
This is needed because the ReactOS installer can also be present from within a HDD partition! svn path=/branches/setup_improvements/; revision=75669
This commit is contained in:
parent
959323902f
commit
e2a92634e1
1 changed files with 50 additions and 2 deletions
|
@ -1662,12 +1662,34 @@ SelectPartitionPage(PINPUT_RECORD Ir)
|
||||||
}
|
}
|
||||||
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
|
||||||
{
|
{
|
||||||
|
WCHAR PathBuffer[MAX_PATH];
|
||||||
|
UNICODE_STRING CurrentPartition;
|
||||||
|
|
||||||
if (PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
if (PartitionList->CurrentPartition->IsPartitioned == FALSE)
|
||||||
{
|
{
|
||||||
MUIDisplayError(ERROR_DELETE_SPACE, Ir, POPUP_WAIT_ANY_KEY);
|
MUIDisplayError(ERROR_DELETE_SPACE, Ir, POPUP_WAIT_ANY_KEY);
|
||||||
return SELECT_PARTITION_PAGE;
|
return SELECT_PARTITION_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
|
||||||
|
L"\\Device\\Harddisk%lu\\Partition%lu\\",
|
||||||
|
PartitionList->CurrentDisk->DiskNumber,
|
||||||
|
PartitionList->CurrentPartition->PartitionNumber);
|
||||||
|
RtlInitUnicodeString(&CurrentPartition, PathBuffer);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the user attempts to delete the partition on which
|
||||||
|
* the installation source is present. If so, fail with an error.
|
||||||
|
*/
|
||||||
|
// &USetupData.SourceRootPath
|
||||||
|
if (RtlPrefixUnicodeString(&CurrentPartition, &USetupData.SourcePath, TRUE))
|
||||||
|
{
|
||||||
|
PopupError("You cannot delete the partition containing the installation source!",
|
||||||
|
MUIGetString(STRING_CONTINUE),
|
||||||
|
Ir, POPUP_WAIT_ENTER);
|
||||||
|
return SELECT_PARTITION_PAGE;
|
||||||
|
}
|
||||||
|
|
||||||
if (PartitionList->CurrentPartition->BootIndicator ||
|
if (PartitionList->CurrentPartition->BootIndicator ||
|
||||||
PartitionList->CurrentPartition == PartitionList->SystemPartition)
|
PartitionList->CurrentPartition == PartitionList->SystemPartition)
|
||||||
{
|
{
|
||||||
|
@ -2705,6 +2727,8 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
||||||
PartTypeString,
|
PartTypeString,
|
||||||
ARRAYSIZE(PartTypeString));
|
ARRAYSIZE(PartTypeString));
|
||||||
|
|
||||||
|
MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE);
|
||||||
|
|
||||||
if (PartEntry->AutoCreate)
|
if (PartEntry->AutoCreate)
|
||||||
{
|
{
|
||||||
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NEWPARTITION));
|
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_NEWPARTITION));
|
||||||
|
@ -2789,8 +2813,6 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
|
||||||
DiskEntry->NoMbr ? "GPT" : "MBR");
|
DiskEntry->NoMbr ? "GPT" : "MBR");
|
||||||
}
|
}
|
||||||
|
|
||||||
MUIDisplayPage(SELECT_FILE_SYSTEM_PAGE);
|
|
||||||
|
|
||||||
if (FileSystemList == NULL)
|
if (FileSystemList == NULL)
|
||||||
{
|
{
|
||||||
/* Create the file system list, and by default select the "FAT" file system */
|
/* Create the file system list, and by default select the "FAT" file system */
|
||||||
|
@ -3228,6 +3250,19 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
||||||
DiskEntry,
|
DiskEntry,
|
||||||
PartEntry);
|
PartEntry);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the user attempts to install ReactOS within the
|
||||||
|
* installation source directory, or in a subdirectory thereof.
|
||||||
|
* If so, fail with an error.
|
||||||
|
*/
|
||||||
|
if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
|
||||||
|
{
|
||||||
|
PopupError("You cannot install ReactOS within the installation source directory!",
|
||||||
|
MUIGetString(STRING_CONTINUE),
|
||||||
|
Ir, POPUP_WAIT_ENTER);
|
||||||
|
return INSTALL_DIRECTORY_PAGE;
|
||||||
|
}
|
||||||
|
|
||||||
return PREPARE_COPY_PAGE;
|
return PREPARE_COPY_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3317,6 +3352,19 @@ InstallDirectoryPage(PINPUT_RECORD Ir)
|
||||||
DiskEntry,
|
DiskEntry,
|
||||||
PartEntry);
|
PartEntry);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check whether the user attempts to install ReactOS within the
|
||||||
|
* installation source directory, or in a subdirectory thereof.
|
||||||
|
* If so, fail with an error.
|
||||||
|
*/
|
||||||
|
if (RtlPrefixUnicodeString(&USetupData.SourcePath, &USetupData.DestinationPath, TRUE))
|
||||||
|
{
|
||||||
|
PopupError("You cannot install ReactOS within the installation source directory!",
|
||||||
|
MUIGetString(STRING_CONTINUE),
|
||||||
|
Ir, POPUP_WAIT_ENTER);
|
||||||
|
return INSTALL_DIRECTORY_PAGE;
|
||||||
|
}
|
||||||
|
|
||||||
return PREPARE_COPY_PAGE;
|
return PREPARE_COPY_PAGE;
|
||||||
}
|
}
|
||||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
|
else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x08) /* BACKSPACE */
|
||||||
|
|
Loading…
Reference in a new issue