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 UNREFERENCED_PARAMETER(PackedBootSector
);
22 /* For now, always return failure... */
28 FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject
,
31 PIO_STACK_LOCATION Stack
;
33 PDEVICE_OBJECT MountDevice
;
36 LARGE_INTEGER Offset
= {{0, 0}};
37 BOOLEAN DeviceError
= FALSE
;
40 /* Get the I/O Stack and check the function type */
41 Stack
= IoGetCurrentIrpStackLocation(Irp
);
42 switch (Stack
->MinorFunction
)
44 case IRP_MN_MOUNT_VOLUME
:
47 Status
= STATUS_UNRECOGNIZED_VOLUME
;
49 /* Get the device object and request the sector size */
50 MountDevice
= Stack
->Parameters
.MountVolume
.DeviceObject
;
51 if (FsRecGetDeviceSectorSize(MountDevice
, &SectorSize
))
53 /* Try to read the BPB */
54 if (FsRecReadBlock(MountDevice
,
61 /* Check if it's an actual EXT2 volume */
62 if (FsRecIsExt2Volume(Bpb
))
65 Status
= STATUS_FS_DRIVER_REQUIRED
;
69 /* Free the boot sector if we have one */
74 /* We have some sort of failure in the storage stack */
78 /* Check if we have an error on the stack */
81 /* Was this because of a floppy? */
82 if (MountDevice
->Characteristics
& FILE_FLOPPY_DISKETTE
)
84 /* Let the FS try anyway */
85 Status
= STATUS_FS_DRIVER_REQUIRED
;
91 case IRP_MN_LOAD_FILE_SYSTEM
:
93 /* Load the file system */
94 Status
= FsRecLoadFileSystem(DeviceObject
,
95 L
"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2");
100 /* Invalid request */
101 Status
= STATUS_INVALID_DEVICE_REQUEST
;