xref: /reactos/base/setup/lib/fsutil.h (revision d6d1efe7)
1 /*
2  * PROJECT:     ReactOS Setup Library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Filesystem support functions
5  * COPYRIGHT:   Copyright 2003-2019 Casper S. Hornstrup (chorns@users.sourceforge.net)
6  *              Copyright 2017-2019 Hermes Belusca-Maito
7  */
8 
9 #pragma once
10 
11 #include <fmifs/fmifs.h>
12 
13 /** QueryAvailableFileSystemFormat() **/
14 BOOLEAN
15 GetRegisteredFileSystems(
16     IN ULONG Index,
17     OUT PCWSTR* FileSystemName);
18 
19 NTSTATUS
20 GetFileSystemNameByHandle(
21     IN HANDLE PartitionHandle,
22     IN OUT PWSTR FileSystemName,
23     IN SIZE_T FileSystemNameSize);
24 
25 NTSTATUS
26 GetFileSystemName_UStr(
27     IN PUNICODE_STRING PartitionPath,
28     IN OUT PWSTR FileSystemName,
29     IN SIZE_T FileSystemNameSize);
30 
31 NTSTATUS
32 GetFileSystemName(
33     IN PCWSTR Partition,
34     IN OUT PWSTR FileSystemName,
35     IN SIZE_T FileSystemNameSize);
36 
37 NTSTATUS
38 InferFileSystemByHandle(
39     IN HANDLE PartitionHandle,
40     IN UCHAR PartitionType,
41     IN OUT PWSTR FileSystemName,
42     IN SIZE_T FileSystemNameSize);
43 
44 NTSTATUS
45 InferFileSystem(
46     IN PCWSTR Partition,
47     IN UCHAR PartitionType,
48     IN OUT PWSTR FileSystemName,
49     IN SIZE_T FileSystemNameSize);
50 
51 
52 /** ChkdskEx() **/
53 NTSTATUS
54 ChkdskFileSystem_UStr(
55     IN PUNICODE_STRING DriveRoot,
56     IN PCWSTR FileSystemName,
57     IN BOOLEAN FixErrors,
58     IN BOOLEAN Verbose,
59     IN BOOLEAN CheckOnlyIfDirty,
60     IN BOOLEAN ScanDrive,
61     IN PFMIFSCALLBACK Callback);
62 
63 NTSTATUS
64 ChkdskFileSystem(
65     IN PCWSTR DriveRoot,
66     IN PCWSTR FileSystemName,
67     IN BOOLEAN FixErrors,
68     IN BOOLEAN Verbose,
69     IN BOOLEAN CheckOnlyIfDirty,
70     IN BOOLEAN ScanDrive,
71     IN PFMIFSCALLBACK Callback);
72 
73 
74 /** FormatEx() **/
75 NTSTATUS
76 FormatFileSystem_UStr(
77     IN PUNICODE_STRING DriveRoot,
78     IN PCWSTR FileSystemName,
79     IN FMIFS_MEDIA_FLAG MediaFlag,
80     IN PUNICODE_STRING Label,
81     IN BOOLEAN QuickFormat,
82     IN ULONG ClusterSize,
83     IN PFMIFSCALLBACK Callback);
84 
85 NTSTATUS
86 FormatFileSystem(
87     IN PCWSTR DriveRoot,
88     IN PCWSTR FileSystemName,
89     IN FMIFS_MEDIA_FLAG MediaFlag,
90     IN PCWSTR Label,
91     IN BOOLEAN QuickFormat,
92     IN ULONG ClusterSize,
93     IN PFMIFSCALLBACK Callback);
94 
95 
96 UCHAR
97 FileSystemToPartitionType(
98     IN PCWSTR FileSystem,
99     IN PULARGE_INTEGER StartSector,
100     IN PULARGE_INTEGER SectorCount);
101 
102 
103 //
104 // Formatting routines
105 //
106 
107 struct _PARTENTRY; // Defined in partlist.h
108 
109 BOOLEAN
110 PreparePartitionForFormatting(
111     IN struct _PARTENTRY* PartEntry,
112     IN PCWSTR FileSystemName);
113 
114 /* EOF */
115