mirror of
https://github.com/reactos/reactos.git
synced 2025-01-06 06:20:13 +00:00
Implement "Check volume" page in usetup.
Doesn't work yet because VfatChkdsk() is not implemented svn path=/trunk/; revision=24000
This commit is contained in:
parent
07f8340c15
commit
8e420b3974
7 changed files with 205 additions and 56 deletions
86
reactos/base/setup/usetup/chkdsk.c
Normal file
86
reactos/base/setup/usetup/chkdsk.c
Normal file
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/chkdsk.c
|
||||
* PURPOSE: Filesystem chkdsk support functions
|
||||
* PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include "usetup.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
static PPROGRESSBAR ChkdskProgressBar = NULL;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
static BOOLEAN NTAPI
|
||||
ChkdskCallback(
|
||||
IN CALLBACKCOMMAND Command,
|
||||
IN ULONG Modifier,
|
||||
IN PVOID Argument)
|
||||
{
|
||||
switch (Command)
|
||||
{
|
||||
default:
|
||||
DPRINT("Unknown callback %lu\n", (ULONG)Command);
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
ChkdskPartition(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
IN PFILE_SYSTEM_ITEM FileSystem)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
if (!FileSystem->ChkdskFunc)
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
|
||||
ChkdskProgressBar = CreateProgressBar(6,
|
||||
yScreen - 14,
|
||||
xScreen - 7,
|
||||
yScreen - 10,
|
||||
"Setup is checking your disk");
|
||||
|
||||
ProgressSetStepCount(ChkdskProgressBar, 100);
|
||||
|
||||
Status = FileSystem->ChkdskFunc(DriveRoot,
|
||||
TRUE, /* FixErrors */
|
||||
FALSE, /* Verbose */
|
||||
FALSE, /* CheckOnlyIfDirty */
|
||||
FALSE, /* ScanDrive */
|
||||
ChkdskCallback); /* Callback */
|
||||
|
||||
DestroyProgressBar(ChkdskProgressBar);
|
||||
ChkdskProgressBar = NULL;
|
||||
|
||||
DPRINT("ChkdskPartition() finished with status 0x%08lx\n", Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* EOF */
|
36
reactos/base/setup/usetup/chkdsk.h
Normal file
36
reactos/base/setup/usetup/chkdsk.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* ReactOS kernel
|
||||
* Copyright (C) 2006 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS text-mode setup
|
||||
* FILE: subsys/system/usetup/chkdsk.h
|
||||
* PURPOSE: Filesystem chkdsk support functions
|
||||
* PROGRAMMER: Hervé Poussineau (hpoussin@reactos.org)
|
||||
*/
|
||||
|
||||
#ifndef __CHKDSK_H__
|
||||
#define __CHKDSK_H__
|
||||
|
||||
NTSTATUS
|
||||
ChkdskPartition(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
IN PFILE_SYSTEM_ITEM FileSystem);
|
||||
|
||||
#endif /* __CHKDSK_H__ */
|
||||
|
||||
/* EOF */
|
|
@ -30,7 +30,7 @@
|
|||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
PPROGRESSBAR ProgressBar = NULL;
|
||||
static PPROGRESSBAR FormatProgressBar = NULL;
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
|
@ -49,7 +49,7 @@ FormatCallback(
|
|||
Percent = (PULONG)Argument;
|
||||
DPRINT("%lu percent completed\n", *Percent);
|
||||
|
||||
ProgressSetStep(ProgressBar, *Percent);
|
||||
ProgressSetStep(FormatProgressBar, *Percent);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -89,13 +89,16 @@ FormatPartition(
|
|||
{
|
||||
NTSTATUS Status;
|
||||
|
||||
ProgressBar = CreateProgressBar(6,
|
||||
yScreen - 14,
|
||||
xScreen - 7,
|
||||
yScreen - 10,
|
||||
"Setup is formatting your disk");
|
||||
if (!FileSystem->FormatFunc)
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
|
||||
ProgressSetStepCount(ProgressBar, 100);
|
||||
FormatProgressBar = CreateProgressBar(6,
|
||||
yScreen - 14,
|
||||
xScreen - 7,
|
||||
yScreen - 10,
|
||||
"Setup is formatting your disk");
|
||||
|
||||
ProgressSetStepCount(FormatProgressBar, 100);
|
||||
|
||||
Status = FileSystem->FormatFunc(DriveRoot,
|
||||
FMIFS_HARDDISK, /* MediaFlag */
|
||||
|
@ -104,10 +107,10 @@ FormatPartition(
|
|||
0, /* ClusterSize */
|
||||
FormatCallback); /* Callback */
|
||||
|
||||
DestroyProgressBar(ProgressBar);
|
||||
ProgressBar = NULL;
|
||||
DestroyProgressBar(FormatProgressBar);
|
||||
FormatProgressBar = NULL;
|
||||
|
||||
DPRINT("FormatEx() finished with status 0x%08lx\n", Status);
|
||||
DPRINT("FormatPartition() finished with status 0x%08lx\n", Status);
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ CreateFileSystemList(
|
|||
List->Selected = NULL;
|
||||
InitializeListHead(&List->ListHead);
|
||||
|
||||
AddProvider(List, "FAT", VfatFormat, NULL);
|
||||
AddProvider(List, "FAT", VfatFormat, VfatChkdsk);
|
||||
if (!ForceFormat)
|
||||
{
|
||||
/* Add 'Keep' provider */
|
||||
|
|
|
@ -2419,62 +2419,84 @@ FormatPartitionPage (PINPUT_RECORD Ir)
|
|||
static ULONG
|
||||
CheckFileSystemPage(PINPUT_RECORD Ir)
|
||||
{
|
||||
PFILE_SYSTEM_ITEM CurrentFileSystem;
|
||||
WCHAR PathBuffer[MAX_PATH];
|
||||
CHAR Buffer[MAX_PATH];
|
||||
NTSTATUS Status;
|
||||
|
||||
CONSOLE_SetTextXY(6, 8, "Check file system");
|
||||
|
||||
CONSOLE_SetTextXY(6, 10, "At present, ReactOS can not check file systems.");
|
||||
|
||||
CONSOLE_SetStatusText(" Please wait ...");
|
||||
|
||||
|
||||
CONSOLE_SetStatusText(" ENTER = Continue F3 = Quit");
|
||||
|
||||
|
||||
/* FIXME: code duplicated in FormatPartitionPage */
|
||||
/* Set DestinationRootPath */
|
||||
RtlFreeUnicodeString (&DestinationRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&DestinationRootPath,
|
||||
PathBuffer);
|
||||
DPRINT ("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
||||
RtlFreeUnicodeString(&DestinationRootPath);
|
||||
swprintf(PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->CurrentDisk->DiskNumber,
|
||||
PartitionList->CurrentPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString(&DestinationRootPath, PathBuffer);
|
||||
DPRINT("DestinationRootPath: %wZ\n", &DestinationRootPath);
|
||||
|
||||
/* Set SystemRootPath */
|
||||
RtlFreeUnicodeString (&SystemRootPath);
|
||||
swprintf (PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->ActiveBootDisk->DiskNumber,
|
||||
PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString (&SystemRootPath,
|
||||
PathBuffer);
|
||||
DPRINT ("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
RtlFreeUnicodeString(&SystemRootPath);
|
||||
swprintf(PathBuffer,
|
||||
L"\\Device\\Harddisk%lu\\Partition%lu",
|
||||
PartitionList->ActiveBootDisk->DiskNumber,
|
||||
PartitionList->ActiveBootPartition->PartInfo[0].PartitionNumber);
|
||||
RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
|
||||
DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
|
||||
|
||||
CONSOLE_SetTextXY(6, 8, "Setup is now checking the selected partition.");
|
||||
|
||||
if (IsUnattendedSetup)
|
||||
{
|
||||
return(INSTALL_DIRECTORY_PAGE);
|
||||
}
|
||||
CONSOLE_SetStatusText(" Please wait...");
|
||||
|
||||
while(TRUE)
|
||||
/* WRONG: first filesystem is not necesseraly the one of the current partition! */
|
||||
CurrentFileSystem = CONTAINING_RECORD(FileSystemList->ListHead.Flink, FILE_SYSTEM_ITEM, ListEntry);
|
||||
|
||||
if (!CurrentFileSystem->ChkdskFunc)
|
||||
{
|
||||
sprintf(Buffer,
|
||||
"Setup is currently unable to check a partition formatted in %s.\n"
|
||||
"\n"
|
||||
" \x07 Press ENTER to continue Setup.\n"
|
||||
" \x07 Press F3 to quit Setup.",
|
||||
CurrentFileSystem->FileSystem);
|
||||
PopupError(
|
||||
Buffer,
|
||||
"F3= Quit ENTER = Continue",
|
||||
NULL, POPUP_WAIT_NONE);
|
||||
|
||||
while(TRUE)
|
||||
{
|
||||
CONSOLE_ConInKey(Ir);
|
||||
|
||||
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 == 0x0D) /* ENTER */
|
||||
{
|
||||
return(INSTALL_DIRECTORY_PAGE);
|
||||
}
|
||||
if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x00
|
||||
&& Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3) /* F3 */
|
||||
{
|
||||
if (ConfirmQuit(Ir))
|
||||
return QUIT_PAGE;
|
||||
else
|
||||
return CHECK_FILE_SYSTEM_PAGE;
|
||||
}
|
||||
else if (Ir->Event.KeyEvent.uChar.AsciiChar == VK_RETURN) /* ENTER */
|
||||
{
|
||||
return INSTALL_DIRECTORY_PAGE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Status = ChkdskPartition(&DestinationRootPath, CurrentFileSystem);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("ChkdskPartition() failed with status 0x%08lx\n", Status);
|
||||
sprintf(Buffer, "Setup failed to verify the selected partition.\n"
|
||||
"(Status 0x%08lx).\n", Status);
|
||||
PopupError(Buffer,
|
||||
"ENTER = Reboot computer",
|
||||
Ir, POPUP_WAIT_ENTER);
|
||||
return QUIT_PAGE;
|
||||
}
|
||||
|
||||
return(CHECK_FILE_SYSTEM_PAGE);
|
||||
return INSTALL_DIRECTORY_PAGE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "keytrans.h"
|
||||
#include "registry.h"
|
||||
#include "fslist.h"
|
||||
#include "chkdsk.h"
|
||||
#include "format.h"
|
||||
#include "cabinet.h"
|
||||
#include "filesup.h"
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
<library>inflib</library>
|
||||
<library>vfatlib</library>
|
||||
<library>ntdll</library>
|
||||
<!--pch>usetup.h</pch-->
|
||||
<pch>usetup.h</pch>
|
||||
<compilationunit name="unit.c">
|
||||
<file>bootsup.c</file>
|
||||
<file>cabinet.c</file>
|
||||
<file>chkdsk.c</file>
|
||||
<file>console.c</file>
|
||||
<file>drivesup.c</file>
|
||||
<file>filequeue.c</file>
|
||||
|
|
Loading…
Reference in a new issue