reactos/base/setup/usetup/format.c
Hermès Bélusca-Maïto 3a19ee6a96
[SETUPLIB][USETUP] Introduce a 'SetupLib' library. CORE-13544
- Create the beginnings of a "setuplib" library, whose aim is to be shared between the (currently existing) 1st-stage text-mode installer, and the (future) 1st-stage GUI installer.
- Finish to split the GenList and PartList codes into their UI part, which remain in usetup, and their algorithmic part, which go into setuplib.
- Move SetMountedDeviceValue into the PartList module.
- Split the FileSystem list code into its UI and the algorithmic part (which goes into setuplib under the name fsutil.c).
  * The algo part is meant to be able to manage the filesystems available on the running system, similarly to what is mostly done (in scattered form) in fmifs, format, chkdsk / autochk codes...
    It also manages the partition filesystem recognition, using OS routines.
  * The UI part manages the FS list as it appears on screen, showing only the possible FSes that can be used to format the selected partition (a bit similar to what we do in the shell32's drive.c, etc...).
- Adapt the calling code to these changes.
- Remove some "host" code that was dating back from the dark old times.

svn path=/branches/setup_improvements/; revision=74570
svn path=/branches/setup_improvements/; revision=74659
2018-05-27 20:18:50 +02:00

126 lines
3.6 KiB
C

/*
* ReactOS kernel
* Copyright (C) 2003 ReactOS Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* 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
* PROJECT: ReactOS text-mode setup
* FILE: base/setup/usetup/format.c
* PURPOSE: Filesystem format support functions
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
/* INCLUDES *****************************************************************/
#include "usetup.h"
#define NDEBUG
#include <debug.h>
static PPROGRESSBAR FormatProgressBar = NULL;
/* FUNCTIONS ****************************************************************/
static
BOOLEAN
NTAPI
FormatCallback(
IN CALLBACKCOMMAND Command,
IN ULONG Modifier,
IN PVOID Argument)
{
switch (Command)
{
case PROGRESS:
{
PULONG Percent;
Percent = (PULONG)Argument;
DPRINT("%lu percent completed\n", *Percent);
ProgressSetStep(FormatProgressBar, *Percent);
break;
}
/*case OUTPUT:
{
PTEXTOUTPUT Output;
output = (PTEXTOUTPUT) Argument;
DPRINT("%s\n", output->Output);
break;
}*/
case DONE:
{
/*PBOOLEAN Success;*/
DPRINT("Done\n");
/*Success = (PBOOLEAN)Argument;
if (*Success == FALSE)
{
DPRINT("FormatEx was unable to complete successfully.\n\n");
}*/
break;
}
default:
DPRINT("Unknown callback %lu\n", (ULONG)Command);
break;
}
return TRUE;
}
NTSTATUS
FormatPartition(
IN PUNICODE_STRING DriveRoot,
IN PFILE_SYSTEM_ITEM FileSystemItem)
{
NTSTATUS Status;
PFILE_SYSTEM FileSystem = FileSystemItem->FileSystem;
if (!FileSystem || !FileSystem->FormatFunc)
return STATUS_NOT_SUPPORTED;
FormatProgressBar = CreateProgressBar(6,
yScreen - 14,
xScreen - 7,
yScreen - 10,
10,
24,
TRUE,
MUIGetString(STRING_FORMATTINGDISK));
ProgressSetStepCount(FormatProgressBar, 100);
Status = FileSystem->FormatFunc(DriveRoot,
FMIFS_HARDDISK, /* MediaFlag */
NULL, /* Label */
FileSystemItem->QuickFormat, /* QuickFormat */
0, /* ClusterSize */
FormatCallback); /* Callback */
DestroyProgressBar(FormatProgressBar);
FormatProgressBar = NULL;
DPRINT("FormatPartition() finished with status 0x%08lx\n", Status);
return Status;
}
/* EOF */