Author: fireball
Date: Fri Oct 16 15:11:05 2009
New Revision: 43513
URL: http://svn.reactos.org/svn/reactos?rev=43513&view=rev
Log:
[fastfat_new]
- Add a function to read the dirent and return status of that object - does it exist, is it a file or a directory.
- Branch according to this in FatiCreate and try to open either an existing file or an existing directory. Directory open is stubbed.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.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] Fri Oct 16 15:11:05 2009
@@ -38,6 +38,63 @@
Iosb.Status = STATUS_NOT_IMPLEMENTED;
+ return Iosb;
+}
+
+FF_ERROR
+NTAPI
+FatiTryToOpen(IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb)
+{
+ OEM_STRING AnsiName;
+ CHAR AnsiNameBuf[512];
+ FF_ERROR Error;
+ NTSTATUS Status;
+ FF_FILE *FileHandle;
+
+ /* Convert the name to ANSI */
+ AnsiName.Buffer = AnsiNameBuf;
+ AnsiName.Length = 0;
+ AnsiName.MaximumLength = sizeof(AnsiNameBuf);
+ RtlZeroMemory(AnsiNameBuf, sizeof(AnsiNameBuf));
+ Status = RtlUpcaseUnicodeStringToCountedOemString(&AnsiName, &FileObject->FileName, FALSE);
+ if (!NT_SUCCESS(Status))
+ {
+ ASSERT(FALSE);
+ }
+
+ /* Open the file with FullFAT */
+ FileHandle = FF_Open(Vcb->Ioman, AnsiName.Buffer, FF_MODE_READ, &Error);
+
+ /* Close the handle */
+ if (FileHandle) FF_Close(FileHandle);
+
+ /* Return status */
+ return Error;
+}
+
+IO_STATUS_BLOCK
+NTAPI
+FatiOpenExistingDir(IN PFAT_IRP_CONTEXT IrpContext,
+ IN PFILE_OBJECT FileObject,
+ IN PVCB Vcb,
+ IN PFCB ParentDcb,
+ 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 DeleteOnClose)
+{
+ IO_STATUS_BLOCK Iosb = {{0}};
+
+ DPRINT1("Opening directory\n");
+
+ UNIMPLEMENTED;
+
+ Iosb.Status = STATUS_NOT_IMPLEMENTED;
return Iosb;
}
@@ -251,6 +308,7 @@
BOOLEAN EndBackslash = FALSE, OpenedAsDos;
UNICODE_STRING RemainingPart, FirstName, NextName;
OEM_STRING AnsiFirstName;
+ FF_ERROR FfError;
Iosb.Status = STATUS_SUCCESS;
@@ -643,7 +701,8 @@
FatSetFullNameInFcb(ParentDcb, &FirstName);
}
- // TODO: Try to find a directory entry of this path
+ /* Try to open it and get a result, saying if this is a dir or a file */
+ FfError = FatiTryToOpen(FileObject, Vcb);
/* Check if we need to open target directory */
if (OpenTargetDirectory)
@@ -652,7 +711,46 @@
UNIMPLEMENTED;
}
- // TODO: Check, if path is a directory or a file
+ /* Check, if path is a directory or a file */
+ if (FfError == FF_ERR_FILE_OBJECT_IS_A_DIR)
+ {
+ if (NonDirectoryFile)
+ {
+ DPRINT1("Can't open dir as a file\n");
+
+ /* Unlock VCB */
+ FatReleaseVcb(IrpContext, Vcb);
+
+ /* Complete the request */
+ Iosb.Status = STATUS_FILE_IS_A_DIRECTORY;
+ FatCompleteRequest(IrpContext, Irp, Iosb.Status);
+ return Iosb.Status;
+ }
+
+ /* Open this directory */
+ Iosb = FatiOpenExistingDir(IrpContext,
+ FileObject,
+ Vcb,
+ ParentDcb,
+ DesiredAccess,
+ ShareAccess,
+ AllocationSize,
+ EaBuffer,
+ EaLength,
+ FileAttributes,
+ CreateDisposition,
+ DeleteOnClose);
+
+ Irp->IoStatus.Information = Iosb.Information;
+
+ /* Unlock VCB */
+ FatReleaseVcb(IrpContext, Vcb);
+
+ /* Complete the request */
+ FatCompleteRequest(IrpContext, Irp, Iosb.Status);
+
+ return Iosb.Status;
+ }
/* If end backslash here, then it's definately not permitted,
since we're opening files here */
Author: fireball
Date: Fri Oct 16 14:29:34 2009
New Revision: 43512
URL: http://svn.reactos.org/svn/reactos?rev=43512&view=rev
Log:
[fastfat_new]
- Minor comments/TODO improvement in FatiCreate.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.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] Fri Oct 16 14:29:34 2009
@@ -643,7 +643,16 @@
FatSetFullNameInFcb(ParentDcb, &FirstName);
}
- // TODO: Try to open directory
+ // TODO: Try to find a directory entry of this path
+
+ /* Check if we need to open target directory */
+ if (OpenTargetDirectory)
+ {
+ // TODO: Open target directory
+ UNIMPLEMENTED;
+ }
+
+ // TODO: Check, if path is a directory or a file
/* If end backslash here, then it's definately not permitted,
since we're opening files here */