Author: ekohl
Date: Sun Dec 28 09:16:41 2014
New Revision: 65855
URL:
http://svn.reactos.org/svn/reactos?rev=65855&view=rev
Log:
[USETUP]
Update the on-disk partition tables immediately after modifying the in-memory tables.
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/partlist.c
trunk/reactos/base/setup/usetup/partlist.h
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c [iso-8859-1] Sun Dec 28 09:16:41
2014
@@ -1834,6 +1834,7 @@
ULONGLONG DiskSize;
ULONGLONG SectorCount;
PCHAR Unit;
+ NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -1959,6 +1960,14 @@
CreatePrimaryPartition(PartitionList,
SectorCount,
FALSE);
+
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
return SELECT_PARTITION_PAGE;
}
@@ -1981,6 +1990,7 @@
ULONGLONG DiskSize;
ULONGLONG SectorCount;
PCHAR Unit;
+ NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -2105,6 +2115,14 @@
CreateExtendedPartition(PartitionList,
SectorCount);
+
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
return SELECT_PARTITION_PAGE;
}
@@ -2127,6 +2145,7 @@
ULONGLONG DiskSize;
ULONGLONG SectorCount;
PCHAR Unit;
+ NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -2252,6 +2271,14 @@
CreateLogicalPartition(PartitionList,
SectorCount);
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
+
return SELECT_PARTITION_PAGE;
}
}
@@ -2269,6 +2296,7 @@
ULONGLONG PartSize;
PCHAR Unit;
PCHAR PartType;
+ NTSTATUS Status;
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -2420,6 +2448,14 @@
else if (Ir->Event.KeyEvent.wVirtualKeyCode == 'D') /* D */
{
DeleteCurrentPartition(PartitionList);
+
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ return QUIT_PAGE;
+ }
return SELECT_PARTITION_PAGE;
}
@@ -2792,9 +2828,10 @@
CheckActiveBootPartition(PartitionList);
- if (WritePartitionsToDisk(PartitionList) == FALSE)
- {
- DPRINT("WritePartitionsToDisk() failed\n");
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}
@@ -3706,6 +3743,7 @@
BOOLEAN InstallOnFloppy;
USHORT Line = 12;
WCHAR PathBuffer[MAX_PATH];
+ NTSTATUS Status;
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
@@ -3713,9 +3751,10 @@
CheckActiveBootPartition(PartitionList);
/* Update the partition table because we may have changed the active partition */
- if (WritePartitionsToDisk(PartitionList) == FALSE)
- {
- DPRINT("WritePartitionsToDisk() failed\n");
+ Status = WriteDirtyPartitions(PartitionList);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT("WriteDirtyPartitions() failed\n");
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
return QUIT_PAGE;
}
Modified: trunk/reactos/base/setup/usetup/partlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.c [iso-8859-1] Sun Dec 28 09:16:41 2014
@@ -2931,15 +2931,16 @@
}
-BOOLEAN
-WritePartitionsToDisk(
+NTSTATUS
+WriteDirtyPartitions(
PPARTLIST List)
{
PLIST_ENTRY Entry;
PDISKENTRY DiskEntry;
+ NTSTATUS Status;
if (List == NULL)
- return TRUE;
+ return STATUS_SUCCESS;
Entry = List->DiskListHead.Flink;
while (Entry != &List->DiskListHead)
@@ -2948,13 +2949,17 @@
if (DiskEntry->Dirty == TRUE)
{
- WritePartitons(List, DiskEntry);
+ Status = WritePartitons(List, DiskEntry);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ DiskEntry->Dirty = FALSE;
}
Entry = Entry->Flink;
}
- return TRUE;
+ return STATUS_SUCCESS;
}
Modified: trunk/reactos/base/setup/usetup/partlist.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist…
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.h [iso-8859-1] Sun Dec 28 09:16:41 2014
@@ -247,8 +247,8 @@
CheckForLinuxFdiskPartitions(
PPARTLIST List);
-BOOLEAN
-WritePartitionsToDisk(
+NTSTATUS
+WriteDirtyPartitions(
PPARTLIST List);
ULONG