https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b51b8ee2d527b7a7f640e…
commit b51b8ee2d527b7a7f640e4a4a740738ce7d34d93
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Oct 11 23:42:02 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Oct 18 20:56:16 2020 +0200
[SETUPLIB] Move the filesystem recognition helpers to their own file.
---
base/setup/lib/CMakeLists.txt | 1 +
base/setup/lib/fsutil.c | 294 +----------------------------
base/setup/lib/fsutil.h | 39 ----
base/setup/lib/setuplib.h | 1 +
base/setup/lib/{fsutil.c => utils/fsrec.c} | 272 +-------------------------
base/setup/lib/utils/fsrec.h | 49 +++++
base/setup/lib/utils/partlist.c | 2 +-
7 files changed, 58 insertions(+), 600 deletions(-)
diff --git a/base/setup/lib/CMakeLists.txt b/base/setup/lib/CMakeLists.txt
index 0d2f3a8aeb5..ff23bc57d16 100644
--- a/base/setup/lib/CMakeLists.txt
+++ b/base/setup/lib/CMakeLists.txt
@@ -9,6 +9,7 @@ list(APPEND SOURCE
utils/arcname.c
utils/bldrsup.c
utils/filesup.c
+ utils/fsrec.c
utils/genlist.c
utils/inicache.c
utils/ntverrsrc.c
diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/fsutil.c
index 89555184650..2abe8e4c7a8 100644
--- a/base/setup/lib/fsutil.c
+++ b/base/setup/lib/fsutil.c
@@ -16,8 +16,9 @@
#include "precomp.h"
-#include "fsutil.h"
#include "partlist.h"
+#include "fsrec.h"
+#include "fsutil.h"
#include <fslib/vfatlib.h>
#include <fslib/btrfslib.h>
@@ -128,222 +129,6 @@ GetFileSystemByName(
}
-//
-// FileSystem recognition, using NT OS functionality
-//
-
-/* NOTE: Ripped & adapted from base/system/autochk/autochk.c */
-NTSTATUS
-GetFileSystemNameByHandle(
- IN HANDLE PartitionHandle,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize)
-{
- NTSTATUS Status;
- IO_STATUS_BLOCK IoStatusBlock;
- UCHAR Buffer[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + MAX_PATH * sizeof(WCHAR)];
- PFILE_FS_ATTRIBUTE_INFORMATION FileFsAttribute =
(PFILE_FS_ATTRIBUTE_INFORMATION)Buffer;
-
- /* Retrieve the FS attributes */
- Status = NtQueryVolumeInformationFile(PartitionHandle,
- &IoStatusBlock,
- FileFsAttribute,
- sizeof(Buffer),
- FileFsAttributeInformation);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("NtQueryVolumeInformationFile failed, Status 0x%08lx\n",
Status);
- return Status;
- }
-
- if (FileSystemNameSize < FileFsAttribute->FileSystemNameLength +
sizeof(WCHAR))
- return STATUS_BUFFER_TOO_SMALL;
-
- return RtlStringCbCopyNW(FileSystemName, FileSystemNameSize,
- FileFsAttribute->FileSystemName,
- FileFsAttribute->FileSystemNameLength);
-}
-
-NTSTATUS
-GetFileSystemName_UStr(
- IN PUNICODE_STRING PartitionPath,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize)
-{
- NTSTATUS Status;
- OBJECT_ATTRIBUTES ObjectAttributes;
- HANDLE PartitionHandle;
- IO_STATUS_BLOCK IoStatusBlock;
-
- /* Open the partition */
- InitializeObjectAttributes(&ObjectAttributes,
- PartitionPath,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL);
- Status = NtOpenFile(&PartitionHandle,
- FILE_GENERIC_READ /* | SYNCHRONIZE */,
- &ObjectAttributes,
- &IoStatusBlock,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- 0 /* FILE_SYNCHRONOUS_IO_NONALERT */);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to open partition '%wZ', Status 0x%08lx\n",
PartitionPath, Status);
- return Status;
- }
-
- /* Retrieve the FS attributes */
- Status = GetFileSystemNameByHandle(PartitionHandle, FileSystemName,
FileSystemNameSize);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("GetFileSystemNameByHandle() failed for partition '%wZ',
Status 0x%08lx\n",
- PartitionPath, Status);
- }
-
- /* Close the partition */
- NtClose(PartitionHandle);
-
- return Status;
-}
-
-NTSTATUS
-GetFileSystemName(
- IN PCWSTR Partition,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize)
-{
- UNICODE_STRING PartitionPath;
-
- RtlInitUnicodeString(&PartitionPath, Partition);
- return GetFileSystemName_UStr(&PartitionPath,
- FileSystemName,
- FileSystemNameSize);
-}
-
-NTSTATUS
-InferFileSystemByHandle(
- IN HANDLE PartitionHandle,
- IN UCHAR PartitionType,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize)
-{
- NTSTATUS Status;
-
- if (FileSystemNameSize < sizeof(WCHAR))
- return STATUS_BUFFER_TOO_SMALL;
-
- *FileSystemName = L'\0';
-
- /* Try to infer a file system using NT file system recognition */
- Status = GetFileSystemNameByHandle(PartitionHandle,
- FileSystemName,
- FileSystemNameSize);
- if (NT_SUCCESS(Status) && *FileSystemName)
- {
- goto Quit;
- }
-
- /*
- * Try to infer a preferred file system for this partition, given its ID.
- *
- * WARNING: This is partly a hack, since partitions with the same ID can
- * be formatted with different file systems: for example, usual Linux
- * partitions that are formatted in EXT2/3/4, ReiserFS, etc... have the
- * same partition ID 0x83.
- *
- * The proper fix is to make a function that detects the existing FS
- * from a given partition (not based on the partition ID).
- * On the contrary, for unformatted partitions with a given ID, the
- * following code is OK.
- */
- if ((PartitionType == PARTITION_FAT_12) ||
- (PartitionType == PARTITION_FAT_16) ||
- (PartitionType == PARTITION_HUGE ) ||
- (PartitionType == PARTITION_XINT13))
- {
- /* FAT12 or FAT16 */
- Status = RtlStringCbCopyW(FileSystemName, FileSystemNameSize, L"FAT");
- }
- else if ((PartitionType == PARTITION_FAT32) ||
- (PartitionType == PARTITION_FAT32_XINT13))
- {
- Status = RtlStringCbCopyW(FileSystemName, FileSystemNameSize,
L"FAT32");
- }
- else if (PartitionType == PARTITION_LINUX)
- {
- // WARNING: See the warning above.
- /* Could also be EXT2/3/4, ReiserFS, ... */
- Status = RtlStringCbCopyW(FileSystemName, FileSystemNameSize,
L"BTRFS");
- }
- else if (PartitionType == PARTITION_IFS)
- {
- // WARNING: See the warning above.
- /* Could also be HPFS */
- Status = RtlStringCbCopyW(FileSystemName, FileSystemNameSize,
L"NTFS");
- }
-
-Quit:
- if (*FileSystemName)
- {
- // WARNING: We cannot write on this FS yet!
- if (PartitionType == PARTITION_IFS)
- {
- DPRINT1("Recognized file system '%S' that doesn't have write
support yet!\n",
- FileSystemName);
- }
- }
-
- DPRINT1("InferFileSystem -- PartitionType: 0x%02X ; FileSystem (guessed):
%S\n",
- PartitionType, *FileSystemName ? FileSystemName : L"None");
-
- return Status;
-}
-
-NTSTATUS
-InferFileSystem(
- IN PCWSTR Partition,
- IN UCHAR PartitionType,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize)
-{
- NTSTATUS Status;
- UNICODE_STRING PartitionPath;
- OBJECT_ATTRIBUTES ObjectAttributes;
- HANDLE PartitionHandle;
- IO_STATUS_BLOCK IoStatusBlock;
-
- /* Open the partition */
- RtlInitUnicodeString(&PartitionPath, Partition);
- InitializeObjectAttributes(&ObjectAttributes,
- &PartitionPath,
- OBJ_CASE_INSENSITIVE,
- NULL,
- NULL);
- Status = NtOpenFile(&PartitionHandle,
- FILE_GENERIC_READ /* | SYNCHRONIZE */,
- &ObjectAttributes,
- &IoStatusBlock,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- 0 /* FILE_SYNCHRONOUS_IO_NONALERT */);
- if (!NT_SUCCESS(Status))
- {
- DPRINT1("Failed to open partition '%wZ', Status 0x%08lx\n",
&PartitionPath, Status);
- return Status;
- }
-
- /* Retrieve the FS */
- Status = InferFileSystemByHandle(PartitionHandle,
- PartitionType,
- FileSystemName,
- FileSystemNameSize);
-
- /* Close the partition */
- NtClose(PartitionHandle);
-
- return Status;
-}
-
/** ChkdskEx() **/
NTSTATUS
ChkdskFileSystem_UStr(
@@ -453,81 +238,6 @@ FormatFileSystem(
}
-UCHAR
-FileSystemToPartitionType(
- IN PCWSTR FileSystem,
- IN PULARGE_INTEGER StartSector,
- IN PULARGE_INTEGER SectorCount)
-{
- ASSERT(FileSystem && StartSector && SectorCount);
-
- if (wcsicmp(FileSystem, L"FAT") == 0 ||
- wcsicmp(FileSystem, L"FAT32") == 0 ||
- wcsicmp(FileSystem, L"RAW") == 0)
- {
- if (SectorCount->QuadPart < 8192)
- {
- /* FAT12 CHS partition (disk is smaller than 4.1MB) */
- return PARTITION_FAT_12;
- }
- else if (StartSector->QuadPart < 1450560)
- {
- /* Partition starts below the 8.4GB boundary ==> CHS partition */
-
- if (SectorCount->QuadPart < 65536)
- {
- /* FAT16 CHS partition (partition size < 32MB) */
- return PARTITION_FAT_16;
- }
- else if (SectorCount->QuadPart < 1048576)
- {
- /* FAT16 CHS partition (partition size < 512MB) */
- return PARTITION_HUGE;
- }
- else
- {
- /* FAT32 CHS partition (partition size >= 512MB) */
- return PARTITION_FAT32;
- }
- }
- else
- {
- /* Partition starts above the 8.4GB boundary ==> LBA partition */
-
- if (SectorCount->QuadPart < 1048576)
- {
- /* FAT16 LBA partition (partition size < 512MB) */
- return PARTITION_XINT13;
- }
- else
- {
- /* FAT32 LBA partition (partition size >= 512MB) */
- return PARTITION_FAT32_XINT13;
- }
- }
- }
- else if (wcsicmp(FileSystem, L"NTFS") == 0)
- {
- return PARTITION_IFS;
- }
- else if (wcsicmp(FileSystem, L"BTRFS") == 0 ||
- wcsicmp(FileSystem, L"EXT2") == 0 ||
- wcsicmp(FileSystem, L"EXT3") == 0 ||
- wcsicmp(FileSystem, L"EXT4") == 0 ||
- wcsicmp(FileSystem, L"FFS") == 0 ||
- wcsicmp(FileSystem, L"REISERFS") == 0)
- {
- return PARTITION_LINUX;
- }
- else
- {
- /* Unknown file system */
- DPRINT1("Unknown file system '%S'\n", FileSystem);
- return PARTITION_ENTRY_UNUSED;
- }
-}
-
-
//
// Formatting routines
//
diff --git a/base/setup/lib/fsutil.h b/base/setup/lib/fsutil.h
index f6c83e953f7..dd2fb3e5964 100644
--- a/base/setup/lib/fsutil.h
+++ b/base/setup/lib/fsutil.h
@@ -16,38 +16,6 @@ GetRegisteredFileSystems(
IN ULONG Index,
OUT PCWSTR* FileSystemName);
-NTSTATUS
-GetFileSystemNameByHandle(
- IN HANDLE PartitionHandle,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize);
-
-NTSTATUS
-GetFileSystemName_UStr(
- IN PUNICODE_STRING PartitionPath,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize);
-
-NTSTATUS
-GetFileSystemName(
- IN PCWSTR Partition,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize);
-
-NTSTATUS
-InferFileSystemByHandle(
- IN HANDLE PartitionHandle,
- IN UCHAR PartitionType,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize);
-
-NTSTATUS
-InferFileSystem(
- IN PCWSTR Partition,
- IN UCHAR PartitionType,
- IN OUT PWSTR FileSystemName,
- IN SIZE_T FileSystemNameSize);
-
/** ChkdskEx() **/
NTSTATUS
@@ -93,13 +61,6 @@ FormatFileSystem(
IN PFMIFSCALLBACK Callback);
-UCHAR
-FileSystemToPartitionType(
- IN PCWSTR FileSystem,
- IN PULARGE_INTEGER StartSector,
- IN PULARGE_INTEGER SectorCount);
-
-
//
// Formatting routines
//
diff --git a/base/setup/lib/setuplib.h b/base/setup/lib/setuplib.h
index 7149d1ffb31..15358f24885 100644
--- a/base/setup/lib/setuplib.h
+++ b/base/setup/lib/setuplib.h
@@ -33,6 +33,7 @@ extern HANDLE ProcessHeap;
#include "utils/bldrsup.h"
#include "bootsup.h"
#include "utils/filesup.h"
+#include "utils/fsrec.h"
#include "fsutil.h"
#include "utils/genlist.h"
#include "utils/inicache.h"
diff --git a/base/setup/lib/fsutil.c b/base/setup/lib/utils/fsrec.c
similarity index 56%
copy from base/setup/lib/fsutil.c
copy to base/setup/lib/utils/fsrec.c
index 89555184650..918e2fb69a3 100644
--- a/base/setup/lib/fsutil.c
+++ b/base/setup/lib/utils/fsrec.c
@@ -1,137 +1,23 @@
/*
* PROJECT: ReactOS Setup Library
* LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
- * PURPOSE: Filesystem support functions
- * COPYRIGHT: Copyright 2003-2019 Casper S. Hornstrup (chorns(a)users.sourceforge.net)
- * Copyright 2017-2019 Hermes Belusca-Maito
+ * PURPOSE: Filesystem Recognition support functions,
+ * using NT OS functionality.
+ * COPYRIGHT: Copyright 2017-2020 Hermes Belusca-Maito
*/
-//
-// See also:
https://git.reactos.org/?p=reactos.git;a=blob;f=reactos/dll/win32/fmifs/ini…
-// 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 "fsutil.h"
-#include "partlist.h"
-
-#include <fslib/vfatlib.h>
-#include <fslib/btrfslib.h>
-// #include <fslib/ext2lib.h>
-// #include <fslib/ntfslib.h>
+#include "fsrec.h"
#define NDEBUG
#include <debug.h>
-/* LOCALS *******************************************************************/
-
-/** IFS_PROVIDER **/
-typedef struct _FILE_SYSTEM
-{
- PCWSTR FileSystemName;
- FORMATEX FormatFunc;
- CHKDSKEX ChkdskFunc;
-} FILE_SYSTEM, *PFILE_SYSTEM;
-
-/* The list of file systems on which we can install ReactOS */
-static FILE_SYSTEM RegisteredFileSystems[] =
-{
- /* NOTE: The FAT formatter automatically determines
- * whether it will use FAT-16 or FAT-32. */
- { L"FAT" , VfatFormat, VfatChkdsk },
-#if 0
- { L"FAT32", VfatFormat, VfatChkdsk }, // Do we support specific FAT
sub-formats specifications?
- { L"FATX" , VfatxFormat, VfatxChkdsk },
- { L"NTFS" , NtfsFormat, NtfsChkdsk },
-#endif
- { L"BTRFS", BtrfsFormatEx, BtrfsChkdskEx },
-#if 0
- { L"EXT2" , Ext2Format, Ext2Chkdsk },
- { L"EXT3" , Ext2Format, Ext2Chkdsk },
- { L"EXT4" , Ext2Format, Ext2Chkdsk },
- { L"FFS" , FfsFormat , FfsChkdsk },
- { L"REISERFS", ReiserfsFormat, ReiserfsChkdsk },
-#endif
-};
-
-
/* FUNCTIONS ****************************************************************/
-/** QueryAvailableFileSystemFormat() **/
-BOOLEAN
-GetRegisteredFileSystems(
- IN ULONG Index,
- OUT PCWSTR* FileSystemName)
-{
- if (Index >= ARRAYSIZE(RegisteredFileSystems))
- return FALSE;
-
- *FileSystemName = RegisteredFileSystems[Index].FileSystemName;
-
- return TRUE;
-}
-
-
-/** GetProvider() **/
-static PFILE_SYSTEM
-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);
- if (Item->FileSystemName &&
- (wcsicmp(FileSystemName, Item->FileSystemName) == 0 ||
- /* Map FAT32 back to FAT */
- (wcsicmp(FileSystemName, L"FAT32") == 0 &&
wcsicmp(Item->FileSystemName, L"FAT") == 0)))
- {
- return Item;
- }
-
- ListEntry = ListEntry->Flink;
- }
-
-#else
-
- ULONG Count = ARRAYSIZE(RegisteredFileSystems);
- PFILE_SYSTEM FileSystems = RegisteredFileSystems;
-
- ASSERT(FileSystems && Count != 0);
-
- while (Count--)
- {
- if (FileSystems->FileSystemName &&
- (wcsicmp(FileSystemName, FileSystems->FileSystemName) == 0 ||
- /* Map FAT32 back to FAT */
- (wcsicmp(FileSystemName, L"FAT32") == 0 &&
wcsicmp(FileSystems->FileSystemName, L"FAT") == 0)))
- {
- return FileSystems;
- }
-
- ++FileSystems;
- }
-
-#endif
-
- return NULL;
-}
-
-
-//
-// FileSystem recognition, using NT OS functionality
-//
-
/* NOTE: Ripped & adapted from base/system/autochk/autochk.c */
NTSTATUS
GetFileSystemNameByHandle(
@@ -344,115 +230,6 @@ InferFileSystem(
return Status;
}
-/** 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;
-
- FileSystem = GetFileSystemByName(FileSystemName);
-
- 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)
-{
- PFILE_SYSTEM FileSystem;
-
- FileSystem = GetFileSystemByName(FileSystemName);
-
- if (!FileSystem || !FileSystem->FormatFunc)
- {
- // BOOLEAN Argument = FALSE;
- // Callback(DONE, 0, &Argument);
- return STATUS_NOT_SUPPORTED;
- }
-
- 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);
-}
-
-
UCHAR
FileSystemToPartitionType(
IN PCWSTR FileSystem,
@@ -527,45 +304,4 @@ FileSystemToPartitionType(
}
}
-
-//
-// 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)
- {
- /* Unknown file system */
- DPRINT1("Unknown file system '%S'\n", FileSystemName);
- return FALSE;
- }
-
- SetPartitionType(PartEntry, PartitionType);
-
-//
-// FIXME: Do this now, or after the partition was actually formatted??
-//
- /* Set the new partition's file system proper */
- RtlStringCbCopyW(PartEntry->FileSystem,
- sizeof(PartEntry->FileSystem),
- FileSystemName);
-
- return TRUE;
-}
-
/* EOF */
diff --git a/base/setup/lib/utils/fsrec.h b/base/setup/lib/utils/fsrec.h
new file mode 100644
index 00000000000..197cdd6e9f6
--- /dev/null
+++ b/base/setup/lib/utils/fsrec.h
@@ -0,0 +1,49 @@
+/*
+ * PROJECT: ReactOS Setup Library
+ * LICENSE: GPL-2.0+ (
https://spdx.org/licenses/GPL-2.0+)
+ * PURPOSE: Filesystem Recognition support functions,
+ * using NT OS functionality.
+ * COPYRIGHT: Copyright 2017-2020 Hermes Belusca-Maito
+ */
+
+#pragma once
+
+NTSTATUS
+GetFileSystemNameByHandle(
+ IN HANDLE PartitionHandle,
+ IN OUT PWSTR FileSystemName,
+ IN SIZE_T FileSystemNameSize);
+
+NTSTATUS
+GetFileSystemName_UStr(
+ IN PUNICODE_STRING PartitionPath,
+ IN OUT PWSTR FileSystemName,
+ IN SIZE_T FileSystemNameSize);
+
+NTSTATUS
+GetFileSystemName(
+ IN PCWSTR Partition,
+ IN OUT PWSTR FileSystemName,
+ IN SIZE_T FileSystemNameSize);
+
+NTSTATUS
+InferFileSystemByHandle(
+ IN HANDLE PartitionHandle,
+ IN UCHAR PartitionType,
+ IN OUT PWSTR FileSystemName,
+ IN SIZE_T FileSystemNameSize);
+
+NTSTATUS
+InferFileSystem(
+ IN PCWSTR Partition,
+ IN UCHAR PartitionType,
+ IN OUT PWSTR FileSystemName,
+ IN SIZE_T FileSystemNameSize);
+
+UCHAR
+FileSystemToPartitionType(
+ IN PCWSTR FileSystem,
+ IN PULARGE_INTEGER StartSector,
+ IN PULARGE_INTEGER SectorCount);
+
+/* EOF */
diff --git a/base/setup/lib/utils/partlist.c b/base/setup/lib/utils/partlist.c
index 2e635954134..3837a83e255 100644
--- a/base/setup/lib/utils/partlist.c
+++ b/base/setup/lib/utils/partlist.c
@@ -10,7 +10,7 @@
#include <ntddscsi.h>
#include "partlist.h"
-#include "fsutil.h"
+#include "fsrec.h"
#include "registry.h"
#define NDEBUG