mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Use NT-compatible (VPB-based) mounting mechanism.
svn path=/trunk/; revision=2974
This commit is contained in:
parent
e5423f156b
commit
02fd65a6dc
6 changed files with 237 additions and 175 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: fsctl.c,v 1.6 2002/05/15 18:01:30 ekohl Exp $
|
/* $Id: fsctl.c,v 1.7 2002/05/23 09:52:00 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -35,7 +35,6 @@
|
||||||
|
|
||||||
#include "cdfs.h"
|
#include "cdfs.h"
|
||||||
|
|
||||||
|
|
||||||
/* FUNCTIONS ****************************************************************/
|
/* FUNCTIONS ****************************************************************/
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
|
@ -295,19 +294,15 @@ CdfsMountVolume(PDEVICE_OBJECT DeviceObject,
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
NewDeviceObject->StackSize = DeviceToMount->StackSize;
|
|
||||||
Vpb->DeviceObject = NewDeviceObject;
|
|
||||||
DeviceExt->Vpb = Vpb;
|
|
||||||
DeviceExt->StorageDevice = DeviceToMount;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NewDeviceObject->Vpb = DeviceToMount->Vpb;
|
NewDeviceObject->Vpb = DeviceToMount->Vpb;
|
||||||
NewDeviceObject->Vpb->Flags |= VPB_MOUNTED;
|
|
||||||
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(NewDeviceObject,
|
DeviceExt->StorageDevice = DeviceToMount;
|
||||||
DeviceToMount);
|
DeviceExt->StorageDevice->Vpb->DeviceObject = NewDeviceObject;
|
||||||
|
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||||
|
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||||
|
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
DeviceExt->StreamFileObject = IoCreateStreamFileObject(NULL,
|
||||||
DeviceExt->StorageDevice);
|
DeviceExt->StorageDevice);
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,14 @@ NTSTATUS Ext2Mount(PDEVICE_OBJECT DeviceToMount)
|
||||||
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
||||||
DeviceExt = (PVOID)DeviceObject->DeviceExtension;
|
DeviceExt = (PVOID)DeviceObject->DeviceExtension;
|
||||||
DPRINT("DeviceExt %x\n",DeviceExt);
|
DPRINT("DeviceExt %x\n",DeviceExt);
|
||||||
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject,
|
|
||||||
DeviceToMount);
|
DeviceExt->StorageDevice = DeviceToMount;
|
||||||
|
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
|
||||||
|
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||||
|
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||||
|
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
DPRINT("DeviceExt->StorageDevice %x\n", DeviceExt->StorageDevice);
|
DPRINT("DeviceExt->StorageDevice %x\n", DeviceExt->StorageDevice);
|
||||||
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||||
DeviceExt->superblock = superblock;
|
DeviceExt->superblock = superblock;
|
||||||
|
|
|
@ -42,25 +42,30 @@ static PDRIVER_OBJECT DriverObject;
|
||||||
|
|
||||||
VOID MinixMount(PDEVICE_OBJECT DeviceToMount)
|
VOID MinixMount(PDEVICE_OBJECT DeviceToMount)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
MINIX_DEVICE_EXTENSION* DeviceExt;
|
MINIX_DEVICE_EXTENSION* DeviceExt;
|
||||||
|
|
||||||
IoCreateDevice(DriverObject,
|
IoCreateDevice(DriverObject,
|
||||||
sizeof(MINIX_DEVICE_EXTENSION),
|
sizeof(MINIX_DEVICE_EXTENSION),
|
||||||
NULL,
|
NULL,
|
||||||
FILE_DEVICE_FILE_SYSTEM,
|
FILE_DEVICE_FILE_SYSTEM,
|
||||||
0,
|
0,
|
||||||
FALSE,
|
FALSE,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
||||||
DeviceExt = DeviceObject->DeviceExtension;
|
DeviceExt = DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf);
|
MinixReadSector(DeviceToMount,1,DeviceExt->superblock_buf);
|
||||||
DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf);
|
DeviceExt->sb = (struct minix_super_block *)(DeviceExt->superblock_buf);
|
||||||
|
|
||||||
DeviceExt->AttachedDevice = IoAttachDeviceToDeviceStack(DeviceObject,
|
DeviceExt->StorageDevice = DeviceToMount;
|
||||||
DeviceToMount);
|
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
|
||||||
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||||
|
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||||
|
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
|
DeviceExt->FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
|
|
|
@ -1,4 +1,23 @@
|
||||||
/*
|
/*
|
||||||
|
* 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: template.c,v 1.3 2002/05/23 09:52:56 ekohl Exp $
|
||||||
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
* FILE: services/fs/template/template.c
|
* FILE: services/fs/template/template.c
|
||||||
|
@ -19,7 +38,7 @@ typedef struct
|
||||||
PDEVICE_OBJECT StorageDevice;
|
PDEVICE_OBJECT StorageDevice;
|
||||||
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
} DEVICE_EXTENSION, *PDEVICE_EXTENSION;
|
||||||
|
|
||||||
/* GLOBALS *****************************************************************/
|
/* GLOBALS ******************************************************************/
|
||||||
|
|
||||||
static PDRIVER_OBJECT DriverObject;
|
static PDRIVER_OBJECT DriverObject;
|
||||||
|
|
||||||
|
@ -32,9 +51,10 @@ FsdCloseFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
* FUNCTION: Closes a file
|
* FUNCTION: Closes a file
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
|
FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
PFILE_OBJECT FileObject,
|
PFILE_OBJECT FileObject,
|
||||||
|
@ -43,9 +63,10 @@ FsdOpenFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
* FUNCTION: Opens a file
|
* FUNCTION: Opens a file
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||||
/*
|
/*
|
||||||
|
@ -53,9 +74,10 @@ FsdHasFileSystem(PDEVICE_OBJECT DeviceToMount)
|
||||||
* by this fsd
|
* by this fsd
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
|
FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
|
||||||
PDEVICE_OBJECT DeviceToMount)
|
PDEVICE_OBJECT DeviceToMount)
|
||||||
|
@ -63,7 +85,7 @@ FsdMountDevice(PDEVICE_EXTENSION DeviceExt,
|
||||||
* FUNCTION: Mounts the device
|
* FUNCTION: Mounts the device
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,7 +99,7 @@ FsdReadFile(PDEVICE_EXTENSION DeviceExt,
|
||||||
* FUNCTION: Reads data from a file
|
* FUNCTION: Reads data from a file
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,37 +107,38 @@ NTSTATUS STDCALL
|
||||||
FsdClose(PDEVICE_OBJECT DeviceObject,
|
FsdClose(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
PFILE_OBJECT FileObject = Stack->FileObject;
|
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||||
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
PDEVICE_EXTENSION DeviceExtension = DeviceObject->DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = FsdCloseFile(DeviceExtension,FileObject);
|
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Status = FsdCloseFile(DeviceExtension,FileObject);
|
||||||
Irp->IoStatus.Information = 0;
|
|
||||||
|
Irp->IoStatus.Status = Status;
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
Irp->IoStatus.Information = 0;
|
||||||
return(Status);
|
|
||||||
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
FsdCreate(PDEVICE_OBJECT DeviceObject,
|
FsdCreate(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
PFILE_OBJECT FileObject = Stack->FileObject;
|
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDEVICE_EXTENSION DeviceExt;
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
DeviceExt = DeviceObject->DeviceExtension;
|
DeviceExt = DeviceObject->DeviceExtension;
|
||||||
Status = FsdOpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer);
|
Status = FsdOpenFile(DeviceExt,FileObject,FileObject->FileName.Buffer);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,89 +146,96 @@ NTSTATUS STDCALL
|
||||||
FsdWrite(PDEVICE_OBJECT DeviceObject,
|
FsdWrite(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
DPRINT("FsdWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
DPRINT("FsdWrite(DeviceObject %x Irp %x)\n",DeviceObject,Irp);
|
||||||
|
|
||||||
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
return(STATUS_UNSUCCESSFUL);
|
return(STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
FsdRead(PDEVICE_OBJECT DeviceObject,
|
FsdRead(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
PVOID Buffer;
|
PVOID Buffer;
|
||||||
ULONG Offset;
|
ULONG Offset;
|
||||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
PFILE_OBJECT FileObject = Stack->FileObject;
|
PFILE_OBJECT FileObject = Stack->FileObject;
|
||||||
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
PDEVICE_EXTENSION DeviceExt = DeviceObject->DeviceExtension;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("FsdRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
DPRINT("FsdRead(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||||
|
|
||||||
Length = Stack->Parameters.Read.Length;
|
Length = Stack->Parameters.Read.Length;
|
||||||
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
|
||||||
Offset = Stack->Parameters.Read.ByteOffset.LowPart;
|
Offset = Stack->Parameters.Read.ByteOffset.LowPart;
|
||||||
|
|
||||||
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset);
|
Status = FsdReadFile(DeviceExt,FileObject,Buffer,Length,Offset);
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = Length;
|
Irp->IoStatus.Information = Length;
|
||||||
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
IoCompleteRequest(Irp,IO_NO_INCREMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
FsdMount(PDEVICE_OBJECT DeviceToMount)
|
FsdMount(PDEVICE_OBJECT DeviceToMount)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PDEVICE_EXTENSION DeviceExt;
|
PDEVICE_EXTENSION DeviceExt;
|
||||||
|
|
||||||
IoCreateDevice(DriverObject,
|
IoCreateDevice(DriverObject,
|
||||||
sizeof(DEVICE_EXTENSION),
|
sizeof(DEVICE_EXTENSION),
|
||||||
NULL,
|
NULL,
|
||||||
FILE_DEVICE_FILE_SYSTEM,
|
FILE_DEVICE_FILE_SYSTEM,
|
||||||
0,
|
0,
|
||||||
FALSE,
|
FALSE,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
DeviceObject->Flags = DeviceObject->Flags | DO_DIRECT_IO;
|
||||||
DeviceExt = (PVOID)DeviceObject->DeviceExtension;
|
DeviceExt = (PVOID)DeviceObject->DeviceExtension;
|
||||||
|
|
||||||
FsdMountDevice(DeviceExt,
|
FsdMountDevice(DeviceExt,
|
||||||
DeviceToMount);
|
DeviceToMount);
|
||||||
|
|
||||||
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject,
|
DeviceExt->StorageDevice = DeviceToMount;
|
||||||
DeviceToMount);
|
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
|
||||||
return(STATUS_SUCCESS);
|
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||||
|
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||||
|
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
FsdFileSystemControl(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
PIO_STACK_LOCATION Stack = IoGetCurrentIrpStackLocation(Irp);
|
||||||
PVPB vpb = Stack->Parameters.Mount.Vpb;
|
PVPB vpb = Stack->Parameters.Mount.Vpb;
|
||||||
PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject;
|
PDEVICE_OBJECT DeviceToMount = Stack->Parameters.Mount.DeviceObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
if (FsdHasFileSystem(DeviceToMount))
|
if (FsdHasFileSystem(DeviceToMount))
|
||||||
{
|
{
|
||||||
Status = FsdMount(DeviceToMount);
|
Status = FsdMount(DeviceToMount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Status = STATUS_UNRECOGNIZED_VOLUME;
|
Status = STATUS_UNRECOGNIZED_VOLUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->IoStatus.Status = Status;
|
Irp->IoStatus.Status = Status;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
DriverEntry(PDRIVER_OBJECT _DriverObject,
|
DriverEntry(PDRIVER_OBJECT _DriverObject,
|
||||||
PUNICODE_STRING RegistryPath)
|
PUNICODE_STRING RegistryPath)
|
||||||
|
@ -217,39 +247,40 @@ DriverEntry(PDRIVER_OBJECT _DriverObject,
|
||||||
* RETURNS: Success or failure
|
* RETURNS: Success or failure
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING DeviceName;
|
UNICODE_STRING DeviceName;
|
||||||
|
|
||||||
DbgPrint("Bare FSD Template 0.0.1\n");
|
DbgPrint("Bare FSD Template 0.0.1\n");
|
||||||
|
|
||||||
DriverObject = _DriverObject;
|
DriverObject = _DriverObject;
|
||||||
|
|
||||||
RtlInitUnicodeString(&DeviceName,
|
RtlInitUnicodeString(&DeviceName,
|
||||||
L"\\Device\\BareFsd");
|
L"\\Device\\BareFsd");
|
||||||
Status = IoCreateDevice(DriverObject,
|
Status = IoCreateDevice(DriverObject,
|
||||||
0,
|
0,
|
||||||
&DeviceName,
|
&DeviceName,
|
||||||
FILE_DEVICE_FILE_SYSTEM,
|
FILE_DEVICE_FILE_SYSTEM,
|
||||||
0,
|
0,
|
||||||
FALSE,
|
FALSE,
|
||||||
&DeviceObject);
|
&DeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(ret);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceObject->Flags=0;
|
DeviceObject->Flags=0;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CLOSE] = FsdClose;
|
DriverObject->MajorFunction[IRP_MJ_CLOSE] = FsdClose;
|
||||||
DriverObject->MajorFunction[IRP_MJ_CREATE] = FsdCreate;
|
DriverObject->MajorFunction[IRP_MJ_CREATE] = FsdCreate;
|
||||||
DriverObject->MajorFunction[IRP_MJ_READ] = FsdRead;
|
DriverObject->MajorFunction[IRP_MJ_READ] = FsdRead;
|
||||||
DriverObject->MajorFunction[IRP_MJ_WRITE] = FsdWrite;
|
DriverObject->MajorFunction[IRP_MJ_WRITE] = FsdWrite;
|
||||||
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
DriverObject->MajorFunction[IRP_MJ_FILE_SYSTEM_CONTROL] =
|
||||||
FsdFileSystemControl;
|
FsdFileSystemControl;
|
||||||
DriverObject->DriverUnload = NULL;
|
DriverObject->DriverUnload = NULL;
|
||||||
|
|
||||||
IoRegisterFileSystem(DeviceObject);
|
IoRegisterFileSystem(DeviceObject);
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
/* $Id: fsctl.c,v 1.3 2002/05/05 20:19:14 hbirr Exp $
|
/*
|
||||||
|
* 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: fsctl.c,v 1.4 2002/05/23 09:53:26 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -254,8 +272,15 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
DbgPrint("RootCluster: %d\n", DeviceExt->FatInfo.RootCluster);
|
DbgPrint("RootCluster: %d\n", DeviceExt->FatInfo.RootCluster);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
|
|
||||||
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.MountVolume.DeviceObject);
|
DeviceExt->StorageDevice = IrpContext->Stack->Parameters.MountVolume.DeviceObject;
|
||||||
|
DeviceExt->StorageDevice->Vpb->DeviceObject = DeviceObject;
|
||||||
|
DeviceExt->StorageDevice->Vpb->RealDevice = DeviceExt->StorageDevice;
|
||||||
|
DeviceExt->StorageDevice->Vpb->Flags |= VPB_MOUNTED;
|
||||||
|
DeviceObject->StackSize = DeviceExt->StorageDevice->StackSize + 1;
|
||||||
|
DeviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
|
||||||
|
|
||||||
|
DPRINT("FsDeviceObject %lx\n", DeviceObject);
|
||||||
|
|
||||||
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
||||||
Fcb = vfatNewFCB(NULL);
|
Fcb = vfatNewFCB(NULL);
|
||||||
|
@ -334,7 +359,6 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
ReadVolumeLabel(DeviceExt, DeviceObject->Vpb);
|
ReadVolumeLabel(DeviceExt, DeviceObject->Vpb);
|
||||||
|
|
||||||
Status = STATUS_SUCCESS;
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
ByeBye:
|
ByeBye:
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.57 2002/05/15 09:39:02 ekohl Exp $
|
/* $Id: create.c,v 1.58 2002/05/23 09:51:11 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -139,8 +139,9 @@ IopCreateFile(PVOID ObjectBody,
|
||||||
Status);
|
Status);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
DeviceObject = IoGetAttachedDevice(DeviceObject);
|
|
||||||
}
|
}
|
||||||
|
DeviceObject = DeviceObject->Vpb->DeviceObject;
|
||||||
|
DPRINT("FsDeviceObject %lx\n", DeviceObject);
|
||||||
}
|
}
|
||||||
RtlCreateUnicodeString(&(FileObject->FileName),
|
RtlCreateUnicodeString(&(FileObject->FileName),
|
||||||
RemainingPath);
|
RemainingPath);
|
||||||
|
@ -189,7 +190,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||||
|
|
||||||
DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",
|
DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",
|
||||||
FileObject, DeviceObject);
|
FileObject, DeviceObject);
|
||||||
|
|
||||||
assert_irql(PASSIVE_LEVEL);
|
assert_irql(PASSIVE_LEVEL);
|
||||||
|
|
||||||
Status = ObCreateObject(&FileHandle,
|
Status = ObCreateObject(&FileHandle,
|
||||||
|
@ -202,7 +203,7 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||||
DPRINT("Could not create FileObject\n");
|
DPRINT("Could not create FileObject\n");
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FileObject != NULL)
|
if (FileObject != NULL)
|
||||||
{
|
{
|
||||||
DeviceObject = FileObject->DeviceObject;
|
DeviceObject = FileObject->DeviceObject;
|
||||||
|
@ -211,16 +212,16 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||||
|
|
||||||
DPRINT("DeviceObject %x\n", DeviceObject);
|
DPRINT("DeviceObject %x\n", DeviceObject);
|
||||||
|
|
||||||
CreatedFileObject->DeviceObject = DeviceObject;
|
CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject;
|
||||||
CreatedFileObject->Vpb = DeviceObject->Vpb;
|
CreatedFileObject->Vpb = DeviceObject->Vpb;
|
||||||
CreatedFileObject->Type = InternalFileType;
|
CreatedFileObject->Type = InternalFileType;
|
||||||
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||||
|
|
||||||
// shouldn't we initialize the lock event, and several other things here too?
|
// shouldn't we initialize the lock event, and several other things here too?
|
||||||
KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
|
KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
|
||||||
|
|
||||||
ZwClose(FileHandle);
|
ZwClose(FileHandle);
|
||||||
|
|
||||||
return(CreatedFileObject);
|
return(CreatedFileObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,8 +333,8 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
(PVOID*)&FileObject);
|
(PVOID*)&FileObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("ObCreateObject() failed!\n");
|
DPRINT("ObCreateObject() failed! (Status %lx)\n", Status);
|
||||||
return (Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT)
|
if (CreateOptions & FILE_SYNCHRONOUS_IO_ALERT)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue