Author: greatlrd
Date: Sun May 7 22:50:18 2006
New Revision: 21839
URL:
http://svn.reactos.ru/svn/reactos?rev=21839&view=rev
Log:
bug 1457: patch by w3seek : VFAT: Implement FileEaInformation for FAT32
Modified:
trunk/reactos/drivers/filesystems/vfat/direntry.c
trunk/reactos/drivers/filesystems/vfat/finfo.c
trunk/reactos/drivers/filesystems/vfat/vfat.h
Modified: trunk/reactos/drivers/filesystems/vfat/direntry.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/vfat/di…
==============================================================================
--- trunk/reactos/drivers/filesystems/vfat/direntry.c (original)
+++ trunk/reactos/drivers/filesystems/vfat/direntry.c Sun May 7 22:50:18 2006
@@ -21,8 +21,8 @@
if (pDeviceExt->FatInfo.FatType == FAT32)
{
- cluster = pFatDirEntry->Fat.FirstCluster +
- pFatDirEntry->Fat.FirstClusterHigh * 65536;
+ cluster = pFatDirEntry->Fat.FirstCluster |
+ (pFatDirEntry->Fat.FirstClusterHigh << 16);
}
else if (pDeviceExt->Flags & VCB_IS_FATX)
{
Modified: trunk/reactos/drivers/filesystems/vfat/finfo.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/vfat/fi…
==============================================================================
--- trunk/reactos/drivers/filesystems/vfat/finfo.c (original)
+++ trunk/reactos/drivers/filesystems/vfat/finfo.c Sun May 7 22:50:18 2006
@@ -445,6 +445,28 @@
static NTSTATUS
+VfatGetEaInformation(PFILE_OBJECT FileObject,
+ PVFATFCB Fcb,
+ PDEVICE_OBJECT DeviceObject,
+ PFILE_EA_INFORMATION Info,
+ PULONG BufferLength)
+{
+ PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
+
+ /* FIXME - use SEH to access the buffer! */
+ Info->EaSize = 0;
+ *BufferLength -= sizeof(*Info);
+ if (DeviceExt->FatInfo.FatType == FAT12 ||
+ DeviceExt->FatInfo.FatType == FAT16)
+ {
+ /* FIXME */
+ DPRINT1("VFAT: FileEaInformation not implemented!\n");
+ }
+ return STATUS_SUCCESS;
+}
+
+
+static NTSTATUS
VfatGetAllInformation(PFILE_OBJECT FileObject,
PVFATFCB Fcb,
PDEVICE_OBJECT DeviceObject,
@@ -585,8 +607,16 @@
}
else
{
- Fcb->entry.Fat.FirstCluster = (unsigned short)(FirstCluster &
0x0000FFFF);
- Fcb->entry.Fat.FirstClusterHigh = (unsigned short)((FirstCluster &
0xFFFF0000) >> 16);
+ if (DeviceExt->FatInfo.FatType == FAT32)
+ {
+ Fcb->entry.Fat.FirstCluster = (unsigned short)(FirstCluster &
0x0000FFFF);
+ Fcb->entry.Fat.FirstClusterHigh = FirstCluster >> 16;
+ }
+ else
+ {
+ ASSERT((FirstCluster >> 16) == 0);
+ Fcb->entry.Fat.FirstCluster = (unsigned short)(FirstCluster &
0x0000FFFF);
+ }
}
}
else
@@ -670,8 +700,15 @@
}
else
{
- Fcb->entry.Fat.FirstCluster = 0;
- Fcb->entry.Fat.FirstClusterHigh = 0;
+ if (DeviceExt->FatInfo.FatType == FAT32)
+ {
+ Fcb->entry.Fat.FirstCluster = 0;
+ Fcb->entry.Fat.FirstClusterHigh = 0;
+ }
+ else
+ {
+ Fcb->entry.Fat.FirstCluster = 0;
+ }
}
NCluster = Cluster = FirstCluster;
@@ -778,6 +815,14 @@
IrpContext->DeviceObject,
SystemBuffer,
&BufferLength);
+ break;
+
+ case FileEaInformation:
+ RC = VfatGetEaInformation(IrpContext->FileObject,
+ FCB,
+ IrpContext->DeviceObject,
+ SystemBuffer,
+ &BufferLength);
break;
case FileAlternateNameInformation:
Modified: trunk/reactos/drivers/filesystems/vfat/vfat.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/drivers/filesystems/vfat/vf…
==============================================================================
--- trunk/reactos/drivers/filesystems/vfat/vfat.h (original)
+++ trunk/reactos/drivers/filesystems/vfat/vfat.h Sun May 7 22:50:18 2006
@@ -97,11 +97,50 @@
unsigned char lCase;
unsigned char CreationTimeMs;
unsigned short CreationTime,CreationDate,AccessDate;
- unsigned short FirstClusterHigh; // higher
+ 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;
+};
+
+#define FAT_EAFILE "EA DATA. SF"
+
+typedef struct _EAFileHeader FAT_EA_FILE_HEADER, *PFAT_EA_FILE_HEADER;
+
+struct _EAFileHeader
+{
+ unsigned short Signature; // ED
+ unsigned short Unknown[15];
+ unsigned short EASetTable[240];
+};
+
+typedef struct _EASetHeader FAT_EA_SET_HEADER, *PFAT_EA_SET_HEADER;
+
+struct _EASetHeader
+{
+ 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
+};
+
+typedef struct _EAHeader FAT_EA_HEADER, *PFAT_EA_HEADER;
+
+struct _EAHeader
+{
+ unsigned char Unknown;
+ unsigned char EANameLength;
+ unsigned short EAValueLength;
+ // Name Data
+ // Value Data
};
typedef struct _FATDirEntry FAT_DIR_ENTRY, *PFAT_DIR_ENTRY;