ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

close.c
Go to the documentation of this file.
00001 /*
00002  *  ReactOS kernel
00003  *  Copyright (C) 2002 ReactOS Team
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
00018  *
00019  * COPYRIGHT:        See COPYING in the top level directory
00020  * PROJECT:          ReactOS kernel
00021  * FILE:             drivers/filesystem/ntfs/close.c
00022  * PURPOSE:          NTFS filesystem driver
00023  * PROGRAMMER:       Art Yerkes
00024  * UPDATE HISTORY:
00025  */
00026 
00027 /* INCLUDES *****************************************************************/
00028 
00029 #include "ntfs.h"
00030 
00031 #define NDEBUG
00032 #include <debug.h>
00033 
00034 /* GLOBALS *****************************************************************/
00035 
00036 
00037 /* FUNCTIONS ****************************************************************/
00038 
00039 static NTSTATUS
00040 NtfsCloseFile(PDEVICE_EXTENSION DeviceExt,
00041           PFILE_OBJECT FileObject)
00042 /*
00043  * FUNCTION: Closes a file
00044  */
00045 {
00046   PNTFS_CCB Ccb;
00047 
00048   DPRINT("NtfsCloseFile(DeviceExt %p, FileObject %p)\n",
00049      DeviceExt,
00050      FileObject);
00051 
00052   Ccb = (PNTFS_CCB)(FileObject->FsContext2);
00053 
00054   DPRINT("Ccb %p\n", Ccb);
00055   if (Ccb == NULL)
00056     {
00057       return(STATUS_SUCCESS);
00058     }
00059 
00060   FileObject->FsContext2 = NULL;
00061 
00062   if (FileObject->FileName.Buffer)
00063     {
00064       // This a FO, that was created outside from FSD.
00065       // Some FO's are created with IoCreateStreamFileObject() insid from FSD.
00066       // This FO's don't have a FileName.
00067       NtfsReleaseFCB(DeviceExt, FileObject->FsContext);
00068     }
00069 
00070   if (Ccb->DirectorySearchPattern)
00071     {
00072       ExFreePool(Ccb->DirectorySearchPattern);
00073     }
00074   ExFreePool(Ccb);
00075 
00076   return(STATUS_SUCCESS);
00077 }
00078 
00079 
00080 NTSTATUS NTAPI
00081 NtfsFsdClose(PDEVICE_OBJECT DeviceObject,
00082       PIRP Irp)
00083 {
00084   PDEVICE_EXTENSION DeviceExtension;
00085   PIO_STACK_LOCATION Stack;
00086   PFILE_OBJECT FileObject;
00087   NTSTATUS Status;
00088 
00089   DPRINT("NtfsClose() called\n");
00090 
00091   if (DeviceObject == NtfsGlobalData->DeviceObject)
00092     {
00093       DPRINT("Closing file system\n");
00094       Status = STATUS_SUCCESS;
00095       goto ByeBye;
00096     }
00097 
00098   Stack = IoGetCurrentIrpStackLocation(Irp);
00099   FileObject = Stack->FileObject;
00100   DeviceExtension = DeviceObject->DeviceExtension;
00101 
00102   Status = NtfsCloseFile(DeviceExtension,FileObject);
00103 
00104 ByeBye:
00105   Irp->IoStatus.Status = Status;
00106   Irp->IoStatus.Information = 0;
00107 
00108   IoCompleteRequest(Irp, IO_NO_INCREMENT);
00109   return(Status);
00110 }

Generated on Fri May 25 2012 04:25:48 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.