mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 09:25:10 +00:00
[USETUP]
Update the on-disk partition tables immediately after modifying the in-memory tables. svn path=/trunk/; revision=65855
This commit is contained in:
parent
9bf8864501
commit
cdc15f3bc5
3 changed files with 55 additions and 11 deletions
|
@ -1834,6 +1834,7 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG DiskSize;
|
||||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
|
@ -1960,6 +1961,14 @@ CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
|
|||
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 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG DiskSize;
|
||||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
|
@ -2106,6 +2116,14 @@ CreateExtendedPartitionPage(PINPUT_RECORD Ir)
|
|||
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 @@ CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG DiskSize;
|
||||
ULONGLONG SectorCount;
|
||||
PCHAR Unit;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
|
@ -2252,6 +2271,14 @@ CreateLogicalPartitionPage(PINPUT_RECORD Ir)
|
|||
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 @@ DeletePartitionPage(PINPUT_RECORD Ir)
|
|||
ULONGLONG PartSize;
|
||||
PCHAR Unit;
|
||||
PCHAR PartType;
|
||||
NTSTATUS Status;
|
||||
|
||||
if (PartitionList == NULL ||
|
||||
PartitionList->CurrentDisk == NULL ||
|
||||
|
@ -2421,6 +2449,14 @@ DeletePartitionPage(PINPUT_RECORD Ir)
|
|||
{
|
||||
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 @@ FormatPartitionPage(PINPUT_RECORD Ir)
|
|||
|
||||
CheckActiveBootPartition(PartitionList);
|
||||
|
||||
if (WritePartitionsToDisk(PartitionList) == FALSE)
|
||||
Status = WriteDirtyPartitions(PartitionList);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("WritePartitionsToDisk() failed\n");
|
||||
DPRINT("WriteDirtyPartitions() failed\n");
|
||||
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
@ -3706,6 +3743,7 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
BOOLEAN InstallOnFloppy;
|
||||
USHORT Line = 12;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
NTSTATUS Status;
|
||||
|
||||
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
|
||||
|
||||
|
@ -3713,9 +3751,10 @@ BootLoaderPage(PINPUT_RECORD Ir)
|
|||
CheckActiveBootPartition(PartitionList);
|
||||
|
||||
/* Update the partition table because we may have changed the active partition */
|
||||
if (WritePartitionsToDisk(PartitionList) == FALSE)
|
||||
Status = WriteDirtyPartitions(PartitionList);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("WritePartitionsToDisk() failed\n");
|
||||
DPRINT("WriteDirtyPartitions() failed\n");
|
||||
MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
|
|
@ -2931,15 +2931,16 @@ WritePartitons(
|
|||
}
|
||||
|
||||
|
||||
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 @@ WritePartitionsToDisk(
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -247,8 +247,8 @@ BOOLEAN
|
|||
CheckForLinuxFdiskPartitions(
|
||||
PPARTLIST List);
|
||||
|
||||
BOOLEAN
|
||||
WritePartitionsToDisk(
|
||||
NTSTATUS
|
||||
WriteDirtyPartitions(
|
||||
PPARTLIST List);
|
||||
|
||||
ULONG
|
||||
|
|
Loading…
Reference in a new issue