ReactOS  0.4.14-dev-323-g6fe6a88
vfatlib.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS VFAT filesystem library
4  * FILE: vfatlib.h
5  */
6 
7 #ifndef _VFATLIB_H_
8 #define _VFATLIB_H_
9 
10 #include <stdio.h>
11 #include <stdlib.h>
12 
13 #define WIN32_NO_STATUS
14 #define _INC_WINDOWS
15 #define COM_NO_WINDOWS_H
16 #include <windef.h>
17 #include <winbase.h>
18 #define NTOS_MODE_USER
19 #include <ndk/iofuncs.h>
20 #include <ndk/kefuncs.h>
21 #include <ndk/obfuncs.h>
22 #include <ndk/rtlfuncs.h>
23 #include <fmifs/fmifs.h>
24 
25 #include "check/dosfsck.h"
26 
27 #include <pshpack1.h>
28 typedef struct _FAT16_BOOT_SECTOR
29 {
30  unsigned char Jump[3]; // 0
31  unsigned char OEMName[8]; // 3
32  unsigned short BytesPerSector; // 11
33  unsigned char SectorsPerCluster; // 13
34  unsigned short ReservedSectors; // 14
35  unsigned char FATCount; // 16
36  unsigned short RootEntries; // 17
37  unsigned short Sectors; // 19
38  unsigned char Media; // 21
39  unsigned short FATSectors; // 22
40  unsigned short SectorsPerTrack; // 24
41  unsigned short Heads; // 26
42  unsigned long HiddenSectors; // 28
43  unsigned long SectorsHuge; // 32
44  unsigned char Drive; // 36
45  unsigned char Res1; // 37
46  unsigned char ExtBootSignature; // 38
47  unsigned long VolumeID; // 39
48  unsigned char VolumeLabel[11]; // 43
49  unsigned char SysType[8]; // 54
50  unsigned char Res2[446]; // 62
51  unsigned long Signature1; // 508
53 
54 typedef struct _FAT32_BOOT_SECTOR
55 {
56  unsigned char Jump[3]; // 0
57  unsigned char OEMName[8]; // 3
58  unsigned short BytesPerSector; // 11
59  unsigned char SectorsPerCluster; // 13
60  unsigned short ReservedSectors; // 14
61  unsigned char FATCount; // 16
62  unsigned short RootEntries; // 17
63  unsigned short Sectors; // 19
64  unsigned char Media; // 21
65  unsigned short FATSectors; // 22
66  unsigned short SectorsPerTrack; // 24
67  unsigned short Heads; // 26
68  unsigned long HiddenSectors; // 28
69  unsigned long SectorsHuge; // 32
70  unsigned long FATSectors32; // 36
71  unsigned short ExtFlag; // 40
72  unsigned short FSVersion; // 42
73  unsigned long RootCluster; // 44
74  unsigned short FSInfoSector; // 48
75  unsigned short BootBackup; // 50
76  unsigned char Res3[12]; // 52
77  unsigned char Drive; // 64
78  unsigned char Res4; // 65
79  unsigned char ExtBootSignature; // 66
80  unsigned long VolumeID; // 67
81  unsigned char VolumeLabel[11]; // 71
82  unsigned char SysType[8]; // 82
83  unsigned char Res2[418]; // 90
84  unsigned long Signature1; // 508
86 
87 typedef struct _FAT32_FSINFO
88 {
89  unsigned long LeadSig; // 0
90  unsigned char Res1[480]; // 4
91  unsigned long StrucSig; // 484
92  unsigned long FreeCount; // 488
93  unsigned long NextFree; // 492
94  unsigned long Res2[3]; // 496
95  unsigned long TrailSig; // 508
97 #include <poppack.h>
98 
99 #define FSINFO_SECTOR_BEGIN_SIGNATURE 0x41615252 // 'RRaA'
100 #define FSINFO_SECTOR_END_SIGNATURE 0xAA550000
101 #define FSINFO_SIGNATURE 0x61417272 // 'rrAa'
102 
103 typedef struct _FORMAT_CONTEXT
104 {
111 
112 #include "common.h"
113 
114 
115 NTSTATUS
118  PDISK_GEOMETRY DiskGeometry,
123 
124 NTSTATUS
127  PDISK_GEOMETRY DiskGeometry,
132 
133 NTSTATUS
136  PDISK_GEOMETRY DiskGeometry,
141 
142 VOID
144  ULONG Increment);
145 
146 VOID
148 
149 VOID
150 VfatPrint(PCHAR Format, ...);
151 
152 #endif /* _VFATLIB_H_ */
153 
154 /* EOF */
signed char * PCHAR
Definition: retypes.h:7
unsigned long VolumeID
Definition: vfatlib.h:47
ULONG TotalSectorCount
Definition: vfatlib.h:106
unsigned char Res2[446]
Definition: vfatlib.h:50
unsigned char SysType[8]
Definition: vfatlib.h:49
unsigned char ExtBootSignature
Definition: vfatlib.h:46
unsigned char SectorsPerCluster
Definition: vfatlib.h:33
unsigned long TrailSig
Definition: vfatlib.h:95
unsigned short ExtFlag
Definition: vfatlib.h:71
unsigned char Drive
Definition: vfatlib.h:77
unsigned short RootEntries
Definition: vfatlib.h:62
LONG NTSTATUS
Definition: precomp.h:26
unsigned long RootCluster
Definition: vfatlib.h:73
struct _FAT32_BOOT_SECTOR * PFAT32_BOOT_SECTOR
unsigned long Signature1
Definition: vfatlib.h:84
unsigned char Media
Definition: vfatlib.h:38
unsigned short BytesPerSector
Definition: vfatlib.h:58
Definition: match.c:390
unsigned char Res1
Definition: vfatlib.h:45
unsigned short SectorsPerTrack
Definition: vfatlib.h:40
unsigned short Heads
Definition: vfatlib.h:41
HANDLE FileHandle
Definition: stats.c:38
unsigned long Res2[3]
Definition: vfatlib.h:94
unsigned char Res2[418]
Definition: vfatlib.h:83
unsigned char OEMName[8]
Definition: vfatlib.h:57
struct _FAT32_BOOT_SECTOR FAT32_BOOT_SECTOR
NTSTATUS Fat12Format(HANDLE FileHandle, PPARTITION_INFORMATION PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
unsigned long HiddenSectors
Definition: vfatlib.h:68
unsigned char Media
Definition: vfatlib.h:64
PFMIFSCALLBACK Callback
Definition: vfatlib.h:105
unsigned char BOOLEAN
char * va_list
Definition: acmsvcex.h:78
unsigned char SysType[8]
Definition: vfatlib.h:82
NTSTATUS Fat16Format(HANDLE FileHandle, PPARTITION_INFORMATION PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
unsigned short FSVersion
Definition: vfatlib.h:72
BOOL QuickFormat
Definition: format.c:66
unsigned long LeadSig
Definition: vfatlib.h:89
unsigned short BytesPerSector
Definition: vfatlib.h:32
unsigned char SectorsPerCluster
Definition: vfatlib.h:59
struct _FORMAT_CONTEXT * PFORMAT_CONTEXT
struct _FAT32_FSINFO FAT32_FSINFO
VOID VfatPrintV(PCHAR Format, va_list args)
Definition: vfatlib.c:343
VOID UpdateProgress(PFORMAT_CONTEXT Context, ULONG Increment)
Definition: vfatlib.c:322
NTSTATUS Fat32Format(HANDLE FileHandle, PPARTITION_INFORMATION PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
struct _FAT16_BOOT_SECTOR FAT16_BOOT_SECTOR
unsigned short Sectors
Definition: vfatlib.h:63
DWORD ClusterSize
Definition: format.c:67
_In_ ULONG _In_ struct _SET_PARTITION_INFORMATION_EX * PartitionInfo
Definition: iofuncs.h:2101
unsigned short RootEntries
Definition: vfatlib.h:36
BOOLEAN Success
Definition: vfatlib.h:108
unsigned long NextFree
Definition: vfatlib.h:93
unsigned short Heads
Definition: vfatlib.h:67
unsigned short FATSectors
Definition: vfatlib.h:65
ULONG CurrentSectorCount
Definition: vfatlib.h:107
unsigned short ReservedSectors
Definition: vfatlib.h:34
struct _FAT32_FSINFO * PFAT32_FSINFO
unsigned short FATSectors
Definition: vfatlib.h:39
unsigned char Res1[480]
Definition: vfatlib.h:90
VOID VfatPrint(PCHAR Format,...)
Definition: vfatlib.c:363
unsigned long FATSectors32
Definition: vfatlib.h:70
unsigned char FATCount
Definition: vfatlib.h:35
ULONG Percent
Definition: vfatlib.h:109
unsigned char ExtBootSignature
Definition: vfatlib.h:79
unsigned long FreeCount
Definition: vfatlib.h:92
BOOLEAN(NTAPI * PFMIFSCALLBACK)(IN CALLBACKCOMMAND Command, IN ULONG SubAction, IN PVOID ActionInfo)
Definition: fmifs.h:89
unsigned char VolumeLabel[11]
Definition: vfatlib.h:81
unsigned char OEMName[8]
Definition: vfatlib.h:31
unsigned short SectorsPerTrack
Definition: vfatlib.h:66
unsigned short ReservedSectors
Definition: vfatlib.h:60
unsigned short BootBackup
Definition: vfatlib.h:75
unsigned char Res4
Definition: vfatlib.h:78
unsigned long StrucSig
Definition: vfatlib.h:91
struct _FORMAT_CONTEXT FORMAT_CONTEXT
unsigned int ULONG
Definition: retypes.h:1
unsigned long HiddenSectors
Definition: vfatlib.h:42
unsigned char Jump[3]
Definition: vfatlib.h:30
PWCHAR Label
Definition: format.c:70
unsigned long SectorsHuge
Definition: vfatlib.h:43
unsigned char FATCount
Definition: vfatlib.h:61
unsigned char VolumeLabel[11]
Definition: vfatlib.h:48
unsigned long Signature1
Definition: vfatlib.h:51
unsigned char Jump[3]
Definition: vfatlib.h:56
unsigned long VolumeID
Definition: vfatlib.h:80
unsigned char Drive
Definition: vfatlib.h:44
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:42
unsigned long SectorsHuge
Definition: vfatlib.h:69
unsigned short FSInfoSector
Definition: vfatlib.h:74
unsigned char Res3[12]
Definition: vfatlib.h:76
unsigned short Sectors
Definition: vfatlib.h:37
struct _FAT16_BOOT_SECTOR * PFAT16_BOOT_SECTOR