2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS File System Recognizer
4 * FILE: drivers/filesystems/fs_rec/ext2.c
5 * PURPOSE: EXT2 Recognizer
6 * PROGRAMMER: Eric Kohl
9 /* INCLUDES *****************************************************************/
15 /* FUNCTIONS ****************************************************************/
19 FsRecIsExt2Volume(IN PVOID PackedBootSector
)
21 /* For now, always return failure... */
27 FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject
,
30 PIO_STACK_LOCATION Stack
;
32 PDEVICE_OBJECT MountDevice
;
35 LARGE_INTEGER Offset
= {{0, 0}};
36 BOOLEAN DeviceError
= FALSE
;
39 /* Get the I/O Stack and check the function type */
40 Stack
= IoGetCurrentIrpStackLocation(Irp
);
41 switch (Stack
->MinorFunction
)
43 case IRP_MN_MOUNT_VOLUME
:
46 Status
= STATUS_UNRECOGNIZED_VOLUME
;
48 /* Get the device object and request the sector size */
49 MountDevice
= Stack
->Parameters
.MountVolume
.DeviceObject
;
50 if (FsRecGetDeviceSectorSize(MountDevice
, &SectorSize
))
52 /* Try to read the BPB */
53 if (FsRecReadBlock(MountDevice
,
60 /* Check if it's an actual EXT2 volume */
61 if (FsRecIsExt2Volume(Bpb
))
64 Status
= STATUS_FS_DRIVER_REQUIRED
;
68 /* Free the boot sector if we have one */
73 /* We have some sort of failure in the storage stack */
77 /* Check if we have an error on the stack */
80 /* Was this because of a floppy? */
81 if (MountDevice
->Characteristics
& FILE_FLOPPY_DISKETTE
)
83 /* Let the FS try anyway */
84 Status
= STATUS_FS_DRIVER_REQUIRED
;
90 case IRP_MN_LOAD_FILE_SYSTEM
:
92 /* Load the file system */
93 Status
= FsRecLoadFileSystem(DeviceObject
,
94 L
"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2");
100 Status
= STATUS_INVALID_DEVICE_REQUEST
;