https://git.reactos.org/?p=reactos.git;a=commitdiff;h=05cd77028cad3c198dba9…
commit 05cd77028cad3c198dba936cf9e74a9a578db5b9
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue Nov 24 02:26:52 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Nov 24 03:24:41 2020 +0100
[SETUPLIB][USETUP] Cleanup some code in USETUP. Redefine FormatPartition() and
ChkdskPartition() helpers
so that they wrap the needed init steps for formatting/chkdsk'ing.
These helpers now accept a PPARTENTRY, together with the usual
formatting/chkdsk parameters. The helpers now determine the actual
NT path to use, and can perform the init steps on the partition
before performing the actual operation.
In particular, FormatPartition() is now made GPT-compliant. The
partition type retrieved by FileSystemToMBRPartitionType() is now
used as a hint for choosing FAT32 over FAT12/16, and only in the
case of a MBR partition that is *NOT* a recognized OEM partition,
it is used for updating the corresponding partition type. (OEM
partitions must retain their original type.)
The OEM partition types we (and NT) can recognize are specified
e.g. in the Microsoft Open-Specification [MS-DMRP] Appendix B
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dmrp/5f5043…
Introduce an IsOEMPartition() macro to help checking for these types
(its name is based on the Is***Partition() macros from ntdddisk.h,
and from a dmdskmgr.dll export of similar name).
---
base/setup/lib/fsutil.c | 132 +++++++++++++++++++++++++++++---
base/setup/lib/fsutil.h | 22 ++++--
base/setup/lib/utils/partlist.h | 19 +++++
base/setup/usetup/chkdsk.c | 23 +++---
base/setup/usetup/chkdsk.h | 8 +-
base/setup/usetup/format.c | 23 +++---
base/setup/usetup/format.h | 4 +-
base/setup/usetup/usetup.c | 164 +++++++++++-----------------------------
8 files changed, 230 insertions(+), 165 deletions(-)
diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c
index f71acef487e..c244111a381 100644
--- a/base/setup/lib/fsutil.c
+++ b/base/setup/lib/fsutil.c
@@ -666,19 +666,90 @@ Quit:
// Formatting routines
//
-BOOLEAN
-PreparePartitionForFormatting(
- IN struct _PARTENTRY* PartEntry,
- IN PCWSTR FileSystemName)
+NTSTATUS
+ChkdskPartition(
+ IN PPARTENTRY PartEntry,
+ IN BOOLEAN FixErrors,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN CheckOnlyIfDirty,
+ IN BOOLEAN ScanDrive,
+ IN PFMIFSCALLBACK Callback)
{
+ NTSTATUS Status;
+ PDISKENTRY DiskEntry = PartEntry->DiskEntry;
+ // UNICODE_STRING PartitionRootPath;
+ WCHAR PartitionRootPath[MAX_PATH]; // PathBuffer
+
+ ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
+
+ /* HACK: Do not try to check a partition with an unknown filesystem */
+ if (!*PartEntry->FileSystem)
+ {
+ PartEntry->NeedsCheck = FALSE;
+ return STATUS_SUCCESS;
+ }
+
+ /* Set PartitionRootPath */
+ RtlStringCchPrintfW(PartitionRootPath, ARRAYSIZE(PartitionRootPath),
+ L"\\Device\\Harddisk%lu\\Partition%lu",
+ DiskEntry->DiskNumber,
+ PartEntry->PartitionNumber);
+ DPRINT("PartitionRootPath: %S\n", PartitionRootPath);
+
+ /* Check the partition */
+ Status = ChkdskFileSystem(PartitionRootPath,
+ PartEntry->FileSystem,
+ FixErrors,
+ Verbose,
+ CheckOnlyIfDirty,
+ ScanDrive,
+ Callback);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
+ PartEntry->NeedsCheck = FALSE;
+ return STATUS_SUCCESS;
+}
+
+NTSTATUS
+FormatPartition(
+ IN PPARTENTRY PartEntry,
+ IN PCWSTR FileSystemName,
+ IN FMIFS_MEDIA_FLAG MediaFlag,
+ IN PCWSTR Label,
+ IN BOOLEAN QuickFormat,
+ IN ULONG ClusterSize,
+ IN PFMIFSCALLBACK Callback)
+{
+ NTSTATUS Status;
+ PDISKENTRY DiskEntry = PartEntry->DiskEntry;
UCHAR PartitionType;
+ // UNICODE_STRING PartitionRootPath;
+ WCHAR PartitionRootPath[MAX_PATH]; // PathBuffer
+
+ ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
if (!FileSystemName || !*FileSystemName)
{
DPRINT1("No file system specified?\n");
- return FALSE;
+ return STATUS_UNRECOGNIZED_VOLUME;
}
+ /*
+ * Prepare the partition for formatting (for MBR disks, reset the
+ * partition type), and adjust the filesystem name in case of FAT
+ * vs. FAT32, depending on the geometry of the partition.
+ */
+
+// FIXME: Do this only if QuickFormat == FALSE? What about FAT handling?
+
+ /*
+ * Retrieve a partition type as a hint only. It will be used to determine
+ * whether to actually use FAT12/16 or FAT32 filesystem, depending on the
+ * geometry of the partition. If the partition resides on an MBR disk,
+ * the partition style will be reset to this value as well, unless the
+ * partition is OEM.
+ */
PartitionType = FileSystemToMBRPartitionType(FileSystemName,
PartEntry->StartSector.QuadPart,
PartEntry->SectorCount.QuadPart);
@@ -686,33 +757,70 @@ PreparePartitionForFormatting(
{
/* Unknown file system */
DPRINT1("Unknown file system '%S'\n", FileSystemName);
- return FALSE;
+ return STATUS_UNRECOGNIZED_VOLUME;
}
- SetMBRPartitionType(PartEntry, PartitionType);
+ /* Reset the MBR partition type, unless this is an OEM partition */
+ if (DiskEntry->DiskStyle == PARTITION_STYLE_MBR)
+ {
+ if (!IsOEMPartition(PartEntry->PartitionType))
+ SetMBRPartitionType(PartEntry, PartitionType);
+ }
/*
* Adjust the filesystem name in case of FAT vs. FAT32, according to
- * the type of partition set by FileSystemToPartitionType().
+ * the type of partition returned by FileSystemToMBRPartitionType().
*/
if (wcsicmp(FileSystemName, L"FAT") == 0)
{
- if ((/*PartEntry->*/PartitionType == PARTITION_FAT32) ||
- (/*PartEntry->*/PartitionType == PARTITION_FAT32_XINT13))
+ if ((PartitionType == PARTITION_FAT32) ||
+ (PartitionType == PARTITION_FAT32_XINT13))
{
FileSystemName = L"FAT32";
}
}
+ /* Commit the partition changes to the disk */
+ Status = WritePartitions(DiskEntry);
+ if (!NT_SUCCESS(Status))
+ {
+ DPRINT1("WritePartitions(disk %lu) failed, Status 0x%08lx\n",
+ DiskEntry->DiskNumber, Status);
+ return STATUS_PARTITION_FAILURE;
+ }
+
+ /* Set PartitionRootPath */
+ RtlStringCchPrintfW(PartitionRootPath, ARRAYSIZE(PartitionRootPath),
+ L"\\Device\\Harddisk%lu\\Partition%lu",
+ DiskEntry->DiskNumber,
+ PartEntry->PartitionNumber);
+ DPRINT("PartitionRootPath: %S\n", PartitionRootPath);
+
+ /* Format the partition */
+ Status = FormatFileSystem(PartitionRootPath,
+ FileSystemName,
+ MediaFlag,
+ Label,
+ QuickFormat,
+ ClusterSize,
+ Callback);
+ if (!NT_SUCCESS(Status))
+ return Status;
+
//
-// FIXME: Do this now, or after the partition was actually formatted??
+// TODO: Here, call a partlist.c function that update the actual
+// FS name and the label fields of the volume.
//
+ PartEntry->FormatState = Formatted;
+
/* Set the new partition's file system proper */
RtlStringCbCopyW(PartEntry->FileSystem,
sizeof(PartEntry->FileSystem),
FileSystemName);
- return TRUE;
+ PartEntry->New = FALSE;
+
+ return STATUS_SUCCESS;
}
/* EOF */
diff --git a/base/setup/lib/fsutil.h b/base/setup/lib/fsutil.h
index 7696be6dec8..1056cfb658d 100644
--- a/base/setup/lib/fsutil.h
+++ b/base/setup/lib/fsutil.h
@@ -101,11 +101,23 @@ InstallBtrfsBootCode(
// Formatting routines
//
-struct _PARTENTRY; // Defined in partlist.h
+NTSTATUS
+ChkdskPartition(
+ IN PPARTENTRY PartEntry,
+ IN BOOLEAN FixErrors,
+ IN BOOLEAN Verbose,
+ IN BOOLEAN CheckOnlyIfDirty,
+ IN BOOLEAN ScanDrive,
+ IN PFMIFSCALLBACK Callback);
-BOOLEAN
-PreparePartitionForFormatting(
- IN struct _PARTENTRY* PartEntry,
- IN PCWSTR FileSystemName);
+NTSTATUS
+FormatPartition(
+ IN PPARTENTRY PartEntry,
+ IN PCWSTR FileSystemName,
+ IN FMIFS_MEDIA_FLAG MediaFlag,
+ IN PCWSTR Label,
+ IN BOOLEAN QuickFormat,
+ IN ULONG ClusterSize,
+ IN PFMIFSCALLBACK Callback);
/* EOF */
diff --git a/base/setup/lib/utils/partlist.h b/base/setup/lib/utils/partlist.h
index 4dd108ba15c..2669b9ecdef 100644
--- a/base/setup/lib/utils/partlist.h
+++ b/base/setup/lib/utils/partlist.h
@@ -20,6 +20,25 @@ typedef struct _PARTITION_TYPE
extern PARTITION_TYPE PartitionTypes[NUM_PARTITION_TYPE_ENTRIES];
+/* EXTRA HANDFUL MACROS *****************************************************/
+
+// NOTE: They should be moved into some global header.
+
+/* OEM MBR partition types recognized by NT (see [MS-DMRP] Appendix B) */
+#define PARTITION_EISA 0x12 // EISA partition
+#define PARTITION_HIBERNATION 0x84 // Hibernation partition for laptops
+#define PARTITION_DIAGNOSTIC 0xA0 // Diagnostic partition on some Hewlett-Packard
(HP) notebooks
+#define PARTITION_DELL 0xDE // Dell partition
+#define PARTITION_IBM 0xFE // IBM Initial Microprogram Load (IML) partition
+
+#define IsOEMPartition(PartitionType) \
+ ( ((PartitionType) == PARTITION_EISA) || \
+ ((PartitionType) == PARTITION_HIBERNATION) || \
+ ((PartitionType) == PARTITION_DIAGNOSTIC) || \
+ ((PartitionType) == PARTITION_DELL) || \
+ ((PartitionType) == PARTITION_IBM) )
+
+
/* PARTITION UTILITY FUNCTIONS **********************************************/
typedef enum _FORMATSTATE
diff --git a/base/setup/usetup/chkdsk.c b/base/setup/usetup/chkdsk.c
index 615e7022c0e..b302dc94581 100644
--- a/base/setup/usetup/chkdsk.c
+++ b/base/setup/usetup/chkdsk.c
@@ -16,7 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* COPYRIGHT: See COPYING in the top level directory
+/*
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/chkdsk.c
* PURPOSE: Filesystem chkdsk support functions
@@ -52,11 +53,9 @@ ChkdskCallback(
return TRUE;
}
-
NTSTATUS
-ChkdskPartition(
- IN PUNICODE_STRING DriveRoot,
- IN PCWSTR FileSystemName)
+DoChkdsk(
+ IN PPARTENTRY PartEntry)
{
NTSTATUS Status;
@@ -71,13 +70,13 @@ ChkdskPartition(
ProgressSetStepCount(ChkdskProgressBar, 100);
- Status = ChkdskFileSystem_UStr(DriveRoot,
- FileSystemName,
- TRUE, /* FixErrors */
- FALSE, /* Verbose */
- TRUE, /* CheckOnlyIfDirty */
- FALSE, /* ScanDrive */
- ChkdskCallback); /* Callback */
+ // TODO: Think about which values could be defaulted...
+ Status = ChkdskPartition(PartEntry,
+ TRUE, /* FixErrors */
+ FALSE, /* Verbose */
+ TRUE, /* CheckOnlyIfDirty */
+ FALSE, /* ScanDrive */
+ ChkdskCallback); /* Callback */
DestroyProgressBar(ChkdskProgressBar);
ChkdskProgressBar = NULL;
diff --git a/base/setup/usetup/chkdsk.h b/base/setup/usetup/chkdsk.h
index 3207d2f7f69..594c9b13b61 100644
--- a/base/setup/usetup/chkdsk.h
+++ b/base/setup/usetup/chkdsk.h
@@ -16,7 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* COPYRIGHT: See COPYING in the top level directory
+/*
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/chkdsk.h
* PURPOSE: Filesystem chkdsk support functions
@@ -26,8 +27,7 @@
#pragma once
NTSTATUS
-ChkdskPartition(
- IN PUNICODE_STRING DriveRoot,
- IN PCWSTR FileSystemName);
+DoChkdsk(
+ IN PPARTENTRY PartEntry);
/* EOF */
diff --git a/base/setup/usetup/format.c b/base/setup/usetup/format.c
index 4abb464ba3e..cc0603ed07b 100644
--- a/base/setup/usetup/format.c
+++ b/base/setup/usetup/format.c
@@ -16,7 +16,8 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-/* COPYRIGHT: See COPYING in the top level directory
+/*
+ * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/format.c
* PURPOSE: Filesystem format support functions
@@ -87,10 +88,9 @@ FormatCallback(
return TRUE;
}
-
NTSTATUS
-FormatPartition(
- IN PUNICODE_STRING DriveRoot,
+DoFormat(
+ IN PPARTENTRY PartEntry,
IN PCWSTR FileSystemName,
IN BOOLEAN QuickFormat)
{
@@ -107,13 +107,14 @@ FormatPartition(
ProgressSetStepCount(FormatProgressBar, 100);
- Status = FormatFileSystem_UStr(DriveRoot,
- FileSystemName,
- FMIFS_HARDDISK, /* MediaFlag */
- NULL, /* Label */
- QuickFormat, /* QuickFormat */
- 0, /* ClusterSize */
- FormatCallback); /* Callback */
+ // TODO: Think about which values could be defaulted...
+ Status = FormatPartition(PartEntry,
+ FileSystemName,
+ FMIFS_HARDDISK, /* MediaFlag */
+ NULL, /* Label */
+ QuickFormat, /* QuickFormat */
+ 0, /* ClusterSize */
+ FormatCallback); /* Callback */
DestroyProgressBar(FormatProgressBar);
FormatProgressBar = NULL;
diff --git a/base/setup/usetup/format.h b/base/setup/usetup/format.h
index b84ae57559d..80c5a85039c 100644
--- a/base/setup/usetup/format.h
+++ b/base/setup/usetup/format.h
@@ -27,8 +27,8 @@
#pragma once
NTSTATUS
-FormatPartition(
- IN PUNICODE_STRING DriveRoot,
+DoFormat(
+ IN PPARTENTRY PartEntry,
IN PCWSTR FileSystemName,
IN BOOLEAN QuickFormat);
diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c
index 01907778721..e8de2666026 100644
--- a/base/setup/usetup/usetup.c
+++ b/base/setup/usetup/usetup.c
@@ -2766,7 +2766,6 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
* partition on the system. Otherwise if we install on a removable disk
* use the install partition as the system partition.
*/
- // TODO: Include that logic inside the FindSupportedSystemPartition() function?
if (InstallPartition->DiskEntry->MediaType == FixedMedia)
{
SystemPartition = FindSupportedSystemPartition(PartitionList,
@@ -2949,17 +2948,11 @@ SelectFileSystemPage(PINPUT_RECORD Ir)
*/
if (!SystemPartition->IsPartitioned)
{
- // if (IsUnattendedSetup)
- {
- CreatePrimaryPartition(PartitionList,
- SystemPartition,
- 0LL, // SystemPartition->SectorCount.QuadPart,
- TRUE);
- ASSERT(SystemPartition->IsPartitioned);
- }
- // else
- {
- }
+ CreatePrimaryPartition(PartitionList,
+ SystemPartition,
+ 0LL, // SystemPartition->SectorCount.QuadPart,
+ TRUE);
+ ASSERT(SystemPartition->IsPartitioned);
}
/* Set it as such */
@@ -3363,16 +3356,9 @@ FormatPartitionPage(PINPUT_RECORD Ir)
PPARTENTRY PartEntry;
PDISKENTRY DiskEntry;
PFILE_SYSTEM_ITEM SelectedFileSystem;
- UNICODE_STRING PartitionRootPath;
WCHAR PathBuffer[MAX_PATH];
CHAR Buffer[MAX_PATH];
-#ifndef NDEBUG
- ULONG Line;
- ULONG i;
- PPARTITION_INFORMATION PartitionInfo;
-#endif
-
DPRINT("FormatPartitionPage()\n");
MUIDisplayPage(FORMAT_PARTITION_PAGE);
@@ -3413,82 +3399,40 @@ FormatPartitionPage(PINPUT_RECORD Ir)
/*
* Remove the "Press ENTER to continue" message prompt when the
ENTER
* key is pressed as the user wants to begin the partition formatting.
- */
+ */
MUIClearStyledText(FORMAT_PARTITION_PAGE, TEXT_ID_FORMAT_PROMPT,
TEXT_TYPE_REGULAR);
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- if (!PreparePartitionForFormatting(PartEntry,
SelectedFileSystem->FileSystem))
+ /* Format the partition */
+ Status = DoFormat(PartEntry,
+ SelectedFileSystem->FileSystem,
+ SelectedFileSystem->QuickFormat);
+ if (Status == STATUS_PARTITION_FAILURE)
{
- /* FIXME: show an error dialog */
+ MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
/* Reset the filesystem list */
ResetFileSystemList();
-
return QUIT_PAGE;
}
-
-#ifndef NDEBUG
- CONSOLE_PrintTextXY(6, 12,
- "Cylinders: %I64u Tracks/Cyl: %lu Sectors/Trk: %lu
Bytes/Sec: %lu %c",
- DiskEntry->Cylinders,
- DiskEntry->TracksPerCylinder,
- DiskEntry->SectorsPerTrack,
- DiskEntry->BytesPerSector,
- DiskEntry->Dirty ? '*' : ' ');
-
- Line = 13;
-
- for (i = 0; i < DiskEntry->LayoutBuffer->PartitionCount; i++)
- {
- PartitionInfo = &DiskEntry->LayoutBuffer->PartitionEntry[i];
-
- CONSOLE_PrintTextXY(6, Line,
- "%2u: %2lu %c %12I64u %12I64u %02x",
- i,
- PartitionInfo->PartitionNumber,
- PartitionInfo->BootIndicator ? 'A' :
'-',
- PartitionInfo->StartingOffset.QuadPart /
DiskEntry->BytesPerSector,
- PartitionInfo->PartitionLength.QuadPart /
DiskEntry->BytesPerSector,
- PartitionInfo->PartitionType);
- Line++;
- }
-#endif
-
- /* Commit the partition changes to the disk */
- Status = WritePartitions(DiskEntry);
- if (!NT_SUCCESS(Status))
+ else if (Status == STATUS_UNRECOGNIZED_VOLUME)
{
- DPRINT1("WritePartitions(disk %lu) failed, Status 0x%08lx\n",
- DiskEntry->DiskNumber, Status);
-
- MUIDisplayError(ERROR_WRITE_PTABLE, Ir, POPUP_WAIT_ENTER);
+ /* FIXME: show an error dialog */
+ // MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY,
PathBuffer);
/* Reset the filesystem list */
ResetFileSystemList();
-
return QUIT_PAGE;
}
-
- /* Set PartitionRootPath */
- RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
- L"\\Device\\Harddisk%lu\\Partition%lu",
- DiskEntry->DiskNumber,
- PartEntry->PartitionNumber);
- RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
- DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
-
- /* Format the partition */
- Status = FormatPartition(&PartitionRootPath,
- PartEntry->FileSystem,
- SelectedFileSystem->QuickFormat);
- if (Status == STATUS_NOT_SUPPORTED)
+ else if (Status == STATUS_NOT_SUPPORTED)
{
- sprintf(Buffer,
- "Setup is currently unable to format a partition in
%S.\n"
- "\n"
- " \x07 Press ENTER to continue Setup.\n"
- " \x07 Press F3 to quit Setup.",
- SelectedFileSystem->FileSystem /* PartEntry->FileSystem
*/);
+ RtlStringCbPrintfA(Buffer,
+ sizeof(Buffer),
+ "Setup is currently unable to format a partition
in %S.\n"
+ "\n"
+ " \x07 Press ENTER to continue Setup.\n"
+ " \x07 Press F3 to quit Setup.",
+ SelectedFileSystem->FileSystem);
PopupError(Buffer,
MUIGetString(STRING_QUITCONTINUE),
@@ -3520,28 +3464,20 @@ FormatPartitionPage(PINPUT_RECORD Ir)
}
else if (!NT_SUCCESS(Status))
{
+ /** HACK!! **/
+ RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
+ L"\\Device\\Harddisk%lu\\Partition%lu",
+ DiskEntry->DiskNumber,
+ PartEntry->PartitionNumber);
+
DPRINT1("FormatPartition() failed with status 0x%08lx\n",
Status);
MUIDisplayError(ERROR_FORMATTING_PARTITION, Ir, POPUP_WAIT_ANY_KEY,
PathBuffer);
/* Reset the filesystem list */
ResetFileSystemList();
-
return QUIT_PAGE;
}
-//
-// TODO: Here, call a partlist.c function that update the actual FS name
-// and the label fields of the volume.
-//
- PartEntry->FormatState = Formatted;
- // PartEntry->FileSystem = FileSystem;
- PartEntry->New = FALSE;
-
-#ifndef NDEBUG
- CONSOLE_SetStatusText(" Done. Press any key ...");
- CONSOLE_ConInKey(Ir);
-#endif
-
return SELECT_FILE_SYSTEM_PAGE;
}
}
@@ -3567,10 +3503,7 @@ static PAGE_NUMBER
CheckFileSystemPage(PINPUT_RECORD Ir)
{
NTSTATUS Status;
- PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
- UNICODE_STRING PartitionRootPath;
- WCHAR PathBuffer[MAX_PATH];
CHAR Buffer[MAX_PATH];
if (PartitionList == NULL)
@@ -3579,7 +3512,7 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
return QUIT_PAGE;
}
- if (!GetNextUncheckedPartition(PartitionList, &DiskEntry, &PartEntry))
+ if (!GetNextUncheckedPartition(PartitionList, NULL, &PartEntry))
{
return INSTALL_DIRECTORY_PAGE;
}
@@ -3587,29 +3520,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
ASSERT(PartEntry->IsPartitioned && PartEntry->PartitionNumber != 0);
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_CHECKINGPART));
-
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
DPRINT1("CheckFileSystemPage -- PartitionType: 0x%02X ; FileSystem: %S\n",
PartEntry->PartitionType, (*PartEntry->FileSystem ?
PartEntry->FileSystem : L"n/a"));
- /* HACK: Do not try to check a partition with an unknown filesystem */
- if (!*PartEntry->FileSystem)
- {
- PartEntry->NeedsCheck = FALSE;
- return CHECK_FILE_SYSTEM_PAGE;
- }
-
- /* Set PartitionRootPath */
- RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
- L"\\Device\\Harddisk%lu\\Partition%lu",
- DiskEntry->DiskNumber,
- PartEntry->PartitionNumber);
- RtlInitUnicodeString(&PartitionRootPath, PathBuffer);
- DPRINT("PartitionRootPath: %wZ\n", &PartitionRootPath);
-
/* Check the partition */
- Status = ChkdskPartition(&PartitionRootPath, PartEntry->FileSystem);
+ Status = DoChkdsk(PartEntry);
if (Status == STATUS_NOT_SUPPORTED)
{
/*
@@ -3650,8 +3567,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
}
else if (!NT_SUCCESS(Status))
{
- DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status);
- sprintf(Buffer, "ChkDsk detected some disk errors.\n(Status
0x%08lx).\n", Status);
+ DPRINT1("ChkdskPartition() failed with status 0x%08lx\n", Status);
+
+ RtlStringCbPrintfA(Buffer,
+ sizeof(Buffer),
+ "ChkDsk detected some disk errors.\n(Status
0x%08lx).\n",
+ Status);
+
PopupError(Buffer,
MUIGetString(STRING_CONTINUE),
Ir, POPUP_WAIT_ENTER);
@@ -4307,7 +4229,8 @@ BootLoaderPage(PINPUT_RECORD Ir)
CONSOLE_SetStatusText(MUIGetString(STRING_PLEASEWAIT));
- ASSERT(SystemPartition->IsPartitioned &&
SystemPartition->PartitionNumber != 0);
+ /* We must have a supported system partition by now */
+ ASSERT(SystemPartition && SystemPartition->IsPartitioned &&
SystemPartition->PartitionNumber != 0);
RtlFreeUnicodeString(&USetupData.SystemRootPath);
RtlStringCchPrintfW(PathBuffer, ARRAYSIZE(PathBuffer),
@@ -4806,7 +4729,7 @@ ProgressCountdown(
TimeElapsed = NtGetTickCount() - StartTime;
if (TimeElapsed < TimerDiv)
{
- /* Convert the time to NT Format */
+ /* Convert the time to NT format */
Timeout.QuadPart = (TimerDiv - TimeElapsed) * -10000LL;
Status = NtWaitForSingleObject(StdInput, FALSE, &Timeout);
}
@@ -4987,7 +4910,6 @@ RunUSetup(VOID)
CONSOLE_Flush();
// CONSOLE_SetUnderlinedTextXY(4, 3, " ReactOS " KERNEL_VERSION_STR
" Setup ");
- // CONSOLE_Flush();
switch (Page)
{
@@ -5041,6 +4963,7 @@ RunUSetup(VOID)
Page = LayoutSettingsPage(&Ir);
break;
+ /* Partitioning pages */
case SELECT_PARTITION_PAGE:
Page = SelectPartitionPage(&Ir);
break;
@@ -5065,6 +4988,7 @@ RunUSetup(VOID)
Page = DeletePartitionPage(&Ir);
break;
+ /* Filesystem partition operations pages */
case SELECT_FILE_SYSTEM_PAGE:
Page = SelectFileSystemPage(&Ir);
break;
@@ -5077,6 +5001,7 @@ RunUSetup(VOID)
Page = CheckFileSystemPage(&Ir);
break;
+ /* Installation pages */
case INSTALL_DIRECTORY_PAGE:
Page = InstallDirectoryPage(&Ir);
break;
@@ -5093,6 +5018,7 @@ RunUSetup(VOID)
Page = RegistryPage(&Ir);
break;
+ /* Bootloader installation pages */
case BOOT_LOADER_PAGE:
Page = BootLoaderPage(&Ir);
break;