Silenced debug messges.
svn path=/trunk/; revision=2954
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: cdfs.c,v 1.4 2002/05/15 09:39:54 ekohl Exp $
+/* $Id: cdfs.c,v 1.5 2002/05/15 18:01:30 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
NTSTATUS Status;
UNICODE_STRING DeviceName;
- DbgPrint("CDFS 0.0.2\n");
+ DPRINT("CDFS 0.0.2\n");
RtlInitUnicodeString(&DeviceName,
L"\\Cdfs");
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: fsctl.c,v 1.5 2002/05/14 23:16:23 ekohl Exp $
+/* $Id: fsctl.c,v 1.6 2002/05/15 18:01:30 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
JolietLevel = 3;
}
- /* Don't support Joliet yet! */
-//#if 0
Vcb->CdInfo.JolietLevel = JolietLevel;
if (JolietLevel != 0)
DPRINT("RootStart: %lu\n", Svd->RootDirRecord.ExtentLocationL);
DPRINT("RootSize: %lu\n", Svd->RootDirRecord.DataLengthL);
}
-//#endif
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: blockdev.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: blockdev.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
IO_STATUS_BLOCK IoStatus;
LARGE_INTEGER Offset;
ULONG BlockSize;
- KEVENT Event;
+ PKEVENT Event;
PIRP Irp;
NTSTATUS Status;
- KeInitializeEvent(&Event,
+ Event = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+ if (Event == NULL)
+ {
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ KeInitializeEvent(Event,
NotificationEvent,
FALSE);
Buffer,
BlockSize,
&Offset,
- &Event,
+ Event,
&IoStatus);
if (Irp == NULL)
{
DPRINT("IoBuildSynchronousFsdRequest failed\n");
+ ExFreePool(Event);
return(STATUS_INSUFFICIENT_RESOURCES);
}
DPRINT("Calling IO Driver... with irp %x\n", Irp);
Status = IoCallDriver(DeviceObject, Irp);
-
- DPRINT("Waiting for IO Operation for %x\n", Irp);
if (Status == STATUS_PENDING)
{
DPRINT("Operation pending\n");
- KeWaitForSingleObject(&Event, Suspended, KernelMode, FALSE, NULL);
- DPRINT("Getting IO Status... for %x\n", Irp);
+ KeWaitForSingleObject(Event, Suspended, KernelMode, FALSE, NULL);
+ Status = IoStatus.Status;
+ }
+
+ ExFreePool(Event);
+
+ return(STATUS_SUCCESS);
+}
+
+
+NTSTATUS
+FsRecDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG ControlCode,
+ IN PVOID InputBuffer,
+ IN ULONG InputBufferSize,
+ IN OUT PVOID OutputBuffer,
+ IN OUT PULONG OutputBufferSize)
+{
+ ULONG BufferSize = 0;
+ PKEVENT Event;
+ PIRP Irp;
+ IO_STATUS_BLOCK IoStatus;
+ NTSTATUS Status;
+
+ if (OutputBufferSize != NULL)
+ {
+ BufferSize = *OutputBufferSize;
+ }
+
+ Event = ExAllocatePool(NonPagedPool, sizeof(KEVENT));
+ if (Event == NULL)
+ {
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ KeInitializeEvent(Event, NotificationEvent, FALSE);
+
+ DPRINT("Building device I/O control request ...\n");
+ Irp = IoBuildDeviceIoControlRequest(ControlCode,
+ DeviceObject,
+ InputBuffer,
+ InputBufferSize,
+ OutputBuffer,
+ BufferSize,
+ FALSE,
+ Event,
+ &IoStatus);
+ if (Irp == NULL)
+ {
+ DPRINT("IoBuildDeviceIoControlRequest() failed\n");
+ ExFreePool(Event);
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ DPRINT("Calling IO Driver... with irp %x\n", Irp);
+ Status = IoCallDriver(DeviceObject, Irp);
+ if (Status == STATUS_PENDING)
+ {
+ KeWaitForSingleObject(Event, Suspended, KernelMode, FALSE, NULL);
Status = IoStatus.Status;
}
- if (!NT_SUCCESS(Status))
+ if (OutputBufferSize)
{
- DPRINT("FsrecReadSectors() failed (Status %x)\n", Status);
- DPRINT("(DeviceObject %x, DiskSector %x, Buffer %x, Offset 0x%I64x)\n",
- DeviceObject, DiskSector, Buffer,
- Offset.QuadPart);
- return(Status);
+ *OutputBufferSize = BufferSize;
}
- DPRINT("Block request succeeded for %x\n", Irp);
+ ExFreePool(Event);
- return(STATUS_SUCCESS);
+ return(Status);
}
/* EOF */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: cdfs.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: cdfs.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
static NTSTATUS
FsRecIsCdfsVolume(IN PDEVICE_OBJECT DeviceObject)
{
+ DISK_GEOMETRY DiskGeometry;
PUCHAR Buffer;
NTSTATUS Status;
+ ULONG Size;
+
+ Size = sizeof(DISK_GEOMETRY);
+ Status = FsRecDeviceIoControl(DeviceObject,
+ IOCTL_CDROM_GET_DRIVE_GEOMETRY,
+ NULL,
+ 0,
+ &DiskGeometry,
+ &Size);
+ DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+ DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
Buffer = ExAllocatePool(NonPagedPool,
- 2048);
+ DiskGeometry.BytesPerSector);
if (Buffer == NULL)
{
return(STATUS_INSUFFICIENT_RESOURCES);
Status = FsRecReadSectors(DeviceObject,
16, /* CDFS_PVD_SECTOR */
1,
- 2048,
+ DiskGeometry.BytesPerSector,
Buffer);
if (!NT_SUCCESS(Status))
{
{
case IRP_MN_MOUNT_VOLUME:
DPRINT("Cdfs: IRP_MN_MOUNT_VOLUME\n");
-
Status = FsRecIsCdfsVolume(Stack->Parameters.MountVolume.DeviceObject);
if (NT_SUCCESS(Status))
{
case IRP_MN_LOAD_FILE_SYSTEM:
DPRINT("Cdfs: IRP_MN_LOAD_FILE_SYSTEM\n");
#if 0
- RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+ RtlInitUnicodeString(&RegistryPath,
+ L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Cdfs");
#endif
RtlInitUnicodeString(&RegistryPath,
L"\\SystemRoot\\system32\\drivers\\cdfs.sys");
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: fat.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: fat.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#include <ddk/ntddk.h>
-//#define NDEBUG
+#define NDEBUG
#include <debug.h>
#include "fs_rec.h"
/* FUNCTIONS ****************************************************************/
+static NTSTATUS
+FsRecIsFatVolume(IN PDEVICE_OBJECT DeviceObject)
+{
+ DISK_GEOMETRY DiskGeometry;
+ PUCHAR Buffer;
+ ULONG Size;
+ NTSTATUS Status;
+
+ Size = sizeof(DISK_GEOMETRY);
+ Status = FsRecDeviceIoControl(DeviceObject,
+ IOCTL_DISK_GET_DRIVE_GEOMETRY,
+ NULL,
+ 0,
+ &DiskGeometry,
+ &Size);
+ DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
+ Buffer = ExAllocatePool(NonPagedPool,
+ DiskGeometry.BytesPerSector);
+ if (Buffer == NULL)
+ {
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ Status = FsRecReadSectors(DeviceObject,
+ 0, /* Partition boot sector */
+ 1,
+ DiskGeometry.BytesPerSector,
+ Buffer);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ if ((strncmp(&Buffer[0x36], "FAT12", 5) == 0) ||
+ (strncmp(&Buffer[0x36], "FAT16", 5) == 0) ||
+ (strncmp(&Buffer[0x52], "FAT32", 5) == 0))
+ {
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ Status = STATUS_UNRECOGNIZED_VOLUME;
+ }
+
+ ExFreePool(Buffer);
+
+ return(Status);
+}
+
NTSTATUS
FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
switch (Stack->MinorFunction)
{
case IRP_MN_MOUNT_VOLUME:
- DPRINT("Fat: IRP_MN_MOUNT_VOLUME\n");
- Status = STATUS_INVALID_DEVICE_REQUEST;
-#if 0
+ DPRINT("FAT: IRP_MN_MOUNT_VOLUME\n");
Status = FsRecIsFatVolume(Stack->Parameters.MountVolume.DeviceObject);
if (NT_SUCCESS(Status))
{
DPRINT("Identified FAT volume\n");
Status = STATUS_FS_DRIVER_REQUIRED;
}
-#endif
break;
case IRP_MN_LOAD_FILE_SYSTEM:
- DPRINT("Fat: IRP_MN_LOAD_FILE_SYSTEM\n");
- Status = STATUS_INVALID_DEVICE_REQUEST;
+ DPRINT("FAT: IRP_MN_LOAD_FILE_SYSTEM\n");
#if 0
-#if 0
- RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+ RtlInitUnicodeString(&RegistryPath,
+ L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Vfatfs");
#endif
RtlInitUnicodeString(&RegistryPath,
L"\\SystemRoot\\system32\\drivers\\vfatfs.sys");
{
IoUnregisterFileSystem(DeviceObject);
}
-#endif
break;
default:
- DPRINT("Fat: Unknown minor function %lx\n", Stack->MinorFunction);
+ DPRINT("FAT: Unknown minor function %lx\n", Stack->MinorFunction);
Status = STATUS_INVALID_DEVICE_REQUEST;
break;
}
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: fs_rec.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: fs_rec.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
}
}
-#if 0
Status = FsRecRegisterFs(DriverObject,
L"\\Fat",
L"\\FileSystem\\FatRecognizer",
{
DeviceCount++;
}
-#endif
Status = FsRecRegisterFs(DriverObject,
L"\\Ntfs",
/*
- This is a File System Recognizer for RomFs.
- Copyright (C) 2001 Bo Brantén.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-
-//
-// Registry path for the FSD and this driver
-//
-
-#define FSD_REGISTRY_PATH \
- L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\RomFs"
-
-#define FSR_REGISTRY_PATH \
- L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\RomFsRec"
+ * ReactOS kernel
+ * Copyright (C) 2002 ReactOS Team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/* $Id: fs_rec.h,v 1.2 2002/05/15 18:02:59 ekohl Exp $
+ *
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS kernel
+ * FILE: services/fs/fs_rec/fs_rec.h
+ * PURPOSE: Filesystem recognizer driver
+ * PROGRAMMER: Eric Kohl
+ */
/* Filesystem types (add new filesystems here)*/
+
#define FS_TYPE_UNUSED 0
#define FS_TYPE_VFAT 1
#define FS_TYPE_NTFS 2
#define FS_TYPE_CDFS 3
-
typedef struct _DEVICE_EXTENSION
{
ULONG FsType;
IN ULONG SectorSize,
IN OUT PUCHAR Buffer);
+NTSTATUS
+FsRecDeviceIoControl(IN PDEVICE_OBJECT DeviceObject,
+ IN ULONG ControlCode,
+ IN PVOID InputBuffer,
+ IN ULONG InputBufferSize,
+ IN OUT PVOID OutputBuffer,
+ IN OUT PULONG OutputBufferSize);
+
/* cdfs.c */
IN PIRP Irp);
-/* ntfs.c */
+/* fat.c */
NTSTATUS
-FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
+FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
-/* vfat.c */
+/* ntfs.c */
NTSTATUS
-FsRecVfatFsControl(IN PDEVICE_OBJECT DeviceObject,
+FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp);
/* EOF */
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: ntfs.c,v 1.1 2002/05/15 09:40:47 ekohl Exp $
+/* $Id: ntfs.c,v 1.2 2002/05/15 18:02:59 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
#include <ddk/ntddk.h>
-//#define NDEBUG
+#define NDEBUG
#include <debug.h>
#include "fs_rec.h"
/* FUNCTIONS ****************************************************************/
+static NTSTATUS
+FsRecIsNtfsVolume(IN PDEVICE_OBJECT DeviceObject)
+{
+ DISK_GEOMETRY DiskGeometry;
+ PUCHAR Buffer;
+ ULONG Size;
+ NTSTATUS Status;
+
+ Size = sizeof(DISK_GEOMETRY);
+ Status = FsRecDeviceIoControl(DeviceObject,
+ IOCTL_DISK_GET_DRIVE_GEOMETRY,
+ NULL,
+ 0,
+ &DiskGeometry,
+ &Size);
+ DPRINT("FsRecDeviceIoControl() Status %lx\n", Status);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ DPRINT("BytesPerSector: %lu\n", DiskGeometry.BytesPerSector);
+ Buffer = ExAllocatePool(NonPagedPool,
+ DiskGeometry.BytesPerSector);
+ if (Buffer == NULL)
+ {
+ return(STATUS_INSUFFICIENT_RESOURCES);
+ }
+
+ Status = FsRecReadSectors(DeviceObject,
+ 0, /* Partition boot sector */
+ 1,
+ DiskGeometry.BytesPerSector,
+ Buffer);
+ if (!NT_SUCCESS(Status))
+ {
+ return(Status);
+ }
+
+ if (strncmp(&Buffer[3], "NTFS ", 8) == 0)
+ {
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ Status = STATUS_UNRECOGNIZED_VOLUME;
+ }
+
+ ExFreePool(Buffer);
+
+ return(Status);
+}
+
NTSTATUS
FsRecNtfsFsControl(IN PDEVICE_OBJECT DeviceObject,
{
case IRP_MN_MOUNT_VOLUME:
DPRINT("NTFS: IRP_MN_MOUNT_VOLUME\n");
- Status = STATUS_INVALID_DEVICE_REQUEST;
-#if 0
+
Status = FsRecIsNtfsVolume(Stack->Parameters.MountVolume.DeviceObject);
if (NT_SUCCESS(Status))
{
DPRINT("Identified NTFS volume\n");
Status = STATUS_FS_DRIVER_REQUIRED;
}
-#endif
break;
case IRP_MN_LOAD_FILE_SYSTEM:
DPRINT("NTFS: IRP_MN_LOAD_FILE_SYSTEM\n");
- Status = STATUS_INVALID_DEVICE_REQUEST;
#if 0
-#if 0
- RtlInitUnicodeString(&RegistryPath, FSD_REGISTRY_PATH);
+ RtlInitUnicodeString(&RegistryPath,
+ L"\\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Services\\Ntfs");
#endif
RtlInitUnicodeString(&RegistryPath,
L"\\SystemRoot\\system32\\drivers\\ntfs.sys");
{
IoUnregisterFileSystem(DeviceObject);
}
-#endif
break;
default:
-/* $Id: cleanup.c,v 1.3 2001/11/02 22:44:34 hbirr Exp $
+/* $Id: cleanup.c,v 1.4 2002/05/15 18:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
DPRINT("VfatCleanup(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
+ if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
+ {
+ Status = STATUS_SUCCESS;
+ goto ByeBye;
+ }
+
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
{
return VfatQueueRequest (IrpContext);
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
+ByeBye:
IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0;
-/* $Id: close.c,v 1.10 2002/05/05 20:18:33 hbirr Exp $
+/* $Id: close.c,v 1.11 2002/05/15 18:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
DPRINT ("VfatClose(DeviceObject %x, Irp %x)\n", DeviceObject, Irp);
+ if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
+ {
+ DPRINT("Closing file system\n");
+ Status = STATUS_SUCCESS;
+ goto ByeBye;
+ }
+
if (!ExAcquireResourceExclusiveLite (&IrpContext->DeviceExt->DirResource, IrpContext->Flags & IRPCONTEXT_CANWAIT))
{
return VfatQueueRequest (IrpContext);
Status = VfatCloseFile (IrpContext->DeviceExt, IrpContext->FileObject);
ExReleaseResourceLite (&IrpContext->DeviceExt->DirResource);
+ByeBye:
IrpContext->Irp->IoStatus.Status = Status;
IrpContext->Irp->IoStatus.Information = 0;
IoCompleteRequest (IrpContext->Irp, IO_NO_INCREMENT);
-/* $Id: create.c,v 1.40 2002/05/05 20:18:33 hbirr Exp $
+/* $Id: create.c,v 1.41 2002/05/15 18:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
assert (IrpContext);
- if (IrpContext->DeviceObject->Size == sizeof (DEVICE_OBJECT))
+// if (IrpContext->DeviceObject->Size == sizeof (DEVICE_OBJECT))
+ if (IrpContext->DeviceObject == VfatGlobalData->DeviceObject)
{
/* DeviceObject represents FileSystem instead of logical volume */
DPRINT ("FsdCreate called with file system\n");
-/* $Id: iface.c,v 1.62 2002/03/18 22:37:12 hbirr Exp $
+/* $Id: iface.c,v 1.63 2002/05/15 18:05:00 ekohl Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
DPRINT("VFAT 0.0.6\n");
RtlInitUnicodeString(&DeviceName,
- L"\\Device\\Vfat");
+ L"\\Fat");
Status = IoCreateDevice(DriverObject,
sizeof(VFAT_GLOBAL_DATA),
&DeviceName,