ReactOS 0.4.16-dev-2110-ge3521eb
vfatlib.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <windef.h>
#include <winbase.h>
#include <ndk/iofuncs.h>
#include <ndk/kefuncs.h>
#include <ndk/obfuncs.h>
#include <ndk/rtlfuncs.h>
#include <fmifs/fmifs.h>
#include "check/dosfsck.h"
#include <pshpack1.h>
#include <poppack.h>
#include "common.h"
Include dependency graph for vfatlib.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _FAT16_BOOT_SECTOR
 
struct  _FAT32_BOOT_SECTOR
 
struct  _FAT32_FSINFO
 
struct  _FORMAT_CONTEXT
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define NTOS_MODE_USER
 
#define FSINFO_SECTOR_BEGIN_SIGNATURE   0x41615252
 
#define FSINFO_SECTOR_END_SIGNATURE   0xAA550000
 
#define FSINFO_SIGNATURE   0x61417272
 

Typedefs

typedef struct _FAT16_BOOT_SECTOR FAT16_BOOT_SECTOR
 
typedef struct _FAT16_BOOT_SECTORPFAT16_BOOT_SECTOR
 
typedef struct _FAT32_BOOT_SECTOR FAT32_BOOT_SECTOR
 
typedef struct _FAT32_BOOT_SECTORPFAT32_BOOT_SECTOR
 
typedef struct _FAT32_FSINFO FAT32_FSINFO
 
typedef struct _FAT32_FSINFOPFAT32_FSINFO
 
typedef struct _FORMAT_CONTEXT FORMAT_CONTEXT
 
typedef struct _FORMAT_CONTEXTPFORMAT_CONTEXT
 

Enumerations

enum  FAT_TYPE { FAT_UNKNOWN , FAT_12 , FAT_16 , FAT_32 }
 

Functions

NTSTATUS Fat12Format (HANDLE FileHandle, PPARTITION_INFORMATION_EX PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
 
NTSTATUS Fat16Format (HANDLE FileHandle, PPARTITION_INFORMATION_EX PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
 
NTSTATUS Fat32Format (HANDLE FileHandle, PPARTITION_INFORMATION_EX PartitionInfo, PDISK_GEOMETRY DiskGeometry, PUNICODE_STRING Label, BOOLEAN QuickFormat, ULONG ClusterSize, PFORMAT_CONTEXT Context)
 
VOID UpdateProgress (PFORMAT_CONTEXT Context, ULONG Increment)
 
VOID VfatPrintV (PCHAR Format, va_list args)
 
VOID VfatPrint (PCHAR Format,...)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 14 of file vfatlib.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 15 of file vfatlib.h.

◆ FSINFO_SECTOR_BEGIN_SIGNATURE

#define FSINFO_SECTOR_BEGIN_SIGNATURE   0x41615252

Definition at line 99 of file vfatlib.h.

◆ FSINFO_SECTOR_END_SIGNATURE

#define FSINFO_SECTOR_END_SIGNATURE   0xAA550000

Definition at line 100 of file vfatlib.h.

◆ FSINFO_SIGNATURE

#define FSINFO_SIGNATURE   0x61417272

Definition at line 101 of file vfatlib.h.

◆ NTOS_MODE_USER

#define NTOS_MODE_USER

Definition at line 18 of file vfatlib.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 13 of file vfatlib.h.

Typedef Documentation

◆ FAT16_BOOT_SECTOR

◆ FAT32_BOOT_SECTOR

◆ FAT32_FSINFO

◆ FORMAT_CONTEXT

◆ PFAT16_BOOT_SECTOR

◆ PFAT32_BOOT_SECTOR

◆ PFAT32_FSINFO

◆ PFORMAT_CONTEXT

Enumeration Type Documentation

◆ FAT_TYPE

Enumerator
FAT_UNKNOWN 
FAT_12 
FAT_16 
FAT_32 

Definition at line 112 of file vfatlib.h.

113{
115 FAT_12,
116 FAT_16,
117 FAT_32
118} FAT_TYPE;
FAT_TYPE
Definition: vfatlib.h:113
@ FAT_32
Definition: vfatlib.h:117
@ FAT_12
Definition: vfatlib.h:115
@ FAT_16
Definition: vfatlib.h:116
@ FAT_UNKNOWN
Definition: vfatlib.h:114

Function Documentation

◆ Fat12Format()

NTSTATUS Fat12Format ( HANDLE  FileHandle,
PPARTITION_INFORMATION_EX  PartitionInfo,
PDISK_GEOMETRY  DiskGeometry,
PUNICODE_STRING  Label,
BOOLEAN  QuickFormat,
ULONG  ClusterSize,
PFORMAT_CONTEXT  Context 
)

◆ Fat16Format()

NTSTATUS Fat16Format ( HANDLE  FileHandle,
PPARTITION_INFORMATION_EX  PartitionInfo,
PDISK_GEOMETRY  DiskGeometry,
PUNICODE_STRING  Label,
BOOLEAN  QuickFormat,
ULONG  ClusterSize,
PFORMAT_CONTEXT  Context 
)

◆ Fat32Format()

NTSTATUS Fat32Format ( HANDLE  FileHandle,
PPARTITION_INFORMATION_EX  PartitionInfo,
PDISK_GEOMETRY  DiskGeometry,
PUNICODE_STRING  Label,
BOOLEAN  QuickFormat,
ULONG  ClusterSize,
PFORMAT_CONTEXT  Context 
)

◆ UpdateProgress()

VOID UpdateProgress ( PFORMAT_CONTEXT  Context,
ULONG  Increment 
)

Definition at line 364 of file vfatlib.c.

366{
367 ULONG NewPercent;
368
369 Context->CurrentSectorCount += (ULONGLONG)Increment;
370
371 NewPercent = (Context->CurrentSectorCount * 100ULL) / Context->TotalSectorCount;
372
373 if (NewPercent > Context->Percent)
374 {
375 Context->Percent = NewPercent;
376 if (Context->Callback != NULL)
377 {
378 Context->Callback(PROGRESS, 0, &Context->Percent);
379 }
380 }
381}
#define NULL
Definition: types.h:112
IN OUT PLONG IN OUT PLONG Addend IN OUT PLONG IN LONG Increment
Definition: CrNtStubs.h:46
@ PROGRESS
Definition: fmifs.h:83
if(dx< 0)
Definition: linetemp.h:194
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by Fat12WriteBootSector(), Fat12WriteFAT(), Fat12WriteRootDirectory(), Fat16WriteBootSector(), Fat16WriteFAT(), Fat16WriteRootDirectory(), Fat32WriteBootSector(), Fat32WriteFAT(), Fat32WriteFsInfo(), Fat32WriteRootDirectory(), and FatWipeSectors().

◆ VfatPrint()

VOID VfatPrint ( PCHAR  Format,
  ... 
)

Definition at line 405 of file vfatlib.c.

406{
408
411 va_end(args);
412}
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
#define args
Definition: format.c:66
Definition: match.c:390
VOID VfatPrintV(PCHAR Format, va_list args)
Definition: vfatlib.c:385

Referenced by rename_file(), and VfatChkdsk().

◆ VfatPrintV()

VOID VfatPrintV ( PCHAR  Format,
va_list  args 
)

Definition at line 385 of file vfatlib.c.

386{
388 CHAR TextBuf[512];
389
390 _vsnprintf(TextBuf, sizeof(TextBuf), Format, args);
391
392 /* Prepare parameters */
393 TextOut.Lines = 1;
394 TextOut.Output = TextBuf;
395
396 DPRINT1("VfatPrint -- %s", TextBuf);
397
398 /* Do the callback */
399 if (ChkdskCallback)
401}
#define DPRINT1
Definition: precomp.h:8
#define OUTPUT(ch)
PFMIFSCALLBACK ChkdskCallback
Definition: vfatlib.c:43
#define TextOut
Definition: wingdi.h:4929
#define _vsnprintf
Definition: xmlstorage.h:202
char CHAR
Definition: xmlstorage.h:175

Referenced by die(), pdie(), and VfatPrint().