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 along
00016 *  with this program; if not, write to the Free Software Foundation, Inc.,
00017 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00018 */
00019 /* $Id: close.c 43790 2009-10-27 10:34:16Z dgorbachev $
00020 *
00021 * COPYRIGHT:        See COPYING in the top level directory
00022 * PROJECT:          ReactOS kernel
00023 * FILE:             services/fs/cdfs/close.c
00024 * PURPOSE:          CDROM (ISO 9660) filesystem driver
00025 * PROGRAMMER:       Art Yerkes
00026 * UPDATE HISTORY:
00027 */
00028 
00029 /* INCLUDES *****************************************************************/
00030 
00031 #include "cdfs.h"
00032 
00033 #define NDEBUG
00034 #include <debug.h>
00035 
00036 /* FUNCTIONS ****************************************************************/
00037 
00038 NTSTATUS
00039 CdfsCloseFile(PDEVICE_EXTENSION DeviceExt,
00040               PFILE_OBJECT FileObject)
00041               /*
00042               * FUNCTION: Closes a file
00043               */
00044 {
00045     PCCB Ccb;
00046 
00047     DPRINT("CdfsCloseFile(DeviceExt %x, FileObject %x)\n",
00048         DeviceExt,
00049         FileObject);
00050 
00051     Ccb = (PCCB)(FileObject->FsContext2);
00052 
00053     DPRINT("Ccb %x\n", Ccb);
00054     if (Ccb == NULL)
00055     {
00056         return(STATUS_SUCCESS);
00057     }
00058 
00059     FileObject->FsContext2 = NULL;
00060 
00061     if (FileObject->FileName.Buffer)
00062     {
00063         // This a FO, that was created outside from FSD.
00064         // Some FO's are created with IoCreateStreamFileObject() insid from FSD.
00065         // This FO's don't have a FileName.
00066         CdfsReleaseFCB(DeviceExt, FileObject->FsContext);
00067     }
00068 
00069     if (Ccb->DirectorySearchPattern.Buffer)
00070     {
00071         ExFreePoolWithTag(Ccb->DirectorySearchPattern.Buffer, TAG_CCB);
00072     }
00073     ExFreePoolWithTag(Ccb, TAG_CCB);
00074 
00075     return(STATUS_SUCCESS);
00076 }
00077 
00078 
00079 NTSTATUS NTAPI
00080 CdfsClose(PDEVICE_OBJECT DeviceObject,
00081           PIRP Irp)
00082 {
00083     PDEVICE_EXTENSION DeviceExtension;
00084     PIO_STACK_LOCATION Stack;
00085     PFILE_OBJECT FileObject;
00086     NTSTATUS Status;
00087 
00088     DPRINT("CdfsClose() called\n");
00089 
00090     if (DeviceObject == CdfsGlobalData->DeviceObject)
00091     {
00092         DPRINT("Closing file system\n");
00093         Status = STATUS_SUCCESS;
00094         goto ByeBye;
00095     }
00096 
00097     Stack = IoGetCurrentIrpStackLocation(Irp);
00098     FileObject = Stack->FileObject;
00099     DeviceExtension = DeviceObject->DeviceExtension;
00100 
00101     Status = CdfsCloseFile(DeviceExtension,FileObject);
00102 
00103 ByeBye:
00104     Irp->IoStatus.Status = Status;
00105     Irp->IoStatus.Information = 0;
00106 
00107     IoCompleteRequest(Irp, IO_NO_INCREMENT);
00108     return(Status);
00109 }
00110 
00111 /* EOF */
00112 

Generated on Sun May 27 2012 04:27:29 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.