* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id$
- * COPYRIGHT: See COPYING in the top level directory
+/* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS text-mode setup
* FILE: subsys/system/usetup/format.c
* PURPOSE: Filesystem format support functions
/* FUNCTIONS ****************************************************************/
-
-BOOLEAN NTAPI
-FormatCallback (CALLBACKCOMMAND Command,
- ULONG Modifier,
- PVOID Argument)
+static BOOLEAN NTAPI
+FormatCallback(
+ IN CALLBACKCOMMAND Command,
+ IN ULONG Modifier,
+ IN PVOID Argument)
{
-// DPRINT1 ("FormatCallback() called\n");
-
- switch (Command)
+ switch (Command)
{
- case PROGRESS:
- {
- PULONG Percent;
-
- Percent = (PULONG)Argument;
- DPRINT ("%lu percent completed\n", *Percent);
-
- ProgressSetStep (ProgressBar, *Percent);
- }
- break;
-
-// case OUTPUT:
-// {
-// PTEXTOUTPUT Output;
-// output = (PTEXTOUTPUT) Argument;
-// fprintf(stdout, "%s", output->Output);
-// }
-// break;
-
- case DONE:
- {
- DPRINT ("Done\n");
-// PBOOLEAN Success;
-// status = (PBOOLEAN) Argument;
-// if ( *status == FALSE )
-// {
-// wprintf(L"FormatEx was unable to complete successfully.\n\n");
-// Error = TRUE;
-// }
- }
- break;
-
- default:
- DPRINT ("Unknown callback %lu\n", (ULONG)Command);
- break;
+ case PROGRESS:
+ {
+ PULONG Percent;
+
+ Percent = (PULONG)Argument;
+ DPRINT("%lu percent completed\n", *Percent);
+
+ ProgressSetStep(ProgressBar, *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;
}
-// DPRINT1 ("FormatCallback() done\n");
-
- return TRUE;
+ return TRUE;
}
-
NTSTATUS
-FormatPartition (PUNICODE_STRING DriveRoot)
+FormatPartition(
+ IN PUNICODE_STRING DriveRoot)
{
- NTSTATUS Status;
- SHORT xScreen;
- SHORT yScreen;
-
- CONSOLE_GetScreenSize(&xScreen, &yScreen);
+ NTSTATUS Status;
- ProgressBar = CreateProgressBar (6,
- yScreen - 14,
- xScreen - 7,
- yScreen - 10,
- "Setup is formatting your disk");
+ ProgressBar = CreateProgressBar(6,
+ yScreen - 14,
+ xScreen - 7,
+ yScreen - 10,
+ "Setup is formatting your disk");
- ProgressSetStepCount (ProgressBar, 100);
+ ProgressSetStepCount(ProgressBar, 100);
- Status = VfatFormat (DriveRoot,
- 0, /* MediaFlag */
- NULL, /* Label */
- TRUE, /* QuickFormat */
- 0, /* ClusterSize */
- (PFMIFSCALLBACK)FormatCallback); /* Callback */
+ Status = VfatFormat(DriveRoot,
+ FMIFS_HARDDISK, /* MediaFlag */
+ NULL, /* Label */
+ TRUE, /* QuickFormat */
+ 0, /* ClusterSize */
+ FormatCallback); /* Callback */
- DestroyProgressBar (ProgressBar);
- ProgressBar = NULL;
+ DestroyProgressBar(ProgressBar);
+ ProgressBar = NULL;
- DPRINT ("VfatFormat() status 0x%.08x\n", Status);
+ DPRINT("FormatEx() finished with status 0x%08lx\n", Status);
- return Status;
+ return Status;
}
/* EOF */
/* FUNCTIONS ****************************************************************/
PFILE_SYSTEM_LIST
-CreateFileSystemList (SHORT Left,
- SHORT Top,
- BOOLEAN ForceFormat,
- FILE_SYSTEM ForceFileSystem)
+CreateFileSystemList(
+ IN SHORT Left,
+ IN SHORT Top,
+ IN BOOLEAN ForceFormat,
+ IN FILE_SYSTEM ForceFileSystem)
{
- PFILE_SYSTEM_LIST List;
+ PFILE_SYSTEM_LIST List;
- List = (PFILE_SYSTEM_LIST)RtlAllocateHeap (ProcessHeap, 0, sizeof(FILE_SYSTEM_LIST));
- if (List == NULL)
- return NULL;
+ List = (PFILE_SYSTEM_LIST)RtlAllocateHeap(ProcessHeap, 0, sizeof(FILE_SYSTEM_LIST));
+ if (List == NULL)
+ return NULL;
- List->Left = Left;
- List->Top = Top;
+ List->Left = Left;
+ List->Top = Top;
- List->ForceFormat = ForceFormat;
- List->FileSystemCount = 1;
- if (ForceFormat)
+ List->ForceFormat = ForceFormat;
+ List->FileSystemCount = 1;
+ if (ForceFormat)
{
- List->CurrentFileSystem = ForceFileSystem;
+ List->CurrentFileSystem = ForceFileSystem;
}
- else
+ else
{
- List->FileSystemCount++;
- List->CurrentFileSystem = FsKeep;
+ List->FileSystemCount++;
+ List->CurrentFileSystem = FsKeep;
}
- return List;
+ return List;
}
-
VOID
-DestroyFileSystemList (PFILE_SYSTEM_LIST List)
+DestroyFileSystemList(
+ IN PFILE_SYSTEM_LIST List)
{
- RtlFreeHeap (ProcessHeap, 0, List);
+ RtlFreeHeap(ProcessHeap, 0, List);
}
-
VOID
-DrawFileSystemList (PFILE_SYSTEM_LIST List)
+DrawFileSystemList(
+ IN PFILE_SYSTEM_LIST List)
{
- COORD coPos;
- ULONG Written;
- ULONG Index;
-
- Index = 0;
-
- coPos.X = List->Left;
- coPos.Y = List->Top + Index;
- FillConsoleOutputAttribute (StdOutput,
- FOREGROUND_WHITE | BACKGROUND_BLUE,
- 50,
- coPos,
- &Written);
- FillConsoleOutputCharacterA (StdOutput,
- ' ',
- 50,
- coPos,
- &Written);
-
- if (List->CurrentFileSystem == FsFat)
+ COORD coPos;
+ ULONG Written;
+ ULONG Index;
+
+ Index = 0;
+
+ coPos.X = List->Left;
+ coPos.Y = List->Top + Index;
+ FillConsoleOutputAttribute(StdOutput,
+ FOREGROUND_WHITE | BACKGROUND_BLUE,
+ 50,
+ coPos,
+ &Written);
+ FillConsoleOutputCharacterA(StdOutput,
+ ' ',
+ 50,
+ coPos,
+ &Written);
+
+ if (List->CurrentFileSystem == FsFat)
{
- CONSOLE_SetInvertedTextXY (List->Left,
- List->Top + Index,
- " Format partition as FAT file system ");
+ CONSOLE_SetInvertedTextXY(List->Left,
+ List->Top + Index,
+ " Format partition as FAT file system ");
}
- else
+ else
{
- CONSOLE_SetTextXY (List->Left,
- List->Top + Index,
- " Format partition as FAT file system ");
+ CONSOLE_SetTextXY(List->Left,
+ List->Top + Index,
+ " Format partition as FAT file system ");
}
- Index++;
+ Index++;
- if (List->ForceFormat == FALSE)
+ if (List->ForceFormat == FALSE)
{
- coPos.X = List->Left;
- coPos.Y = List->Top + Index;
- FillConsoleOutputAttribute (StdOutput,
- FOREGROUND_WHITE | BACKGROUND_BLUE,
- 50,
- coPos,
- &Written);
- FillConsoleOutputCharacterA (StdOutput,
- ' ',
- 50,
- coPos,
- &Written);
-
- if (List->CurrentFileSystem == FsKeep)
- {
- CONSOLE_SetInvertedTextXY (List->Left,
- List->Top + Index,
- " Keep current file system (no changes) ");
- }
- else
- {
- CONSOLE_SetTextXY (List->Left,
- List->Top + Index,
- " Keep current file system (no changes) ");
- }
+ coPos.X = List->Left;
+ coPos.Y = List->Top + Index;
+ FillConsoleOutputAttribute(StdOutput,
+ FOREGROUND_WHITE | BACKGROUND_BLUE,
+ 50,
+ coPos,
+ &Written);
+ FillConsoleOutputCharacterA(StdOutput,
+ ' ',
+ 50,
+ coPos,
+ &Written);
+
+ if (List->CurrentFileSystem == FsKeep)
+ {
+ CONSOLE_SetInvertedTextXY(List->Left,
+ List->Top + Index,
+ " Keep current file system (no changes) ");
+ }
+ else
+ {
+ CONSOLE_SetTextXY(List->Left,
+ List->Top + Index,
+ " Keep current file system (no changes) ");
+ }
}
}
-
VOID
-ScrollDownFileSystemList (PFILE_SYSTEM_LIST List)
+ScrollDownFileSystemList(
+ IN PFILE_SYSTEM_LIST List)
{
- if ((ULONG) List->CurrentFileSystem < List->FileSystemCount - 1)
+ if ((ULONG)List->CurrentFileSystem < List->FileSystemCount - 1)
{
- List->CurrentFileSystem++;
- DrawFileSystemList (List);
+ List->CurrentFileSystem++;
+ DrawFileSystemList(List);
}
}
-
VOID
-ScrollUpFileSystemList (PFILE_SYSTEM_LIST List)
+ScrollUpFileSystemList(
+ IN PFILE_SYSTEM_LIST List)
{
- if ((ULONG) List->CurrentFileSystem > 0)
+ if ((ULONG)List->CurrentFileSystem > 0)
{
- List->CurrentFileSystem--;
- DrawFileSystemList (List);
+ List->CurrentFileSystem--;
+ DrawFileSystemList(List);
}
}