Author: fireball
Date: Sat Oct 17 12:57:48 2009
New Revision: 43527
URL:
http://svn.reactos.org/svn/reactos?rev=43527&view=rev
Log:
[fastfat_new]
- Search FCBs with unicode name too, besides of OEM.
- Create an infrastructure for opening existing FCB/DCBs.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.c
trunk/reactos/drivers/filesystems/fastfat_new/dir.c
trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
trunk/reactos/drivers/filesystems/fastfat_new/fcb.c
Modified: trunk/reactos/drivers/filesystems/fastfat_new/create.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/create.c [iso-8859-1] Sat Oct 17
12:57:48 2009
@@ -353,10 +353,11 @@
IO_STATUS_BLOCK Iosb;
PIO_STACK_LOCATION IrpSp;
BOOLEAN EndBackslash = FALSE, OpenedAsDos;
- UNICODE_STRING RemainingPart, FirstName, NextName;
+ UNICODE_STRING RemainingPart, FirstName, NextName, FileNameUpcased;
OEM_STRING AnsiFirstName;
FF_ERROR FfError;
TYPE_OF_OPEN TypeOfOpen;
+ BOOLEAN OplockPostIrp = FALSE;
Iosb.Status = STATUS_SUCCESS;
@@ -684,10 +685,22 @@
&OpenedAsDos);
}
- /* Check if we found anything */
+ /* If nothing found - try with unicode */
if (!NextFcb && Fcb->Dcb.SplayLinksUnicode)
{
- ASSERT(FALSE);
+ FileNameUpcased.Buffer = FsRtlAllocatePool(PagedPool,
FirstName.Length);
+ FileNameUpcased.Length = 0;
+ FileNameUpcased.MaximumLength = FirstName.Length;
+
+ /* Downcase and then upcase to normalize it */
+ Status = RtlDowncaseUnicodeString(&FileNameUpcased,
&FirstName, FALSE);
+ Status = RtlUpcaseUnicodeString(&FileNameUpcased,
&FileNameUpcased, FALSE);
+
+ /* Try to find FCB again using unicode name */
+ NextFcb = FatFindFcb(IrpContext,
+ &Fcb->Dcb.SplayLinksUnicode,
+ (PSTRING)&FileNameUpcased,
+ &OpenedAsDos);
}
/* Move to the next FCB */
@@ -729,8 +742,116 @@
/* We have a valid FCB now */
if (!RemainingPart.Length)
{
- DPRINT1("It's possible to open an existing FCB\n");
- ASSERT(FALSE);
+ /* Check for target dir open */
+ if (OpenTargetDirectory)
+ {
+ DPRINT1("Opening target dir is missing\n");
+ ASSERT(FALSE);
+ }
+
+ /* Check this FCB's type */
+ if (FatNodeType(Fcb) == FAT_NTC_ROOT_DCB ||
+ FatNodeType(Fcb) == FAT_NTC_DCB)
+ {
+ /* Open a directory */
+ if (NonDirectoryFile)
+ {
+ /* Forbidden */
+ Iosb.Status = STATUS_FILE_IS_A_DIRECTORY;
+ ASSERT(FALSE);
+ return Iosb.Status;
+ }
+
+ /* Open existing DCB */
+ Iosb = FatiOpenExistingDcb(IrpContext,
+ FileObject,
+ Vcb,
+ Fcb,
+ DesiredAccess,
+ ShareAccess,
+ CreateDisposition,
+ NoEaKnowledge,
+ DeleteOnClose);
+
+ /* Save information */
+ Irp->IoStatus.Information = Iosb.Information;
+
+ /* Unlock VCB */
+ FatReleaseVcb(IrpContext, Vcb);
+
+ /* Complete the request */
+ FatCompleteRequest(IrpContext, Irp, Iosb.Status);
+
+ return Iosb.Status;
+ }
+ else if (FatNodeType(Fcb) == FAT_NTC_FCB)
+ {
+ /* Open a file */
+ if (OpenDirectory)
+ {
+ /* Forbidden */
+ Iosb.Status = STATUS_NOT_A_DIRECTORY;
+ ASSERT(FALSE);
+ return Iosb.Status;
+ }
+
+ /* Check for trailing backslash */
+ if (EndBackslash)
+ {
+ /* Forbidden */
+ Iosb.Status = STATUS_OBJECT_NAME_INVALID;
+ ASSERT(FALSE);
+ return Iosb.Status;
+ }
+
+ Iosb = FatiOpenExistingFcb(IrpContext,
+ FileObject,
+ Vcb,
+ Fcb,
+ DesiredAccess,
+ ShareAccess,
+ AllocationSize,
+ EaBuffer,
+ EaLength,
+ FileAttributes,
+ CreateDisposition,
+ NoEaKnowledge,
+ DeleteOnClose,
+ OpenedAsDos,
+ &OplockPostIrp);
+
+ /* Check if it's pending */
+ if (Iosb.Status != STATUS_PENDING)
+ {
+ /* In case of success set cache supported flag */
+ if (NT_SUCCESS(Iosb.Status) && !NoIntermediateBuffering)
+ {
+ SetFlag(FileObject->Flags, FO_CACHE_SUPPORTED);
+ }
+
+ /* Save information */
+ Irp->IoStatus.Information = Iosb.Information;
+
+ /* Unlock VCB */
+ FatReleaseVcb(IrpContext, Vcb);
+
+ /* Complete the request */
+ FatCompleteRequest(IrpContext, Irp, Iosb.Status);
+
+ return Iosb.Status;
+ }
+ else
+ {
+ /* Queue this IRP */
+ UNIMPLEMENTED;
+ ASSERT(FALSE);
+ }
+ }
+ else
+ {
+ /* Unexpected FCB type */
+ KeBugCheckEx(/*FAT_FILE_SYSTEM*/0x23, __LINE__, (ULONG_PTR)Fcb, 0, 0);
+ }
}
/* During parsing we encountered a part which has no attached FCB/DCB.
Modified: trunk/reactos/drivers/filesystems/fastfat_new/dir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/dir.c [iso-8859-1] Sat Oct 17 12:57:48
2009
@@ -173,4 +173,24 @@
return Fcb;
}
+IO_STATUS_BLOCK
+NTAPI
+FatiOpenExistingDcb(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb,
+ IN PFCB Dcb,
+ IN PACCESS_MASK DesiredAccess,
+ IN USHORT ShareAccess,
+ IN ULONG CreateDisposition,
+ IN BOOLEAN NoEaKnowledge,
+ IN BOOLEAN DeleteOnClose)
+{
+ IO_STATUS_BLOCK Iosb = {{0}};
+
+ Iosb.Status = STATUS_NOT_IMPLEMENTED;
+ UNIMPLEMENTED;
+
+ return Iosb;
+}
+
/* EOF */
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fastfat.h [iso-8859-1] Sat Oct 17
12:57:48 2009
@@ -86,6 +86,17 @@
IN PVCB Vcb,
IN PFCB ParentDcb,
IN FF_FILE *FileHandle);
+
+IO_STATUS_BLOCK NTAPI
+FatiOpenExistingDcb(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb,
+ IN PFCB Dcb,
+ IN PACCESS_MASK DesiredAccess,
+ IN USHORT ShareAccess,
+ IN ULONG CreateDisposition,
+ IN BOOLEAN NoEaKnowledge,
+ IN BOOLEAN DeleteOnClose);
/* -------------------------------------------------------- create.c */
@@ -296,6 +307,23 @@
IN PFCB ParentDcb,
IN FF_FILE *FileHandle);
+IO_STATUS_BLOCK NTAPI
+FatiOpenExistingFcb(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb,
+ IN PFCB Fcb,
+ IN PACCESS_MASK DesiredAccess,
+ IN USHORT ShareAccess,
+ IN ULONG AllocationSize,
+ IN PFILE_FULL_EA_INFORMATION EaBuffer,
+ IN ULONG EaLength,
+ IN UCHAR FileAttributes,
+ IN ULONG CreateDisposition,
+ IN BOOLEAN NoEaKnowledge,
+ IN BOOLEAN DeleteOnClose,
+ IN BOOLEAN OpenedAsDos,
+ OUT PBOOLEAN OplockPostIrp);
+
PFCB NTAPI
FatFindFcb(PFAT_IRP_CONTEXT IrpContext,
PRTL_SPLAY_LINKS *RootNode,
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fcb.c [iso-8859-1] Sat Oct 17 12:57:48
2009
@@ -170,6 +170,32 @@
Ccb->NodeByteSize = sizeof(CCB);
return Ccb;
+}
+
+IO_STATUS_BLOCK
+NTAPI
+FatiOpenExistingFcb(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb,
+ IN PFCB Fcb,
+ IN PACCESS_MASK DesiredAccess,
+ IN USHORT ShareAccess,
+ IN ULONG AllocationSize,
+ IN PFILE_FULL_EA_INFORMATION EaBuffer,
+ IN ULONG EaLength,
+ IN UCHAR FileAttributes,
+ IN ULONG CreateDisposition,
+ IN BOOLEAN NoEaKnowledge,
+ IN BOOLEAN DeleteOnClose,
+ IN BOOLEAN OpenedAsDos,
+ OUT PBOOLEAN OplockPostIrp)
+{
+ IO_STATUS_BLOCK Iosb = {{0}};
+
+ Iosb.Status = STATUS_NOT_IMPLEMENTED;
+ UNIMPLEMENTED;
+
+ return Iosb;
}
VOID