xref: /reactos/base/setup/lib/utils/volutil.h (revision 1de09c47)
1 /*
2  * PROJECT:     ReactOS Setup Library
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Volume utility functions
5  * COPYRIGHT:   Copyright 2024 Hermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
6  */
7 
8 #pragma once
9 
10 typedef struct _VOLINFO
11 {
12     // WCHAR VolumeName[MAX_PATH]; ///< Name in the DOS/Win32 namespace: "\??\Volume{GUID}\"
13     WCHAR DeviceName[MAX_PATH]; ///< NT device name: "\Device\HarddiskVolumeN"
14 
15     WCHAR DriveLetter;
16     WCHAR VolumeLabel[20];
17     WCHAR FileSystem[MAX_PATH+1];
18 
19     // VOLUME_TYPE VolumeType;
20     // ULARGE_INTEGER Size;
21     // PVOLUME_DISK_EXTENTS Extents;
22 } VOLINFO, *PVOLINFO;
23 
24 /* RawFS "RAW" file system name */
25 #define IS_RAWFS(fs) \
26     ((fs)[0] == 'R' && (fs)[1] == 'A' && (fs)[2] == 'W' && (fs)[3] == 0)
27 
28 #define IsUnknown(VolInfo) \
29     (!*(VolInfo)->FileSystem)
30 
31 #define IsUnformatted(VolInfo) \
32     IS_RAWFS((VolInfo)->FileSystem)
33 
34 #define IsFormatted(VolInfo) \
35     (!IsUnknown(VolInfo) && !IsUnformatted(VolInfo))
36 
37 
38 NTSTATUS
39 MountVolume(
40     _Inout_ PVOLINFO Volume,
41     _In_opt_ UCHAR MbrPartitionType);
42 
43 NTSTATUS
44 DismountVolume(
45     _Inout_ PVOLINFO Volume,
46     _In_ BOOLEAN Force);
47 
48 /* EOF */
49