Author: fireball
Date: Fri Oct 16 19:10:12 2009
New Revision: 43516
URL:
http://svn.reactos.org/svn/reactos?rev=43516&view=rev
Log:
[fastfat_new]
- Implement FatiOpenExistingDir.
Modified:
trunk/reactos/drivers/filesystems/fastfat_new/create.c
trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h
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
19:10:12 2009
@@ -89,12 +89,60 @@
IN BOOLEAN DeleteOnClose)
{
IO_STATUS_BLOCK Iosb = {{0}};
-
- DPRINT1("Opening directory\n");
-
- UNIMPLEMENTED;
-
- Iosb.Status = STATUS_NOT_IMPLEMENTED;
+ OEM_STRING AnsiName;
+ CHAR AnsiNameBuf[512];
+ PFCB Fcb;
+ NTSTATUS Status;
+ FF_FILE *FileHandle;
+
+ /* Only open is permitted */
+ if (CreateDisposition != FILE_OPEN &&
+ CreateDisposition != FILE_OPEN_IF)
+ {
+ Iosb.Status = STATUS_OBJECT_NAME_COLLISION;
+ return Iosb;
+ }
+
+ // TODO: Check dir access
+
+ /* 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 dir with FullFAT */
+ FileHandle = FF_Open(Vcb->Ioman, AnsiName.Buffer, FF_MODE_DIR, NULL);
+
+ if (!FileHandle)
+ {
+ Iosb.Status = STATUS_OBJECT_NAME_NOT_FOUND; // FIXME: A shortcut for now
+ return Iosb;
+ }
+
+ /* Create a new DCB for this directory */
+ Fcb = FatCreateDcb(IrpContext, Vcb, ParentDcb);
+ Fcb->FatHandle = FileHandle;
+
+ /* Set share access */
+ IoSetShareAccess(*DesiredAccess, ShareAccess, FileObject, &Fcb->ShareAccess);
+
+ /* Set context and section object pointers */
+ FatSetFileObject(FileObject,
+ UserDirectoryOpen,
+ Fcb,
+ FatCreateCcb());
+
+ Iosb.Status = STATUS_SUCCESS;
+ Iosb.Information = FILE_OPENED;
+
+ DPRINT1("Successfully opened dir %s\n", AnsiNameBuf);
+
return Iosb;
}
Modified: trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat_new/fatstruc.h [iso-8859-1] Fri Oct 16
19:10:12 2009
@@ -277,6 +277,8 @@
ULONG State;
/* Fcb condition */
FCB_CONDITION Condition;
+ /* Share access */
+ SHARE_ACCESS ShareAccess;
/* Mcb mapping Vbo->Lbo */
LARGE_MCB Mcb;
ULONG FirstCluster;