2014-02-06 12:28:49 +00:00
|
|
|
#ifndef _FASTFAT_PCH_
|
|
|
|
#define _FASTFAT_PCH_
|
|
|
|
|
2005-10-03 07:15:12 +00:00
|
|
|
#include <ntifs.h>
|
|
|
|
#include <ntdddisk.h>
|
2010-12-27 18:11:35 +00:00
|
|
|
#include <dos.h>
|
2014-08-24 03:28:01 +00:00
|
|
|
#include <pseh/pseh2.h>
|
2000-12-29 23:17:12 +00:00
|
|
|
|
2015-09-03 20:34:47 +00:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define INIT_SECTION __attribute__((section ("INIT")))
|
|
|
|
#else
|
|
|
|
#define INIT_SECTION /* Done via alloc_text for MSC */
|
|
|
|
#endif
|
|
|
|
|
2005-01-12 12:06:15 +00:00
|
|
|
#define USE_ROS_CC_AND_FS
|
2014-12-22 23:00:22 +00:00
|
|
|
#if 0
|
2014-11-29 20:26:07 +00:00
|
|
|
#ifndef _MSC_VER
|
|
|
|
#define ENABLE_SWAPOUT
|
|
|
|
#endif
|
2014-12-22 23:00:22 +00:00
|
|
|
#endif
|
2005-01-12 12:06:15 +00:00
|
|
|
|
2009-01-25 16:13:16 +00:00
|
|
|
#define ROUND_DOWN(n, align) \
|
|
|
|
(((ULONG)n) & ~((align) - 1l))
|
|
|
|
|
|
|
|
#define ROUND_UP(n, align) \
|
|
|
|
ROUND_DOWN(((ULONG)n) + (align) - 1, (align))
|
|
|
|
|
2016-06-11 09:32:00 +00:00
|
|
|
#define ROUND_DOWN_64(n, align) \
|
|
|
|
(((ULONGLONG)n) & ~((align) - 1LL))
|
|
|
|
|
|
|
|
#define ROUND_UP_64(n, align) \
|
|
|
|
ROUND_DOWN_64(((ULONGLONG)n) + (align) - 1LL, (align))
|
|
|
|
|
2005-02-24 20:47:07 +00:00
|
|
|
#include <pshpack1.h>
|
2001-07-20 08:00:21 +00:00
|
|
|
struct _BootSector
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char magic0, res0, magic1;
|
|
|
|
unsigned char OEMName[8];
|
|
|
|
unsigned short BytesPerSector;
|
|
|
|
unsigned char SectorsPerCluster;
|
|
|
|
unsigned short ReservedSectors;
|
|
|
|
unsigned char FATCount;
|
|
|
|
unsigned short RootEntries, Sectors;
|
|
|
|
unsigned char Media;
|
|
|
|
unsigned short FATSectors, SectorsPerTrack, Heads;
|
|
|
|
unsigned long HiddenSectors, SectorsHuge;
|
|
|
|
unsigned char Drive, Res1, Sig;
|
|
|
|
unsigned long VolumeID;
|
|
|
|
unsigned char VolumeLabel[11], SysType[8];
|
|
|
|
unsigned char Res2[448];
|
|
|
|
unsigned short Signatur1;
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
1998-10-05 04:00:59 +00:00
|
|
|
|
2001-07-20 08:00:21 +00:00
|
|
|
struct _BootSector32
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char magic0, res0, magic1; // 0
|
|
|
|
unsigned char OEMName[8]; // 3
|
|
|
|
unsigned short BytesPerSector; // 11
|
|
|
|
unsigned char SectorsPerCluster; // 13
|
|
|
|
unsigned short ReservedSectors; // 14
|
|
|
|
unsigned char FATCount; // 16
|
|
|
|
unsigned short RootEntries, Sectors; // 17
|
|
|
|
unsigned char Media; // 21
|
|
|
|
unsigned short FATSectors, SectorsPerTrack, Heads; // 22
|
|
|
|
unsigned long HiddenSectors, SectorsHuge; // 28
|
|
|
|
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], SysType[8]; // 71
|
|
|
|
unsigned char Res2[420]; // 90
|
|
|
|
unsigned short Signature1; // 510
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
2001-07-20 08:00:21 +00:00
|
|
|
|
2004-12-05 16:31:51 +00:00
|
|
|
struct _BootSectorFatX
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char SysType[4]; // 0
|
|
|
|
unsigned long VolumeID; // 4
|
|
|
|
unsigned long SectorsPerCluster; // 8
|
|
|
|
unsigned short FATCount; // 12
|
|
|
|
unsigned long Unknown; // 14
|
|
|
|
unsigned char Unused[4078]; // 18
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
2004-12-05 16:31:51 +00:00
|
|
|
|
2003-01-31 15:55:18 +00:00
|
|
|
struct _FsInfoSector
|
2001-07-20 08:00:21 +00:00
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned long ExtBootSignature2; // 0
|
|
|
|
unsigned char Res6[480]; // 4
|
|
|
|
unsigned long FSINFOSignature; // 484
|
|
|
|
unsigned long FreeCluster; // 488
|
|
|
|
unsigned long NextCluster; // 492
|
|
|
|
unsigned char Res7[12]; // 496
|
|
|
|
unsigned long Signatur2; // 508
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
1998-12-20 19:41:39 +00:00
|
|
|
|
1998-10-05 04:00:59 +00:00
|
|
|
typedef struct _BootSector BootSector;
|
|
|
|
|
2002-03-18 22:37:13 +00:00
|
|
|
struct _FATDirEntry
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct { unsigned char Filename[8], Ext[3]; };
|
|
|
|
unsigned char ShortName[11];
|
|
|
|
};
|
|
|
|
unsigned char Attrib;
|
|
|
|
unsigned char lCase;
|
|
|
|
unsigned char CreationTimeMs;
|
|
|
|
unsigned short CreationTime,CreationDate,AccessDate;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
unsigned short FirstClusterHigh; // FAT32
|
|
|
|
unsigned short ExtendedAttributes; // FAT12/FAT16
|
|
|
|
};
|
|
|
|
unsigned short UpdateTime; //time create/update
|
|
|
|
unsigned short UpdateDate; //date create/update
|
|
|
|
unsigned short FirstCluster;
|
|
|
|
unsigned long FileSize;
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
1998-10-05 04:00:59 +00:00
|
|
|
|
2006-05-07 18:50:18 +00:00
|
|
|
#define FAT_EAFILE "EA DATA. SF"
|
|
|
|
|
|
|
|
typedef struct _EAFileHeader FAT_EA_FILE_HEADER, *PFAT_EA_FILE_HEADER;
|
|
|
|
|
|
|
|
struct _EAFileHeader
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned short Signature; // ED
|
|
|
|
unsigned short Unknown[15];
|
|
|
|
unsigned short EASetTable[240];
|
2006-05-07 18:50:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _EASetHeader FAT_EA_SET_HEADER, *PFAT_EA_SET_HEADER;
|
|
|
|
|
|
|
|
struct _EASetHeader
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned short Signature; // EA
|
|
|
|
unsigned short Offset; // relative offset, same value as in the EASetTable
|
|
|
|
unsigned short Unknown1[2];
|
|
|
|
char TargetFileName[12];
|
|
|
|
unsigned short Unknown2[3];
|
|
|
|
unsigned int EALength;
|
|
|
|
// EA Header
|
2006-05-07 18:50:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _EAHeader FAT_EA_HEADER, *PFAT_EA_HEADER;
|
|
|
|
|
|
|
|
struct _EAHeader
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char Unknown;
|
|
|
|
unsigned char EANameLength;
|
|
|
|
unsigned short EAValueLength;
|
|
|
|
// Name Data
|
|
|
|
// Value Data
|
2006-05-07 18:50:18 +00:00
|
|
|
};
|
|
|
|
|
2004-12-05 16:31:51 +00:00
|
|
|
typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;
|
|
|
|
|
|
|
|
struct _FATXDirEntry
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char FilenameLength; // 0
|
|
|
|
unsigned char Attrib; // 1
|
|
|
|
unsigned char Filename[42]; // 2
|
|
|
|
unsigned long FirstCluster; // 44
|
|
|
|
unsigned long FileSize; // 48
|
|
|
|
unsigned short UpdateTime; // 52
|
|
|
|
unsigned short UpdateDate; // 54
|
|
|
|
unsigned short CreationTime; // 56
|
|
|
|
unsigned short CreationDate; // 58
|
|
|
|
unsigned short AccessTime; // 60
|
|
|
|
unsigned short AccessDate; // 62
|
2004-12-05 16:31:51 +00:00
|
|
|
};
|
|
|
|
|
1998-10-05 04:00:59 +00:00
|
|
|
struct _slot
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
unsigned char id; // sequence number for slot
|
|
|
|
WCHAR name0_4[5]; // first 5 characters in name
|
|
|
|
unsigned char attr; // attribute byte
|
|
|
|
unsigned char reserved; // always 0
|
|
|
|
unsigned char alias_checksum; // checksum for 8.3 alias
|
|
|
|
WCHAR name5_10[6]; // 6 more characters in name
|
|
|
|
unsigned char start[2]; // starting cluster number
|
|
|
|
WCHAR name11_12[2]; // last 2 characters in name
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
1998-10-05 04:00:59 +00:00
|
|
|
|
|
|
|
typedef struct _slot slot;
|
|
|
|
|
2005-02-24 20:47:07 +00:00
|
|
|
#include <poppack.h>
|
|
|
|
|
|
|
|
#define VFAT_CASE_LOWER_BASE 8 // base is lower case
|
|
|
|
#define VFAT_CASE_LOWER_EXT 16 // extension is lower case
|
|
|
|
|
|
|
|
#define LONGNAME_MAX_LENGTH 256 // max length for a long filename
|
|
|
|
|
2017-02-18 21:37:56 +00:00
|
|
|
#define ENTRY_DELETED(IsFatX, DirEntry) (IsFatX ? FATX_ENTRY_DELETED(&((DirEntry)->FatX)) : FAT_ENTRY_DELETED(&((DirEntry)->Fat)))
|
|
|
|
#define ENTRY_VOLUME(IsFatX, DirEntry) (IsFatX ? FATX_ENTRY_VOLUME(&((DirEntry)->FatX)) : FAT_ENTRY_VOLUME(&((DirEntry)->Fat)))
|
|
|
|
#define ENTRY_END(IsFatX, DirEntry) (IsFatX ? FATX_ENTRY_END(&((DirEntry)->FatX)) : FAT_ENTRY_END(&((DirEntry)->Fat)))
|
2017-02-18 21:24:31 +00:00
|
|
|
|
2005-02-24 20:47:07 +00:00
|
|
|
#define FAT_ENTRY_DELETED(DirEntry) ((DirEntry)->Filename[0] == 0xe5)
|
|
|
|
#define FAT_ENTRY_END(DirEntry) ((DirEntry)->Filename[0] == 0)
|
|
|
|
#define FAT_ENTRY_LONG(DirEntry) (((DirEntry)->Attrib & 0x3f) == 0x0f)
|
|
|
|
#define FAT_ENTRY_VOLUME(DirEntry) (((DirEntry)->Attrib & 0x1f) == 0x08)
|
|
|
|
|
|
|
|
#define FATX_ENTRY_DELETED(DirEntry) ((DirEntry)->FilenameLength == 0xe5)
|
|
|
|
#define FATX_ENTRY_END(DirEntry) ((DirEntry)->FilenameLength == 0xff)
|
|
|
|
#define FATX_ENTRY_LONG(DirEntry) (FALSE)
|
|
|
|
#define FATX_ENTRY_VOLUME(DirEntry) (((DirEntry)->Attrib & 0x1f) == 0x08)
|
|
|
|
|
|
|
|
#define FAT_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FAT_DIR_ENTRY))
|
|
|
|
#define FATX_ENTRIES_PER_PAGE (PAGE_SIZE / sizeof (FATX_DIR_ENTRY))
|
|
|
|
|
|
|
|
typedef struct _FATXDirEntry FATX_DIR_ENTRY, *PFATX_DIR_ENTRY;
|
|
|
|
|
|
|
|
union _DIR_ENTRY
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
FAT_DIR_ENTRY Fat;
|
|
|
|
FATX_DIR_ENTRY FatX;
|
2005-02-24 20:47:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef union _DIR_ENTRY DIR_ENTRY, *PDIR_ENTRY;
|
|
|
|
|
1998-10-05 04:00:59 +00:00
|
|
|
#define BLOCKSIZE 512
|
1998-12-20 19:41:39 +00:00
|
|
|
|
2004-12-05 16:31:51 +00:00
|
|
|
#define FAT16 (1)
|
|
|
|
#define FAT12 (2)
|
|
|
|
#define FAT32 (3)
|
|
|
|
#define FATX16 (4)
|
|
|
|
#define FATX32 (5)
|
1998-12-30 18:43:27 +00:00
|
|
|
|
2002-03-18 22:37:13 +00:00
|
|
|
#define VCB_VOLUME_LOCKED 0x0001
|
|
|
|
#define VCB_DISMOUNT_PENDING 0x0002
|
2004-12-05 16:31:51 +00:00
|
|
|
#define VCB_IS_FATX 0x0004
|
2005-04-16 16:04:38 +00:00
|
|
|
#define VCB_IS_DIRTY 0x4000 /* Volume is dirty */
|
|
|
|
#define VCB_CLEAR_DIRTY 0x8000 /* Clean dirty flag at shutdown */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
ULONG VolumeID;
|
2017-02-06 19:43:48 +00:00
|
|
|
CHAR VolumeLabel[11];
|
2013-12-12 13:51:50 +00:00
|
|
|
ULONG FATStart;
|
|
|
|
ULONG FATCount;
|
|
|
|
ULONG FATSectors;
|
|
|
|
ULONG rootDirectorySectors;
|
|
|
|
ULONG rootStart;
|
|
|
|
ULONG dataStart;
|
|
|
|
ULONG RootCluster;
|
|
|
|
ULONG SectorsPerCluster;
|
|
|
|
ULONG BytesPerSector;
|
|
|
|
ULONG BytesPerCluster;
|
|
|
|
ULONG NumberOfClusters;
|
|
|
|
ULONG FatType;
|
|
|
|
ULONG Sectors;
|
|
|
|
BOOLEAN FixedMedia;
|
2002-08-14 20:58:39 +00:00
|
|
|
} FATINFO, *PFATINFO;
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2002-05-05 20:18:33 +00:00
|
|
|
struct _VFATFCB;
|
2004-12-05 16:31:51 +00:00
|
|
|
struct _VFAT_DIRENTRY_CONTEXT;
|
2017-02-17 22:25:03 +00:00
|
|
|
struct _VFAT_MOVE_CONTEXT;
|
2002-05-05 20:18:33 +00:00
|
|
|
|
* Used look aside lists to allocate memory for VFATFCB, VFATCCB and VFAT_IRP_CONTEXT.
* Removed IsLastEntry, IsVolEntry, IsDeletedEntry, vfat_wstrlen, vfatGrabFCB,
vfat_initstr, vfat_wcsncat, vfat_wcsncpy, vfat_movestr, wstrcmpi and replaced
this functions with existing equivalents or functions from ntoskrnl.
* Merged GetEntryName into vfatGetNextDirEntry for reducing some overhead.
* Implemented a file name cache to speed up the searching for existing fcb.
* Removed some calls to FsdDosDateTimeToFileTime.
* Moved the call to CcZeroData behind the initializing of the cache (in VfatWrite).
* Using existing fcbs in FindFile if there is no '*?' within the search name.
svn path=/trunk/; revision=3740
2002-11-11 21:49:18 +00:00
|
|
|
typedef struct _HASHENTRY
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
ULONG Hash;
|
|
|
|
struct _VFATFCB* self;
|
|
|
|
struct _HASHENTRY* next;
|
* Used look aside lists to allocate memory for VFATFCB, VFATCCB and VFAT_IRP_CONTEXT.
* Removed IsLastEntry, IsVolEntry, IsDeletedEntry, vfat_wstrlen, vfatGrabFCB,
vfat_initstr, vfat_wcsncat, vfat_wcsncpy, vfat_movestr, wstrcmpi and replaced
this functions with existing equivalents or functions from ntoskrnl.
* Merged GetEntryName into vfatGetNextDirEntry for reducing some overhead.
* Implemented a file name cache to speed up the searching for existing fcb.
* Removed some calls to FsdDosDateTimeToFileTime.
* Moved the call to CcZeroData behind the initializing of the cache (in VfatWrite).
* Using existing fcbs in FindFile if there is no '*?' within the search name.
svn path=/trunk/; revision=3740
2002-11-11 21:49:18 +00:00
|
|
|
}
|
|
|
|
HASHENTRY;
|
|
|
|
|
2004-08-01 21:57:18 +00:00
|
|
|
typedef struct DEVICE_EXTENSION *PDEVICE_EXTENSION;
|
|
|
|
|
|
|
|
typedef NTSTATUS (*PGET_NEXT_CLUSTER)(PDEVICE_EXTENSION,ULONG,PULONG);
|
|
|
|
typedef NTSTATUS (*PFIND_AND_MARK_AVAILABLE_CLUSTER)(PDEVICE_EXTENSION,PULONG);
|
|
|
|
typedef NTSTATUS (*PWRITE_CLUSTER)(PDEVICE_EXTENSION,ULONG,ULONG,PULONG);
|
|
|
|
|
2017-02-17 22:25:03 +00:00
|
|
|
typedef BOOLEAN (*PIS_DIRECTORY_EMPTY)(struct _VFATFCB*);
|
|
|
|
typedef NTSTATUS (*PADD_ENTRY)(PDEVICE_EXTENSION,PUNICODE_STRING,struct _VFATFCB**,struct _VFATFCB*,ULONG,UCHAR,struct _VFAT_MOVE_CONTEXT*);
|
|
|
|
typedef NTSTATUS (*PDEL_ENTRY)(PDEVICE_EXTENSION,struct _VFATFCB*,struct _VFAT_MOVE_CONTEXT*);
|
2004-12-05 16:31:51 +00:00
|
|
|
typedef NTSTATUS (*PGET_NEXT_DIR_ENTRY)(PVOID*,PVOID*,struct _VFATFCB*,struct _VFAT_DIRENTRY_CONTEXT*,BOOLEAN);
|
|
|
|
|
2017-02-17 22:25:03 +00:00
|
|
|
typedef struct _VFAT_DISPATCH
|
|
|
|
{
|
|
|
|
PIS_DIRECTORY_EMPTY IsDirectoryEmpty;
|
|
|
|
PADD_ENTRY AddEntry;
|
|
|
|
PDEL_ENTRY DelEntry;
|
|
|
|
PGET_NEXT_DIR_ENTRY GetNextDirEntry;
|
|
|
|
} VFAT_DISPATCH, *PVFAT_DISPATCH;
|
|
|
|
|
2017-09-24 08:56:06 +00:00
|
|
|
#define STATISTICS_SIZE_NO_PAD (sizeof(FILESYSTEM_STATISTICS) + sizeof(FAT_STATISTICS))
|
|
|
|
typedef struct _STATISTICS {
|
|
|
|
FILESYSTEM_STATISTICS Base;
|
|
|
|
FAT_STATISTICS Fat;
|
|
|
|
UCHAR Pad[((STATISTICS_SIZE_NO_PAD + 0x3f) & ~0x3f) - STATISTICS_SIZE_NO_PAD];
|
|
|
|
} STATISTICS, *PSTATISTICS;
|
|
|
|
|
2004-08-01 21:57:18 +00:00
|
|
|
typedef struct DEVICE_EXTENSION
|
1998-12-30 18:43:27 +00:00
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
ERESOURCE DirResource;
|
|
|
|
ERESOURCE FatResource;
|
|
|
|
|
|
|
|
KSPIN_LOCK FcbListLock;
|
|
|
|
LIST_ENTRY FcbListHead;
|
|
|
|
ULONG HashTableSize;
|
|
|
|
struct _HASHENTRY **FcbHashTable;
|
|
|
|
|
2014-11-10 22:11:36 +00:00
|
|
|
PDEVICE_OBJECT VolumeDevice;
|
2013-12-12 13:51:50 +00:00
|
|
|
PDEVICE_OBJECT StorageDevice;
|
|
|
|
PFILE_OBJECT FATFileObject;
|
|
|
|
FATINFO FatInfo;
|
|
|
|
ULONG LastAvailableCluster;
|
|
|
|
ULONG AvailableClusters;
|
|
|
|
BOOLEAN AvailableClustersValid;
|
|
|
|
ULONG Flags;
|
|
|
|
struct _VFATFCB *VolumeFcb;
|
2017-09-24 08:56:06 +00:00
|
|
|
PSTATISTICS Statistics;
|
2013-12-12 13:51:50 +00:00
|
|
|
|
|
|
|
/* Pointers to functions for manipulating FAT. */
|
|
|
|
PGET_NEXT_CLUSTER GetNextCluster;
|
|
|
|
PFIND_AND_MARK_AVAILABLE_CLUSTER FindAndMarkAvailableCluster;
|
|
|
|
PWRITE_CLUSTER WriteCluster;
|
|
|
|
ULONG CleanShutBitMask;
|
|
|
|
|
|
|
|
ULONG BaseDateYear;
|
|
|
|
|
|
|
|
LIST_ENTRY VolumeListEntry;
|
2014-03-07 19:38:35 +00:00
|
|
|
|
|
|
|
/* Notifications */
|
|
|
|
LIST_ENTRY NotifyList;
|
|
|
|
PNOTIFY_SYNC NotifySync;
|
2014-10-30 20:56:40 +00:00
|
|
|
|
2014-11-10 22:11:36 +00:00
|
|
|
/* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLOSE */
|
2014-10-30 20:56:40 +00:00
|
|
|
ULONG OpenHandleCount;
|
2014-11-10 17:42:51 +00:00
|
|
|
|
|
|
|
/* VPBs for dismount */
|
|
|
|
PVPB IoVPB;
|
|
|
|
PVPB SpareVPB;
|
2017-02-17 22:25:03 +00:00
|
|
|
|
|
|
|
/* Pointers to functions for manipulating directory entries. */
|
|
|
|
VFAT_DISPATCH Dispatch;
|
2004-08-01 21:57:18 +00:00
|
|
|
} DEVICE_EXTENSION, VCB, *PVCB;
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2017-02-17 22:25:03 +00:00
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
|
|
|
VfatIsDirectoryEmpty(PDEVICE_EXTENSION DeviceExt,
|
|
|
|
struct _VFATFCB* Fcb)
|
|
|
|
{
|
|
|
|
return DeviceExt->Dispatch.IsDirectoryEmpty(Fcb);
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
NTSTATUS
|
|
|
|
VfatAddEntry(PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PUNICODE_STRING NameU,
|
|
|
|
struct _VFATFCB** Fcb,
|
|
|
|
struct _VFATFCB* ParentFcb,
|
|
|
|
ULONG RequestedOptions,
|
|
|
|
UCHAR ReqAttr,
|
|
|
|
struct _VFAT_MOVE_CONTEXT* MoveContext)
|
|
|
|
{
|
|
|
|
return DeviceExt->Dispatch.AddEntry(DeviceExt, NameU, Fcb, ParentFcb, RequestedOptions, ReqAttr, MoveContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
NTSTATUS
|
|
|
|
VfatDelEntry(PDEVICE_EXTENSION DeviceExt,
|
|
|
|
struct _VFATFCB* Fcb,
|
|
|
|
struct _VFAT_MOVE_CONTEXT* MoveContext)
|
|
|
|
{
|
|
|
|
return DeviceExt->Dispatch.DelEntry(DeviceExt, Fcb, MoveContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
NTSTATUS
|
|
|
|
VfatGetNextDirEntry(PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PVOID *pContext,
|
|
|
|
PVOID *pPage,
|
|
|
|
struct _VFATFCB* pDirFcb,
|
|
|
|
struct _VFAT_DIRENTRY_CONTEXT* DirContext,
|
|
|
|
BOOLEAN First)
|
|
|
|
{
|
|
|
|
return DeviceExt->Dispatch.GetNextDirEntry(pContext, pPage, pDirFcb, DirContext, First);
|
|
|
|
}
|
|
|
|
|
2015-11-01 08:55:47 +00:00
|
|
|
#define VFAT_BREAK_ON_CORRUPTION 1
|
|
|
|
|
2002-03-18 22:37:13 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
PDRIVER_OBJECT DriverObject;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
ULONG Flags;
|
2017-09-24 08:56:06 +00:00
|
|
|
ULONG NumberProcessors;
|
2013-12-12 13:51:50 +00:00
|
|
|
ERESOURCE VolumeListLock;
|
|
|
|
LIST_ENTRY VolumeListHead;
|
|
|
|
NPAGED_LOOKASIDE_LIST FcbLookasideList;
|
|
|
|
NPAGED_LOOKASIDE_LIST CcbLookasideList;
|
|
|
|
NPAGED_LOOKASIDE_LIST IrpContextLookasideList;
|
|
|
|
FAST_IO_DISPATCH FastIoDispatch;
|
|
|
|
CACHE_MANAGER_CALLBACKS CacheMgrCallbacks;
|
2002-08-14 20:58:39 +00:00
|
|
|
} VFAT_GLOBAL_DATA, *PVFAT_GLOBAL_DATA;
|
2002-03-18 22:37:13 +00:00
|
|
|
|
|
|
|
extern PVFAT_GLOBAL_DATA VfatGlobalData;
|
1998-12-30 18:43:27 +00:00
|
|
|
|
2001-08-14 20:47:30 +00:00
|
|
|
#define FCB_CACHE_INITIALIZED 0x0001
|
|
|
|
#define FCB_DELETE_PENDING 0x0002
|
2001-10-10 22:20:48 +00:00
|
|
|
#define FCB_IS_FAT 0x0004
|
2001-11-02 22:57:14 +00:00
|
|
|
#define FCB_IS_PAGE_FILE 0x0008
|
2002-05-05 20:18:33 +00:00
|
|
|
#define FCB_IS_VOLUME 0x0010
|
2004-12-05 16:31:51 +00:00
|
|
|
#define FCB_IS_DIRTY 0x0020
|
2001-08-14 20:47:30 +00:00
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
typedef struct _VFATFCB
|
1998-12-30 18:43:27 +00:00
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
/* FCB header required by ROS/NT */
|
|
|
|
FSRTL_COMMON_FCB_HEADER RFCB;
|
|
|
|
SECTION_OBJECT_POINTERS SectionObjectPointers;
|
|
|
|
ERESOURCE MainResource;
|
|
|
|
ERESOURCE PagingIoResource;
|
|
|
|
/* end FCB header required by ROS/NT */
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* directory entry for this file or directory */
|
|
|
|
DIR_ENTRY entry;
|
2005-05-08 02:16:32 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Pointer to attributes in entry */
|
|
|
|
PUCHAR Attributes;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* long file name, points into PathNameBuffer */
|
|
|
|
UNICODE_STRING LongNameU;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* short file name */
|
|
|
|
UNICODE_STRING ShortNameU;
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* directory name, points into PathNameBuffer */
|
|
|
|
UNICODE_STRING DirNameU;
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* path + long file name 260 max*/
|
|
|
|
UNICODE_STRING PathNameU;
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* buffer for PathNameU */
|
|
|
|
PWCHAR PathNameBuffer;
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* buffer for ShortNameU */
|
|
|
|
WCHAR ShortNameBuffer[13];
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* */
|
|
|
|
LONG RefCount;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* List of FCB's for this volume */
|
|
|
|
LIST_ENTRY FcbListEntry;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2016-08-06 08:32:17 +00:00
|
|
|
/* List of FCB's for the parent */
|
|
|
|
LIST_ENTRY ParentListEntry;
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* pointer to the parent fcb */
|
|
|
|
struct _VFATFCB *parentFcb;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2016-08-06 08:32:17 +00:00
|
|
|
/* List for the children */
|
|
|
|
LIST_ENTRY ParentListHead;
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Flags for the fcb */
|
|
|
|
ULONG Flags;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* pointer to the file object which has initialized the fcb */
|
|
|
|
PFILE_OBJECT FileObject;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Directory index for the short name entry */
|
|
|
|
ULONG dirIndex;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Directory index where the long name starts */
|
|
|
|
ULONG startIndex;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Share access for the file object */
|
|
|
|
SHARE_ACCESS FCBShareAccess;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Incremented on IRP_MJ_CREATE, decremented on IRP_MJ_CLEANUP */
|
|
|
|
ULONG OpenHandleCount;
|
2004-08-28 22:19:12 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Entry into the hash table for the path + long name */
|
|
|
|
HASHENTRY Hash;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* Entry into the hash table for the path + short name */
|
|
|
|
HASHENTRY ShortHash;
|
2003-02-13 22:24:19 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* List of byte-range locks for this file */
|
|
|
|
FILE_LOCK FileLock;
|
2002-01-08 00:49:02 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/*
|
2016-11-13 15:31:39 +00:00
|
|
|
* Optimization: caching of last read/write cluster+offset pair. Can't
|
2013-12-12 13:51:50 +00:00
|
|
|
* be in VFATCCB because it must be reset everytime the allocated clusters
|
|
|
|
* change.
|
|
|
|
*/
|
|
|
|
FAST_MUTEX LastMutex;
|
|
|
|
ULONG LastCluster;
|
|
|
|
ULONG LastOffset;
|
2002-08-14 20:58:39 +00:00
|
|
|
} VFATFCB, *PVFATFCB;
|
1999-01-04 11:59:25 +00:00
|
|
|
|
2017-05-02 19:33:14 +00:00
|
|
|
#define CCB_DELETE_ON_CLOSE 0x0001
|
|
|
|
|
1999-12-11 21:14:49 +00:00
|
|
|
typedef struct _VFATCCB
|
1999-01-04 11:59:25 +00:00
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
LARGE_INTEGER CurrentByteOffset;
|
2017-05-02 19:33:14 +00:00
|
|
|
ULONG Flags;
|
2013-12-12 13:51:50 +00:00
|
|
|
/* for DirectoryControl */
|
|
|
|
ULONG Entry;
|
|
|
|
/* for DirectoryControl */
|
|
|
|
UNICODE_STRING SearchPattern;
|
2002-08-14 20:58:39 +00:00
|
|
|
} VFATCCB, *PVFATCCB;
|
1998-12-30 18:43:27 +00:00
|
|
|
|
2009-08-24 17:12:25 +00:00
|
|
|
#define TAG_CCB 'BCCV'
|
|
|
|
#define TAG_FCB 'BCFV'
|
|
|
|
#define TAG_IRP 'PRIV'
|
|
|
|
#define TAG_VFAT 'TAFV'
|
1998-12-30 18:43:27 +00:00
|
|
|
|
|
|
|
#define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))
|
|
|
|
|
1999-05-15 17:25:02 +00:00
|
|
|
typedef struct __DOSTIME
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
USHORT Second:5;
|
|
|
|
USHORT Minute:6;
|
|
|
|
USHORT Hour:5;
|
2002-03-18 22:37:13 +00:00
|
|
|
}
|
|
|
|
DOSTIME, *PDOSTIME;
|
1999-05-15 17:25:02 +00:00
|
|
|
|
|
|
|
typedef struct __DOSDATE
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
USHORT Day:5;
|
|
|
|
USHORT Month:4;
|
|
|
|
USHORT Year:7;
|
2002-03-18 22:37:13 +00:00
|
|
|
}
|
|
|
|
DOSDATE, *PDOSDATE;
|
1999-05-15 17:25:02 +00:00
|
|
|
|
2015-05-15 16:03:29 +00:00
|
|
|
#define IRPCONTEXT_CANWAIT 0x0001
|
|
|
|
#define IRPCONTEXT_COMPLETE 0x0002
|
|
|
|
#define IRPCONTEXT_QUEUE 0x0004
|
|
|
|
#define IRPCONTEXT_PENDINGRETURNED 0x0008
|
2001-11-02 22:57:14 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
PIRP Irp;
|
|
|
|
PDEVICE_OBJECT DeviceObject;
|
|
|
|
PDEVICE_EXTENSION DeviceExt;
|
|
|
|
ULONG Flags;
|
|
|
|
WORK_QUEUE_ITEM WorkQueueItem;
|
|
|
|
PIO_STACK_LOCATION Stack;
|
|
|
|
UCHAR MajorFunction;
|
|
|
|
UCHAR MinorFunction;
|
|
|
|
PFILE_OBJECT FileObject;
|
|
|
|
ULONG RefCount;
|
|
|
|
KEVENT Event;
|
2015-05-15 16:03:29 +00:00
|
|
|
CCHAR PriorityBoost;
|
2002-08-14 20:58:39 +00:00
|
|
|
} VFAT_IRP_CONTEXT, *PVFAT_IRP_CONTEXT;
|
2001-11-02 22:57:14 +00:00
|
|
|
|
2003-10-11 17:51:56 +00:00
|
|
|
typedef struct _VFAT_DIRENTRY_CONTEXT
|
|
|
|
{
|
2013-12-12 13:51:50 +00:00
|
|
|
ULONG StartIndex;
|
|
|
|
ULONG DirIndex;
|
|
|
|
DIR_ENTRY DirEntry;
|
|
|
|
UNICODE_STRING LongNameU;
|
|
|
|
UNICODE_STRING ShortNameU;
|
2003-10-11 17:51:56 +00:00
|
|
|
} VFAT_DIRENTRY_CONTEXT, *PVFAT_DIRENTRY_CONTEXT;
|
|
|
|
|
[FASTFAT]
- Implement vfatPrepareTargetForRename() that prepares for renaming. It tries to open target and deletes it if it exists and if allowed. And then, it opens the parent directory.
- Implement VfatSetRenameInformation() that actually does the renaming (call as SetInformationFile). It handles cases we we have (or we don't have) TargetDirectory provided. It sends notifications as appropriated on demands.
- Implement vfatRenameEntry() that renames an entry in place. So far, it only supports FATX entries renaming. FAT entries are a bit more complex. It falls back to vfatMoveEntry() in later cases.
- Implement VfatMoveEntry() that will move an entry accross directories (or in place for FAT). Its principles are simple: it deletes the entry in old parent, and recreate it in new parent, keeping file metadata & data.
- Modify VfatDelEntry() and VfatAddEntry() so that they can handle deleting an entry without touching its data and adding an entry with an already provided FCB and thus use the given metadata.
- Implement vfatDelFCBFromTable() which is just old code moved to new routine to allow reuse. It deletes a FCB entry from hash table. Doesn't deal with references!
- Implement vfatMakeFullName() which is mostly old code moved to new routine to allow reuse. It allocates buffer and copy data for FCB full name.
- Implement vfatUpdateFCB() that will update a FCB with new names and parent. It will remove anything related to old name and will recreate using new data. It will adjust references count.
- Modify vfatMakeFCBFromDirEntry() so that it calls vfatMakeFullName().
- Modify vfatReleaseFCB() so that it calls vfatDelFCBFromTable().
- Revert VfatOpenFile() to its previous features.
- Modify VfatCreateFile() to reimplement support for SL_OPEN_TARGET_DIRECTORY. It is way less hackish than previously. It also properly opens parent now, by incrementing its handle count and by setting appropriate access rights.
[KERNEL32]
- Rewritten MoveFileWithProgressW() to implement all the missing features that are used in Windows 2k3 including links and reparse points.
- Implemented BasepMoveFileDelayed() to replace deprecated add_boot_rename_entry(). This functions is matching the features implemented in SMSS.
- Implemented BasepMoveFileCopyProgress() which is used in MoveFileWithProgressW().
- Stubbed BasepNotifyTrackingService() which is not use at the moment (FastFAT, even in Windows doesn't provide such feature).
- Reimplemented ReplaceFileA(), MoveFileWithProgressA() to quit Winisms and use our internal helpers.
- Make MoveFileX() use MoveFileWithProgressX() directly.
- Fixed a few prototypes.
TL;DR:
This (huge) commit implements file and directory renaming in FastFAT driver. This allows getting rid of old implementation in kernel32 where files were force copied.
A feature is still missing, but Jérôme should implement it anytime soon (he prototyped it already): moving directories across volumes. This requires some work in BasepCopyFileExW().
Kudos to all the devs who helped me on this: Christoph, Hervé, Jérôme, Thomas.
This finally allows killing CR-52... It was about time!
svn path=/trunk/; revision=64836
2014-10-19 21:38:32 +00:00
|
|
|
typedef struct _VFAT_MOVE_CONTEXT
|
|
|
|
{
|
|
|
|
ULONG FirstCluster;
|
|
|
|
ULONG FileSize;
|
|
|
|
USHORT CreationDate;
|
|
|
|
USHORT CreationTime;
|
2016-05-06 21:06:31 +00:00
|
|
|
BOOLEAN InPlace;
|
[FASTFAT]
- Implement vfatPrepareTargetForRename() that prepares for renaming. It tries to open target and deletes it if it exists and if allowed. And then, it opens the parent directory.
- Implement VfatSetRenameInformation() that actually does the renaming (call as SetInformationFile). It handles cases we we have (or we don't have) TargetDirectory provided. It sends notifications as appropriated on demands.
- Implement vfatRenameEntry() that renames an entry in place. So far, it only supports FATX entries renaming. FAT entries are a bit more complex. It falls back to vfatMoveEntry() in later cases.
- Implement VfatMoveEntry() that will move an entry accross directories (or in place for FAT). Its principles are simple: it deletes the entry in old parent, and recreate it in new parent, keeping file metadata & data.
- Modify VfatDelEntry() and VfatAddEntry() so that they can handle deleting an entry without touching its data and adding an entry with an already provided FCB and thus use the given metadata.
- Implement vfatDelFCBFromTable() which is just old code moved to new routine to allow reuse. It deletes a FCB entry from hash table. Doesn't deal with references!
- Implement vfatMakeFullName() which is mostly old code moved to new routine to allow reuse. It allocates buffer and copy data for FCB full name.
- Implement vfatUpdateFCB() that will update a FCB with new names and parent. It will remove anything related to old name and will recreate using new data. It will adjust references count.
- Modify vfatMakeFCBFromDirEntry() so that it calls vfatMakeFullName().
- Modify vfatReleaseFCB() so that it calls vfatDelFCBFromTable().
- Revert VfatOpenFile() to its previous features.
- Modify VfatCreateFile() to reimplement support for SL_OPEN_TARGET_DIRECTORY. It is way less hackish than previously. It also properly opens parent now, by incrementing its handle count and by setting appropriate access rights.
[KERNEL32]
- Rewritten MoveFileWithProgressW() to implement all the missing features that are used in Windows 2k3 including links and reparse points.
- Implemented BasepMoveFileDelayed() to replace deprecated add_boot_rename_entry(). This functions is matching the features implemented in SMSS.
- Implemented BasepMoveFileCopyProgress() which is used in MoveFileWithProgressW().
- Stubbed BasepNotifyTrackingService() which is not use at the moment (FastFAT, even in Windows doesn't provide such feature).
- Reimplemented ReplaceFileA(), MoveFileWithProgressA() to quit Winisms and use our internal helpers.
- Make MoveFileX() use MoveFileWithProgressX() directly.
- Fixed a few prototypes.
TL;DR:
This (huge) commit implements file and directory renaming in FastFAT driver. This allows getting rid of old implementation in kernel32 where files were force copied.
A feature is still missing, but Jérôme should implement it anytime soon (he prototyped it already): moving directories across volumes. This requires some work in BasepCopyFileExW().
Kudos to all the devs who helped me on this: Christoph, Hervé, Jérôme, Thomas.
This finally allows killing CR-52... It was about time!
svn path=/trunk/; revision=64836
2014-10-19 21:38:32 +00:00
|
|
|
} VFAT_MOVE_CONTEXT, *PVFAT_MOVE_CONTEXT;
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2015-05-15 16:03:29 +00:00
|
|
|
FORCEINLINE
|
|
|
|
NTSTATUS
|
|
|
|
VfatMarkIrpContextForQueue(PVFAT_IRP_CONTEXT IrpContext)
|
|
|
|
{
|
|
|
|
PULONG Flags = &IrpContext->Flags;
|
|
|
|
|
|
|
|
*Flags &= ~IRPCONTEXT_COMPLETE;
|
|
|
|
*Flags |= IRPCONTEXT_QUEUE;
|
|
|
|
|
|
|
|
return STATUS_PENDING;
|
|
|
|
}
|
|
|
|
|
2017-02-17 17:58:18 +00:00
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
|
|
|
vfatFCBIsDirectory(PVFATFCB FCB)
|
|
|
|
{
|
|
|
|
return BooleanFlagOn(*FCB->Attributes, FILE_ATTRIBUTE_DIRECTORY);
|
|
|
|
}
|
|
|
|
|
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
|
|
|
vfatFCBIsReadOnly(PVFATFCB FCB)
|
|
|
|
{
|
|
|
|
return BooleanFlagOn(*FCB->Attributes, FILE_ATTRIBUTE_READONLY);
|
|
|
|
}
|
|
|
|
|
2017-02-17 21:24:12 +00:00
|
|
|
FORCEINLINE
|
|
|
|
BOOLEAN
|
|
|
|
vfatVolumeIsFatX(PDEVICE_EXTENSION DeviceExt)
|
|
|
|
{
|
|
|
|
return BooleanFlagOn(DeviceExt->Flags, VCB_IS_FATX);
|
|
|
|
}
|
|
|
|
|
2017-09-24 09:50:36 +00:00
|
|
|
#define vfatAddToStat(Vcb, Stat, Inc) \
|
|
|
|
{ \
|
|
|
|
PSTATISTICS Stats = &(Vcb)->Statistics[KeGetCurrentProcessorNumber() % VfatGlobalData->NumberProcessors]; \
|
|
|
|
Stats->Stat += Inc; \
|
|
|
|
}
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* blockdev.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatReadDisk(
|
|
|
|
IN PDEVICE_OBJECT pDeviceObject,
|
|
|
|
IN PLARGE_INTEGER ReadOffset,
|
|
|
|
IN ULONG ReadLength,
|
|
|
|
IN PUCHAR Buffer,
|
|
|
|
IN BOOLEAN Override);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatReadDiskPartial(
|
|
|
|
IN PVFAT_IRP_CONTEXT IrpContext,
|
|
|
|
IN PLARGE_INTEGER ReadOffset,
|
|
|
|
IN ULONG ReadLength,
|
|
|
|
IN ULONG BufferOffset,
|
|
|
|
IN BOOLEAN Wait);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatWriteDiskPartial(
|
|
|
|
IN PVFAT_IRP_CONTEXT IrpContext,
|
|
|
|
IN PLARGE_INTEGER WriteOffset,
|
|
|
|
IN ULONG WriteLength,
|
|
|
|
IN ULONG BufferOffset,
|
|
|
|
IN BOOLEAN Wait);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
VfatBlockDeviceIoControl(
|
|
|
|
IN PDEVICE_OBJECT DeviceObject,
|
|
|
|
IN ULONG CtlCode,
|
|
|
|
IN PVOID InputBuffer,
|
|
|
|
IN ULONG InputBufferSize,
|
|
|
|
IN OUT PVOID OutputBuffer,
|
|
|
|
IN OUT PULONG pOutputBufferSize,
|
|
|
|
IN BOOLEAN Override);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* cleanup.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatCleanup(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* close.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatClose(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2004-05-15 23:00:02 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatCloseFile(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PFILE_OBJECT FileObject);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* create.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatCreate(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2001-11-02 22:57:14 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FindFile(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PVFATFCB Parent,
|
|
|
|
PUNICODE_STRING FileToFindU,
|
|
|
|
PVFAT_DIRENTRY_CONTEXT DirContext,
|
|
|
|
BOOLEAN First);
|
1999-12-11 21:14:49 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfat8Dot3ToString(
|
|
|
|
PFAT_DIR_ENTRY pEntry,
|
|
|
|
PUNICODE_STRING NameU);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* dir.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatDirectoryControl(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
FsdDosDateTimeToSystemTime(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
USHORT DosDate,
|
|
|
|
USHORT DosTime,
|
|
|
|
PLARGE_INTEGER SystemTime);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
FsdSystemTimeToDosDateTime(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PLARGE_INTEGER SystemTime,
|
|
|
|
USHORT *pDosDate,
|
|
|
|
USHORT *pDosTime);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* direntry.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
ULONG
|
|
|
|
vfatDirEntryGetFirstCluster(
|
|
|
|
PDEVICE_EXTENSION pDeviceExt,
|
|
|
|
PDIR_ENTRY pDirEntry);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* dirwr.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatUpdateEntry(
|
2017-02-17 21:24:12 +00:00
|
|
|
PVFATFCB pFcb,
|
|
|
|
IN BOOLEAN IsFatX);
|
2013-12-12 13:51:50 +00:00
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
vfatFindDirSpace(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PVFATFCB pDirFcb,
|
|
|
|
ULONG nbSlots,
|
|
|
|
PULONG start);
|
2005-01-12 13:00:43 +00:00
|
|
|
|
[FASTFAT]
- Implement vfatPrepareTargetForRename() that prepares for renaming. It tries to open target and deletes it if it exists and if allowed. And then, it opens the parent directory.
- Implement VfatSetRenameInformation() that actually does the renaming (call as SetInformationFile). It handles cases we we have (or we don't have) TargetDirectory provided. It sends notifications as appropriated on demands.
- Implement vfatRenameEntry() that renames an entry in place. So far, it only supports FATX entries renaming. FAT entries are a bit more complex. It falls back to vfatMoveEntry() in later cases.
- Implement VfatMoveEntry() that will move an entry accross directories (or in place for FAT). Its principles are simple: it deletes the entry in old parent, and recreate it in new parent, keeping file metadata & data.
- Modify VfatDelEntry() and VfatAddEntry() so that they can handle deleting an entry without touching its data and adding an entry with an already provided FCB and thus use the given metadata.
- Implement vfatDelFCBFromTable() which is just old code moved to new routine to allow reuse. It deletes a FCB entry from hash table. Doesn't deal with references!
- Implement vfatMakeFullName() which is mostly old code moved to new routine to allow reuse. It allocates buffer and copy data for FCB full name.
- Implement vfatUpdateFCB() that will update a FCB with new names and parent. It will remove anything related to old name and will recreate using new data. It will adjust references count.
- Modify vfatMakeFCBFromDirEntry() so that it calls vfatMakeFullName().
- Modify vfatReleaseFCB() so that it calls vfatDelFCBFromTable().
- Revert VfatOpenFile() to its previous features.
- Modify VfatCreateFile() to reimplement support for SL_OPEN_TARGET_DIRECTORY. It is way less hackish than previously. It also properly opens parent now, by incrementing its handle count and by setting appropriate access rights.
[KERNEL32]
- Rewritten MoveFileWithProgressW() to implement all the missing features that are used in Windows 2k3 including links and reparse points.
- Implemented BasepMoveFileDelayed() to replace deprecated add_boot_rename_entry(). This functions is matching the features implemented in SMSS.
- Implemented BasepMoveFileCopyProgress() which is used in MoveFileWithProgressW().
- Stubbed BasepNotifyTrackingService() which is not use at the moment (FastFAT, even in Windows doesn't provide such feature).
- Reimplemented ReplaceFileA(), MoveFileWithProgressA() to quit Winisms and use our internal helpers.
- Make MoveFileX() use MoveFileWithProgressX() directly.
- Fixed a few prototypes.
TL;DR:
This (huge) commit implements file and directory renaming in FastFAT driver. This allows getting rid of old implementation in kernel32 where files were force copied.
A feature is still missing, but Jérôme should implement it anytime soon (he prototyped it already): moving directories across volumes. This requires some work in BasepCopyFileExW().
Kudos to all the devs who helped me on this: Christoph, Hervé, Jérôme, Thomas.
This finally allows killing CR-52... It was about time!
svn path=/trunk/; revision=64836
2014-10-19 21:38:32 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatRenameEntry(
|
|
|
|
IN PDEVICE_EXTENSION DeviceExt,
|
|
|
|
IN PVFATFCB pFcb,
|
|
|
|
IN PUNICODE_STRING FileName,
|
|
|
|
IN BOOLEAN CaseChangeOnly);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
VfatMoveEntry(
|
|
|
|
IN PDEVICE_EXTENSION DeviceExt,
|
|
|
|
IN PVFATFCB pFcb,
|
|
|
|
IN PUNICODE_STRING FileName,
|
|
|
|
IN PVFATFCB ParentFcb);
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* ea.h */
|
2005-01-12 13:00:43 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatSetExtendedAttributes(
|
|
|
|
PFILE_OBJECT FileObject,
|
|
|
|
PVOID Ea,
|
|
|
|
ULONG EaLength);
|
2005-01-12 13:00:43 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* fastio.c */
|
2005-01-12 13:00:43 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
VfatInitFastIoRoutines(
|
|
|
|
PFAST_IO_DISPATCH FastIoDispatch);
|
2005-01-12 13:00:43 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
VfatAcquireForLazyWrite(
|
|
|
|
IN PVOID Context,
|
|
|
|
IN BOOLEAN Wait);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
VfatReleaseFromLazyWrite(
|
|
|
|
IN PVOID Context);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
NTAPI
|
|
|
|
VfatAcquireForReadAhead(
|
|
|
|
IN PVOID Context,
|
|
|
|
IN BOOLEAN Wait);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
NTAPI
|
|
|
|
VfatReleaseFromReadAhead(
|
|
|
|
IN PVOID Context);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* fat.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2002-08-14 20:58:39 +00:00
|
|
|
NTSTATUS
|
2013-12-12 13:51:50 +00:00
|
|
|
FAT12GetNextCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG CurrentCluster,
|
|
|
|
PULONG NextCluster);
|
2002-08-14 20:58:39 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT12FindAndMarkAvailableCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PULONG Cluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT12WriteCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG ClusterToWrite,
|
|
|
|
ULONG NewValue,
|
|
|
|
PULONG OldValue);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT16GetNextCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG CurrentCluster,
|
|
|
|
PULONG NextCluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT16FindAndMarkAvailableCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PULONG Cluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT16WriteCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG ClusterToWrite,
|
|
|
|
ULONG NewValue,
|
|
|
|
PULONG OldValue);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT32GetNextCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG CurrentCluster,
|
|
|
|
PULONG NextCluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT32FindAndMarkAvailableCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PULONG Cluster);
|
2004-12-05 16:31:51 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
FAT32WriteCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG ClusterToWrite,
|
|
|
|
ULONG NewValue,
|
|
|
|
PULONG OldValue);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
OffsetToCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG FirstCluster,
|
|
|
|
ULONG FileOffset,
|
|
|
|
PULONG Cluster,
|
|
|
|
BOOLEAN Extend);
|
|
|
|
|
|
|
|
ULONGLONG
|
|
|
|
ClusterToSector(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG Cluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
GetNextCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG CurrentCluster,
|
|
|
|
PULONG NextCluster);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
GetNextClusterExtend(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG CurrentCluster,
|
|
|
|
PULONG NextCluster);
|
1999-12-11 21:14:49 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
CountAvailableClusters(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PLARGE_INTEGER Clusters);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
WriteCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG ClusterToWrite,
|
|
|
|
ULONG NewValue);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* fcb.c */
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
PVFATFCB
|
|
|
|
vfatNewFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PUNICODE_STRING pFileNameU);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2016-08-07 12:29:48 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatSetFCBNewDirName(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB Fcb,
|
|
|
|
PVFATFCB ParentFcb);
|
|
|
|
|
[FASTFAT]
- Implement vfatPrepareTargetForRename() that prepares for renaming. It tries to open target and deletes it if it exists and if allowed. And then, it opens the parent directory.
- Implement VfatSetRenameInformation() that actually does the renaming (call as SetInformationFile). It handles cases we we have (or we don't have) TargetDirectory provided. It sends notifications as appropriated on demands.
- Implement vfatRenameEntry() that renames an entry in place. So far, it only supports FATX entries renaming. FAT entries are a bit more complex. It falls back to vfatMoveEntry() in later cases.
- Implement VfatMoveEntry() that will move an entry accross directories (or in place for FAT). Its principles are simple: it deletes the entry in old parent, and recreate it in new parent, keeping file metadata & data.
- Modify VfatDelEntry() and VfatAddEntry() so that they can handle deleting an entry without touching its data and adding an entry with an already provided FCB and thus use the given metadata.
- Implement vfatDelFCBFromTable() which is just old code moved to new routine to allow reuse. It deletes a FCB entry from hash table. Doesn't deal with references!
- Implement vfatMakeFullName() which is mostly old code moved to new routine to allow reuse. It allocates buffer and copy data for FCB full name.
- Implement vfatUpdateFCB() that will update a FCB with new names and parent. It will remove anything related to old name and will recreate using new data. It will adjust references count.
- Modify vfatMakeFCBFromDirEntry() so that it calls vfatMakeFullName().
- Modify vfatReleaseFCB() so that it calls vfatDelFCBFromTable().
- Revert VfatOpenFile() to its previous features.
- Modify VfatCreateFile() to reimplement support for SL_OPEN_TARGET_DIRECTORY. It is way less hackish than previously. It also properly opens parent now, by incrementing its handle count and by setting appropriate access rights.
[KERNEL32]
- Rewritten MoveFileWithProgressW() to implement all the missing features that are used in Windows 2k3 including links and reparse points.
- Implemented BasepMoveFileDelayed() to replace deprecated add_boot_rename_entry(). This functions is matching the features implemented in SMSS.
- Implemented BasepMoveFileCopyProgress() which is used in MoveFileWithProgressW().
- Stubbed BasepNotifyTrackingService() which is not use at the moment (FastFAT, even in Windows doesn't provide such feature).
- Reimplemented ReplaceFileA(), MoveFileWithProgressA() to quit Winisms and use our internal helpers.
- Make MoveFileX() use MoveFileWithProgressX() directly.
- Fixed a few prototypes.
TL;DR:
This (huge) commit implements file and directory renaming in FastFAT driver. This allows getting rid of old implementation in kernel32 where files were force copied.
A feature is still missing, but Jérôme should implement it anytime soon (he prototyped it already): moving directories across volumes. This requires some work in BasepCopyFileExW().
Kudos to all the devs who helped me on this: Christoph, Hervé, Jérôme, Thomas.
This finally allows killing CR-52... It was about time!
svn path=/trunk/; revision=64836
2014-10-19 21:38:32 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatUpdateFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB Fcb,
|
2016-04-30 08:20:00 +00:00
|
|
|
PVFAT_DIRENTRY_CONTEXT DirContext,
|
[FASTFAT]
- Implement vfatPrepareTargetForRename() that prepares for renaming. It tries to open target and deletes it if it exists and if allowed. And then, it opens the parent directory.
- Implement VfatSetRenameInformation() that actually does the renaming (call as SetInformationFile). It handles cases we we have (or we don't have) TargetDirectory provided. It sends notifications as appropriated on demands.
- Implement vfatRenameEntry() that renames an entry in place. So far, it only supports FATX entries renaming. FAT entries are a bit more complex. It falls back to vfatMoveEntry() in later cases.
- Implement VfatMoveEntry() that will move an entry accross directories (or in place for FAT). Its principles are simple: it deletes the entry in old parent, and recreate it in new parent, keeping file metadata & data.
- Modify VfatDelEntry() and VfatAddEntry() so that they can handle deleting an entry without touching its data and adding an entry with an already provided FCB and thus use the given metadata.
- Implement vfatDelFCBFromTable() which is just old code moved to new routine to allow reuse. It deletes a FCB entry from hash table. Doesn't deal with references!
- Implement vfatMakeFullName() which is mostly old code moved to new routine to allow reuse. It allocates buffer and copy data for FCB full name.
- Implement vfatUpdateFCB() that will update a FCB with new names and parent. It will remove anything related to old name and will recreate using new data. It will adjust references count.
- Modify vfatMakeFCBFromDirEntry() so that it calls vfatMakeFullName().
- Modify vfatReleaseFCB() so that it calls vfatDelFCBFromTable().
- Revert VfatOpenFile() to its previous features.
- Modify VfatCreateFile() to reimplement support for SL_OPEN_TARGET_DIRECTORY. It is way less hackish than previously. It also properly opens parent now, by incrementing its handle count and by setting appropriate access rights.
[KERNEL32]
- Rewritten MoveFileWithProgressW() to implement all the missing features that are used in Windows 2k3 including links and reparse points.
- Implemented BasepMoveFileDelayed() to replace deprecated add_boot_rename_entry(). This functions is matching the features implemented in SMSS.
- Implemented BasepMoveFileCopyProgress() which is used in MoveFileWithProgressW().
- Stubbed BasepNotifyTrackingService() which is not use at the moment (FastFAT, even in Windows doesn't provide such feature).
- Reimplemented ReplaceFileA(), MoveFileWithProgressA() to quit Winisms and use our internal helpers.
- Make MoveFileX() use MoveFileWithProgressX() directly.
- Fixed a few prototypes.
TL;DR:
This (huge) commit implements file and directory renaming in FastFAT driver. This allows getting rid of old implementation in kernel32 where files were force copied.
A feature is still missing, but Jérôme should implement it anytime soon (he prototyped it already): moving directories across volumes. This requires some work in BasepCopyFileExW().
Kudos to all the devs who helped me on this: Christoph, Hervé, Jérôme, Thomas.
This finally allows killing CR-52... It was about time!
svn path=/trunk/; revision=64836
2014-10-19 21:38:32 +00:00
|
|
|
PVFATFCB ParentFcb);
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfatDestroyFCB(
|
|
|
|
PVFATFCB pFCB);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfatDestroyCCB(
|
|
|
|
PVFATCCB pCcb);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfatGrabFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB pFCB);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfatReleaseFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB pFCB);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
PVFATFCB
|
|
|
|
vfatGrabFCBFromTable(
|
|
|
|
PDEVICE_EXTENSION pDeviceExt,
|
|
|
|
PUNICODE_STRING pFileNameU);
|
2004-08-01 21:57:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
PVFATFCB
|
|
|
|
vfatMakeRootFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
PVFATFCB
|
|
|
|
vfatOpenRootFCB(
|
|
|
|
PDEVICE_EXTENSION pVCB);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
vfatFCBIsDirectory(
|
|
|
|
PVFATFCB FCB);
|
2004-08-05 02:48:18 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
vfatFCBIsRoot(
|
|
|
|
PVFATFCB FCB);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatAttachFCBToFileObject(
|
|
|
|
PDEVICE_EXTENSION vcb,
|
|
|
|
PVFATFCB fcb,
|
|
|
|
PFILE_OBJECT fileObject);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2003-07-24 19:00:42 +00:00
|
|
|
NTSTATUS
|
2013-12-12 13:51:50 +00:00
|
|
|
vfatDirFindFile(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB parentFCB,
|
|
|
|
PUNICODE_STRING FileToFindU,
|
|
|
|
PVFATFCB *fileFCB);
|
2003-07-24 19:00:42 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatGetFCBForFile(
|
|
|
|
PDEVICE_EXTENSION pVCB,
|
|
|
|
PVFATFCB *pParentFCB,
|
|
|
|
PVFATFCB *pFCB,
|
|
|
|
PUNICODE_STRING pFileNameU);
|
2001-07-05 01:51:53 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
vfatMakeFCBFromDirEntry(
|
|
|
|
PVCB vcb,
|
|
|
|
PVFATFCB directoryFCB,
|
|
|
|
PVFAT_DIRENTRY_CONTEXT DirContext,
|
|
|
|
PVFATFCB *fileFCB);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* finfo.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2015-05-18 19:51:14 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatGetStandardInformation(
|
|
|
|
PVFATFCB FCB,
|
|
|
|
PFILE_STANDARD_INFORMATION StandardInfo,
|
|
|
|
PULONG BufferLength);
|
|
|
|
|
|
|
|
NTSTATUS
|
|
|
|
VfatGetBasicInformation(
|
|
|
|
PFILE_OBJECT FileObject,
|
|
|
|
PVFATFCB FCB,
|
2017-06-26 18:10:43 +00:00
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
2015-05-18 19:51:14 +00:00
|
|
|
PFILE_BASIC_INFORMATION BasicInfo,
|
|
|
|
PULONG BufferLength);
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatQueryInformation(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2004-12-05 16:31:51 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatSetInformation(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2001-07-05 01:51:53 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatSetAllocationSizeInformation(
|
|
|
|
PFILE_OBJECT FileObject,
|
|
|
|
PVFATFCB Fcb,
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PLARGE_INTEGER AllocationSize);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* flush.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatFlush(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatFlushVolume(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
PVFATFCB VolumeFcb);
|
2003-07-24 19:00:42 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* fsctl.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatFileSystemControl(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* iface.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
DriverEntry(
|
|
|
|
PDRIVER_OBJECT DriverObject,
|
|
|
|
PUNICODE_STRING RegistryPath);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* misc.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
DRIVER_DISPATCH
|
|
|
|
VfatBuildRequest;
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
VfatBuildRequest(
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PIRP Irp);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
PVOID
|
|
|
|
VfatGetUserBuffer(
|
2015-05-17 12:22:28 +00:00
|
|
|
IN PIRP,
|
|
|
|
IN BOOLEAN Paging);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatLockUserBuffer(
|
|
|
|
IN PIRP,
|
|
|
|
IN ULONG,
|
|
|
|
IN LOCK_OPERATION);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2014-11-10 22:11:36 +00:00
|
|
|
BOOLEAN
|
|
|
|
VfatCheckForDismount(
|
|
|
|
IN PDEVICE_EXTENSION DeviceExt,
|
|
|
|
IN BOOLEAN Create);
|
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* pnp.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatPnp(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* rw.c */
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatRead(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatWrite(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
NextCluster(
|
|
|
|
PDEVICE_EXTENSION DeviceExt,
|
|
|
|
ULONG FirstCluster,
|
|
|
|
PULONG CurrentCluster,
|
|
|
|
BOOLEAN Extend);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* shutdown.c */
|
2001-05-02 03:18:03 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
DRIVER_DISPATCH
|
|
|
|
VfatShutdown;
|
2002-05-05 20:18:33 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
NTAPI
|
|
|
|
VfatShutdown(
|
|
|
|
PDEVICE_OBJECT DeviceObject,
|
|
|
|
PIRP Irp);
|
2002-03-18 22:37:13 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
/* string.c */
|
2002-05-05 20:18:33 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
VOID
|
|
|
|
vfatSplitPathName(
|
|
|
|
PUNICODE_STRING PathNameU,
|
|
|
|
PUNICODE_STRING DirNameU,
|
|
|
|
PUNICODE_STRING FileNameU);
|
2003-02-09 18:02:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
vfatIsLongIllegal(
|
|
|
|
WCHAR c);
|
2003-02-09 18:02:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
BOOLEAN
|
|
|
|
wstrcmpjoki(
|
|
|
|
PWSTR s1,
|
|
|
|
PWSTR s2);
|
|
|
|
|
|
|
|
/* volume.c */
|
2003-02-09 18:02:56 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatQueryVolumeInformation(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
[FASTFAT]
Make our FAT driver PNP aware.
On PNP requests it should handle, it will return STATUS_NOT_IMPLEMENTED.
On the others, it will pass them to lower driver.
This is the first step outside the kernel into getting IoGetRelatedTargetDevice (and so notifications) working.
It doesn't work at the moment, as class2 doesn't handle PNP.
[NTOSKRNL]
Some fixes to IRP cancelation process:
- Renamed IopRemoveThreadIrp() to IopDisassociateThreadIrp() to match Windows 2k3
- Made dead IRP global, to make its debug easier.
- IopDisassociateThreadIrp(), Handle dead IRP at dispatch level, using IoCompletionLock.
- IopDisassociateThreadIrp(), Use the proper error code to write the entry to logs.
- IoCancelIrp(), removed non needed ASSERT, which is even not present on Windows, removed corresponding var as well.
- IoCancelIrp(), fixed parameters to KeBugCheckEx() call.
- IoCancelThreadIo() is pageable.
- IoCancelThreadIo() under Windows isn't using given thread, but using current. Do the same here.
All that stuff doesn't fix bug #5550, it comes from outside.
Patch by Pierre Schweitzer, modified by me to make it compile. If it breaks anything, don't blame me!
svn path=/trunk/; revision=48560
2010-08-18 23:21:15 +00:00
|
|
|
|
2013-12-12 13:51:50 +00:00
|
|
|
NTSTATUS
|
|
|
|
VfatSetVolumeInformation(
|
|
|
|
PVFAT_IRP_CONTEXT IrpContext);
|
2003-10-11 17:51:56 +00:00
|
|
|
|
2014-02-06 12:28:49 +00:00
|
|
|
#endif /* _FASTFAT_PCH_ */
|