diff --git a/reactos/subsys/system/usetup/partlist.c b/reactos/subsys/system/usetup/partlist.c index c0257b23c1f..462480e4e3b 100644 --- a/reactos/subsys/system/usetup/partlist.c +++ b/reactos/subsys/system/usetup/partlist.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: partlist.c,v 1.20 2003/08/20 16:59:46 ekohl Exp $ +/* $Id: partlist.c,v 1.21 2003/08/20 20:07:33 ekohl Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: subsys/system/usetup/partlist.c @@ -1660,6 +1660,59 @@ CheckActiveBootPartition (PPARTLIST List) } +BOOLEAN +CheckForLinuxFdiskPartitions (PPARTLIST List) +{ + PDISKENTRY DiskEntry; + PPARTENTRY PartEntry; + PLIST_ENTRY Entry1; + PLIST_ENTRY Entry2; + ULONG PartitionCount; + ULONG i; + + Entry1 = List->DiskListHead.Flink; + while (Entry1 != &List->DiskListHead) + { + DiskEntry = CONTAINING_RECORD (Entry1, + DISKENTRY, + ListEntry); + + Entry2 = DiskEntry->PartListHead.Flink; + while (Entry2 != &DiskEntry->PartListHead) + { + PartEntry = CONTAINING_RECORD (Entry2, + PARTENTRY, + ListEntry); + + if (PartEntry->Unpartitioned == FALSE) + { + PartitionCount = 0; + + for (i = 0; i < 4; i++) + { + if (!IsContainerPartition (PartEntry->PartInfo[i].PartitionType) && + PartEntry->PartInfo[i].PartitionLength.QuadPart != 0ULL) + { + PartitionCount++; + } + } + + if (PartitionCount > 1) + { + return TRUE; + } + } + + Entry2 = Entry2->Flink; + } + + Entry1 = Entry1->Flink; + } + + return FALSE; +} + + BOOLEAN WritePartitionsToDisk (PPARTLIST List) { diff --git a/reactos/subsys/system/usetup/partlist.h b/reactos/subsys/system/usetup/partlist.h index 99bbbfd1722..dd63700e17e 100644 --- a/reactos/subsys/system/usetup/partlist.h +++ b/reactos/subsys/system/usetup/partlist.h @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: partlist.h,v 1.19 2003/08/19 15:54:47 ekohl Exp $ +/* $Id: partlist.h,v 1.20 2003/08/20 20:07:33 ekohl Exp $ * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS text-mode setup * FILE: subsys/system/usetup/partlist.h @@ -143,6 +143,9 @@ DeleteCurrentPartition (PPARTLIST List); VOID CheckActiveBootPartition (PPARTLIST List); +BOOLEAN +CheckForLinuxFdiskPartitions (PPARTLIST List); + BOOLEAN WritePartitionsToDisk (PPARTLIST List); diff --git a/reactos/subsys/system/usetup/usetup.c b/reactos/subsys/system/usetup/usetup.c index e8f279fcd2c..42d678cd086 100644 --- a/reactos/subsys/system/usetup/usetup.c +++ b/reactos/subsys/system/usetup/usetup.c @@ -113,6 +113,8 @@ static HINF SetupInf; static HSPFILEQ SetupFileQueue = NULL; +static BOOLEAN WarnLinuxPartitions = TRUE; + /* FUNCTIONS ****************************************************************/ @@ -706,6 +708,35 @@ SelectPartitionPage(PINPUT_RECORD Ir) DrawPartitionList (PartitionList); + /* Warn about partitions created by Linux Fdisk */ + if (WarnLinuxPartitions == TRUE && + CheckForLinuxFdiskPartitions (PartitionList) == TRUE) + { + PopupError ("Setup found that at least one harddisk contains an incompatible\n" + "partition table that can not be handled properly!\n" + "\n" + "Creating or deleting partitions can destroy the partiton table.\n" + "\n" + " \x07 Press F3 to quit Setup." + " \x07 Press ENTER to continue.", + "F3= Quit ENTER = Continue"); + while (TRUE) + { + ConInKey (Ir); + + if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) && + (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */ + { + return QUIT_PAGE; + } + else if (Ir->Event.KeyEvent.wVirtualKeyCode == VK_RETURN) /* ENTER */ + { + WarnLinuxPartitions = FALSE; + return SELECT_PARTITION_PAGE; + } + } + } + while(TRUE) { /* Update status text */