Hey Thomas
I think that you want to use _SEH2_YIELD in a few places here, that is,
unless we want to completely ditch pseh2 in favor of pseh3 ;-)
Regards
Jérôme
Le 24/08/2014 05:28, tfa...@svn.reactos.org a écrit :
Author: tfaber
Date: Sun Aug 24 03:28:01 2014
New Revision: 63928
URL: http://svn.reactos.org/svn/reactos?rev=63928&view=rev
Log:
[FASTFAT]
- Properly handle errors in CcInitializeCacheMap, CcCopyRead and CcCopyWrite
CORE-8410
Modified:
trunk/reactos/drivers/filesystems/fastfat/CMakeLists.txt
trunk/reactos/drivers/filesystems/fastfat/fcb.c
trunk/reactos/drivers/filesystems/fastfat/fsctl.c
trunk/reactos/drivers/filesystems/fastfat/rw.c
trunk/reactos/drivers/filesystems/fastfat/vfat.h
Modified: trunk/reactos/drivers/filesystems/fastfat/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/CMakeLists.txt?rev=63928&r1=63927&r2=63928&view=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/CMakeLists.txt[iso-8859-1]
(original)
+++ trunk/reactos/drivers/filesystems/fastfat/CMakeLists.txt[iso-8859-1]
Sun Aug 24 03:28:01 2014
@@ -26,6 +26,7 @@
add_library(fastfat SHARED ${SOURCE} vfatfs.rc)
set_module_type(fastfat kernelmodedriver)
+target_link_libraries(fastfat ${PSEH_LIB})
add_importlibs(fastfat ntoskrnl hal)
add_pch(fastfat vfat.h SOURCE)
Modified: trunk/reactos/drivers/filesystems/fastfat/fcb.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fcb.c?rev=63928&r1=63927&r2=63928&view=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fcb.c [iso-8859-1] Sun Aug 24
03:28:01 2014
@@ -340,12 +340,14 @@
{
PFILE_OBJECT fileObject;
PVFATCCB newCCB;
+NTSTATUS status;
fileObject = IoCreateStreamFileObject (NULL, vcb->StorageDevice);
newCCB = ExAllocateFromNPagedLookasideList(&VfatGlobalData->CcbLookasideList);
if (newCCB == NULL)
{
+ObDereferenceObject(fileObject);
return STATUS_INSUFFICIENT_RESOURCES;
}
RtlZeroMemory(newCCB, sizeof (VFATCCB));
@@ -356,11 +358,24 @@
fcb->FileObject = fileObject;
fcb->RefCount++;
-CcInitializeCacheMap(fileObject,
- (PCC_FILE_SIZES)(&fcb->RFCB.AllocationSize),
- TRUE,
- &VfatGlobalData->CacheMgrCallbacks,
- fcb);
+_SEH2_TRY
+{
+CcInitializeCacheMap(fileObject,
+ (PCC_FILE_SIZES)(&fcb->RFCB.AllocationSize),
+ TRUE,
+ &VfatGlobalData->CacheMgrCallbacks,
+ fcb);
+}
+_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+{
+status = _SEH2_GetExceptionCode();
+fcb->RefCount--;
+fcb->FileObject = NULL;
+ExFreeToNPagedLookasideList(&VfatGlobalData->CcbLookasideList, newCCB);
+ObDereferenceObject(fileObject);
+return status;
+}
+_SEH2_END;
fcb->Flags |= FCB_CACHE_INITIALIZED;
return STATUS_SUCCESS;
Modified: trunk/reactos/drivers/filesystems/fastfat/fsctl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/fsctl.c?rev=63928&r1=63927&r2=63928&view=diff
==
--- trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/fsctl.c [iso-8859-1] Sun Aug 24
03:28:01 2014
@@ -550,11 +550,20 @@
Fcb->RFCB.ValidDataLength = Fcb->RFCB.FileSize;
Fcb->RFCB.AllocationSize = Fcb->RFCB.FileSize;
-CcInitializeCacheMap(DeviceExt->FATFileObject,
- (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
- TRUE,
- &VfatGlobalData->CacheMgrCallbacks,
- Fcb);
+_SEH2_TRY
+{
+CcInitializeCacheMap(DeviceExt->FATFileObject,
+ (PCC_FILE_SIZES)(&Fcb->RFCB.AllocationSize),
+ TRUE,
+ &VfatGlobalData->CacheMgrCallbacks,
+ Fcb);
+}
+_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+{
+Status = _SEH2_GetExceptionCode();
+goto ByeBye;
+}
+_SEH2_END;
DeviceExt->LastAvailableCluster = 2;
ExInitializeResourceLite(&DeviceExt->FatResource);
Modified: trunk/reactos/drivers/filesystems/fastfat/rw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfat/rw.c?rev=63928&r1=63927&r2=63928&view=diff
==
--- trunk/reactos/drivers/fil