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

ext2.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:        See COPYING in the top level directory
00003  * PROJECT:          ReactOS File System Recognizer
00004  * FILE:             drivers/filesystems/fs_rec/ext2.c
00005  * PURPOSE:          EXT2 Recognizer
00006  * PROGRAMMER:       Eric Kohl
00007  */
00008 
00009 /* INCLUDES *****************************************************************/
00010 
00011 #include "fs_rec.h"
00012 #define NDEBUG
00013 #include <debug.h>
00014 
00015 /* FUNCTIONS ****************************************************************/
00016 
00017 BOOLEAN
00018 NTAPI
00019 FsRecIsExt2Volume(IN PVOID PackedBootSector)
00020 {
00021     /* For now, always return failure... */
00022     return FALSE;
00023 }
00024 
00025 NTSTATUS
00026 NTAPI
00027 FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject,
00028                    IN PIRP Irp)
00029 {
00030     PIO_STACK_LOCATION Stack;
00031     NTSTATUS Status;
00032     PDEVICE_OBJECT MountDevice;
00033     PVOID Bpb = NULL;
00034     ULONG SectorSize;
00035     LARGE_INTEGER Offset = {{0, 0}};
00036     BOOLEAN DeviceError = FALSE;
00037     PAGED_CODE();
00038 
00039     /* Get the I/O Stack and check the function type */
00040     Stack = IoGetCurrentIrpStackLocation(Irp);
00041     switch (Stack->MinorFunction)
00042     {
00043         case IRP_MN_MOUNT_VOLUME:
00044 
00045             /* Assume failure */
00046             Status = STATUS_UNRECOGNIZED_VOLUME;
00047 
00048             /* Get the device object and request the sector size */
00049             MountDevice = Stack->Parameters.MountVolume.DeviceObject;
00050             if (FsRecGetDeviceSectorSize(MountDevice, &SectorSize))
00051             {
00052                 /* Try to read the BPB */
00053                 if (FsRecReadBlock(MountDevice,
00054                                    &Offset,
00055                                    512,
00056                                    SectorSize,
00057                                    (PVOID)&Bpb,
00058                                    &DeviceError))
00059                 {
00060                     /* Check if it's an actual EXT2 volume */
00061                     if (FsRecIsExt2Volume(Bpb))
00062                     {
00063                         /* It is! */
00064                         Status = STATUS_FS_DRIVER_REQUIRED;
00065                     }
00066                 }
00067 
00068                 /* Free the boot sector if we have one */
00069                 ExFreePool(Bpb);
00070             }
00071             else
00072             {
00073                 /* We have some sort of failure in the storage stack */
00074                 DeviceError = TRUE;
00075             }
00076 
00077             /* Check if we have an error on the stack */
00078             if (DeviceError)
00079             {
00080                 /* Was this because of a floppy? */
00081                 if (MountDevice->Characteristics & FILE_FLOPPY_DISKETTE)
00082                 {
00083                     /* Let the FS try anyway */
00084                     Status = STATUS_FS_DRIVER_REQUIRED;
00085                 }
00086             }
00087 
00088             break;
00089 
00090         case IRP_MN_LOAD_FILE_SYSTEM:
00091 
00092             /* Load the file system */
00093             Status = FsRecLoadFileSystem(DeviceObject,
00094                                          L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2");
00095             break;
00096 
00097         default:
00098 
00099             /* Invalid request */
00100             Status = STATUS_INVALID_DEVICE_REQUEST;
00101     }
00102 
00103     /* Return Status */
00104     return Status;
00105 }
00106 
00107 /* EOF */

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