mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[CDFS_NEW]
Restore the ability to restore installing from disk image. CORE-13184
This commit is contained in:
parent
7dc30a5b84
commit
6c73385625
4 changed files with 116 additions and 0 deletions
|
@ -38,6 +38,10 @@ NTSTATUS
|
|||
CdInitializeGlobalData (
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
||||
#ifdef __REACTOS__
|
||||
,
|
||||
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||
#endif
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
|
@ -89,6 +93,9 @@ Return Value:
|
|||
NTSTATUS Status;
|
||||
UNICODE_STRING UnicodeString;
|
||||
PDEVICE_OBJECT CdfsFileSystemDeviceObject;
|
||||
#ifdef __REACTOS__
|
||||
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Create the device object.
|
||||
|
@ -107,6 +114,27 @@ Return Value:
|
|||
if (!NT_SUCCESS( Status )) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
#ifdef __REACTOS__
|
||||
//
|
||||
// Create the HDD device object.
|
||||
//
|
||||
|
||||
RtlInitUnicodeString( &UnicodeString, L"\\CdfsHdd" );
|
||||
|
||||
Status = IoCreateDevice( DriverObject,
|
||||
0,
|
||||
&UnicodeString,
|
||||
FILE_DEVICE_DISK_FILE_SYSTEM,
|
||||
0,
|
||||
FALSE,
|
||||
&HddFileSystemDeviceObject );
|
||||
|
||||
if (!NT_SUCCESS( Status )) {
|
||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||
return Status;
|
||||
}
|
||||
#endif
|
||||
DriverObject->DriverUnload = CdUnload;
|
||||
//
|
||||
// Note that because of the way data caching is done, we set neither
|
||||
|
@ -141,6 +169,9 @@ Return Value:
|
|||
Status = IoRegisterShutdownNotification (CdfsFileSystemDeviceObject);
|
||||
if (!NT_SUCCESS (Status)) {
|
||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||
#ifdef __REACTOS__
|
||||
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -148,9 +179,16 @@ Return Value:
|
|||
// Initialize the global data structures
|
||||
//
|
||||
|
||||
#ifndef __REACTOS__
|
||||
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject );
|
||||
#else
|
||||
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject, HddFileSystemDeviceObject );
|
||||
#endif
|
||||
if (!NT_SUCCESS (Status)) {
|
||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||
#ifdef __REACTOS__
|
||||
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||
#endif
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -161,9 +199,16 @@ Return Value:
|
|||
//
|
||||
|
||||
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||
#ifdef __REACTOS__
|
||||
HddFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||
#endif
|
||||
|
||||
IoRegisterFileSystem( CdfsFileSystemDeviceObject );
|
||||
ObReferenceObject (CdfsFileSystemDeviceObject);
|
||||
#ifdef __REACTOS__
|
||||
IoRegisterFileSystem( HddFileSystemDeviceObject );
|
||||
ObReferenceObject (HddFileSystemDeviceObject);
|
||||
#endif
|
||||
|
||||
//
|
||||
// And return to our caller
|
||||
|
@ -198,6 +243,9 @@ Return Value:
|
|||
{
|
||||
IoUnregisterFileSystem (DeviceObject);
|
||||
IoDeleteDevice (CdData.FileSystemDeviceObject);
|
||||
#ifdef __REACTOS__
|
||||
IoDeleteDevice (CdData.HddFileSystemDeviceObject);
|
||||
#endif
|
||||
|
||||
CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );
|
||||
return STATUS_SUCCESS;
|
||||
|
@ -241,6 +289,9 @@ Return Value:
|
|||
IoFreeWorkItem (CdData.CloseItem);
|
||||
ExDeleteResourceLite( &CdData.DataResource );
|
||||
ObDereferenceObject (CdData.FileSystemDeviceObject);
|
||||
#ifdef __REACTOS__
|
||||
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -251,6 +302,10 @@ NTSTATUS
|
|||
CdInitializeGlobalData (
|
||||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
||||
#ifdef __REACTOS__
|
||||
,
|
||||
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||
#endif
|
||||
)
|
||||
|
||||
/*++
|
||||
|
@ -307,6 +362,9 @@ Return Value:
|
|||
|
||||
CdData.DriverObject = DriverObject;
|
||||
CdData.FileSystemDeviceObject = FileSystemDeviceObject;
|
||||
#ifdef __REACTOS__
|
||||
CdData.HddFileSystemDeviceObject = HddFileSystemDeviceObject;
|
||||
#endif
|
||||
|
||||
InitializeListHead( &CdData.VcbQueue );
|
||||
|
||||
|
|
|
@ -349,6 +349,10 @@ typedef struct _CD_DATA {
|
|||
|
||||
PDEVICE_OBJECT FileSystemDeviceObject;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||
#endif
|
||||
|
||||
//
|
||||
// Following are used to manage the async and delayed close queue.
|
||||
//
|
||||
|
|
|
@ -596,6 +596,10 @@ Return Value:
|
|||
ULONG TocDiskFlags = 0;
|
||||
ULONG MediaChangeCount = 0;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
DEVICE_TYPE FilesystemDeviceType;
|
||||
#endif
|
||||
|
||||
PAGED_CODE();
|
||||
|
||||
//
|
||||
|
@ -603,7 +607,16 @@ Return Value:
|
|||
// always be waitable.
|
||||
//
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) {
|
||||
FilesystemDeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
|
||||
} else {
|
||||
#endif
|
||||
ASSERT( Vpb->RealDevice->DeviceType == FILE_DEVICE_CD_ROM );
|
||||
#ifdef __REACTOS__
|
||||
FilesystemDeviceType = FILE_DEVICE_CD_ROM_FILE_SYSTEM;
|
||||
}
|
||||
#endif
|
||||
ASSERT( FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ));
|
||||
|
||||
//
|
||||
|
@ -630,7 +643,11 @@ Return Value:
|
|||
//
|
||||
|
||||
Status = CdPerformDevIoCtrl( IrpContext,
|
||||
#ifndef __REACTOS__
|
||||
IOCTL_CDROM_CHECK_VERIFY,
|
||||
#else
|
||||
(FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_CHECK_VERIFY : IOCTL_CDROM_CHECK_VERIFY),
|
||||
#endif
|
||||
DeviceObjectWeTalkTo,
|
||||
&MediaChangeCount,
|
||||
sizeof(ULONG),
|
||||
|
@ -659,7 +676,11 @@ Return Value:
|
|||
//
|
||||
|
||||
Status = CdPerformDevIoCtrl( IrpContext,
|
||||
#ifndef __REACTOS__
|
||||
IOCTL_CDROM_GET_DRIVE_GEOMETRY,
|
||||
#else
|
||||
(FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_GET_DRIVE_GEOMETRY : IOCTL_CDROM_GET_DRIVE_GEOMETRY),
|
||||
#endif
|
||||
DeviceObjectWeTalkTo,
|
||||
&DiskGeometry,
|
||||
sizeof( DISK_GEOMETRY ),
|
||||
|
@ -727,7 +748,11 @@ Return Value:
|
|||
Status = IoCreateDevice( CdData.DriverObject,
|
||||
sizeof( VOLUME_DEVICE_OBJECT ) - sizeof( DEVICE_OBJECT ),
|
||||
NULL,
|
||||
#ifndef __REACTOS__
|
||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||
#else
|
||||
FilesystemDeviceType,
|
||||
#endif
|
||||
0,
|
||||
FALSE,
|
||||
(PDEVICE_OBJECT *) &VolDo );
|
||||
|
@ -780,7 +805,21 @@ Return Value:
|
|||
|
||||
if (Status != STATUS_SUCCESS) {
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
//
|
||||
// Don't bail out if that was a disk based ISO image, it is legit
|
||||
//
|
||||
|
||||
if (FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM) {
|
||||
CdFreePool( &CdromToc );
|
||||
Status = STATUS_SUCCESS;
|
||||
} else {
|
||||
#endif
|
||||
try_leave( Status );
|
||||
#ifdef __REACTOS__
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -2247,7 +2286,12 @@ Return Value:
|
|||
// We only allow the invalidate call to come in on our file system devices.
|
||||
//
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||
#else
|
||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject &&
|
||||
IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) {
|
||||
#endif
|
||||
|
||||
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST );
|
||||
|
||||
|
|
|
@ -1570,7 +1570,12 @@ Return Value:
|
|||
// occur in the context of fileobjects (i.e., mount).
|
||||
//
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject) {
|
||||
#else
|
||||
if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject ||
|
||||
IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) {
|
||||
#endif
|
||||
|
||||
if (IrpSp->FileObject != NULL &&
|
||||
IrpSp->MajorFunction != IRP_MJ_CREATE &&
|
||||
|
@ -1648,7 +1653,12 @@ Return Value:
|
|||
// the Vcb field.
|
||||
//
|
||||
|
||||
#ifndef __REACTOS__
|
||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||
#else
|
||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject &&
|
||||
IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) {
|
||||
#endif
|
||||
|
||||
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
||||
|
||||
|
|
Loading…
Reference in a new issue