Check some attributes in CdfsCreateFile.

svn path=/trunk/; revision=3506
This commit is contained in:
Hartmut Birr 2002-09-15 22:21:40 +00:00
parent c7c45f9bac
commit 9083e6bddd
2 changed files with 27 additions and 10 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: close.c,v 1.4 2002/09/09 17:25:39 hbirr Exp $ /* $Id: close.c,v 1.5 2002/09/15 22:21:40 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -38,7 +38,7 @@
/* FUNCTIONS ****************************************************************/ /* FUNCTIONS ****************************************************************/
static NTSTATUS NTSTATUS
CdfsCloseFile(PDEVICE_EXTENSION DeviceExt, CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
PFILE_OBJECT FileObject) PFILE_OBJECT FileObject)
/* /*

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: create.c,v 1.6 2002/09/08 10:22:08 chorns Exp $ /* $Id: create.c,v 1.7 2002/09/15 22:21:40 hbirr Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -169,6 +169,7 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
ULONG RequestedDisposition; ULONG RequestedDisposition;
ULONG RequestedOptions; ULONG RequestedOptions;
PFCB Fcb; PFCB Fcb;
PCCB Ccb;
// PWSTR FileName; // PWSTR FileName;
NTSTATUS Status; NTSTATUS Status;
@ -180,12 +181,9 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
assert (Stack); assert (Stack);
RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff); RequestedDisposition = ((Stack->Parameters.Create.Options >> 24) & 0xff);
// RequestedOptions = RequestedOptions = Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS;
// Stack->Parameters.Create.Options & FILE_VALID_OPTION_FLAGS; DPRINT("RequestedDisposition %x, RequestedOptions %x\n",
// PagingFileCreate = (Stack->Flags & SL_OPEN_PAGING_FILE) ? TRUE : FALSE; RequestedDisposition, RequestedOptions);
// if ((RequestedOptions & FILE_DIRECTORY_FILE)
// && RequestedDisposition == FILE_SUPERSEDE)
// return STATUS_INVALID_PARAMETER;
FileObject = Stack->FileObject; FileObject = Stack->FileObject;
@ -200,6 +198,25 @@ CdfsCreateFile(PDEVICE_OBJECT DeviceObject,
FileObject, FileObject,
FileObject->FileName.Buffer); FileObject->FileName.Buffer);
if (NT_SUCCESS(Status))
{
Ccb = FileObject->FsContext2;
Fcb = Ccb->Fcb;
/*
* Check the file has the requested attributes
*/
if (RequestedOptions & FILE_NON_DIRECTORY_FILE && CdfsFCBIsDirectory(Fcb))
{
CdfsCloseFile (DeviceExt, FileObject);
return STATUS_FILE_IS_A_DIRECTORY;
}
if (RequestedOptions & FILE_DIRECTORY_FILE && !CdfsFCBIsDirectory(Fcb))
{
CdfsCloseFile (DeviceExt, FileObject);
return STATUS_NOT_A_DIRECTORY;
}
}
/* /*
* If the directory containing the file to open doesn't exist then * If the directory containing the file to open doesn't exist then
* fail immediately * fail immediately
@ -243,4 +260,4 @@ ByeBye:
return(Status); return(Status);
} }
/* EOF */ /* EOF */