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 *****************************************************************/
16 /* FUNCTIONS ****************************************************************/
20 FsRecIsExt2Volume(IN PVOID PackedBootSector
)
22 UNREFERENCED_PARAMETER(PackedBootSector
);
23 /* For now, always return failure... */
29 FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject
,
32 PIO_STACK_LOCATION Stack
;
34 PDEVICE_OBJECT MountDevice
;
37 LARGE_INTEGER Offset
= {{0, 0}};
38 BOOLEAN DeviceError
= FALSE
;
41 /* Get the I/O Stack and check the function type */
42 Stack
= IoGetCurrentIrpStackLocation(Irp
);
43 switch (Stack
->MinorFunction
)
45 case IRP_MN_MOUNT_VOLUME
:
48 Status
= STATUS_UNRECOGNIZED_VOLUME
;
50 /* Get the device object and request the sector size */
51 MountDevice
= Stack
->Parameters
.MountVolume
.DeviceObject
;
52 if (FsRecGetDeviceSectorSize(MountDevice
, &SectorSize
))
54 /* Try to read the BPB */
55 if (FsRecReadBlock(MountDevice
,
62 /* Check if it's an actual EXT2 volume */
63 if (FsRecIsExt2Volume(Bpb
))
66 Status
= STATUS_FS_DRIVER_REQUIRED
;
70 /* Free the boot sector if we have one */
75 /* We have some sort of failure in the storage stack */
79 /* Check if we have an error on the stack */
82 /* Was this because of a floppy? */
83 if (MountDevice
->Characteristics
& FILE_FLOPPY_DISKETTE
)
85 /* Let the FS try anyway */
86 Status
= STATUS_FS_DRIVER_REQUIRED
;
92 case IRP_MN_LOAD_FILE_SYSTEM
:
94 /* Load the file system */
95 Status
= FsRecLoadFileSystem(DeviceObject
,
96 L
"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\Ext2fs");
101 /* Invalid request */
102 Status
= STATUS_INVALID_DEVICE_REQUEST
;