Author: tfaber
Date: Fri Feb 27 21:30:09 2015
New Revision: 66478
URL:
http://svn.reactos.org/svn/reactos?rev=66478&view=rev
Log:
[CDFS]
- Handle errors from CcInitializeCacheMap and CcCopyRead
CORE-6501
Modified:
trunk/reactos/drivers/filesystems/cdfs/CMakeLists.txt
trunk/reactos/drivers/filesystems/cdfs/cdfs.h
trunk/reactos/drivers/filesystems/cdfs/fcb.c
trunk/reactos/drivers/filesystems/cdfs/fsctl.c
trunk/reactos/drivers/filesystems/cdfs/rw.c
Modified: trunk/reactos/drivers/filesystems/cdfs/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/C…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/CMakeLists.txt [iso-8859-1] Fri Feb 27 21:30:09
2015
@@ -19,6 +19,7 @@
add_library(cdfs SHARED ${SOURCE} cdfs.rc)
set_module_type(cdfs kernelmodedriver)
+target_link_libraries(cdfs ${PSEH_LIB})
add_importlibs(cdfs ntoskrnl hal)
add_pch(cdfs cdfs.h SOURCE)
add_cd_file(TARGET cdfs DESTINATION reactos/system32/drivers NO_CAB FOR all)
Modified: trunk/reactos/drivers/filesystems/cdfs/cdfs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/c…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/cdfs.h [iso-8859-1] Fri Feb 27 21:30:09 2015
@@ -3,6 +3,7 @@
#include <ntifs.h>
#include <ntddcdrm.h>
+#include <pseh/pseh2.h>
#define CDFS_BASIC_SECTOR 2048
#define CDFS_PRIMARY_DESCRIPTOR_LOCATION 16
Modified: trunk/reactos/drivers/filesystems/cdfs/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/fcb.c [iso-8859-1] Fri Feb 27 21:30:09 2015
@@ -255,11 +255,23 @@
Fcb->FileObject = FileObject;
Fcb->DevExt = Vcb;
- CcInitializeCacheMap(FileObject,
- (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
- FALSE,
- &(CdfsGlobalData->CacheMgrCallbacks),
- Fcb);
+ _SEH2_TRY
+ {
+ CcInitializeCacheMap(FileObject,
+ (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+ FALSE,
+ &(CdfsGlobalData->CacheMgrCallbacks),
+ Fcb);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ FileObject->FsContext2 = NULL;
+ ExFreePoolWithTag(newCCB, TAG_CCB);
+ ObDereferenceObject(FileObject);
+ Fcb->FileObject = NULL;
+ return _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
ObDereferenceObject(FileObject);
Fcb->Flags |= FCB_CACHE_INITIALIZED;
@@ -444,11 +456,21 @@
if (CdfsFCBIsDirectory(Fcb))
{
- CcInitializeCacheMap(FileObject,
- (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
- FALSE,
- &(CdfsGlobalData->CacheMgrCallbacks),
- Fcb);
+ _SEH2_TRY
+ {
+ CcInitializeCacheMap(FileObject,
+ (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+ FALSE,
+ &(CdfsGlobalData->CacheMgrCallbacks),
+ Fcb);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ FileObject->FsContext2 = NULL;
+ ExFreePoolWithTag(newCCB, TAG_CCB);
+ return _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
Fcb->Flags |= FCB_CACHE_INITIALIZED;
}
Modified: trunk/reactos/drivers/filesystems/cdfs/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/f…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/fsctl.c [iso-8859-1] Fri Feb 27 21:30:09 2015
@@ -414,11 +414,20 @@
Fcb->Entry.ExtentLocationL = 0;
Fcb->Entry.DataLengthL = (DeviceExt->CdInfo.VolumeSpaceSize +
DeviceExt->CdInfo.VolumeOffset) * BLOCKSIZE;
- CcInitializeCacheMap(DeviceExt->StreamFileObject,
- (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
- TRUE,
- &(CdfsGlobalData->CacheMgrCallbacks),
- Fcb);
+ _SEH2_TRY
+ {
+ CcInitializeCacheMap(DeviceExt->StreamFileObject,
+ (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+ TRUE,
+ &(CdfsGlobalData->CacheMgrCallbacks),
+ Fcb);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ Status = _SEH2_GetExceptionCode();
+ goto ByeBye;
+ }
+ _SEH2_END;
ExInitializeResourceLite(&DeviceExt->VcbResource);
Modified: trunk/reactos/drivers/filesystems/cdfs/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/cdfs/r…
==============================================================================
--- trunk/reactos/drivers/filesystems/cdfs/rw.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/cdfs/rw.c [iso-8859-1] Fri Feb 27 21:30:09 2015
@@ -91,20 +91,37 @@
Fcb->RFCB.ValidDataLength.HighPart,
Fcb->RFCB.ValidDataLength.LowPart);
- CcInitializeCacheMap(FileObject,
- &FileSizes,
- FALSE,
- &(CdfsGlobalData->CacheMgrCallbacks),
- Fcb);
+ _SEH2_TRY
+ {
+ CcInitializeCacheMap(FileObject,
+ &FileSizes,
+ FALSE,
+ &(CdfsGlobalData->CacheMgrCallbacks),
+ Fcb);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ return _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
}
FileOffset.QuadPart = (LONGLONG)ReadOffset;
- CcCopyRead(FileObject,
- &FileOffset,
- ToRead,
- TRUE,
- Buffer,
- &IoStatus);
+ _SEH2_TRY
+ {
+ CcCopyRead(FileObject,
+ &FileOffset,
+ ToRead,
+ TRUE,
+ Buffer,
+ &IoStatus);
+ }
+ _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+ {
+ IoStatus.Information = 0;
+ IoStatus.Status = _SEH2_GetExceptionCode();
+ }
+ _SEH2_END;
*LengthRead = IoStatus.Information;
Status = IoStatus.Status;