2003-04-28 19:44:13 +00:00
|
|
|
/*
|
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
|
|
|
* PROJECT: ReactOS VFAT filesystem library
|
|
|
|
* FILE: vfatlib.h
|
|
|
|
*/
|
2005-06-20 19:46:09 +00:00
|
|
|
|
2014-02-07 16:58:53 +00:00
|
|
|
#ifndef _VFATLIB_H_
|
|
|
|
#define _VFATLIB_H_
|
|
|
|
|
2011-08-17 14:06:16 +00:00
|
|
|
#include <stdio.h>
|
2016-03-02 01:08:54 +00:00
|
|
|
#include <stdlib.h>
|
2011-08-17 14:06:16 +00:00
|
|
|
|
2005-10-19 17:03:38 +00:00
|
|
|
#define WIN32_NO_STATUS
|
2013-01-24 23:00:42 +00:00
|
|
|
#define _INC_WINDOWS
|
|
|
|
#define COM_NO_WINDOWS_H
|
|
|
|
#include <windef.h>
|
|
|
|
#include <winbase.h>
|
2003-04-28 19:44:13 +00:00
|
|
|
#define NTOS_MODE_USER
|
2011-08-17 14:06:16 +00:00
|
|
|
#include <ndk/iofuncs.h>
|
|
|
|
#include <ndk/kefuncs.h>
|
|
|
|
#include <ndk/obfuncs.h>
|
|
|
|
#include <ndk/rtlfuncs.h>
|
2006-09-07 17:39:42 +00:00
|
|
|
#include <fmifs/fmifs.h>
|
2003-04-28 19:44:13 +00:00
|
|
|
|
2016-03-02 01:08:54 +00:00
|
|
|
#include "check/dosfsck.h"
|
2008-08-08 09:53:13 +00:00
|
|
|
|
2007-11-22 14:28:21 +00:00
|
|
|
#include <pshpack1.h>
|
2003-08-21 15:33:48 +00:00
|
|
|
typedef struct _FAT16_BOOT_SECTOR
|
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
unsigned char magic0; // 0
|
|
|
|
unsigned char res0; // 1
|
|
|
|
unsigned char magic1; // 2
|
|
|
|
unsigned char OEMName[8]; // 3
|
|
|
|
unsigned short BytesPerSector; // 11
|
|
|
|
unsigned char SectorsPerCluster; // 13
|
|
|
|
unsigned short ReservedSectors; // 14
|
|
|
|
unsigned char FATCount; // 16
|
|
|
|
unsigned short RootEntries; // 17
|
|
|
|
unsigned short Sectors; // 19
|
|
|
|
unsigned char Media; // 21
|
|
|
|
unsigned short FATSectors; // 22
|
|
|
|
unsigned short SectorsPerTrack; // 24
|
|
|
|
unsigned short Heads; // 26
|
|
|
|
unsigned long HiddenSectors; // 28
|
|
|
|
unsigned long SectorsHuge; // 32
|
|
|
|
unsigned char Drive; // 36
|
|
|
|
unsigned char Res1; // 37
|
|
|
|
unsigned char ExtBootSignature; // 38
|
|
|
|
unsigned long VolumeID; // 39
|
|
|
|
unsigned char VolumeLabel[11]; // 43
|
|
|
|
unsigned char SysType[8]; // 54
|
|
|
|
unsigned char Res2[446]; // 62
|
|
|
|
unsigned long Signature1; // 508
|
2007-11-22 14:28:21 +00:00
|
|
|
} FAT16_BOOT_SECTOR, *PFAT16_BOOT_SECTOR;
|
2003-08-21 15:33:48 +00:00
|
|
|
|
2003-04-28 19:44:13 +00:00
|
|
|
typedef struct _FAT32_BOOT_SECTOR
|
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
unsigned char magic0; // 0
|
|
|
|
unsigned char res0; // 1
|
|
|
|
unsigned char magic1; // 2
|
|
|
|
unsigned char OEMName[8]; // 3
|
|
|
|
unsigned short BytesPerSector; // 11
|
|
|
|
unsigned char SectorsPerCluster; // 13
|
|
|
|
unsigned short ReservedSectors; // 14
|
|
|
|
unsigned char FATCount; // 16
|
|
|
|
unsigned short RootEntries; // 17
|
|
|
|
unsigned short Sectors; // 19
|
|
|
|
unsigned char Media; // 21
|
|
|
|
unsigned short FATSectors; // 22
|
|
|
|
unsigned short SectorsPerTrack; // 24
|
|
|
|
unsigned short Heads; // 26
|
|
|
|
unsigned long HiddenSectors; // 28
|
|
|
|
unsigned long SectorsHuge; // 32
|
|
|
|
unsigned long FATSectors32; // 36
|
|
|
|
unsigned short ExtFlag; // 40
|
|
|
|
unsigned short FSVersion; // 42
|
|
|
|
unsigned long RootCluster; // 44
|
|
|
|
unsigned short FSInfoSector; // 48
|
|
|
|
unsigned short BootBackup; // 50
|
|
|
|
unsigned char Res3[12]; // 52
|
|
|
|
unsigned char Drive; // 64
|
|
|
|
unsigned char Res4; // 65
|
|
|
|
unsigned char ExtBootSignature; // 66
|
|
|
|
unsigned long VolumeID; // 67
|
|
|
|
unsigned char VolumeLabel[11]; // 71
|
|
|
|
unsigned char SysType[8]; // 82
|
|
|
|
unsigned char Res2[418]; // 90
|
|
|
|
unsigned long Signature1; // 508
|
2007-11-22 14:28:21 +00:00
|
|
|
} FAT32_BOOT_SECTOR, *PFAT32_BOOT_SECTOR;
|
2003-04-28 19:44:13 +00:00
|
|
|
|
|
|
|
typedef struct _FAT32_FSINFO
|
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
unsigned long LeadSig; // 0
|
|
|
|
unsigned char Res1[480]; // 4
|
|
|
|
unsigned long StrucSig; // 484
|
|
|
|
unsigned long FreeCount; // 488
|
|
|
|
unsigned long NextFree; // 492
|
|
|
|
unsigned long Res2[3]; // 496
|
|
|
|
unsigned long TrailSig; // 508
|
2007-11-22 14:28:21 +00:00
|
|
|
} FAT32_FSINFO, *PFAT32_FSINFO;
|
|
|
|
#include <poppack.h>
|
2003-08-21 15:33:48 +00:00
|
|
|
|
2015-12-27 19:38:13 +00:00
|
|
|
#define FSINFO_SECTOR_BEGIN_SIGNATURE 0x41615252 // 'RRaA'
|
|
|
|
#define FSINFO_SECTOR_END_SIGNATURE 0xAA550000
|
|
|
|
#define FSINFO_SIGNATURE 0x61417272 // 'rrAa'
|
|
|
|
|
2004-02-23 11:56:10 +00:00
|
|
|
typedef struct _FORMAT_CONTEXT
|
|
|
|
{
|
2010-06-12 10:25:18 +00:00
|
|
|
PFMIFSCALLBACK Callback;
|
|
|
|
ULONG TotalSectorCount;
|
|
|
|
ULONG CurrentSectorCount;
|
|
|
|
BOOLEAN Success;
|
|
|
|
ULONG Percent;
|
2004-02-23 11:56:10 +00:00
|
|
|
} FORMAT_CONTEXT, *PFORMAT_CONTEXT;
|
|
|
|
|
2015-12-27 00:57:51 +00:00
|
|
|
#include "common.h"
|
|
|
|
|
2004-02-23 11:56:10 +00:00
|
|
|
|
2003-08-24 16:15:31 +00:00
|
|
|
NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
Fat12Format(HANDLE FileHandle,
|
|
|
|
PPARTITION_INFORMATION PartitionInfo,
|
|
|
|
PDISK_GEOMETRY DiskGeometry,
|
|
|
|
PUNICODE_STRING Label,
|
|
|
|
BOOLEAN QuickFormat,
|
|
|
|
ULONG ClusterSize,
|
|
|
|
PFORMAT_CONTEXT Context);
|
2003-08-24 16:15:31 +00:00
|
|
|
|
2003-08-21 15:33:48 +00:00
|
|
|
NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
Fat16Format(HANDLE FileHandle,
|
|
|
|
PPARTITION_INFORMATION PartitionInfo,
|
|
|
|
PDISK_GEOMETRY DiskGeometry,
|
|
|
|
PUNICODE_STRING Label,
|
|
|
|
BOOLEAN QuickFormat,
|
|
|
|
ULONG ClusterSize,
|
|
|
|
PFORMAT_CONTEXT Context);
|
2003-08-22 13:53:02 +00:00
|
|
|
|
|
|
|
NTSTATUS
|
2010-06-12 10:25:18 +00:00
|
|
|
Fat32Format(HANDLE FileHandle,
|
|
|
|
PPARTITION_INFORMATION PartitionInfo,
|
|
|
|
PDISK_GEOMETRY DiskGeometry,
|
|
|
|
PUNICODE_STRING Label,
|
|
|
|
BOOLEAN QuickFormat,
|
|
|
|
ULONG ClusterSize,
|
|
|
|
PFORMAT_CONTEXT Context);
|
2004-02-23 11:56:10 +00:00
|
|
|
|
|
|
|
VOID
|
2010-06-12 10:25:18 +00:00
|
|
|
UpdateProgress(PFORMAT_CONTEXT Context,
|
|
|
|
ULONG Increment);
|
2004-02-23 11:56:10 +00:00
|
|
|
|
2016-03-02 01:08:54 +00:00
|
|
|
VOID
|
|
|
|
VfatPrintV(PCHAR Format, va_list args);
|
|
|
|
|
2008-08-08 09:53:13 +00:00
|
|
|
VOID
|
|
|
|
VfatPrint(PCHAR Format, ...);
|
|
|
|
|
2014-02-07 16:58:53 +00:00
|
|
|
#endif /* _VFATLIB_H_ */
|
|
|
|
|
2004-02-23 11:56:10 +00:00
|
|
|
/* EOF */
|