--*/
-#include "CdProcs.h"
+#include "cdprocs.h"
//
// The Bug check file id for this module
IoAcquireVpbSpinLock( &SavedIrql );
+#ifdef _MSC_VER
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
+#endif
NewVcb->Vpb->RealDevice->Vpb = OldVcb->Vpb;
OldVcb->Vpb->RealDevice = NewVcb->Vpb->RealDevice;
ULONG TocDiskFlags = 0;
ULONG MediaChangeCount = 0;
+#ifdef __REACTOS__
+ DEVICE_TYPE FilesystemDeviceType;
+#endif
+
#ifdef CDFS_TELEMETRY_DATA
GUID VolumeGuid;
GUID VolumeCorrelationId = { 0 };
// always be waitable.
//
+#ifdef __REACTOS__
+ if (IrpSp->DeviceObject == CdData.HddFileSystemDeviceObject) {
+ FilesystemDeviceType = FILE_DEVICE_DISK_FILE_SYSTEM;
+ } else {
+#endif
NT_ASSERT( Vpb->RealDevice->DeviceType == FILE_DEVICE_CD_ROM );
+#ifdef __REACTOS__
+ FilesystemDeviceType = FILE_DEVICE_CD_ROM_FILE_SYSTEM;
+ }
+#endif
NT_ASSERT( FlagOn( IrpContext->Flags, IRP_CONTEXT_FLAG_WAIT ));
#ifdef CDFS_TELEMETRY_DATA
//
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),
//
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 ),
// Use a try-finally to facilitate cleanup.
//
- try {
+ _SEH2_TRY {
//
// Allocate a buffer to query the TOC.
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 );
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
}
//
Status = STATUS_SUCCESS;
- } finally {
+ } _SEH2_FINALLY {
//
// Free the TOC buffer if not in the Vcb.
// If we are not mounting the device, then set the verify bit again.
//
- if ((AbnormalTermination() || (Status != STATUS_SUCCESS)) &&
+ if ((_SEH2_AbnormalTermination() || (Status != STATUS_SUCCESS)) &&
SetDoVerifyOnFail) {
CdMarkRealDevForVerify( IrpContext->RealDevice);
//
CdReleaseCdData( IrpContext );
- }
+ } _SEH2_END;
//
// Now send mount notification.
CdAcquireCdData( IrpContext );
- try {
+ _SEH2_TRY {
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
ReleaseVcb = TRUE;
}
}
- }
- finally {
+ } _SEH2_FINALLY {
//
// Free the TOC buffer if allocated.
}
CdReleaseCdData( IrpContext );
- }
+ } _SEH2_END;
//
// Now send mount notification.
// Use a try finally to free the Fcb.
//
- try {
+ _SEH2_TRY {
//
// Verify the Fcb.
Irp = NULL;
- } finally {
+ } _SEH2_FINALLY {
//
// Release all of our resources
//
CdReleaseFcb( IrpContext, Fcb );
- }
+ } _SEH2_END;
//
// Complete the request if there was no exception.
Vcb = Fcb->Vcb;
CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
- try {
+ _SEH2_TRY {
//
// Verify the Vcb.
Status = CdLockVolumeInternal( IrpContext, Vcb, IrpSp->FileObject );
- } finally {
+ } _SEH2_FINALLY {
//
// Release the Vcb.
CdReleaseVcb( IrpContext, Vcb );
- if (AbnormalTermination() || !NT_SUCCESS( Status )) {
+ if (_SEH2_AbnormalTermination() || !NT_SUCCESS( Status )) {
FsRtlNotifyVolumeEvent( IrpSp->FileObject, FSRTL_VOLUME_LOCK_FAILED );
}
- }
+ } _SEH2_END;
//
// Complete the request if there haven't been any exceptions.
// 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 );
0,
*IoFileObjectType,
KernelMode,
- &FileToMarkBad,
+ (PVOID*)&FileToMarkBad, /* ReactOS Change: GCC "passing argument 5 of 'ObReferenceObjectByHandle' from incompatible pointer type" */
NULL );
if (!NT_SUCCESS(Status)) {
IoAcquireVpbSpinLock( &SavedIrql );
+#ifdef _MSC_VER
#pragma prefast(suppress: 28175, "this is a filesystem driver, touching the vpb is allowed")
+#endif
if (DeviceToMarkBad->Vpb == Vcb->Vpb) {
PVPB NewVpb = Vcb->SwapVpb;
NewVpb->Size = sizeof( VPB );
NewVpb->RealDevice = DeviceToMarkBad;
+#ifdef _MSC_VER
#pragma prefast(push)
#pragma prefast(disable: 28175, "this is a filesystem driver, touching the vpb is allowed")
+#endif
NewVpb->Flags = FlagOn( DeviceToMarkBad->Vpb->Flags, VPB_REMOVE_PENDING );
DeviceToMarkBad->Vpb = NewVpb;
+#ifdef _MSC_VER
#pragma prefast(pop)
+#endif
Vcb->SwapVpb = NULL;
}
// Check for whether this device supports XA and multi-session.
//
- try {
+ _SEH2_TRY {
//
// Allocate a buffer for the last session information.
ThisPass += 1;
}
- } finally {
+ } _SEH2_FINALLY {
if (CdromToc != NULL) { CdFreePool( &CdromToc ); }
- }
+ } _SEH2_END;
}
//