Author: ekohl
Date: Sun Dec 6 20:14:29 2015
New Revision: 70283
URL:
http://svn.reactos.org/svn/reactos?rev=70283&view=rev
Log:
[USETUP]
Little Improvements:
* Duplicate code removement regarding the simple list pages (and now everyone has
pageup/down + selection via char)
* Duplicate code removement regarding the partition type string
* Document the pages
Patch my Michael Fritscher
#CORE-10012 #resolve #comment Thanks a lot!
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/partlist.c
trunk/reactos/base/setup/usetup/partlist.h
trunk/reactos/base/setup/usetup/usetup.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 6 20:14:29
2015
@@ -612,6 +612,14 @@
}
+/*
+ * Displays the LanguagePage.
+ *
+ * Next pages: IntroPage, QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
LanguagePage(PINPUT_RECORD Ir)
{
@@ -737,6 +745,22 @@
/*
* Start page
+ *
+ * Next pages:
+ * LanguagePage (at once, default)
+ * InstallIntroPage (at once, if unattended)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Init Sdi
+ * Init SourcePath
+ * Init SourceRootPath
+ * Init SourceRootDir
+ * Init SetupInf
+ * Init RequiredPartitionDiskSpace
+ * Init IsUnattendedSetup
+ * If unattended, init *List and sets the Codepage
+ *
* RETURNS
* Number of the next page.
*/
@@ -911,9 +935,16 @@
/*
- * First setup page
+ * Displays the IntroPage.
+ *
+ * Next pages:
+ * InstallIntroPage (default)
+ * RepairIntroPage
+ * LicensePage
+ * QuitPage
+ *
* RETURNS
- * Next page number.
+ * Number of the next page.
*/
static PAGE_NUMBER
IntroPage(PINPUT_RECORD Ir)
@@ -951,9 +982,13 @@
/*
- * License Page
+ * Displays the License page.
+ *
+ * Next page:
+ * IntroPage (default)
+ *
* RETURNS
- * Back to main setup page.
+ * Number of the next page.
*/
static PAGE_NUMBER
LicensePage(PINPUT_RECORD Ir)
@@ -974,6 +1009,18 @@
}
+/*
+ * Displays the RepairIntroPage.
+ *
+ * Next pages:
+ * RebootPage (default)
+ * InstallIntroPage
+ * RecoveryPage
+ * IntroPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
RepairIntroPage(PINPUT_RECORD Ir)
{
@@ -1006,7 +1053,18 @@
return REPAIR_INTRO_PAGE;
}
-
+/*
+ * Displays the InstallIntroPage.
+ *
+ * Next pages:
+ * DeviceSettingsPage (At once if repair or update is selected)
+ * SelectPartitionPage (At once if unattended setup)
+ * DeviceSettingsPage (default)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
InstallIntroPage(PINPUT_RECORD Ir)
{
@@ -1083,6 +1141,27 @@
#endif
+/*
+ * Displays the DeviceSettingsPage.
+ *
+ * Next pages:
+ * SelectPartitionPage (At once if repair or update is selected)
+ * ComputerSettingsPage
+ * DisplaySettingsPage
+ * KeyboardSettingsPage
+ * LayoutsettingsPage
+ * SelectPartitionPage
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Init ComputerList
+ * Init DisplayList
+ * Init KeyboardList
+ * Init LayoutList
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
DeviceSettingsPage(PINPUT_RECORD Ir)
{
@@ -1208,6 +1287,80 @@
}
+/*
+ * Handles generic selection lists.
+ *
+ * PARAMS
+ * GenericList: The list to handle.
+ * nextPage: The page it needs to jump to after this page.
+ * Ir: The PINPUT_RECORD
+ */
+static PAGE_NUMBER
+HandleGenericList(PGENERIC_LIST GenericList,
+ PAGE_NUMBER nextPage,
+ PINPUT_RECORD Ir)
+{
+ while (TRUE)
+ {
+ CONSOLE_ConInKey(Ir);
+
+ if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
+ {
+ ScrollDownGenericList(GenericList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
+ {
+ ScrollUpGenericList(GenericList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
+ {
+ ScrollPageDownGenericList(GenericList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
+ {
+ ScrollPageUpGenericList(GenericList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
+ {
+ if (ConfirmQuit(Ir) == TRUE)
+ return QUIT_PAGE;
+
+ continue;
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
+ {
+ RestoreGenericListState(GenericList);
+ return nextPage;
+ }
+ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
+ {
+ return nextPage;
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
(Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
+ {
+ /* a-z */
+ GenericListKeyPress(GenericList, Ir->Event.KeyEvent.uChar.AsciiChar);
+ }
+ }
+}
+
+
+/*
+ * Displays the ComputerSettingsPage.
+ *
+ * Next pages:
+ * DeviceSettingsPage
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
ComputerSettingsPage(PINPUT_RECORD Ir)
{
@@ -1221,44 +1374,20 @@
SaveGenericListState(ComputerList);
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownGenericList(ComputerList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpGenericList(ComputerList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- return QUIT_PAGE;
-
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- RestoreGenericListState(ComputerList);
- return DEVICE_SETTINGS_PAGE;
- }
- else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return DEVICE_SETTINGS_PAGE;
- }
- }
-
- return COMPUTER_SETTINGS_PAGE;
+ return HandleGenericList(ComputerList, DEVICE_SETTINGS_PAGE, Ir);
}
-
-
+
+
+/*
+ * Displays the DisplaySettingsPage.
+ *
+ * Next pages:
+ * DeviceSettingsPage
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
DisplaySettingsPage(PINPUT_RECORD Ir)
{
@@ -1272,46 +1401,20 @@
SaveGenericListState(DisplayList);
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownGenericList(DisplayList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpGenericList(DisplayList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- {
- return QUIT_PAGE;
- }
-
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- RestoreGenericListState(DisplayList);
- return DEVICE_SETTINGS_PAGE;
- }
- else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return DEVICE_SETTINGS_PAGE;
- }
- }
-
- return DISPLAY_SETTINGS_PAGE;
+ return HandleGenericList(DisplayList, DEVICE_SETTINGS_PAGE, Ir);
}
+/*
+ * Displays the KeyboardSettingsPage.
+ *
+ * Next pages:
+ * DeviceSettingsPage
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
KeyboardSettingsPage(PINPUT_RECORD Ir)
{
@@ -1325,44 +1428,20 @@
SaveGenericListState(KeyboardList);
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownGenericList(KeyboardList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpGenericList(KeyboardList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- return QUIT_PAGE;
-
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- RestoreGenericListState(KeyboardList);
- return DEVICE_SETTINGS_PAGE;
- }
- else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return DEVICE_SETTINGS_PAGE;
- }
- }
-
- return KEYBOARD_SETTINGS_PAGE;
+ return HandleGenericList(KeyboardList, DEVICE_SETTINGS_PAGE, Ir);
}
+/*
+ * Displays the LayoutSettingsPage.
+ *
+ * Next pages:
+ * DeviceSettingsPage
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
LayoutSettingsPage(PINPUT_RECORD Ir)
{
@@ -1376,56 +1455,7 @@
SaveGenericListState(LayoutList);
- while (TRUE)
- {
- CONSOLE_ConInKey(Ir);
-
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
- {
- ScrollDownGenericList(LayoutList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
- {
- ScrollUpGenericList(LayoutList);
- }
- if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_NEXT)) /* PAGE DOWN */
- {
- ScrollPageDownGenericList(LayoutList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_PRIOR)) /* PAGE UP */
- {
- ScrollPageUpGenericList(LayoutList);
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
- {
- if (ConfirmQuit(Ir) == TRUE)
- return QUIT_PAGE;
-
- break;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
- (Ir->Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE)) /* ESC */
- {
- RestoreGenericListState(LayoutList);
- return DEVICE_SETTINGS_PAGE;
- }
- else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
- {
- return DEVICE_SETTINGS_PAGE;
- }
- else if ((Ir->Event.KeyEvent.uChar.AsciiChar > 0x60) &&
(Ir->Event.KeyEvent.uChar.AsciiChar < 0x7b))
- {
- /* a-z */
- GenericListKeyPress(LayoutList , Ir->Event.KeyEvent.uChar.AsciiChar);
- }
- }
-
- return LAYOUT_SETTINGS_PAGE;
+ return HandleGenericList(LayoutList, DEVICE_SETTINGS_PAGE, Ir);
}
@@ -1450,6 +1480,26 @@
}
+/*
+ * Displays the SelectPartitionPage.
+ *
+ * Next pages:
+ * SelectFileSystemPage (At once if unattended)
+ * SelectFileSystemPage (Default if free space is selected)
+ * CreatePrimaryPartitionPage
+ * CreateExtendedPartitionPage
+ * CreateLogicalPartitionPage
+ * ConfirmDeleteSystemPartitionPage (if the selected partition is the system partition,
aka with the boot flag set)
+ * DeletePartitionPage
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Init DestinationDriveLetter (only if unattended or not free space is selected)
+ * Set InstallShortcut (only if not unattended + free space is selected)
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
SelectPartitionPage(PINPUT_RECORD Ir)
{
@@ -1801,6 +1851,17 @@
}
+/*
+ * Displays the CreatePrimaryPartitionPage.
+ *
+ * Next pages:
+ * SelectPartitionPage
+ * SelectFileSystemPage (default)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
CreatePrimaryPartitionPage(PINPUT_RECORD Ir)
{
@@ -1948,6 +2009,16 @@
}
+/*
+ * Displays the CreateExtendedPartitionPage.
+ *
+ * Next pages:
+ * SelectPartitionPage (default)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
CreateExtendedPartitionPage(PINPUT_RECORD Ir)
{
@@ -2094,6 +2165,16 @@
}
+/*
+ * Displays the CreateLogicalPartitionPage.
+ *
+ * Next pages:
+ * SelectFileSystemPage (default)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
CreateLogicalPartitionPage(PINPUT_RECORD Ir)
{
@@ -2241,6 +2322,16 @@
}
+/*
+ * Displays the ConfirmDeleteSystemPartitionPage.
+ *
+ * Next pages:
+ * DeletePartitionPage (default)
+ * SelectPartitionPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
ConfirmDeleteSystemPartitionPage(PINPUT_RECORD Ir)
{
@@ -2274,6 +2365,16 @@
}
+/*
+ * Displays the DeletePartitionPage.
+ *
+ * Next pages:
+ * SelectPartitionPage (default)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
DeletePartitionPage(PINPUT_RECORD Ir)
{
@@ -2282,7 +2383,7 @@
ULONGLONG DiskSize;
ULONGLONG PartSize;
PCHAR Unit;
- PCHAR PartType;
+ CHAR PartType[32];
if (PartitionList == NULL ||
PartitionList->CurrentDisk == NULL ||
@@ -2297,39 +2398,9 @@
MUIDisplayPage(DELETE_PARTITION_PAGE);
- /* Determine partition type */
- PartType = NULL;
- if (PartEntry->New == TRUE)
- {
- PartType = MUIGetString(STRING_UNFORMATTED);
- }
- else if (PartEntry->IsPartitioned == TRUE)
- {
- if ((PartEntry->PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartitionType == PARTITION_XINT13))
- {
- PartType = "FAT";
- }
- else if ((PartEntry->PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartitionType == PARTITION_FAT32_XINT13))
- {
- PartType = "FAT32";
- }
- else if (PartEntry->PartitionType == PARTITION_EXT2)
- {
- PartType = "EXT2";
- }
- else if (PartEntry->PartitionType == PARTITION_IFS)
- {
- PartType = "NTFS"; /* FIXME: Not quite correct! */
- }
- else if (IsContainerPartition(PartEntry->PartitionType))
- {
- PartType = MUIGetString(STRING_EXTENDED_PARTITION);
- }
- }
+ GetPartTypeStringFromPartitionTypeA(PartEntry->PartitionType,
+ PartType,
+ 30);
PartSize = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
#if 0
@@ -2443,6 +2514,24 @@
}
+/*
+ * Displays the SelectFileSystemPage.
+ *
+ * Next pages:
+ * CheckFileSystemPage (At once if RepairUpdate is selected)
+ * CheckFileSystemPage (At once if Unattended and not UnattendFormatPartition)
+ * FormatPartitionPage (At once if Unattended and UnattendFormatPartition)
+ * SelectPartitionPage (If the user aborts)
+ * FormatPartitionPage (Default)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Sets
PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType
(via UpdatePartitionType)
+ * Calls CheckActiveBootPartition()
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
SelectFileSystemPage(PINPUT_RECORD Ir)
{
@@ -2452,7 +2541,7 @@
ULONGLONG PartSize;
PCHAR DiskUnit;
PCHAR PartUnit;
- PCHAR PartType;
+ CHAR PartTypeString[32];
DPRINT("SelectFileSystemPage()\n");
@@ -2576,34 +2665,9 @@
}
/* adjust partition type */
- if ((PartEntry->PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartitionType == PARTITION_XINT13))
- {
- PartType = "FAT";
- }
- else if ((PartEntry->PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartitionType == PARTITION_FAT32_XINT13))
- {
- PartType = "FAT32";
- }
- else if (PartEntry->PartitionType == PARTITION_EXT2)
- {
- PartType = "EXT2";
- }
- else if (PartEntry->PartitionType == PARTITION_IFS)
- {
- PartType = "NTFS"; /* FIXME: Not quite correct! */
- }
- else if (PartEntry->PartitionType == PARTITION_ENTRY_UNUSED)
- {
- PartType = MUIGetString(STRING_FORMATUNUSED);
- }
- else
- {
- PartType = MUIGetString(STRING_FORMATUNKNOWN);
- }
+ GetPartTypeStringFromPartitionTypeA(PartEntry->PartitionType,
+ PartTypeString,
+ 30);
if (PartEntry->AutoCreate == TRUE)
{
@@ -2657,7 +2721,7 @@
{
CONSOLE_SetTextXY(6, 8, MUIGetString(STRING_INSTALLONPART));
- if (PartType == NULL)
+ if (PartTypeString == NULL)
{
CONSOLE_PrintTextXY(8, 10,
MUIGetString(STRING_HDDINFOUNK4),
@@ -2673,7 +2737,7 @@
"%c%c %s %I64u %s",
(PartEntry->DriveLetter == 0) ? '-' :
PartEntry->DriveLetter,
(PartEntry->DriveLetter == 0) ? '-' :
':',
- PartType,
+ PartTypeString,
PartSize,
PartUnit);
}
@@ -2769,6 +2833,21 @@
}
+/*
+ * Displays the FormatPartitionPage.
+ *
+ * Next pages:
+ * InstallDirectoryPage (At once if IsUnattendedSetup or InstallShortcut)
+ * SelectPartitionPage (At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Sets PartitionList->CurrentPartition->FormatState
+ * Sets DestinationRootPath
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static ULONG
FormatPartitionPage(PINPUT_RECORD Ir)
{
@@ -2961,6 +3040,19 @@
}
+/*
+ * Displays the CheckFileSystemPage.
+ *
+ * Next pages:
+ * InstallDirectoryPage (At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Inits or reloads FileSystemList
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static ULONG
CheckFileSystemPage(PINPUT_RECORD Ir)
{
@@ -2968,7 +3060,7 @@
UNICODE_STRING PartitionRootPath;
WCHAR PathBuffer[MAX_PATH];
CHAR Buffer[MAX_PATH];
- LPWSTR FileSystemName = NULL;
+ WCHAR PartTypeString[32];
PDISKENTRY DiskEntry;
PPARTENTRY PartEntry;
NTSTATUS Status;
@@ -3001,29 +3093,13 @@
CurrentFileSystem = PartEntry->FileSystem;
if (CurrentFileSystem == NULL || CurrentFileSystem->FileSystemName == NULL)
{
- if ((PartEntry->PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartitionType == PARTITION_XINT13) ||
- (PartEntry->PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartitionType == PARTITION_FAT32_XINT13))
- {
- FileSystemName = L"FAT";
- }
- else if (PartEntry->PartitionType == PARTITION_EXT2)
- {
- FileSystemName = L"EXT2";
- }
- else if (PartEntry->PartitionType == PARTITION_IFS)
- {
- FileSystemName = L"NTFS"; /* FIXME: Not quite correct! */
- }
-
- DPRINT("FileSystemName: %S\n", FileSystemName);
-
- if (FileSystemName != NULL)
+ GetPartTypeStringFromPartitionTypeW(PartEntry->PartitionType, PartTypeString,
30);
+
+ DPRINT("PartTypeString: %S\n", PartTypeString);
+
+ if (PartTypeString != NULL)
CurrentFileSystem = GetFileSystemByName(FileSystemList,
- FileSystemName);
+ PartTypeString);
}
/* HACK: Do not try to check a partition with an unknown filesytem */
@@ -3087,6 +3163,20 @@
}
+/*
+ * Displays the InstallDirectoryPage1.
+ *
+ * Next pages:
+ * PrepareCopyPage (At once)
+ *
+ * SIDEEFFECTS
+ * Inits DestinationRootPath
+ * Inits DestinationPath
+ * Inits DestinationArcPath
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
InstallDirectoryPage1(PWCHAR InstallDir,
PDISKENTRY DiskEntry,
@@ -3135,6 +3225,16 @@
}
+/*
+ * Displays the InstallDirectoryPage.
+ *
+ * Next pages:
+ * PrepareCopyPage (As the direct result of InstallDirectoryPage1)
+ * QuitPage
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
InstallDirectoryPage(PINPUT_RECORD Ir)
{
@@ -3574,6 +3674,20 @@
}
+/*
+ * Displays the PrepareCopyPage.
+ *
+ * Next pages:
+ * FileCopyPage(At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Inits SetupFileQueue
+ * Calls PrepareCopyPageInfFile
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
PrepareCopyPage(PINPUT_RECORD Ir)
{
@@ -3739,6 +3853,19 @@
}
+/*
+ * Displays the FileCopyPage.
+ *
+ * Next pages:
+ * RegistryPage(At once)
+ *
+ * SIDEEFFECTS
+ * Calls SetupCommitFileQueueW
+ * Calls SetupCloseFileQueue
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static
PAGE_NUMBER
FileCopyPage(PINPUT_RECORD Ir)
@@ -3816,6 +3943,24 @@
}
+/*
+ * Displays the RegistryPage.
+ *
+ * Next pages:
+ * SuccessPage (if RepairUpdate)
+ * BootLoaderPage (default)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Calls SetInstallPathValue
+ * Calls NtInitializeRegistry
+ * Calls ImportRegistryFile
+ * Calls SetDefaultPagefile
+ * Calls SetMountedDeviceValues
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
RegistryPage(PINPUT_RECORD Ir)
{
@@ -3961,6 +4106,27 @@
}
+/*
+ * Displays the BootLoaderPage.
+ *
+ * Next pages:
+ * SuccessPage (if RepairUpdate)
+ * BootLoaderHarddiskMbrPage
+ * BootLoaderHarddiskVbrPage
+ * BootLoaderFloppyPage
+ * SuccessPage
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Calls SetInstallPathValue
+ * Calls NtInitializeRegistry
+ * Calls ImportRegistryFile
+ * Calls SetDefaultPagefile
+ * Calls SetMountedDeviceValues
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
BootLoaderPage(PINPUT_RECORD Ir)
{
@@ -4115,6 +4281,19 @@
}
+/*
+ * Displays the BootLoaderFloppyPage.
+ *
+ * Next pages:
+ * SuccessPage (At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Calls InstallFatBootcodeToFloppy()
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
BootLoaderFloppyPage(PINPUT_RECORD Ir)
{
@@ -4159,6 +4338,19 @@
}
+/*
+ * Displays the BootLoaderHarddiskVbrPage.
+ *
+ * Next pages:
+ * SuccessPage (At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Calls InstallVBRToPartition()
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
BootLoaderHarddiskVbrPage(PINPUT_RECORD Ir)
{
@@ -4181,6 +4373,20 @@
}
+/*
+ * Displays the BootLoaderHarddiskMbrPage.
+ *
+ * Next pages:
+ * SuccessPage (At once)
+ * QuitPage
+ *
+ * SIDEEFFECTS
+ * Calls InstallVBRToPartition()
+ * CallsInstallMbrBootCodeToDisk()
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
BootLoaderHarddiskMbrPage(PINPUT_RECORD Ir)
{
@@ -4227,6 +4433,18 @@
}
+/*
+ * Displays the QuitPage.
+ *
+ * Next pages:
+ * FlushPage (At once)
+ *
+ * SIDEEFFECTS
+ * Destroy the Lists
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
QuitPage(PINPUT_RECORD Ir)
{
@@ -4294,6 +4512,18 @@
}
+/*
+ * Displays the SuccessPage.
+ *
+ * Next pages:
+ * FlushPage (At once)
+ *
+ * SIDEEFFECTS
+ * Destroy the Lists
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
SuccessPage(PINPUT_RECORD Ir)
{
@@ -4316,6 +4546,15 @@
}
+/*
+ * Displays the FlushPage.
+ *
+ * Next pages:
+ * RebootPage (At once)
+ *
+ * RETURNS
+ * Number of the next page.
+ */
static PAGE_NUMBER
FlushPage(PINPUT_RECORD Ir)
{
@@ -4327,6 +4566,10 @@
DWORD WINAPI
PnpEventThread(IN LPVOID lpParameter);
+
+/*
+ * The start routine and page management
+ */
VOID
RunUSetup(VOID)
{
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 6 20:14:29 2015
@@ -1448,6 +1448,66 @@
}
+VOID
+GetPartTypeStringFromPartitionTypeW(
+ UCHAR partitionType,
+ PWCHAR strPartType,
+ DWORD cchPartType)
+{
+ CHAR partTypeString[32];
+
+ GetPartTypeStringFromPartitionTypeA(partitionType,
+ partTypeString,
+ 30);
+
+ mbstowcs(strPartType,
+ partTypeString,
+ (30 < cchPartType) ? 30 : cchPartType);
+}
+
+
+VOID
+GetPartTypeStringFromPartitionTypeA(
+ UCHAR partitionType,
+ PCHAR strPartType,
+ DWORD cchPartType)
+{
+ /* Determine partition type */
+ if ((partitionType == PARTITION_FAT_12) ||
+ (partitionType == PARTITION_FAT_16) ||
+ (partitionType == PARTITION_HUGE) ||
+ (partitionType == PARTITION_XINT13))
+ {
+ StringCchCopy(strPartType, cchPartType, "FAT");
+ }
+ else if ((partitionType == PARTITION_FAT32) ||
+ (partitionType == PARTITION_FAT32_XINT13))
+ {
+ StringCchCopy(strPartType, cchPartType, "FAT32");
+ }
+ else if (partitionType == PARTITION_EXT2)
+ {
+ StringCchCopy(strPartType, cchPartType, "EXT2");
+ }
+ else if (partitionType == PARTITION_IFS)
+ {
+ StringCchCopy(strPartType, cchPartType, "NTFS"); /* FIXME: Not quite
correct! */
+ }
+ else if (IsContainerPartition(partitionType))
+ {
+ StringCchCopy(strPartType, cchPartType,
MUIGetString(STRING_EXTENDED_PARTITION));
+ }
+ else if (partitionType == PARTITION_ENTRY_UNUSED)
+ {
+ StringCchCopy(strPartType, cchPartType, MUIGetString(STRING_FORMATUNUSED));
+ }
+ else
+ {
+ StringCchCopy(strPartType, cchPartType, MUIGetString(STRING_FORMATUNKNOWN));
+ }
+}
+
+
static
VOID
PrintPartitionData(
@@ -1463,7 +1523,9 @@
LARGE_INTEGER PartSize;
PCHAR Unit;
UCHAR Attribute;
+ CHAR PartTypeString[32];
PCHAR PartType;
+ PartType = PartTypeString;
Width = List->Right - List->Left - 1;
Height = List->Bottom - List->Top - 2;
@@ -1503,38 +1565,17 @@
else
{
/* Determine partition type */
- PartType = NULL;
+ PartTypeString[0] = '\0';
if (PartEntry->New == TRUE)
{
PartType = MUIGetString(STRING_UNFORMATTED);
}
else if (PartEntry->IsPartitioned == TRUE)
{
- if ((PartEntry->PartitionType == PARTITION_FAT_12) ||
- (PartEntry->PartitionType == PARTITION_FAT_16) ||
- (PartEntry->PartitionType == PARTITION_HUGE) ||
- (PartEntry->PartitionType == PARTITION_XINT13))
- {
- PartType = "FAT";
- }
- else if ((PartEntry->PartitionType == PARTITION_FAT32) ||
- (PartEntry->PartitionType == PARTITION_FAT32_XINT13))
- {
- PartType = "FAT32";
- }
- else if (PartEntry->PartitionType == PARTITION_EXT2)
- {
- PartType = "EXT2";
- }
- else if (PartEntry->PartitionType == PARTITION_IFS)
- {
- PartType = "NTFS"; /* FIXME: Not quite correct! */
- }
- else if ((PartEntry->PartitionType == PARTITION_EXTENDED) ||
- (PartEntry->PartitionType == PARTITION_XINT13_EXTENDED))
- {
- PartType = MUIGetString(STRING_EXTENDED_PARTITION);
- }
+ GetPartTypeStringFromPartitionTypeA(PartEntry->PartitionType,
+ PartTypeString,
+ 30);
+ PartType = PartTypeString;
}
PartSize.QuadPart = PartEntry->SectorCount.QuadPart *
DiskEntry->BytesPerSector;
@@ -1557,7 +1598,7 @@
Unit = MUIGetString(STRING_KB);
}
- if (PartType == NULL)
+ if (strcmp(PartType, MUIGetString(STRING_FORMATUNKNOWN)) == 0)
{
sprintf(LineBuffer,
MUIGetString(STRING_HDDINFOUNK5),
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 6 20:14:29 2015
@@ -293,4 +293,16 @@
OUT PDISKENTRY *pDiskEntry,
OUT PPARTENTRY *pPartEntry);
+VOID
+GetPartTypeStringFromPartitionTypeA(
+ UCHAR partitionType,
+ PSTR strPartType,
+ DWORD cchPartType);
+
+VOID
+GetPartTypeStringFromPartitionTypeW(
+ UCHAR partitionType,
+ PWSTR strPartType,
+ DWORD cchPartType);
+
/* EOF */
Modified: trunk/reactos/base/setup/usetup/usetup.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/usetup.h…
==============================================================================
--- trunk/reactos/base/setup/usetup/usetup.h [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/usetup.h [iso-8859-1] Sun Dec 6 20:14:29 2015
@@ -38,6 +38,8 @@
#include <winreg.h>
#include <winuser.h>
#include <wincon.h>
+
+#include <strsafe.h>
#define NTOS_MODE_USER
#include <ndk/cmfuncs.h>