[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
2017-05-17 23:37:41 +00:00
/*
* PROJECT : ReactOS Setup Library
* LICENSE : GPL - 2.0 + ( https : //spdx.org/licenses/GPL-2.0+)
* PURPOSE : Filesystem support functions
2019-02-24 16:52:33 +00:00
* COPYRIGHT : Copyright 2003 - 2019 Casper S . Hornstrup ( chorns @ users . sourceforge . net )
* Copyright 2017 - 2019 Hermes Belusca - Maito
[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
2017-05-17 23:37:41 +00:00
*/
//
// See also: https://git.reactos.org/?p=reactos.git;a=blob;f=reactos/dll/win32/fmifs/init.c;h=e895f5ef9cae4806123f6bbdd3dfed37ec1c8d33;hb=b9db9a4e377a2055f635b2fb69fef4e1750d219c
// for how to get FS providers in a dynamic way. In the (near) future we may
// consider merging some of this code with us into a fmifs / fsutil / fslib library...
//
/* INCLUDES *****************************************************************/
# include "precomp.h"
# include "partlist.h"
2020-10-11 21:42:02 +00:00
# include "fsrec.h"
# include "fsutil.h"
[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
2017-05-17 23:37:41 +00:00
# include <fslib/vfatlib.h>
2018-06-13 23:30:06 +00:00
# include <fslib/btrfslib.h>
2017-05-17 23:31:52 +00:00
// #include <fslib/ext2lib.h>
[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
2017-05-17 23:37:41 +00:00
// #include <fslib/ntfslib.h>
# define NDEBUG
# include <debug.h>
2019-02-24 16:52:33 +00:00
/* LOCALS *******************************************************************/
/** IFS_PROVIDER **/
typedef struct _FILE_SYSTEM
{
PCWSTR FileSystemName ;
FORMATEX FormatFunc ;
CHKDSKEX ChkdskFunc ;
} FILE_SYSTEM , * PFILE_SYSTEM ;
2018-11-12 23:13:45 +00:00
/* The list of file systems on which we can install ReactOS */
2019-02-24 16:52:33 +00:00
static FILE_SYSTEM RegisteredFileSystems [ ] =
[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
2017-05-17 23:37:41 +00:00
{
2017-12-23 19:17:38 +00:00
/* NOTE: The FAT formatter automatically determines
* whether it will use FAT - 16 or FAT - 32. */
[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
2017-05-17 23:37:41 +00:00
{ L " FAT " , VfatFormat , VfatChkdsk } ,
#if 0
2017-12-23 19:17:38 +00:00
{ L " FAT32 " , VfatFormat , VfatChkdsk } , // Do we support specific FAT sub-formats specifications?
2017-05-17 23:31:52 +00:00
{ L " FATX " , VfatxFormat , VfatxChkdsk } ,
{ L " NTFS " , NtfsFormat , NtfsChkdsk } ,
2018-06-13 23:30:06 +00:00
# endif
2017-05-17 23:31:52 +00:00
{ L " BTRFS " , BtrfsFormatEx , BtrfsChkdskEx } ,
2018-06-13 23:30:06 +00:00
#if 0
2018-11-12 23:13:45 +00:00
{ L " EXT2 " , Ext2Format , Ext2Chkdsk } ,
{ L " EXT3 " , Ext2Format , Ext2Chkdsk } ,
{ L " EXT4 " , Ext2Format , Ext2Chkdsk } ,
2017-05-17 23:31:52 +00:00
{ L " FFS " , FfsFormat , FfsChkdsk } ,
{ L " REISERFS " , ReiserfsFormat , ReiserfsChkdsk } ,
[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
2017-05-17 23:37:41 +00:00
# endif
} ;
/* FUNCTIONS ****************************************************************/
2019-02-24 16:52:33 +00:00
/** QueryAvailableFileSystemFormat() **/
BOOLEAN
GetRegisteredFileSystems (
IN ULONG Index ,
OUT PCWSTR * FileSystemName )
[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
2017-05-17 23:37:41 +00:00
{
2019-02-24 16:52:33 +00:00
if ( Index > = ARRAYSIZE ( RegisteredFileSystems ) )
return FALSE ;
* FileSystemName = RegisteredFileSystems [ Index ] . FileSystemName ;
return TRUE ;
[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
2017-05-17 23:37:41 +00:00
}
2019-02-24 16:52:33 +00:00
/** GetProvider() **/
static PFILE_SYSTEM
[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
2017-05-17 23:37:41 +00:00
GetFileSystemByName (
IN PCWSTR FileSystemName )
{
#if 0 // Reenable when the list of registered FSes will again be dynamic
PLIST_ENTRY ListEntry ;
PFILE_SYSTEM_ITEM Item ;
ListEntry = List - > ListHead . Flink ;
while ( ListEntry ! = & List - > ListHead )
{
Item = CONTAINING_RECORD ( ListEntry , FILE_SYSTEM_ITEM , ListEntry ) ;
2019-02-24 16:52:33 +00:00
if ( Item - > FileSystemName & &
( wcsicmp ( FileSystemName , Item - > FileSystemName ) = = 0 | |
/* Map FAT32 back to FAT */
( wcsicmp ( FileSystemName , L " FAT32 " ) = = 0 & & wcsicmp ( Item - > FileSystemName , L " FAT " ) = = 0 ) ) )
{
[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
2017-05-17 23:37:41 +00:00
return Item ;
2019-02-24 16:52:33 +00:00
}
[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
2017-05-17 23:37:41 +00:00
ListEntry = ListEntry - > Flink ;
}
# else
2019-02-24 16:52:33 +00:00
ULONG Count = ARRAYSIZE ( RegisteredFileSystems ) ;
PFILE_SYSTEM FileSystems = RegisteredFileSystems ;
[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
2017-05-17 23:37:41 +00:00
2019-02-24 16:52:33 +00:00
ASSERT ( FileSystems & & Count ! = 0 ) ;
[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
2017-05-17 23:37:41 +00:00
while ( Count - - )
{
2019-02-24 16:52:33 +00:00
if ( FileSystems - > FileSystemName & &
( wcsicmp ( FileSystemName , FileSystems - > FileSystemName ) = = 0 | |
/* Map FAT32 back to FAT */
( wcsicmp ( FileSystemName , L " FAT32 " ) = = 0 & & wcsicmp ( FileSystems - > FileSystemName , L " FAT " ) = = 0 ) ) )
{
[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
2017-05-17 23:37:41 +00:00
return FileSystems ;
2019-02-24 16:52:33 +00:00
}
[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
2017-05-17 23:37:41 +00:00
+ + FileSystems ;
}
# endif
return NULL ;
}
2019-02-24 16:52:33 +00:00
/** ChkdskEx() **/
NTSTATUS
ChkdskFileSystem_UStr (
IN PUNICODE_STRING DriveRoot ,
IN PCWSTR FileSystemName ,
IN BOOLEAN FixErrors ,
IN BOOLEAN Verbose ,
IN BOOLEAN CheckOnlyIfDirty ,
IN BOOLEAN ScanDrive ,
IN PFMIFSCALLBACK Callback )
{
PFILE_SYSTEM FileSystem ;
2017-05-17 23:31:52 +00:00
2019-02-24 16:52:33 +00:00
FileSystem = GetFileSystemByName ( FileSystemName ) ;
2017-05-17 23:31:52 +00:00
2019-02-24 16:52:33 +00:00
if ( ! FileSystem | | ! FileSystem - > ChkdskFunc )
{
// BOOLEAN Argument = FALSE;
// Callback(DONE, 0, &Argument);
return STATUS_NOT_SUPPORTED ;
}
return FileSystem - > ChkdskFunc ( DriveRoot ,
FixErrors ,
Verbose ,
CheckOnlyIfDirty ,
ScanDrive ,
Callback ) ;
}
NTSTATUS
ChkdskFileSystem (
IN PCWSTR DriveRoot ,
IN PCWSTR FileSystemName ,
IN BOOLEAN FixErrors ,
IN BOOLEAN Verbose ,
IN BOOLEAN CheckOnlyIfDirty ,
IN BOOLEAN ScanDrive ,
IN PFMIFSCALLBACK Callback )
{
UNICODE_STRING DriveRootU ;
RtlInitUnicodeString ( & DriveRootU , DriveRoot ) ;
return ChkdskFileSystem_UStr ( & DriveRootU ,
FileSystemName ,
FixErrors ,
Verbose ,
CheckOnlyIfDirty ,
ScanDrive ,
Callback ) ;
}
/** FormatEx() **/
NTSTATUS
FormatFileSystem_UStr (
IN PUNICODE_STRING DriveRoot ,
IN PCWSTR FileSystemName ,
IN FMIFS_MEDIA_FLAG MediaFlag ,
IN PUNICODE_STRING Label ,
IN BOOLEAN QuickFormat ,
IN ULONG ClusterSize ,
IN PFMIFSCALLBACK Callback )
2017-05-17 23:31:52 +00:00
{
2019-02-24 16:52:33 +00:00
PFILE_SYSTEM FileSystem ;
FileSystem = GetFileSystemByName ( FileSystemName ) ;
if ( ! FileSystem | | ! FileSystem - > FormatFunc )
2017-05-17 23:31:52 +00:00
{
2019-02-24 16:52:33 +00:00
// BOOLEAN Argument = FALSE;
// Callback(DONE, 0, &Argument);
return STATUS_NOT_SUPPORTED ;
2017-05-17 23:31:52 +00:00
}
2019-02-24 16:52:33 +00:00
return FileSystem - > FormatFunc ( DriveRoot ,
MediaFlag ,
Label ,
QuickFormat ,
ClusterSize ,
Callback ) ;
}
NTSTATUS
FormatFileSystem (
IN PCWSTR DriveRoot ,
IN PCWSTR FileSystemName ,
IN FMIFS_MEDIA_FLAG MediaFlag ,
IN PCWSTR Label ,
IN BOOLEAN QuickFormat ,
IN ULONG ClusterSize ,
IN PFMIFSCALLBACK Callback )
{
UNICODE_STRING DriveRootU ;
UNICODE_STRING LabelU ;
RtlInitUnicodeString ( & DriveRootU , DriveRoot ) ;
RtlInitUnicodeString ( & LabelU , Label ) ;
return FormatFileSystem_UStr ( & DriveRootU ,
FileSystemName ,
MediaFlag ,
& LabelU ,
QuickFormat ,
ClusterSize ,
Callback ) ;
}
//
// Formatting routines
//
BOOLEAN
PreparePartitionForFormatting (
IN struct _PARTENTRY * PartEntry ,
IN PCWSTR FileSystemName )
{
UCHAR PartitionType ;
if ( ! FileSystemName | | ! * FileSystemName )
{
DPRINT1 ( " No file system specified? \n " ) ;
return FALSE ;
}
PartitionType = FileSystemToPartitionType ( FileSystemName ,
& PartEntry - > StartSector ,
& PartEntry - > SectorCount ) ;
if ( PartitionType = = PARTITION_ENTRY_UNUSED )
2017-05-17 23:31:52 +00:00
{
2019-02-24 16:52:33 +00:00
/* Unknown file system */
DPRINT1 ( " Unknown file system '%S' \n " , FileSystemName ) ;
2017-05-17 23:31:52 +00:00
return FALSE ;
}
2019-02-24 16:52:33 +00:00
SetPartitionType ( PartEntry , PartitionType ) ;
2017-05-17 23:31:52 +00:00
//
// FIXME: Do this now, or after the partition was actually formatted??
//
/* Set the new partition's file system proper */
2019-02-24 16:52:33 +00:00
RtlStringCbCopyW ( PartEntry - > FileSystem ,
sizeof ( PartEntry - > FileSystem ) ,
FileSystemName ) ;
2017-05-17 23:31:52 +00:00
return TRUE ;
}
[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
2017-05-17 23:37:41 +00:00
/* EOF */