2003-04-28 19:44:13 +00:00
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*
|
2009-10-27 10:34:16 +00:00
|
|
|
* 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.
|
2003-04-28 19:44:13 +00:00
|
|
|
*/
|
2006-09-07 20:15:45 +00:00
|
|
|
/* COPYRIGHT: See COPYING in the top level directory
|
2003-04-28 19:44:13 +00:00
|
|
|
* PROJECT: ReactOS text-mode setup
|
2015-09-13 16:40:36 +00:00
|
|
|
* FILE: base/setup/usetup/format.c
|
2003-04-28 19:44:13 +00:00
|
|
|
* PURPOSE: Filesystem format support functions
|
|
|
|
* PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES *****************************************************************/
|
|
|
|
|
2006-08-31 09:13:03 +00:00
|
|
|
#include "usetup.h"
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2010-06-07 21:38:49 +00:00
|
|
|
#define NDEBUG
|
2003-04-28 19:44:13 +00:00
|
|
|
#include <debug.h>
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
static PPROGRESSBAR FormatProgressBar = NULL;
|
2003-04-28 19:44:13 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS ****************************************************************/
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
static
|
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
2006-09-07 20:15:45 +00:00
|
|
|
FormatCallback(
|
|
|
|
IN CALLBACKCOMMAND Command,
|
|
|
|
IN ULONG Modifier,
|
|
|
|
IN PVOID Argument)
|
2004-02-23 11:58:27 +00:00
|
|
|
{
|
2006-09-07 20:15:45 +00:00
|
|
|
switch (Command)
|
2004-02-23 11:58:27 +00:00
|
|
|
{
|
2006-09-07 20:15:45 +00:00
|
|
|
case PROGRESS:
|
|
|
|
{
|
|
|
|
PULONG Percent;
|
|
|
|
|
|
|
|
Percent = (PULONG)Argument;
|
|
|
|
DPRINT("%lu percent completed\n", *Percent);
|
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
ProgressSetStep(FormatProgressBar, *Percent);
|
2006-09-07 20:15:45 +00:00
|
|
|
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;
|
2004-02-23 11:58:27 +00:00
|
|
|
}
|
|
|
|
|
2006-09-07 20:15:45 +00:00
|
|
|
return TRUE;
|
2004-02-23 11:58:27 +00:00
|
|
|
}
|
|
|
|
|
2014-05-12 14:17:37 +00:00
|
|
|
|
2003-04-28 19:44:13 +00:00
|
|
|
NTSTATUS
|
2006-09-07 20:15:45 +00:00
|
|
|
FormatPartition(
|
2006-09-07 22:42:28 +00:00
|
|
|
IN PUNICODE_STRING DriveRoot,
|
2019-02-24 16:52:33 +00:00
|
|
|
IN PCWSTR FileSystemName,
|
|
|
|
IN BOOLEAN QuickFormat)
|
2003-04-28 19:44:13 +00:00
|
|
|
{
|
2006-09-07 20:15:45 +00:00
|
|
|
NTSTATUS Status;
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
FormatProgressBar = CreateProgressBar(6,
|
|
|
|
yScreen - 14,
|
|
|
|
xScreen - 7,
|
|
|
|
yScreen - 10,
|
2007-02-28 20:43:13 +00:00
|
|
|
10,
|
|
|
|
24,
|
|
|
|
TRUE,
|
2008-02-12 14:52:36 +00:00
|
|
|
MUIGetString(STRING_FORMATTINGDISK));
|
2006-09-09 17:11:03 +00:00
|
|
|
|
|
|
|
ProgressSetStepCount(FormatProgressBar, 100);
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2019-02-24 16:52:33 +00:00
|
|
|
Status = FormatFileSystem_UStr(DriveRoot,
|
|
|
|
FileSystemName,
|
|
|
|
FMIFS_HARDDISK, /* MediaFlag */
|
|
|
|
NULL, /* Label */
|
|
|
|
QuickFormat, /* QuickFormat */
|
|
|
|
0, /* ClusterSize */
|
|
|
|
FormatCallback); /* Callback */
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
DestroyProgressBar(FormatProgressBar);
|
|
|
|
FormatProgressBar = NULL;
|
2004-02-23 11:58:27 +00:00
|
|
|
|
2006-09-09 17:11:03 +00:00
|
|
|
DPRINT("FormatPartition() finished with status 0x%08lx\n", Status);
|
2003-04-28 19:44:13 +00:00
|
|
|
|
2006-09-07 20:15:45 +00:00
|
|
|
return Status;
|
2003-04-28 19:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* EOF */
|