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

misc.c
Go to the documentation of this file.
00001 /*
00002  *  ReactOS kernel
00003  *  Copyright (C) 2008 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/misc.c
00022  * PURPOSE:          NTFS filesystem driver
00023  * PROGRAMMER:       Pierre Schweitzer
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 /*
00040  * FUNCTION: Used with IRP to set them to TopLevelIrp field
00041  * ARGUMENTS:
00042  *           Irp = The IRP to set
00043  * RETURNS: TRUE if top level was null, else FALSE
00044  */
00045 BOOLEAN
00046 NtfsIsIrpTopLevel(PIRP Irp)
00047 {
00048   BOOLEAN   ReturnCode = FALSE;
00049   
00050   TRACE_(NTFS, "NtfsIsIrpTopLevel()\n");
00051 
00052   if (IoGetTopLevelIrp() == NULL)
00053   {
00054     IoSetTopLevelIrp(Irp);
00055     ReturnCode = TRUE;
00056   }
00057 
00058   return ReturnCode;
00059 }
00060 
00061 /*
00062  * FUNCTION: Allocate and fill an NTFS_IRP_CONTEXT struct in order to use it for IRP
00063  * ARGUMENTS:
00064  *           DeviceObject = Used to fill in struct 
00065  *           Irp = The IRP that need IRP_CONTEXT struct
00066  * RETURNS: NULL or PNTFS_IRP_CONTEXT
00067  */
00068 PNTFS_IRP_CONTEXT
00069 NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject,
00070                        PIRP Irp)
00071 {
00072   PNTFS_IRP_CONTEXT IrpContext;
00073   PIO_STACK_LOCATION IoStackLocation;
00074   
00075   TRACE_(NTFS, "NtfsAllocateIrpContext()\n");
00076   
00077   IrpContext = (PNTFS_IRP_CONTEXT)ExAllocatePoolWithTag(NonPagedPool, sizeof(NTFS_IRP_CONTEXT), 'PRIN');
00078   if (IrpContext == NULL)
00079     return NULL;
00080   RtlZeroMemory(IrpContext, sizeof(NTFS_IRP_CONTEXT));
00081 
00082   IrpContext->Identifier.Type = NTFS_TYPE_IRP_CONTEST;
00083   IrpContext->Identifier.Size = sizeof(NTFS_IRP_CONTEXT);
00084   IrpContext->Irp = Irp;
00085   IrpContext->DeviceObject = DeviceObject;
00086   if (Irp)
00087   {
00088     IoStackLocation = IoGetCurrentIrpStackLocation(Irp);
00089     ASSERT(IoStackLocation);
00090 
00091     IrpContext->MajorFunction = IoStackLocation->MajorFunction;
00092     IrpContext->MinorFunction = IoStackLocation->MinorFunction;
00093     IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp);
00094   }
00095   
00096   return IrpContext;
00097 }

Generated on Thu May 24 2012 04:16:49 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.