mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 21:32:56 +00:00
Moved IoVerifyVolume().
Made CDROM and TAPE devices mountable. svn path=/trunk/; revision=2837
This commit is contained in:
parent
b6a1093b95
commit
62b86daaf8
10 changed files with 468 additions and 371 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fsctl.c,v 1.1 2002/03/18 22:37:13 hbirr Exp $
|
/* $Id: fsctl.c,v 1.2 2002/04/10 09:58:45 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -202,7 +202,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = VfatHasFileSystem (IrpContext->Stack->Parameters.Mount.DeviceObject, &RecognizedFS, NULL);
|
Status = VfatHasFileSystem (IrpContext->Stack->Parameters.MountVolume.DeviceObject, &RecognizedFS, NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
goto ByeBye;
|
goto ByeBye;
|
||||||
|
@ -233,8 +233,8 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
RtlZeroMemory(DeviceExt, sizeof(DEVICE_EXTENSION));
|
RtlZeroMemory(DeviceExt, sizeof(DEVICE_EXTENSION));
|
||||||
|
|
||||||
/* use same vpb as device disk */
|
/* use same vpb as device disk */
|
||||||
DeviceObject->Vpb = IrpContext->Stack->Parameters.Mount.DeviceObject->Vpb;
|
DeviceObject->Vpb = IrpContext->Stack->Parameters.MountVolume.DeviceObject->Vpb;
|
||||||
Status = VfatMountDevice(DeviceExt, IrpContext->Stack->Parameters.Mount.DeviceObject);
|
Status = VfatMountDevice(DeviceExt, IrpContext->Stack->Parameters.MountVolume.DeviceObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* FIXME: delete device object */
|
/* FIXME: delete device object */
|
||||||
|
@ -254,7 +254,7 @@ VfatMount (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
|
DeviceObject->Vpb->Flags |= VPB_MOUNTED;
|
||||||
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.Mount.DeviceObject);
|
DeviceExt->StorageDevice = IoAttachDeviceToDeviceStack(DeviceObject, IrpContext->Stack->Parameters.MountVolume.DeviceObject);
|
||||||
|
|
||||||
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
DeviceExt->FATFileObject = IoCreateStreamFileObject(NULL, DeviceExt->StorageDevice);
|
||||||
Fcb = vfatNewFCB(NULL);
|
Fcb = vfatNewFCB(NULL);
|
||||||
|
@ -334,6 +334,21 @@ ByeBye:
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static NTSTATUS
|
||||||
|
VfatVerify (PVFAT_IRP_CONTEXT IrpContext)
|
||||||
|
/*
|
||||||
|
* FUNCTION: Mount the filesystem
|
||||||
|
*/
|
||||||
|
{
|
||||||
|
DPRINT("VfatVerify(IrpContext %x)\n", IrpContext);
|
||||||
|
|
||||||
|
assert(IrpContext);
|
||||||
|
|
||||||
|
return(STATUS_INVALID_DEVICE_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext)
|
NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: File system control
|
* FUNCTION: File system control
|
||||||
|
@ -358,8 +373,7 @@ NTSTATUS VfatFileSystemControl(PVFAT_IRP_CONTEXT IrpContext)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_VERIFY_VOLUME:
|
case IRP_MN_VERIFY_VOLUME:
|
||||||
DPRINT("VFAT FSC: IRP_MN_VERIFY_VOLUME\n");
|
Status = VfatVerify(IrpContext);
|
||||||
Status = STATUS_INVALID_DEVICE_REQUEST;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef _INCLUDE_DDK_IOFUNCS_H
|
#ifndef _INCLUDE_DDK_IOFUNCS_H
|
||||||
#define _INCLUDE_DDK_IOFUNCS_H
|
#define _INCLUDE_DDK_IOFUNCS_H
|
||||||
/* $Id: iofuncs.h,v 1.29 2002/01/21 22:27:36 hbirr Exp $ */
|
/* $Id: iofuncs.h,v 1.30 2002/04/10 09:55:10 ekohl Exp $ */
|
||||||
|
|
||||||
/* --- EXPORTED BY NTOSKRNL --- */
|
/* --- EXPORTED BY NTOSKRNL --- */
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ IoQueryVolumeInformation (
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
IoQueueThreadIrp (
|
IoQueueThreadIrp (
|
||||||
PVOID Unknown0
|
IN PIRP Irp
|
||||||
);
|
);
|
||||||
VOID
|
VOID
|
||||||
STDCALL
|
STDCALL
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: iotypes.h,v 1.35 2002/03/25 21:53:27 ekohl Exp $
|
/* $Id: iotypes.h,v 1.36 2002/04/10 09:55:10 ekohl Exp $
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ typedef struct __attribute__((packed)) _IO_STACK_LOCATION
|
||||||
{
|
{
|
||||||
struct _VPB* Vpb;
|
struct _VPB* Vpb;
|
||||||
struct _DEVICE_OBJECT* DeviceObject;
|
struct _DEVICE_OBJECT* DeviceObject;
|
||||||
} Mount;
|
} MountVolume;
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct _VPB* Vpb;
|
struct _VPB* Vpb;
|
||||||
|
|
|
@ -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: io.h,v 1.17 2002/03/15 23:59:05 ekohl Exp $
|
/* $Id: io.h,v 1.18 2002/04/10 09:58:02 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,7 +254,7 @@ NTSTATUS
|
||||||
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
|
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode);
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
PDEVICE_NODE DeviceNode);
|
PDEVICE_NODE DeviceNode);
|
||||||
VOID
|
VOID
|
||||||
IoInitCancelHandling(VOID);
|
IoInitCancelHandling(VOID);
|
||||||
VOID
|
VOID
|
||||||
|
@ -264,7 +264,9 @@ IoInitFileSystemImplementation(VOID);
|
||||||
VOID
|
VOID
|
||||||
IoInitVpbImplementation (VOID);
|
IoInitVpbImplementation (VOID);
|
||||||
|
|
||||||
NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject);
|
NTSTATUS
|
||||||
|
IoTryToMountStorageDevice(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN BOOLEAN AllowRawMount);
|
||||||
POBJECT IoOpenSymlink(POBJECT SymbolicLink);
|
POBJECT IoOpenSymlink(POBJECT SymbolicLink);
|
||||||
POBJECT IoOpenFileOnDevice(POBJECT SymbolicLink, PWCHAR Name);
|
POBJECT IoOpenFileOnDevice(POBJECT SymbolicLink, PWCHAR Name);
|
||||||
|
|
||||||
|
@ -300,16 +302,17 @@ VOID IoShutdownRegisteredDevices(VOID);
|
||||||
VOID IoShutdownRegisteredFileSystems(VOID);
|
VOID IoShutdownRegisteredFileSystems(VOID);
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
IoPageRead (PFILE_OBJECT FileObject,
|
IoPageRead(PFILE_OBJECT FileObject,
|
||||||
|
PMDL Mdl,
|
||||||
|
PLARGE_INTEGER Offset,
|
||||||
|
PIO_STATUS_BLOCK StatusBlock,
|
||||||
|
BOOLEAN PagingIo);
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
IoPageWrite(PFILE_OBJECT FileObject,
|
||||||
PMDL Mdl,
|
PMDL Mdl,
|
||||||
PLARGE_INTEGER Offset,
|
PLARGE_INTEGER Offset,
|
||||||
PIO_STATUS_BLOCK StatusBlock,
|
PIO_STATUS_BLOCK StatusBlock,
|
||||||
BOOLEAN PagingIo);
|
BOOLEAN PagingIo);
|
||||||
NTSTATUS STDCALL IoPageWrite (PFILE_OBJECT FileObject,
|
|
||||||
PMDL Mdl,
|
|
||||||
PLARGE_INTEGER Offset,
|
|
||||||
PIO_STATUS_BLOCK StatusBlock,
|
|
||||||
BOOLEAN PagingIo);
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IoCreateArcNames(VOID);
|
IoCreateArcNames(VOID);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: buildirp.c,v 1.26 2002/03/17 17:21:44 hbirr Exp $
|
/* $Id: buildirp.c,v 1.27 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -81,8 +81,8 @@ PIRP IoBuildFilesystemControlRequest(ULONG MinorFunction,
|
||||||
* DeviceObject = Device object to send the request to
|
* DeviceObject = Device object to send the request to
|
||||||
* UserEvent = Event used to notify the caller of completion
|
* UserEvent = Event used to notify the caller of completion
|
||||||
* IoStatusBlock (OUT) = Used to return the status of the operation
|
* IoStatusBlock (OUT) = Used to return the status of the operation
|
||||||
* DeviceToMount = Device to mount (for the IRP_MN_MOUNT_DEVICE
|
* DeviceToMount = Device to mount (for the IRP_MN_MOUNT_VOLUME
|
||||||
* request)
|
* or IRP_MN_VERIFY_VOLUME request)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
@ -114,11 +114,13 @@ PIRP IoBuildFilesystemControlRequest(ULONG MinorFunction,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_MOUNT_VOLUME:
|
case IRP_MN_MOUNT_VOLUME:
|
||||||
StackPtr->Parameters.Mount.Vpb = DeviceToMount->Vpb;
|
StackPtr->Parameters.MountVolume.Vpb = DeviceToMount->Vpb;
|
||||||
StackPtr->Parameters.Mount.DeviceObject = DeviceToMount;
|
StackPtr->Parameters.MountVolume.DeviceObject = DeviceToMount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_VERIFY_VOLUME:
|
case IRP_MN_VERIFY_VOLUME:
|
||||||
|
StackPtr->Parameters.VerifyVolume.Vpb = DeviceToMount->Vpb;
|
||||||
|
StackPtr->Parameters.VerifyVolume.DeviceObject = DeviceToMount;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IRP_MN_LOAD_FILE_SYSTEM:
|
case IRP_MN_LOAD_FILE_SYSTEM:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.55 2002/04/07 18:36:13 phreak Exp $
|
/* $Id: create.c,v 1.56 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes)
|
NtDeleteFile(IN POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,91 +67,95 @@ IopCreateFile(PVOID ObjectBody,
|
||||||
PWSTR RemainingPath,
|
PWSTR RemainingPath,
|
||||||
POBJECT_ATTRIBUTES ObjectAttributes)
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) Parent;
|
PDEVICE_OBJECT DeviceObject = (PDEVICE_OBJECT) Parent;
|
||||||
PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
|
PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
DPRINT("IopCreateFile(ObjectBody %x, Parent %x, RemainingPath %S)\n",
|
||||||
ObjectBody,
|
ObjectBody,
|
||||||
Parent,
|
Parent,
|
||||||
RemainingPath);
|
RemainingPath);
|
||||||
|
|
||||||
if (NULL == DeviceObject)
|
if (NULL == DeviceObject)
|
||||||
{
|
{
|
||||||
/* This is probably an attempt to create a meta fileobject (eg. for FAT)
|
/* This is probably an attempt to create a meta fileobject (eg. for FAT)
|
||||||
for the cache manager, so return STATUS_SUCCESS */
|
for the cache manager, so return STATUS_SUCCESS */
|
||||||
DPRINT("DeviceObject was NULL\n");
|
DPRINT("DeviceObject was NULL\n");
|
||||||
return (STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
if (IoDeviceObjectType != BODY_TO_HEADER(Parent)->ObjectType)
|
|
||||||
{
|
|
||||||
CPRINT("Parent is a %S which is not a device type\n",
|
|
||||||
BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
|
|
||||||
return (STATUS_UNSUCCESSFUL);
|
|
||||||
}
|
|
||||||
Status = ObReferenceObjectByPointer (DeviceObject,
|
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
|
||||||
IoDeviceObjectType,
|
|
||||||
UserMode);
|
|
||||||
if (STATUS_SUCCESS != Status)
|
|
||||||
{
|
|
||||||
CHECKPOINT1;
|
|
||||||
return (Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceObject = IoGetAttachedDevice (DeviceObject);
|
if (IoDeviceObjectType != BODY_TO_HEADER(Parent)->ObjectType)
|
||||||
|
{
|
||||||
|
CPRINT("Parent is a %S which is not a device type\n",
|
||||||
|
BODY_TO_HEADER(Parent)->ObjectType->TypeName.Buffer);
|
||||||
|
return(STATUS_UNSUCCESSFUL);
|
||||||
|
}
|
||||||
|
|
||||||
DPRINT("DeviceObject %x\n", DeviceObject);
|
Status = ObReferenceObjectByPointer(DeviceObject,
|
||||||
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
|
IoDeviceObjectType,
|
||||||
|
UserMode);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
CPRINT("Failed to reference device object %x\n", DeviceObject);
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
if (NULL == RemainingPath)
|
DeviceObject = IoGetAttachedDevice(DeviceObject);
|
||||||
{
|
DPRINT("DeviceObject %x\n", DeviceObject);
|
||||||
FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
|
|
||||||
FileObject->FileName.Buffer = 0;
|
|
||||||
FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM)
|
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_DISK)
|
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_NETWORK)
|
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
|
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
|
|
||||||
{
|
|
||||||
CPRINT ("Device was wrong type\n");
|
|
||||||
return (STATUS_UNSUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK
|
if (NULL == RemainingPath)
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
|
{
|
||||||
&& (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
|
FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
|
||||||
{
|
FileObject->FileName.Buffer = 0;
|
||||||
if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
|
FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
|
||||||
{
|
}
|
||||||
DPRINT("Trying to mount storage device\n");
|
else
|
||||||
Status = IoTryToMountStorageDevice (DeviceObject);
|
{
|
||||||
DPRINT("Status %x\n", Status);
|
if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM)
|
||||||
if (!NT_SUCCESS(Status))
|
&& (DeviceObject->DeviceType != FILE_DEVICE_DISK)
|
||||||
{
|
&& (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM)
|
||||||
CPRINT("Failed to mount storage device (status %x)\n",
|
&& (DeviceObject->DeviceType != FILE_DEVICE_TAPE)
|
||||||
Status);
|
&& (DeviceObject->DeviceType != FILE_DEVICE_NETWORK)
|
||||||
return (Status);
|
&& (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
|
||||||
}
|
&& (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
|
||||||
DeviceObject = IoGetAttachedDevice(DeviceObject);
|
{
|
||||||
}
|
CPRINT("Device was wrong type\n");
|
||||||
}
|
return(STATUS_UNSUCCESSFUL);
|
||||||
RtlCreateUnicodeString(&(FileObject->FileName),
|
}
|
||||||
RemainingPath);
|
|
||||||
}
|
|
||||||
DPRINT("FileObject->FileName.Buffer %S\n",
|
|
||||||
FileObject->FileName.Buffer);
|
|
||||||
FileObject->DeviceObject = DeviceObject;
|
|
||||||
DPRINT("FileObject %x DeviceObject %x\n",
|
|
||||||
FileObject,
|
|
||||||
DeviceObject);
|
|
||||||
FileObject->Vpb = DeviceObject->Vpb;
|
|
||||||
FileObject->Type = InternalFileType;
|
|
||||||
|
|
||||||
return (STATUS_SUCCESS);
|
if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK
|
||||||
|
&& (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
|
||||||
|
&& (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
|
||||||
|
{
|
||||||
|
if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
|
||||||
|
{
|
||||||
|
DPRINT("Trying to mount storage device\n");
|
||||||
|
Status = IoTryToMountStorageDevice(DeviceObject, FALSE);
|
||||||
|
DPRINT("Status %x\n", Status);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
CPRINT("Failed to mount storage device (status %x)\n",
|
||||||
|
Status);
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
DeviceObject = IoGetAttachedDevice(DeviceObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RtlCreateUnicodeString(&(FileObject->FileName),
|
||||||
|
RemainingPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("FileObject->FileName %wZ\n",
|
||||||
|
&FileObject->FileName);
|
||||||
|
FileObject->DeviceObject = DeviceObject;
|
||||||
|
DPRINT("FileObject %x DeviceObject %x\n",
|
||||||
|
FileObject,
|
||||||
|
DeviceObject);
|
||||||
|
FileObject->Vpb = DeviceObject->Vpb;
|
||||||
|
FileObject->Type = InternalFileType;
|
||||||
|
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,15 +188,15 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
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,
|
||||||
STANDARD_RIGHTS_REQUIRED,
|
STANDARD_RIGHTS_REQUIRED,
|
||||||
NULL,
|
NULL,
|
||||||
IoFileObjectType,
|
IoFileObjectType,
|
||||||
(PVOID*)&CreatedFileObject);
|
(PVOID*)&CreatedFileObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Could not create FileObject\n");
|
DPRINT("Could not create FileObject\n");
|
||||||
|
@ -213,11 +217,11 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: device.c,v 1.36 2002/03/24 15:30:44 ekohl Exp $
|
/* $Id: device.c,v 1.37 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -274,17 +274,19 @@ IoRegisterDriverReinitialization(PDRIVER_OBJECT DriverObject,
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
IopDefaultDispatchFunction(PDEVICE_OBJECT DeviceObject,
|
IopDefaultDispatchFunction(PDEVICE_OBJECT DeviceObject,
|
||||||
PIRP Irp)
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
|
|
||||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject)
|
IopCreateDriverObject(PDRIVER_OBJECT *DriverObject)
|
||||||
{
|
{
|
||||||
|
@ -458,8 +460,7 @@ IopInitializeService(
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializeDeviceNodeService(
|
IopInitializeDeviceNodeService(PDEVICE_NODE DeviceNode)
|
||||||
PDEVICE_NODE DeviceNode)
|
|
||||||
{
|
{
|
||||||
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
RTL_QUERY_REGISTRY_TABLE QueryTable[2];
|
||||||
UNICODE_STRING ImagePath;
|
UNICODE_STRING ImagePath;
|
||||||
|
@ -473,8 +474,8 @@ IopInitializeDeviceNodeService(
|
||||||
&KeyHandle);
|
&KeyHandle);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("RtlpGetRegistryHandle() failed (Status %x)\n", Status);
|
DPRINT("RtlpGetRegistryHandle() failed (Status %x)\n", Status);
|
||||||
return Status;
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
RtlZeroMemory(QueryTable, sizeof(QueryTable));
|
||||||
|
@ -496,20 +497,20 @@ IopInitializeDeviceNodeService(
|
||||||
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
|
DPRINT("RtlQueryRegistryValues() returned status %x\n", Status);
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
|
DPRINT("Got ImagePath %S\n", ImagePath.Buffer);
|
||||||
|
|
||||||
Status = IopInitializeService(DeviceNode, &ImagePath);
|
Status = IopInitializeService(DeviceNode, &ImagePath);
|
||||||
|
|
||||||
RtlFreeUnicodeString(&ImagePath);
|
RtlFreeUnicodeString(&ImagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Status;
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
PDEVICE_NODE DeviceNode)
|
PDEVICE_NODE DeviceNode)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Called to initalize a loaded driver
|
* FUNCTION: Called to initalize a loaded driver
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -528,21 +529,21 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
Status = IopCreateDriverObject(&DriverObject);
|
Status = IopCreateDriverObject(&DriverObject);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceNode->DriverObject = DriverObject;
|
DeviceNode->DriverObject = DriverObject;
|
||||||
|
|
||||||
if (DeviceNode->ServiceName.Buffer)
|
if (DeviceNode->ServiceName.Buffer)
|
||||||
{
|
{
|
||||||
wcscpy(RegistryKeyBuffer, DRIVER_REGISTRY_KEY_BASENAME);
|
wcscpy(RegistryKeyBuffer, DRIVER_REGISTRY_KEY_BASENAME);
|
||||||
wcscat(RegistryKeyBuffer, DeviceNode->ServiceName.Buffer);
|
wcscat(RegistryKeyBuffer, DeviceNode->ServiceName.Buffer);
|
||||||
RtlInitUnicodeString(&RegistryKey, RegistryKeyBuffer);
|
RtlInitUnicodeString(&RegistryKey, RegistryKeyBuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RtlInitUnicodeString(&RegistryKey, NULL);
|
RtlInitUnicodeString(&RegistryKey, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("RegistryKey: %wZ\n", &RegistryKey);
|
DPRINT("RegistryKey: %wZ\n", &RegistryKey);
|
||||||
DPRINT("Calling driver entrypoint at %08lx\n", DriverEntry);
|
DPRINT("Calling driver entrypoint at %08lx\n", DriverEntry);
|
||||||
|
@ -550,10 +551,10 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
Status = DriverEntry(DriverObject, &RegistryKey);
|
Status = DriverEntry(DriverObject, &RegistryKey);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DeviceNode->DriverObject = NULL;
|
DeviceNode->DriverObject = NULL;
|
||||||
ExFreePool(DriverObject->DriverExtension);
|
ExFreePool(DriverObject->DriverExtension);
|
||||||
ExFreePool(DriverObject);
|
ExFreePool(DriverObject);
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = IopInitializeDevice(DeviceNode, TRUE);
|
Status = IopInitializeDevice(DeviceNode, TRUE);
|
||||||
|
@ -561,6 +562,7 @@ IopInitializeDriver(PDRIVER_INITIALIZE DriverEntry,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
IoAttachDevice(PDEVICE_OBJECT SourceDevice,
|
IoAttachDevice(PDEVICE_OBJECT SourceDevice,
|
||||||
PUNICODE_STRING TargetDevice,
|
PUNICODE_STRING TargetDevice,
|
||||||
|
@ -573,9 +575,10 @@ IoAttachDevice(PDEVICE_OBJECT SourceDevice,
|
||||||
* AttachedDevice (OUT) = Caller storage for the device attached to
|
* AttachedDevice (OUT) = Caller storage for the device attached to
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
IopCreateDevice(PVOID ObjectBody,
|
IopCreateDevice(PVOID ObjectBody,
|
||||||
PVOID Parent,
|
PVOID Parent,
|
||||||
|
@ -675,44 +678,47 @@ IoCreateDevice(PDRIVER_OBJECT DriverObject,
|
||||||
DriverObject->DeviceObject = CreatedDeviceObject;
|
DriverObject->DeviceObject = CreatedDeviceObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatedDeviceObject->Type = DeviceType;
|
CreatedDeviceObject->Type = DeviceType;
|
||||||
CreatedDeviceObject->DriverObject = DriverObject;
|
CreatedDeviceObject->DriverObject = DriverObject;
|
||||||
CreatedDeviceObject->CurrentIrp = NULL;
|
CreatedDeviceObject->CurrentIrp = NULL;
|
||||||
CreatedDeviceObject->Flags = 0;
|
CreatedDeviceObject->Flags = 0;
|
||||||
|
|
||||||
CreatedDeviceObject->DeviceExtension =
|
CreatedDeviceObject->DeviceExtension =
|
||||||
ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize,
|
ExAllocatePoolWithTag(NonPagedPool, DeviceExtensionSize,
|
||||||
TAG_DEVICE_EXTENSION);
|
TAG_DEVICE_EXTENSION);
|
||||||
if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
|
if (DeviceExtensionSize > 0 && CreatedDeviceObject->DeviceExtension == NULL)
|
||||||
{
|
{
|
||||||
ExFreePool(CreatedDeviceObject);
|
ExFreePool(CreatedDeviceObject);
|
||||||
return(STATUS_INSUFFICIENT_RESOURCES);
|
return(STATUS_INSUFFICIENT_RESOURCES);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DeviceExtensionSize > 0)
|
if (DeviceExtensionSize > 0)
|
||||||
{
|
{
|
||||||
RtlZeroMemory(CreatedDeviceObject->DeviceExtension,
|
RtlZeroMemory(CreatedDeviceObject->DeviceExtension,
|
||||||
DeviceExtensionSize);
|
DeviceExtensionSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatedDeviceObject->AttachedDevice = NULL;
|
CreatedDeviceObject->AttachedDevice = NULL;
|
||||||
CreatedDeviceObject->DeviceType = DeviceType;
|
CreatedDeviceObject->DeviceType = DeviceType;
|
||||||
CreatedDeviceObject->StackSize = 1;
|
CreatedDeviceObject->StackSize = 1;
|
||||||
CreatedDeviceObject->AlignmentRequirement = 1;
|
CreatedDeviceObject->AlignmentRequirement = 1;
|
||||||
KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
|
KeInitializeDeviceQueue(&CreatedDeviceObject->DeviceQueue);
|
||||||
|
|
||||||
KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
|
KeInitializeEvent(&CreatedDeviceObject->DeviceLock,
|
||||||
SynchronizationEvent,
|
SynchronizationEvent,
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK)
|
/* FIXME: Do we need to add network drives too?! */
|
||||||
{
|
if (CreatedDeviceObject->DeviceType == FILE_DEVICE_DISK ||
|
||||||
IoAttachVpb(CreatedDeviceObject);
|
CreatedDeviceObject->DeviceType == FILE_DEVICE_CD_ROM ||
|
||||||
}
|
CreatedDeviceObject->DeviceType == FILE_DEVICE_TAPE)
|
||||||
|
{
|
||||||
|
IoAttachVpb(CreatedDeviceObject);
|
||||||
|
}
|
||||||
|
|
||||||
*DeviceObject = CreatedDeviceObject;
|
*DeviceObject = CreatedDeviceObject;
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
return(STATUS_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,8 +732,8 @@ IoOpenDeviceInstanceKey (
|
||||||
DWORD Unknown4
|
DWORD Unknown4
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return (STATUS_NOT_IMPLEMENTED);
|
return(STATUS_NOT_IMPLEMENTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -738,8 +744,8 @@ IoQueryDeviceEnumInfo (
|
||||||
DWORD Unknown1
|
DWORD Unknown1
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -750,15 +756,15 @@ IoGetDeviceToVerify (PETHREAD Thread)
|
||||||
* device, that is the target of the given thread's I/O request
|
* device, that is the target of the given thread's I/O request
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
return Thread->DeviceToVerify;
|
return(Thread->DeviceToVerify);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IoSetDeviceToVerify (IN PETHREAD Thread,
|
IoSetDeviceToVerify(IN PETHREAD Thread,
|
||||||
IN PDEVICE_OBJECT DeviceObject)
|
IN PDEVICE_OBJECT DeviceObject)
|
||||||
{
|
{
|
||||||
Thread->DeviceToVerify = DeviceObject;
|
Thread->DeviceToVerify = DeviceObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -766,7 +772,7 @@ VOID STDCALL
|
||||||
IoSetHardErrorOrVerifyDevice(PIRP Irp,
|
IoSetHardErrorOrVerifyDevice(PIRP Irp,
|
||||||
PDEVICE_OBJECT DeviceObject)
|
PDEVICE_OBJECT DeviceObject)
|
||||||
{
|
{
|
||||||
Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
|
Irp->Tail.Overlay.Thread->DeviceToVerify = DeviceObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fs.c,v 1.21 2002/04/07 18:36:13 phreak Exp $
|
/* $Id: fs.c,v 1.22 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -130,7 +130,9 @@ NtFsControlFile (
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IoInitFileSystemImplementation(VOID)
|
|
||||||
|
VOID
|
||||||
|
IoInitFileSystemImplementation(VOID)
|
||||||
{
|
{
|
||||||
InitializeListHead(&FileSystemListHead);
|
InitializeListHead(&FileSystemListHead);
|
||||||
KeInitializeSpinLock(&FileSystemListLock);
|
KeInitializeSpinLock(&FileSystemListLock);
|
||||||
|
@ -139,7 +141,9 @@ VOID IoInitFileSystemImplementation(VOID)
|
||||||
KeInitializeSpinLock(&FsChangeNotifyListLock);
|
KeInitializeSpinLock(&FsChangeNotifyListLock);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID IoShutdownRegisteredFileSystems(VOID)
|
|
||||||
|
VOID
|
||||||
|
IoShutdownRegisteredFileSystems(VOID)
|
||||||
{
|
{
|
||||||
KIRQL oldlvl;
|
KIRQL oldlvl;
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
|
@ -180,8 +184,10 @@ VOID IoShutdownRegisteredFileSystems(VOID)
|
||||||
KeReleaseSpinLock(&FileSystemListLock,oldlvl);
|
KeReleaseSpinLock(&FileSystemListLock,oldlvl);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
|
|
||||||
PDEVICE_OBJECT DeviceToMount)
|
NTSTATUS
|
||||||
|
IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
|
||||||
|
PDEVICE_OBJECT DeviceToMount)
|
||||||
{
|
{
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
@ -211,12 +217,17 @@ NTSTATUS IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IoAskFileSystemToLoad(PDEVICE_OBJECT DeviceObject)
|
|
||||||
|
NTSTATUS
|
||||||
|
IoAskFileSystemToLoad(PDEVICE_OBJECT DeviceObject)
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject)
|
|
||||||
|
NTSTATUS
|
||||||
|
IoTryToMountStorageDevice(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN BOOLEAN AllowRawMount)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Trys to mount a storage device
|
* FUNCTION: Trys to mount a storage device
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -231,7 +242,7 @@ NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject)
|
||||||
|
|
||||||
assert_irql(PASSIVE_LEVEL);
|
assert_irql(PASSIVE_LEVEL);
|
||||||
|
|
||||||
DPRINT("IoTryToMountStorageDevice(DeviceObject %x)\n",DeviceObject);
|
DPRINT1("IoTryToMountStorageDevice(DeviceObject %x)\n",DeviceObject);
|
||||||
|
|
||||||
KeAcquireSpinLock(&FileSystemListLock,&oldlvl);
|
KeAcquireSpinLock(&FileSystemListLock,&oldlvl);
|
||||||
current_entry = FileSystemListHead.Flink;
|
current_entry = FileSystemListHead.Flink;
|
||||||
|
@ -266,6 +277,90 @@ NTSTATUS IoTryToMountStorageDevice(PDEVICE_OBJECT DeviceObject)
|
||||||
return(STATUS_UNRECOGNIZED_VOLUME);
|
return(STATUS_UNRECOGNIZED_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* NAME EXPORTED
|
||||||
|
* IoVerifyVolume
|
||||||
|
*
|
||||||
|
* DESCRIPTION
|
||||||
|
* Veriyfy the file system type and volume information or mount
|
||||||
|
* a file system.
|
||||||
|
*
|
||||||
|
* ARGUMENTS
|
||||||
|
* DeviceObject
|
||||||
|
* Device to verify or mount
|
||||||
|
*
|
||||||
|
* AllowRawMount
|
||||||
|
* ...
|
||||||
|
*
|
||||||
|
* RETURN VALUE
|
||||||
|
* Status
|
||||||
|
*/
|
||||||
|
NTSTATUS STDCALL
|
||||||
|
IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
|
||||||
|
IN BOOLEAN AllowRawMount)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
IO_STATUS_BLOCK IoStatusBlock,
|
||||||
|
KEVENT Event;
|
||||||
|
PIRP Irp;
|
||||||
|
#endif
|
||||||
|
NTSTATUS Status;
|
||||||
|
|
||||||
|
DPRINT1("IoVerifyVolume(DeviceObject %x AllowRawMount %x)\n",
|
||||||
|
DeviceObject,
|
||||||
|
AllowRawMount);
|
||||||
|
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
|
KeWaitForSingleObject(&DeviceObject->DeviceLock,
|
||||||
|
Executive,
|
||||||
|
KernelMode,
|
||||||
|
FALSE,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
if (DeviceObject->Vpb->Flags & VPB_MOUNTED)
|
||||||
|
{
|
||||||
|
/* FIXME: Issue verify request to the FSD */
|
||||||
|
#if 0
|
||||||
|
KeInitializeEvent(&Event,...);
|
||||||
|
|
||||||
|
Irp = IoBuildFilesystemControlRequest(IRP_MN_VERIFY_VOLUME,
|
||||||
|
DeviceObject,
|
||||||
|
&Event,
|
||||||
|
&IoStatusBlock,
|
||||||
|
&DeviceToMount)
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
KeSetEvent(&DeviceObject->DeviceLock,
|
||||||
|
IO_NO_INCREMENT,
|
||||||
|
FALSE);
|
||||||
|
return(STATUS_SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Status == STATUS_WRONG_VOLUME)
|
||||||
|
{
|
||||||
|
/* FIXME: Replace existing VPB by a new one */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Start mount sequence */
|
||||||
|
Status = IoTryToMountStorageDevice(DeviceObject,
|
||||||
|
AllowRawMount);
|
||||||
|
|
||||||
|
KeSetEvent(&DeviceObject->DeviceLock,
|
||||||
|
IO_NO_INCREMENT,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
|
return(Status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
|
IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
|
||||||
{
|
{
|
||||||
|
@ -283,6 +378,7 @@ IoRegisterFileSystem(PDEVICE_OBJECT DeviceObject)
|
||||||
IopNotifyFileSystemChange(DeviceObject, TRUE);
|
IopNotifyFileSystemChange(DeviceObject, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IoUnregisterFileSystem(PDEVICE_OBJECT DeviceObject)
|
IoUnregisterFileSystem(PDEVICE_OBJECT DeviceObject)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: irp.c,v 1.39 2002/01/21 22:30:26 hbirr Exp $
|
/* $Id: irp.c,v 1.40 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -46,19 +46,20 @@
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IoFreeIrp (PIRP Irp)
|
IoFreeIrp(PIRP Irp)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Releases a caller allocated irp
|
* FUNCTION: Releases a caller allocated irp
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
* Irp = Irp to free
|
* Irp = Irp to free
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
ExFreePool(Irp);
|
ExFreePool(Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIRP STDCALL
|
PIRP STDCALL
|
||||||
IoMakeAssociatedIrp (PIRP Irp, CCHAR StackSize)
|
IoMakeAssociatedIrp(PIRP Irp,
|
||||||
|
CCHAR StackSize)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Allocates and initializes an irp to associated with a master irp
|
* FUNCTION: Allocates and initializes an irp to associated with a master irp
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -67,15 +68,17 @@ IoMakeAssociatedIrp (PIRP Irp, CCHAR StackSize)
|
||||||
* RETURNS: The irp allocated
|
* RETURNS: The irp allocated
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PIRP AssocIrp;
|
PIRP AssocIrp;
|
||||||
|
|
||||||
AssocIrp = IoAllocateIrp(StackSize,FALSE);
|
AssocIrp = IoAllocateIrp(StackSize,FALSE);
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
IoInitializeIrp (PIRP Irp, USHORT PacketSize, CCHAR StackSize)
|
IoInitializeIrp(PIRP Irp,
|
||||||
|
USHORT PacketSize,
|
||||||
|
CCHAR StackSize)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Initalizes an irp allocated by the caller
|
* FUNCTION: Initalizes an irp allocated by the caller
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -84,48 +87,50 @@ IoInitializeIrp (PIRP Irp, USHORT PacketSize, CCHAR StackSize)
|
||||||
* StackSize = Number of stack locations in the IRP
|
* StackSize = Number of stack locations in the IRP
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
assert(Irp != NULL);
|
assert(Irp != NULL);
|
||||||
|
|
||||||
memset(Irp, 0, PacketSize);
|
memset(Irp, 0, PacketSize);
|
||||||
Irp->Size = PacketSize;
|
Irp->Size = PacketSize;
|
||||||
Irp->StackCount = StackSize;
|
Irp->StackCount = StackSize;
|
||||||
Irp->CurrentLocation = StackSize;
|
Irp->CurrentLocation = StackSize;
|
||||||
Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize];
|
Irp->Tail.Overlay.CurrentStackLocation = &Irp->Stack[(ULONG)StackSize];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS FASTCALL
|
NTSTATUS FASTCALL
|
||||||
IofCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
IofCallDriver(PDEVICE_OBJECT DeviceObject,
|
||||||
|
PIRP Irp)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Sends an IRP to the next lower driver
|
* FUNCTION: Sends an IRP to the next lower driver
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PDRIVER_OBJECT DriverObject;
|
PDRIVER_OBJECT DriverObject;
|
||||||
PIO_STACK_LOCATION Param;
|
PIO_STACK_LOCATION Param;
|
||||||
|
|
||||||
DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
DPRINT("IofCallDriver(DeviceObject %x, Irp %x)\n",DeviceObject,Irp);
|
||||||
|
|
||||||
assert(Irp);
|
assert(Irp);
|
||||||
assert(DeviceObject);
|
assert(DeviceObject);
|
||||||
|
|
||||||
DriverObject = DeviceObject->DriverObject;
|
DriverObject = DeviceObject->DriverObject;
|
||||||
|
|
||||||
assert(DriverObject);
|
assert(DriverObject);
|
||||||
|
|
||||||
Param = IoGetNextIrpStackLocation(Irp);
|
Param = IoGetNextIrpStackLocation(Irp);
|
||||||
|
|
||||||
DPRINT("IrpSp 0x%X\n", Param);
|
DPRINT("IrpSp 0x%X\n", Param);
|
||||||
|
|
||||||
Irp->Tail.Overlay.CurrentStackLocation--;
|
Irp->Tail.Overlay.CurrentStackLocation--;
|
||||||
Irp->CurrentLocation--;
|
Irp->CurrentLocation--;
|
||||||
|
|
||||||
DPRINT("MajorFunction %d\n", Param->MajorFunction);
|
DPRINT("MajorFunction %d\n", Param->MajorFunction);
|
||||||
DPRINT("DriverObject->MajorFunction[Param->MajorFunction] %x\n",
|
DPRINT("DriverObject->MajorFunction[Param->MajorFunction] %x\n",
|
||||||
DriverObject->MajorFunction[Param->MajorFunction]);
|
DriverObject->MajorFunction[Param->MajorFunction]);
|
||||||
Status = DriverObject->MajorFunction[Param->MajorFunction](DeviceObject,
|
Status = DriverObject->MajorFunction[Param->MajorFunction](DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
return Status;
|
|
||||||
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,16 +138,14 @@ NTSTATUS
|
||||||
STDCALL
|
STDCALL
|
||||||
IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
IoCallDriver (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||||
{
|
{
|
||||||
return IofCallDriver (
|
return(IofCallDriver(DeviceObject,
|
||||||
DeviceObject,
|
Irp));
|
||||||
Irp
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIRP
|
PIRP STDCALL
|
||||||
STDCALL
|
IoAllocateIrp(CCHAR StackSize,
|
||||||
IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
|
BOOLEAN ChargeQuota)
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Allocates an IRP
|
* FUNCTION: Allocates an IRP
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -151,37 +154,41 @@ IoAllocateIrp (CCHAR StackSize, BOOLEAN ChargeQuota)
|
||||||
* RETURNS: Irp allocated
|
* RETURNS: Irp allocated
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",
|
DbgPrint("IoAllocateIrp(StackSize %d ChargeQuota %d)\n",
|
||||||
StackSize,
|
StackSize,
|
||||||
ChargeQuota);
|
ChargeQuota);
|
||||||
KeDumpStackFrames(0,8);
|
KeDumpStackFrames(0,8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ChargeQuota)
|
if (ChargeQuota)
|
||||||
{
|
{
|
||||||
// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
|
// Irp = ExAllocatePoolWithQuota(NonPagedPool,IoSizeOfIrp(StackSize));
|
||||||
Irp = ExAllocatePoolWithTag(NonPagedPool, IoSizeOfIrp(StackSize),
|
Irp = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
TAG_IRP);
|
IoSizeOfIrp(StackSize),
|
||||||
}
|
TAG_IRP);
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
Irp = ExAllocatePoolWithTag(NonPagedPool,IoSizeOfIrp(StackSize),
|
{
|
||||||
TAG_IRP);
|
Irp = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
}
|
IoSizeOfIrp(StackSize),
|
||||||
|
TAG_IRP);
|
||||||
|
}
|
||||||
|
|
||||||
if (Irp==NULL)
|
if (Irp==NULL)
|
||||||
{
|
{
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
IoInitializeIrp(Irp, IoSizeOfIrp(StackSize), StackSize);
|
IoInitializeIrp(Irp,
|
||||||
|
IoSizeOfIrp(StackSize),
|
||||||
|
StackSize);
|
||||||
|
|
||||||
// DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation);
|
// DPRINT("Irp %x Irp->StackPtr %d\n", Irp, Irp->CurrentLocation);
|
||||||
|
|
||||||
return Irp;
|
return(Irp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,11 +199,12 @@ IopCompleteRequest(struct _KAPC* Apc,
|
||||||
PVOID* SystemArgument1,
|
PVOID* SystemArgument1,
|
||||||
PVOID* SystemArgument2)
|
PVOID* SystemArgument2)
|
||||||
{
|
{
|
||||||
DPRINT("IopCompleteRequest(Apc %x, SystemArgument1 %x, "
|
DPRINT("IopCompleteRequest(Apc %x, SystemArgument1 %x, (*SystemArgument1) %x\n",
|
||||||
"(*SystemArgument1) %x\n", Apc, SystemArgument1,
|
Apc,
|
||||||
*SystemArgument1);
|
SystemArgument1,
|
||||||
IoSecondStageCompletion((PIRP)(*SystemArgument1),
|
*SystemArgument1);
|
||||||
(KPRIORITY)(*SystemArgument2));
|
IoSecondStageCompletion((PIRP)(*SystemArgument1),
|
||||||
|
(KPRIORITY)(*SystemArgument2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -263,14 +271,12 @@ IofCompleteRequest(PIRP Irp,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
IoCompleteRequest(PIRP Irp,
|
||||||
IoCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
CCHAR PriorityBoost)
|
||||||
{
|
{
|
||||||
IofCompleteRequest (
|
IofCompleteRequest(Irp,
|
||||||
Irp,
|
PriorityBoost);
|
||||||
PriorityBoost
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -288,89 +294,65 @@ IoCompleteRequest (PIRP Irp, CCHAR PriorityBoost)
|
||||||
* RETURN VALUE
|
* RETURN VALUE
|
||||||
* TRUE if Irp's operation is synchronous; otherwise FALSE.
|
* TRUE if Irp's operation is synchronous; otherwise FALSE.
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN STDCALL
|
||||||
STDCALL
|
IoIsOperationSynchronous(IN PIRP Irp)
|
||||||
IoIsOperationSynchronous (
|
|
||||||
IN PIRP Irp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
ULONG Flags = 0;
|
PFILE_OBJECT FileObject = NULL;
|
||||||
PFILE_OBJECT FileObject = NULL;
|
ULONG Flags = 0;
|
||||||
|
|
||||||
/*
|
/* Check the associated FILE_OBJECT's flags first. */
|
||||||
* Check the associated FILE_OBJECT's
|
FileObject = Irp->Tail.Overlay.OriginalFileObject;
|
||||||
* flags first.
|
if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
|
||||||
*/
|
{
|
||||||
FileObject = Irp->Tail.Overlay.OriginalFileObject;
|
/* Check IRP's flags. */
|
||||||
if (!(FO_SYNCHRONOUS_IO & FileObject->Flags))
|
Flags = Irp->Flags;
|
||||||
|
if (!((IRP_SYNCHRONOUS_API | IRP_SYNCHRONOUS_PAGING_IO) & Flags))
|
||||||
{
|
{
|
||||||
/* Check IRP's flags. */
|
return(FALSE);
|
||||||
Flags = Irp->Flags;
|
|
||||||
if (!( (IRP_SYNCHRONOUS_API | IRP_SYNCHRONOUS_PAGING_IO)
|
|
||||||
& Flags
|
|
||||||
))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*
|
}
|
||||||
* Check more IRP's flags.
|
|
||||||
*/
|
/* Check more IRP's flags. */
|
||||||
Flags = Irp->Flags;
|
Flags = Irp->Flags;
|
||||||
if ( !(IRP_MOUNT_COMPLETION & Flags)
|
if (!(IRP_MOUNT_COMPLETION & Flags)
|
||||||
|| (IRP_SYNCHRONOUS_PAGING_IO & Flags)
|
|| (IRP_SYNCHRONOUS_PAGING_IO & Flags))
|
||||||
)
|
{
|
||||||
{
|
return(TRUE);
|
||||||
return TRUE;
|
}
|
||||||
}
|
|
||||||
/*
|
/* Otherwise, it is an asynchronous operation. */
|
||||||
* Otherwise, it is an
|
return(FALSE);
|
||||||
* asynchronous operation.
|
|
||||||
*/
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
IoEnqueueIrp(IN PIRP Irp)
|
||||||
IoEnqueueIrp (
|
|
||||||
PIRP Irp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
IoSetTopLevelIrp(IN PIRP Irp)
|
||||||
IoSetTopLevelIrp (
|
|
||||||
IN PIRP Irp
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PETHREAD Thread;
|
PETHREAD Thread;
|
||||||
|
|
||||||
Thread = PsGetCurrentThread ();
|
Thread = PsGetCurrentThread();
|
||||||
Thread->TopLevelIrp->TopLevelIrp = Irp;
|
Thread->TopLevelIrp->TopLevelIrp = Irp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PIRP
|
PIRP STDCALL
|
||||||
STDCALL
|
IoGetTopLevelIrp(VOID)
|
||||||
IoGetTopLevelIrp (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
return (PsGetCurrentThread ()->TopLevelIrp->TopLevelIrp);
|
return(PsGetCurrentThread()->TopLevelIrp->TopLevelIrp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID STDCALL
|
||||||
STDCALL
|
IoQueueThreadIrp(IN PIRP Irp)
|
||||||
IoQueueThreadIrp (
|
|
||||||
PVOID Unknown0
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: vpb.c,v 1.14 2001/11/02 22:22:33 hbirr Exp $
|
/* $Id: vpb.c,v 1.15 2002/04/10 09:57:31 ekohl Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -376,14 +376,4 @@ IoReleaseVpbSpinLock(IN KIRQL Irql)
|
||||||
Irql);
|
Irql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
|
||||||
IoVerifyVolume(IN PDEVICE_OBJECT DeviceObject,
|
|
||||||
IN BOOLEAN AllowRawMount)
|
|
||||||
{
|
|
||||||
UNIMPLEMENTED;
|
|
||||||
return(STATUS_NOT_IMPLEMENTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue