reactos/base/setup/lib/utils/fsrec.h
Hermès Bélusca-Maïto 9735a8379f
[SETUPLIB] Make InferFileSystem() compatible for both MBR and GPT disks. Simplify the FSREC interface a bit.
Instead of providing an MBR partition type to InferFileSystem(), make
it call IOCTL_DISK_GET_PARTITION_INFO(_EX) to determine whether the
partition pointed by the path/handle is MBR or GPT. Then, only if it's
MBR, we retrieve its partition type in order to "guess" an adequate file
system name, in case the latter was not recognized already via regular
ways (via GetFileSystemName() / NtQueryVolumeInformationFile()).

- Remove the GetFileSystemNameByHandle() and InferFileSystemByHandle()
  functions. Instead, make the other GetFileSystemName*() and
  InferFileSystem*() functions accept a HANDLE as an alternative to the
  already-existing partition path string. These parameters are exclusive
  to each other.

- Rename SetPartitionType() -> SetMBRPartitionType(),
  and FileSystemToPartitionType() -> FileSystemToMBRPartitionType()
  in order to really clarify what they do (since this code is meant
  for MBR partitions only, not GPT ones).
2020-11-24 03:24:36 +01:00

38 lines
951 B
C

/*
* 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
GetFileSystemName_UStr(
IN PUNICODE_STRING PartitionPath OPTIONAL,
IN HANDLE PartitionHandle OPTIONAL,
IN OUT PWSTR FileSystemName,
IN SIZE_T FileSystemNameSize);
NTSTATUS
GetFileSystemName(
IN PCWSTR PartitionPath OPTIONAL,
IN HANDLE PartitionHandle OPTIONAL,
IN OUT PWSTR FileSystemName,
IN SIZE_T FileSystemNameSize);
NTSTATUS
InferFileSystem(
IN PCWSTR PartitionPath OPTIONAL,
IN HANDLE PartitionHandle OPTIONAL,
IN OUT PWSTR FileSystemName,
IN SIZE_T FileSystemNameSize);
UCHAR
FileSystemToMBRPartitionType(
IN PCWSTR FileSystem,
IN ULONGLONG StartSector,
IN ULONGLONG SectorCount);
/* EOF */