mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +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 (
|
CdInitializeGlobalData (
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
IN PDEVICE_OBJECT FileSystemDeviceObject
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
,
|
||||||
|
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
|
@ -89,6 +93,9 @@ Return Value:
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
UNICODE_STRING UnicodeString;
|
UNICODE_STRING UnicodeString;
|
||||||
PDEVICE_OBJECT CdfsFileSystemDeviceObject;
|
PDEVICE_OBJECT CdfsFileSystemDeviceObject;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the device object.
|
// Create the device object.
|
||||||
|
@ -107,6 +114,27 @@ Return Value:
|
||||||
if (!NT_SUCCESS( Status )) {
|
if (!NT_SUCCESS( Status )) {
|
||||||
return 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;
|
DriverObject->DriverUnload = CdUnload;
|
||||||
//
|
//
|
||||||
// Note that because of the way data caching is done, we set neither
|
// Note that because of the way data caching is done, we set neither
|
||||||
|
@ -141,6 +169,9 @@ Return Value:
|
||||||
Status = IoRegisterShutdownNotification (CdfsFileSystemDeviceObject);
|
Status = IoRegisterShutdownNotification (CdfsFileSystemDeviceObject);
|
||||||
if (!NT_SUCCESS (Status)) {
|
if (!NT_SUCCESS (Status)) {
|
||||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,9 +179,16 @@ Return Value:
|
||||||
// Initialize the global data structures
|
// Initialize the global data structures
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject );
|
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject );
|
||||||
|
#else
|
||||||
|
Status = CdInitializeGlobalData( DriverObject, CdfsFileSystemDeviceObject, HddFileSystemDeviceObject );
|
||||||
|
#endif
|
||||||
if (!NT_SUCCESS (Status)) {
|
if (!NT_SUCCESS (Status)) {
|
||||||
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
IoDeleteDevice (CdfsFileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoDeleteDevice (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +199,16 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
CdfsFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
HddFileSystemDeviceObject->Flags |= DO_LOW_PRIORITY_FILESYSTEM;
|
||||||
|
#endif
|
||||||
|
|
||||||
IoRegisterFileSystem( CdfsFileSystemDeviceObject );
|
IoRegisterFileSystem( CdfsFileSystemDeviceObject );
|
||||||
ObReferenceObject (CdfsFileSystemDeviceObject);
|
ObReferenceObject (CdfsFileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoRegisterFileSystem( HddFileSystemDeviceObject );
|
||||||
|
ObReferenceObject (HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// And return to our caller
|
// And return to our caller
|
||||||
|
@ -198,6 +243,9 @@ Return Value:
|
||||||
{
|
{
|
||||||
IoUnregisterFileSystem (DeviceObject);
|
IoUnregisterFileSystem (DeviceObject);
|
||||||
IoDeleteDevice (CdData.FileSystemDeviceObject);
|
IoDeleteDevice (CdData.FileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
IoDeleteDevice (CdData.HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
|
|
||||||
CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );
|
CdCompleteRequest( NULL, Irp, STATUS_SUCCESS );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
@ -241,6 +289,9 @@ Return Value:
|
||||||
IoFreeWorkItem (CdData.CloseItem);
|
IoFreeWorkItem (CdData.CloseItem);
|
||||||
ExDeleteResourceLite( &CdData.DataResource );
|
ExDeleteResourceLite( &CdData.DataResource );
|
||||||
ObDereferenceObject (CdData.FileSystemDeviceObject);
|
ObDereferenceObject (CdData.FileSystemDeviceObject);
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
ObDereferenceObject (CdData.HddFileSystemDeviceObject);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -251,6 +302,10 @@ NTSTATUS
|
||||||
CdInitializeGlobalData (
|
CdInitializeGlobalData (
|
||||||
IN PDRIVER_OBJECT DriverObject,
|
IN PDRIVER_OBJECT DriverObject,
|
||||||
IN PDEVICE_OBJECT FileSystemDeviceObject
|
IN PDEVICE_OBJECT FileSystemDeviceObject
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
,
|
||||||
|
IN PDEVICE_OBJECT HddFileSystemDeviceObject
|
||||||
|
#endif
|
||||||
)
|
)
|
||||||
|
|
||||||
/*++
|
/*++
|
||||||
|
@ -307,6 +362,9 @@ Return Value:
|
||||||
|
|
||||||
CdData.DriverObject = DriverObject;
|
CdData.DriverObject = DriverObject;
|
||||||
CdData.FileSystemDeviceObject = FileSystemDeviceObject;
|
CdData.FileSystemDeviceObject = FileSystemDeviceObject;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
CdData.HddFileSystemDeviceObject = HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
InitializeListHead( &CdData.VcbQueue );
|
InitializeListHead( &CdData.VcbQueue );
|
||||||
|
|
||||||
|
|
|
@ -349,6 +349,10 @@ typedef struct _CD_DATA {
|
||||||
|
|
||||||
PDEVICE_OBJECT FileSystemDeviceObject;
|
PDEVICE_OBJECT FileSystemDeviceObject;
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
PDEVICE_OBJECT HddFileSystemDeviceObject;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Following are used to manage the async and delayed close queue.
|
// Following are used to manage the async and delayed close queue.
|
||||||
//
|
//
|
||||||
|
|
|
@ -596,6 +596,10 @@ Return Value:
|
||||||
ULONG TocDiskFlags = 0;
|
ULONG TocDiskFlags = 0;
|
||||||
ULONG MediaChangeCount = 0;
|
ULONG MediaChangeCount = 0;
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
DEVICE_TYPE FilesystemDeviceType;
|
||||||
|
#endif
|
||||||
|
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -603,7 +607,16 @@ Return Value:
|
||||||
// always be waitable.
|
// 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 );
|
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 ));
|
ASSERT( FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -630,7 +643,11 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = CdPerformDevIoCtrl( IrpContext,
|
Status = CdPerformDevIoCtrl( IrpContext,
|
||||||
|
#ifndef __REACTOS__
|
||||||
IOCTL_CDROM_CHECK_VERIFY,
|
IOCTL_CDROM_CHECK_VERIFY,
|
||||||
|
#else
|
||||||
|
(FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_CHECK_VERIFY : IOCTL_CDROM_CHECK_VERIFY),
|
||||||
|
#endif
|
||||||
DeviceObjectWeTalkTo,
|
DeviceObjectWeTalkTo,
|
||||||
&MediaChangeCount,
|
&MediaChangeCount,
|
||||||
sizeof(ULONG),
|
sizeof(ULONG),
|
||||||
|
@ -659,7 +676,11 @@ Return Value:
|
||||||
//
|
//
|
||||||
|
|
||||||
Status = CdPerformDevIoCtrl( IrpContext,
|
Status = CdPerformDevIoCtrl( IrpContext,
|
||||||
|
#ifndef __REACTOS__
|
||||||
IOCTL_CDROM_GET_DRIVE_GEOMETRY,
|
IOCTL_CDROM_GET_DRIVE_GEOMETRY,
|
||||||
|
#else
|
||||||
|
(FilesystemDeviceType == FILE_DEVICE_DISK_FILE_SYSTEM ? IOCTL_DISK_GET_DRIVE_GEOMETRY : IOCTL_CDROM_GET_DRIVE_GEOMETRY),
|
||||||
|
#endif
|
||||||
DeviceObjectWeTalkTo,
|
DeviceObjectWeTalkTo,
|
||||||
&DiskGeometry,
|
&DiskGeometry,
|
||||||
sizeof( DISK_GEOMETRY ),
|
sizeof( DISK_GEOMETRY ),
|
||||||
|
@ -727,7 +748,11 @@ Return Value:
|
||||||
Status = IoCreateDevice( CdData.DriverObject,
|
Status = IoCreateDevice( CdData.DriverObject,
|
||||||
sizeof( VOLUME_DEVICE_OBJECT ) - sizeof( DEVICE_OBJECT ),
|
sizeof( VOLUME_DEVICE_OBJECT ) - sizeof( DEVICE_OBJECT ),
|
||||||
NULL,
|
NULL,
|
||||||
|
#ifndef __REACTOS__
|
||||||
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
|
||||||
|
#else
|
||||||
|
FilesystemDeviceType,
|
||||||
|
#endif
|
||||||
0,
|
0,
|
||||||
FALSE,
|
FALSE,
|
||||||
(PDEVICE_OBJECT *) &VolDo );
|
(PDEVICE_OBJECT *) &VolDo );
|
||||||
|
@ -780,7 +805,21 @@ Return Value:
|
||||||
|
|
||||||
if (Status != STATUS_SUCCESS) {
|
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 );
|
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.
|
// We only allow the invalidate call to come in on our file system devices.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||||
|
#else
|
||||||
|
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject &&
|
||||||
|
IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) {
|
||||||
|
#endif
|
||||||
|
|
||||||
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST );
|
CdCompleteRequest( IrpContext, Irp, STATUS_INVALID_DEVICE_REQUEST );
|
||||||
|
|
||||||
|
|
|
@ -1570,7 +1570,12 @@ Return Value:
|
||||||
// occur in the context of fileobjects (i.e., mount).
|
// occur in the context of fileobjects (i.e., mount).
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject) {
|
if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject) {
|
||||||
|
#else
|
||||||
|
if (IrpSp->DeviceObject == CdData.FileSystemDeviceObject ||
|
||||||
|
IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) {
|
||||||
|
#endif
|
||||||
|
|
||||||
if (IrpSp->FileObject != NULL &&
|
if (IrpSp->FileObject != NULL &&
|
||||||
IrpSp->MajorFunction != IRP_MJ_CREATE &&
|
IrpSp->MajorFunction != IRP_MJ_CREATE &&
|
||||||
|
@ -1648,7 +1653,12 @@ Return Value:
|
||||||
// the Vcb field.
|
// the Vcb field.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifndef __REACTOS__
|
||||||
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject) {
|
||||||
|
#else
|
||||||
|
if (IrpSp->DeviceObject != CdData.FileSystemDeviceObject &&
|
||||||
|
IrpSp->DeviceObject != CdData.HddFileSystemDeviceObject) {
|
||||||
|
#endif
|
||||||
|
|
||||||
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
NewIrpContext->Vcb = &((PVOLUME_DEVICE_OBJECT) IrpSp->DeviceObject)->Vcb;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue