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

udfs.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/udfs.c
00005  * PURPOSE:          USFS Recognizer
00006  * PROGRAMMER:       Alex Ionescu (alex.ionescu@reactos.org)
00007  *                   Eric Kohl
00008  */
00009 
00010 /* INCLUDES *****************************************************************/
00011 
00012 #include "fs_rec.h"
00013 #define NDEBUG
00014 #include <debug.h>
00015 
00016 #include "udfs.h"
00017 
00018 /* FUNCTIONS ****************************************************************/
00019 
00020 BOOLEAN
00021 NTAPI
00022 FsRecIsUdfsVolume(IN PDEVICE_OBJECT DeviceObject,
00023                   IN ULONG SectorSize)
00024 {
00025     PVOLSTRUCTDESC VolumeStructDesc = NULL;
00026     LARGE_INTEGER Offset;
00027     ULONG State = 0;
00028     PAGED_CODE();
00029 
00030     Offset.QuadPart = UDFS_VRS_START_OFFSET;
00031     while (TRUE)
00032     {
00033         if (!FsRecReadBlock(DeviceObject,
00034                             &Offset,
00035                             SectorSize,
00036                             SectorSize,
00037                             (PVOID)&VolumeStructDesc,
00038                             NULL))
00039         {
00040             break;
00041         }
00042 
00043         switch (State)
00044         {
00045             case 0:
00046 
00047                 if (!strncmp((const char*)VolumeStructDesc->Ident,
00048                              VSD_STD_ID_BEA01,
00049                              VSD_STD_ID_LEN))
00050                 {
00051                     State = 1;
00052                 }
00053                 else
00054                 {
00055                     ExFreePool(VolumeStructDesc);
00056                     return FALSE;
00057                 }
00058                 break;
00059 
00060             case 1:
00061 
00062                 if (!strncmp((const char*)VolumeStructDesc->Ident,
00063                              VSD_STD_ID_NSR03,
00064                              VSD_STD_ID_LEN) ||
00065                     !strncmp((const char*)VolumeStructDesc->Ident,
00066                              VSD_STD_ID_NSR02,
00067                              VSD_STD_ID_LEN))
00068                 {
00069                     State = 2;
00070                 }
00071                 break;
00072 
00073             case 2:
00074 
00075                 if (!strncmp((const char*)VolumeStructDesc->Ident,
00076                              VSD_STD_ID_TEA01,
00077                              VSD_STD_ID_LEN))
00078                 {
00079                     ExFreePool(VolumeStructDesc);
00080                     return TRUE;
00081                 }
00082                 break;
00083         }
00084 
00085         Offset.QuadPart += SectorSize;
00086         if (Offset.QuadPart == UDFS_AVDP_SECTOR)
00087         {
00088             ExFreePool(VolumeStructDesc);
00089             return FALSE;
00090         }
00091     }
00092 
00093     ExFreePool(VolumeStructDesc);
00094     return TRUE;
00095 }
00096 
00097 NTSTATUS
00098 NTAPI
00099 FsRecUdfsFsControl(IN PDEVICE_OBJECT DeviceObject,
00100                    IN PIRP Irp)
00101 {
00102     PIO_STACK_LOCATION Stack;
00103     NTSTATUS Status;
00104     PDEVICE_OBJECT MountDevice;
00105     ULONG SectorSize;
00106     PAGED_CODE();
00107 
00108     /* Get the I/O Stack and check the function type */
00109     Stack = IoGetCurrentIrpStackLocation(Irp);
00110     switch (Stack->MinorFunction)
00111     {
00112         case IRP_MN_MOUNT_VOLUME:
00113 
00114             /* Assume failure */
00115             Status = STATUS_UNRECOGNIZED_VOLUME;
00116 
00117             /* Get the device object and request the sector size */
00118             MountDevice = Stack->Parameters.MountVolume.DeviceObject;
00119             if (FsRecGetDeviceSectorSize(MountDevice, &SectorSize))
00120             {
00121                 /* Check if it's an actual FAT volume */
00122                 if (FsRecIsUdfsVolume(MountDevice, SectorSize))
00123                 {
00124                     /* It is! */
00125                     Status = STATUS_FS_DRIVER_REQUIRED;
00126                 }
00127             }
00128 
00129             break;
00130 
00131         case IRP_MN_LOAD_FILE_SYSTEM:
00132 
00133             /* Load the file system */
00134             Status = FsRecLoadFileSystem(DeviceObject,
00135                                          L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Udfs");
00136             break;
00137 
00138         default:
00139 
00140             /* Invalid request */
00141             Status = STATUS_INVALID_DEVICE_REQUEST;
00142     }
00143 
00144     /* Return Status */
00145     return Status;
00146 }
00147 
00148 /* EOF */

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