mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 20:33:04 +00:00
[FSLIB][FMIFS][AUTOCHK][SETUPLIB] Use more Windows-compatible (but not fully compatible yet) Format() and Chkdsk() ULIB functions.
[AUTOCHK] Add also support for scanning FATX volumes. The Format(), FormatEx(), Chkdsk(), ChkdskEx() functions exposed by the U*.DLL user-mode FS library dlls are different (and have different prototypes) than the similarly-named functions exported by FMIFS.DLL . In particular, what we used to call "xxxChkdskEx()" and "xxxFormatEx()" in our U*.DLL libraries actually correspond more, from their arguments, to the "Chkdsk()" and "Format()" functions in Windows' U*.DLL . Their *Ex() counterparts instead take most of the parameters through a structure passed by pointer. On FMIFS.DLL side, while FMIFS!Chkdsk() calls U*.DLL!Chkdsk() and FMIFS!ChkdskEx() calls U*.DLL!ChkdskEx() (and we do not implement these *Ex() functions at the moment), both FMIFS!Format() and FMIFS!FormatEx() call U*.DLL!Format() instead, while FMIFS!FormatEx2() calls U*.DLL!FormatEx() (that we do not implement yet either) !! To improve that, refactor the calls to these U*.DLL functions so as to respect the more compatible prototypes: They contain the correct number of parameters in a compatible order. However, some of the parameters do not have the same types yet: the strings are kept here in PUNICODE_STRINGS, while on Windows they are passed via an undocumented DSTRING struct, and the FMIFS callback is instead a MESSAGE struct/class on Windows. Finally, the MEDIA_TYPE parameter in U*.DLL!Format() is equivalent, yet not fully 100% in 1-to-1 correspondence, with the FMIFS_MEDIA_FLAG used in the corresponding FMIFS.DLL functions. One thing to notice is that the U*.DLL!Format() (and the Ex) functions support a BOOLEAN (a flag resp.) for telling that a backwards-compatible FS version should be used instead of the (default) latest FS version. This is used e.g. by the FAT FS, where by default FAT32 is selected (depending also on other constraints like, the disk and the partition sizes), unless that bit is set in which case, FAT16 (or 12) is used.
This commit is contained in:
parent
cdaa5d5fc7
commit
8d3e80e437
37 changed files with 742 additions and 414 deletions
|
@ -798,16 +798,18 @@ Ext2TotalBlocks(PEXT2_FILESYS Ext2Sys, ULONG DataBlocks)
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
Ext2Format(IN PUNICODE_STRING DriveRoot,
|
||||
IN FMIFS_MEDIA_FLAG MediaFlag,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN ULONG ClusterSize,
|
||||
IN PFMIFSCALLBACK Callback)
|
||||
Ext2Format(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
IN PFMIFSCALLBACK Callback,
|
||||
IN BOOLEAN QuickFormat,
|
||||
IN BOOLEAN BackwardCompatible,
|
||||
IN MEDIA_TYPE MediaType,
|
||||
IN PUNICODE_STRING Label,
|
||||
IN ULONG ClusterSize)
|
||||
{
|
||||
BOOLEAN bRet = FALSE;
|
||||
BOOLEAN bRet;
|
||||
NTSTATUS Status = STATUS_UNSUCCESSFUL;
|
||||
/* Super Block: 1024 bytes long */
|
||||
EXT2_SUPER_BLOCK Ext2Sb;
|
||||
|
@ -819,6 +821,9 @@ Ext2Format(IN PUNICODE_STRING DriveRoot,
|
|||
ULONG start;
|
||||
ULONG ret_blk;
|
||||
|
||||
// FIXME:
|
||||
UNREFERENCED_PARAMETER(BackwardCompatible);
|
||||
UNREFERENCED_PARAMETER(MediaType);
|
||||
|
||||
if (Callback != NULL)
|
||||
{
|
||||
|
@ -868,6 +873,7 @@ Ext2Format(IN PUNICODE_STRING DriveRoot,
|
|||
bLocked = TRUE;
|
||||
}
|
||||
|
||||
Status = STATUS_UNSUCCESSFUL;
|
||||
|
||||
// Initialize
|
||||
if (!ext2_initialize_sb(&FileSys))
|
||||
|
@ -917,7 +923,6 @@ Ext2Format(IN PUNICODE_STRING DriveRoot,
|
|||
ext2_print_super(&Ext2Sb);
|
||||
|
||||
bRet = ext2_allocate_tables(&FileSys);
|
||||
|
||||
if (!bRet)
|
||||
{
|
||||
goto clean_up;
|
||||
|
@ -942,6 +947,7 @@ Ext2Format(IN PUNICODE_STRING DriveRoot,
|
|||
if (start > rsv)
|
||||
start -= rsv;
|
||||
|
||||
bRet = TRUE;
|
||||
if (start > 0)
|
||||
bRet = zero_blocks(&FileSys, start, blocks - start, &ret_blk, NULL);
|
||||
|
||||
|
@ -969,14 +975,12 @@ Ext2Format(IN PUNICODE_STRING DriveRoot,
|
|||
|
||||
if (!ext2_flush(&FileSys))
|
||||
{
|
||||
bRet = false;
|
||||
DPRINT1("Mke2fs: Warning, had trouble writing out superblocks.\n");
|
||||
goto clean_up;
|
||||
}
|
||||
|
||||
DPRINT("Mke2fs: Writing superblocks and filesystem accounting information done!\n");
|
||||
|
||||
bRet = true;
|
||||
Status = STATUS_SUCCESS;
|
||||
|
||||
clean_up:
|
||||
|
@ -995,23 +999,25 @@ clean_up:
|
|||
|
||||
Ext2CloseDevice(&FileSys);
|
||||
|
||||
if (Callback != NULL)
|
||||
{
|
||||
Callback(DONE, 0, (PVOID)&bRet);
|
||||
}
|
||||
|
||||
return Status;
|
||||
return NT_SUCCESS(Status);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
Ext2Chkdsk(IN PUNICODE_STRING DriveRoot,
|
||||
IN BOOLEAN FixErrors,
|
||||
IN BOOLEAN Verbose,
|
||||
IN BOOLEAN CheckOnlyIfDirty,
|
||||
IN BOOLEAN ScanDrive,
|
||||
IN PFMIFSCALLBACK Callback)
|
||||
Ext2Chkdsk(
|
||||
IN PUNICODE_STRING DriveRoot,
|
||||
IN PFMIFSCALLBACK Callback,
|
||||
IN BOOLEAN FixErrors,
|
||||
IN BOOLEAN Verbose,
|
||||
IN BOOLEAN CheckOnlyIfDirty,
|
||||
IN BOOLEAN ScanDrive,
|
||||
IN PVOID pUnknown1,
|
||||
IN PVOID pUnknown2,
|
||||
IN PVOID pUnknown3,
|
||||
IN PVOID pUnknown4,
|
||||
IN PULONG ExitStatus)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
return STATUS_SUCCESS;
|
||||
*ExitStatus = (ULONG)STATUS_SUCCESS;
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue