https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f723d230a0bc4b7b78ca125abecce137bb96bed6

commit f723d230a0bc4b7b78ca125abecce137bb96bed6
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Fri Nov 17 22:18:53 2017 +0100

    [CDFS_NEW] _SEH2_FINALLY implement SEH support for real instead of its 
current stub.
    This notably fixes BSOD on media change
---
 drivers/filesystems/cdfs_new/allocsup.c           |  6 ++--
 drivers/filesystems/cdfs_new/cachesup.c           |  6 ++--
 drivers/filesystems/cdfs_new/cddata.c             | 16 +++++-----
 drivers/filesystems/cdfs_new/cdprocs.h            | 15 +++++-----
 drivers/filesystems/cdfs_new/cleanup.c            | 12 ++++----
 drivers/filesystems/cdfs_new/create.c             | 26 ++++++++--------
 drivers/filesystems/cdfs_new/deviosup.c           | 20 ++++++-------
 drivers/filesystems/cdfs_new/dirctrl.c            | 20 ++++++-------
 drivers/filesystems/cdfs_new/fileinfo.c           | 36 +++++++++++------------
 drivers/filesystems/cdfs_new/fsctrl.c             | 34 ++++++++++-----------
 drivers/filesystems/cdfs_new/fspdisp.c            |  8 ++---
 drivers/filesystems/cdfs_new/lockctrl.c           | 24 +++++++--------
 drivers/filesystems/cdfs_new/read.c               | 12 ++++----
 drivers/filesystems/cdfs_new/strucsup.c           | 26 ++++++++--------
 drivers/filesystems/cdfs_new/verfysup.c           |  8 ++---
 drivers/filesystems/cdfs_new/volinfo.c            |  6 ++--
 drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff | 31 -------------------
 17 files changed, 138 insertions(+), 168 deletions(-)

diff --git a/drivers/filesystems/cdfs_new/allocsup.c 
b/drivers/filesystems/cdfs_new/allocsup.c
index b875eca143..93b35bcfda 100755
--- a/drivers/filesystems/cdfs_new/allocsup.c
+++ b/drivers/filesystems/cdfs_new/allocsup.c
@@ -149,7 +149,7 @@ Return Value:
     //  Use a try finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We use a loop to perform the lookup.  If we don't find the mapping 
in the
@@ -296,7 +296,7 @@ Return Value:
             FirstPass = FALSE;
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         if (CleanupParent) {
 
@@ -311,7 +311,7 @@ Return Value:
         }
 
         if (UnlockFcb) { CdUnlockFcb( IrpContext, Fcb ); }
-    }
+    } _SEH2_END;
 
     return;
 }
diff --git a/drivers/filesystems/cdfs_new/cachesup.c 
b/drivers/filesystems/cdfs_new/cachesup.c
index 87b75bbc51..600262f84a 100755
--- a/drivers/filesystems/cdfs_new/cachesup.c
+++ b/drivers/filesystems/cdfs_new/cachesup.c
@@ -94,7 +94,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Create the internal stream.  The Vpb should be pointing at our 
volume
@@ -272,7 +272,7 @@ Return Value:
             }
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Cleanup any dirent structures we may have used.
@@ -306,7 +306,7 @@ Return Value:
         }
 
         CdUnlockFcb( IrpContext, Fcb );
-    }
+    } _SEH2_END;
 
     return;
 }
diff --git a/drivers/filesystems/cdfs_new/cddata.c 
b/drivers/filesystems/cdfs_new/cddata.c
index dbd572a797..c8367233ab 100755
--- a/drivers/filesystems/cdfs_new/cddata.c
+++ b/drivers/filesystems/cdfs_new/cddata.c
@@ -259,7 +259,7 @@ Return Value:
         //  Use a try-except to handle the exception cases.
         //
 
-        try {
+        _SEH2_TRY {
 
             //
             //  If the IrpContext is NULL then this is the first pass through
@@ -398,10 +398,10 @@ Return Value:
                 CdCompleteRequest( IrpContext, Irp, Status );
             }
 
-        } except( CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
+        } _SEH2_EXCEPT( CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() )) {
 
-            Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
-        }
+            Status = CdProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
+        } _SEH2_END;
 
     } while (Status == STATUS_CANT_WAIT);
 
@@ -653,7 +653,7 @@ Return Value:
     //  Note that (children of) CdFsdPostRequest can raise (Mdl allocation).
     //
 
-    try {
+    _SEH2_TRY {
     
         if (ExceptionCode == STATUS_CANT_WAIT) {
 
@@ -670,10 +670,10 @@ Return Value:
             }
         }
     }
-    except( CdExceptionFilter( IrpContext, GetExceptionInformation() ))  {
+    _SEH2_EXCEPT( CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() ))  {
     
-        ExceptionCode = GetExceptionCode();        
-    }
+        ExceptionCode = _SEH2_GetExceptionCode();        
+    } _SEH2_END;
     
     //
     //  If we posted the request or our caller will retry then just return 
here.
diff --git a/drivers/filesystems/cdfs_new/cdprocs.h 
b/drivers/filesystems/cdfs_new/cdprocs.h
index 921f523720..2b066e7192 100755
--- a/drivers/filesystems/cdfs_new/cdprocs.h
+++ b/drivers/filesystems/cdfs_new/cdprocs.h
@@ -22,6 +22,9 @@ Abstract:
 #include <ntddcdrm.h>
 #include <ntdddisk.h>
 #include <ntddscsi.h>
+#ifdef __REACTOS__
+#include <pseh/pseh2.h>
+#endif
 
 #ifndef INLINE
 #define INLINE __inline
@@ -1881,16 +1884,14 @@ CdCommonPnp (                               //  
Implemented in Pnp.c
 //
 //      #define try_return(S)  { S; goto try_exit; }
 //
-/* ReactOS Change: Remove SEH */
-#define try
-#define leave goto exitLabel;
-#define finally  if (0) goto exitLabel; exitLabel:
-#define except(x) while (0)
-#define GetExceptionCode() 0
-#define AbnormalTermination() 0
 
+#ifndef __REACTOS__
 #define try_return(S) { S; goto try_exit; }
 #define try_leave(S) { S; leave; }
+#else
+#define try_return(S) { S; goto try_exit; }
+#define try_leave(S) { S; _SEH2_LEAVE; }
+#endif
 
 
 //
diff --git a/drivers/filesystems/cdfs_new/cleanup.c 
b/drivers/filesystems/cdfs_new/cleanup.c
index 4c621e5c2f..a89be2ffef 100755
--- a/drivers/filesystems/cdfs_new/cleanup.c
+++ b/drivers/filesystems/cdfs_new/cleanup.c
@@ -159,7 +159,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    //try { /* ReactOS Change: Manual removal of SEH since macros to hack 
around it don't allow multiple SEH usage within one function */
+    _SEH2_TRY {
     
         //
         //  Case on the type of open that we are trying to cleanup.
@@ -279,7 +279,7 @@ Return Value:
 
         IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );
 
-    //} finally { /* ReactOS Change: Manual removal of SEH since macros to 
hack around it don't allow multiple SEH usage within one function */
+    } _SEH2_FINALLY {
 
         CdReleaseFcb( IrpContext, Fcb );
         
@@ -287,7 +287,7 @@ Return Value:
             
             FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
         }
-    //} /* ReactOS Change: Manual removal of SEH since macros to hack around 
it don't allow multiple SEH usage within one function */
+    } _SEH2_END;
 
     //
     //  If appropriate, try to spark teardown by purging the volume.  Should
@@ -305,19 +305,19 @@ Return Value:
         
         CdAcquireCdData( IrpContext);
 
-        try {
+        _SEH2_TRY {
             
             CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
             VcbAcquired = TRUE;
             
             CdPurgeVolume( IrpContext, Vcb, FALSE );
 
-        } finally {
+        } _SEH2_FINALLY {
 
             if (VcbAcquired) { CdReleaseVcb( IrpContext, Vcb ); }
             
             CdReleaseCdData( IrpContext);
-        }
+        } _SEH2_END;
     }
 
     //
diff --git a/drivers/filesystems/cdfs_new/create.c 
b/drivers/filesystems/cdfs_new/create.c
index bb072da107..3cab9b9ff9 100755
--- a/drivers/filesystems/cdfs_new/create.c
+++ b/drivers/filesystems/cdfs_new/create.c
@@ -357,7 +357,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify that the Vcb is not in an unusable condition.  This routine
@@ -901,7 +901,7 @@ Return Value:
                                                         RelatedCcb ));
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Cleanup the PathEntry if initialized.
@@ -926,7 +926,7 @@ Return Value:
         //  condition.
         //
 
-        if (AbnormalTermination()) {
+        if (_SEH2_AbnormalTermination()) {
 
 
             //
@@ -985,7 +985,7 @@ Return Value:
         //
 
         CdCompleteRequest( IrpContext, Irp, Status );
-    }
+    } _SEH2_END;
 
     return Status;
 }
@@ -1512,7 +1512,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Go ahead and figure out the TypeOfOpen and NodeType.  We can
@@ -1905,7 +1905,7 @@ Return Value:
         }
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         if (UnlockVcb) {
 
@@ -1921,7 +1921,7 @@ Return Value:
 
             CdCleanupCompoundPathEntry( IrpContext, &CompoundPathEntry );
         }
-    }
+    } _SEH2_END;
 
     return Status;
 }
@@ -2126,7 +2126,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Check the related Ccb to see if this was an OpenByFileId.
@@ -2281,7 +2281,7 @@ Return Value:
                                         
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Unlock the Vcb if held.
@@ -2300,7 +2300,7 @@ Return Value:
 
             CdReleaseFcb( IrpContext, ParentFcb );
         }
-    }
+    } _SEH2_END;
 
     return Status;
 }
@@ -2399,7 +2399,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Check if a version number was used to open this file.
@@ -2569,7 +2569,7 @@ Return Value:
                                     CcbFlags,
                                     
IrpSp->Parameters.Create.SecurityContext->DesiredAccess );
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Unlock the Vcb if held.
@@ -2588,7 +2588,7 @@ Return Value:
 
             CdReleaseFcb( IrpContext, ParentFcb );
         }
-    }
+    } _SEH2_END;
 
     return Status;
 }
diff --git a/drivers/filesystems/cdfs_new/deviosup.c 
b/drivers/filesystems/cdfs_new/deviosup.c
index 0c5c9d2bff..c12f1aa521 100755
--- a/drivers/filesystems/cdfs_new/deviosup.c
+++ b/drivers/filesystems/cdfs_new/deviosup.c
@@ -355,7 +355,7 @@ Return Value:
     //  Use a try-finally to perform the final cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Loop while there are more bytes to transfer.
@@ -518,7 +518,7 @@ Return Value:
         }
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Perform final cleanup on the IoRuns if necessary.
@@ -528,7 +528,7 @@ Return Value:
 
             CdFinishBuffers( IrpContext, IoRuns, CleanupRunCount, TRUE, FALSE 
);
         }
-    }
+    } _SEH2_END;
 
     return Status;
 }
@@ -624,7 +624,7 @@ Return Value:
     //  Use a try-finally to perform the final cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  If the initial offset lies within the RIFF header then copy the
@@ -960,7 +960,7 @@ Return Value:
         KeFlushIoBuffers( IrpContext->Irp->MdlAddress, TRUE, FALSE );
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Perform final cleanup on the IoRuns if necessary.
@@ -970,7 +970,7 @@ Return Value:
 
             CdFinishBuffers( IrpContext, IoRuns, CleanupRunCount, TRUE, FALSE 
);
         }
-    }
+    } _SEH2_END;
 
     return Status;
 }
@@ -1176,15 +1176,15 @@ Return Value:
         //  deallocate the Mdl and return the appropriate "expected" status.
         //
 
-        try {
+        _SEH2_TRY {
 
             MmProbeAndLockPages( Mdl, IrpContext->Irp->RequestorMode, 
IoWriteAccess );
 
             Status = STATUS_SUCCESS;
 
-        } except(EXCEPTION_EXECUTE_HANDLER) {
+        } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
 
-            Status = GetExceptionCode();
+            Status = _SEH2_GetExceptionCode();
 
             IoFreeMdl( Mdl );
             IrpContext->Irp->MdlAddress = NULL;
@@ -1193,7 +1193,7 @@ Return Value:
 
                 Status = STATUS_INVALID_USER_BUFFER;
             }
-        }
+        } _SEH2_END;
     }
 
     //
diff --git a/drivers/filesystems/cdfs_new/dirctrl.c 
b/drivers/filesystems/cdfs_new/dirctrl.c
index 29265a844a..28cf0d51ea 100755
--- a/drivers/filesystems/cdfs_new/dirctrl.c
+++ b/drivers/filesystems/cdfs_new/dirctrl.c
@@ -287,7 +287,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Fcb is still good.
@@ -499,7 +499,7 @@ Return Value:
             //  such trickery.
             //
             
-            try {
+            _SEH2_TRY {
             
                 //
                 //  Zero and initialize the base part of the current entry.
@@ -715,7 +715,7 @@ Return Value:
                 LastEntry = NextEntry;
                 NextEntry = QuadAlign( Information );
             
-            } except (EXCEPTION_EXECUTE_HANDLER) {
+            } _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER) {
 
                   //
                   //  We had a problem filling in the user's buffer, so stop 
and
@@ -724,13 +724,13 @@ Return Value:
                   //
                   
                   Information = 0;
-                  try_leave( Status = GetExceptionCode());
-            }
+                  try_leave( Status = _SEH2_GetExceptionCode());
+            } _SEH2_END;
         }
         
         DoCcbUpdate = TRUE;
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Cleanup our search context - *before* acquiring the FCB mutex 
exclusive,
@@ -769,7 +769,7 @@ Return Value:
         //
 
         CdReleaseFile( IrpContext, Fcb );
-    }
+    } _SEH2_END;
 
     //
     //  Complete the request here.
@@ -837,7 +837,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Vcb.
@@ -862,14 +862,14 @@ Return Value:
                                         NULL,
                                         NULL );
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the Vcb.
         //
 
         CdReleaseVcb( IrpContext, IrpContext->Vcb );
-    }
+    } _SEH2_END;
 
     //
     //  Cleanup the IrpContext.
diff --git a/drivers/filesystems/cdfs_new/fileinfo.c 
b/drivers/filesystems/cdfs_new/fileinfo.c
index b4a185a98a..ca2205869d 100755
--- a/drivers/filesystems/cdfs_new/fileinfo.c
+++ b/drivers/filesystems/cdfs_new/fileinfo.c
@@ -165,7 +165,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We only support query on file and directory handles.
@@ -325,7 +325,7 @@ Return Value:
 
         Irp->IoStatus.Information = IrpSp->Parameters.QueryFile.Length - 
Length;
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the file.
@@ -335,7 +335,7 @@ Return Value:
 
             CdReleaseFile( IrpContext, Fcb );
         }
-    }
+    } _SEH2_END;
 
     //
     //  Complete the request if we didn't raise.
@@ -406,7 +406,7 @@ Return Value:
 
     CdAcquireFileShared( IrpContext, Fcb );
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Make sure the Fcb is in a usable condition.  This
@@ -445,10 +445,10 @@ Return Value:
         Status = STATUS_SUCCESS;
 
     try_exit: NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         CdReleaseFile( IrpContext, Fcb );
-    }
+    } _SEH2_END;
 
     //
     //  Complete the request if there was no raise.
@@ -536,7 +536,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Only deal with 'good' Fcb's.
@@ -566,12 +566,12 @@ Return Value:
             Result = TRUE;
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         ExReleaseResourceLite( Fcb->Resource );
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Result;
 }
@@ -654,7 +654,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Only deal with 'good' Fcb's.
@@ -694,12 +694,12 @@ Return Value:
             Result = TRUE;
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         ExReleaseResourceLite( Fcb->Resource );
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Result;
 }
@@ -782,7 +782,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Only deal with 'good' Fcb's.
@@ -827,12 +827,12 @@ Return Value:
             Result = TRUE;
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         ExReleaseResourceLite( Fcb->Resource );
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Result;
 }
@@ -1278,7 +1278,7 @@ Return Value:
     //  Use a try-finally to cleanup the structures.
     //
 
-    try {
+    _SEH2_TRY {
 
         ParentFcb = Fcb->ParentFcb;
         CdAcquireFileShared( IrpContext, ParentFcb );
@@ -1396,7 +1396,7 @@ Return Value:
         RtlCopyMemory( Buffer->FileName, ShortNameBuffer, 
Buffer->FileNameLength );
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         if (CleanupFileLookup) {
 
@@ -1413,7 +1413,7 @@ Return Value:
 
             CdReleaseFile( IrpContext, ParentFcb );
         }
-    }
+    } _SEH2_END;
 
     //
     //  Reduce the available bytes by the amount stored into this buffer.
diff --git a/drivers/filesystems/cdfs_new/fsctrl.c 
b/drivers/filesystems/cdfs_new/fsctrl.c
index 74b6c63839..cfa3e8b8ac 100755
--- a/drivers/filesystems/cdfs_new/fsctrl.c
+++ b/drivers/filesystems/cdfs_new/fsctrl.c
@@ -723,7 +723,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Allocate a buffer to query the TOC.
@@ -1058,7 +1058,7 @@ Return Value:
 
         Status = STATUS_SUCCESS;
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Free the TOC buffer if not in the Vcb.
@@ -1082,7 +1082,7 @@ Return Value:
         //  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);
@@ -1119,7 +1119,7 @@ Return Value:
         //
 
         CdReleaseCdData( IrpContext );
-    }
+    } _SEH2_END;
 
     //
     //  Now send mount notification.
@@ -1221,7 +1221,7 @@ Return Value:
 
     CdAcquireCdData( IrpContext );
 
-    try {
+    _SEH2_TRY {
 
         CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
         ReleaseVcb = TRUE;
@@ -1545,7 +1545,7 @@ Return Value:
             }
         }
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Free the TOC buffer if allocated.
@@ -1567,7 +1567,7 @@ Return Value:
         }
 
         CdReleaseCdData( IrpContext );
-    }
+    } _SEH2_END;
 
     //
     //  Now send mount notification.
@@ -1692,7 +1692,7 @@ Return Value:
     //  Use a try finally to free the Fcb.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Fcb.
@@ -1722,14 +1722,14 @@ Return Value:
 
         Irp = NULL;
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release all of our resources
         //
 
         CdReleaseFcb( IrpContext, Fcb );
-    }
+    } _SEH2_END;
 
     //
     //  Complete the request if there was no exception.
@@ -1804,7 +1804,7 @@ Return Value:
     Vcb = Fcb->Vcb;
     CdAcquireVcbExclusive( IrpContext, Vcb, FALSE );
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Vcb.
@@ -1814,7 +1814,7 @@ Return Value:
 
         Status = CdLockVolumeInternal( IrpContext, Vcb, IrpSp->FileObject );
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the Vcb.
@@ -1822,11 +1822,11 @@ Return Value:
 
         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.
@@ -2635,7 +2635,7 @@ Return Value:
             //  Check for whether this device supports XA and multi-session.
             //
 
-            try {
+            _SEH2_TRY {
 
                 //
                 //  Allocate a buffer for the last session information.
@@ -2713,10 +2713,10 @@ Return Value:
                     ThisPass += 1;
                 }
 
-            } finally {
+            } _SEH2_FINALLY {
 
                 if (CdromToc != NULL) { CdFreePool( &CdromToc ); }
-            }
+            } _SEH2_END;
         }
 
         //
diff --git a/drivers/filesystems/cdfs_new/fspdisp.c 
b/drivers/filesystems/cdfs_new/fspdisp.c
index a3b89b96cf..da685e2203 100755
--- a/drivers/filesystems/cdfs_new/fspdisp.c
+++ b/drivers/filesystems/cdfs_new/fspdisp.c
@@ -94,7 +94,7 @@ Return Value:
 
         while (TRUE) {
 
-            try {
+            _SEH2_TRY {
 
                 //
                 //  Reinitialize for the next try at completing this
@@ -184,10 +184,10 @@ Return Value:
                     CdCompleteRequest( IrpContext, Irp, Status );
                 }
 
-            } except( CdExceptionFilter( IrpContext, GetExceptionInformation() 
)) {
+            } _SEH2_EXCEPT( CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() )) {
 
-                Status = CdProcessException( IrpContext, Irp, 
GetExceptionCode() );
-            }
+                Status = CdProcessException( IrpContext, Irp, 
_SEH2_GetExceptionCode() );
+            } _SEH2_END;
 
             //
             //  Break out of the loop if we didn't get CANT_WAIT.
diff --git a/drivers/filesystems/cdfs_new/lockctrl.c 
b/drivers/filesystems/cdfs_new/lockctrl.c
index 149d4ecb5c..961c3be6e9 100755
--- a/drivers/filesystems/cdfs_new/lockctrl.c
+++ b/drivers/filesystems/cdfs_new/lockctrl.c
@@ -224,7 +224,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We check whether we can proceed based on the state of the file 
oplocks.
@@ -275,10 +275,10 @@ Return Value:
         }
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Results;
 }
@@ -366,7 +366,7 @@ Return Value:
 
     FsRtlEnterFileSystem();
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We check whether we can proceed based on the state of the file 
oplocks.
@@ -416,10 +416,10 @@ Return Value:
         }
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Results;
 }
@@ -498,7 +498,7 @@ Return Value:
 
     FsRtlEnterFileSystem();
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We check whether we can proceed based on the state of the file 
oplocks.
@@ -539,10 +539,10 @@ Return Value:
         CdUnlockFcb( IrpContext, Fcb );
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Results;
 }
@@ -624,7 +624,7 @@ Return Value:
 
     FsRtlEnterFileSystem();
 
-    try {
+    _SEH2_TRY {
 
         //
         //  We check whether we can proceed based on the state of the file 
oplocks.
@@ -666,10 +666,10 @@ Return Value:
         CdUnlockFcb( IrpContext, Fcb );
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         FsRtlExitFileSystem();
-    }
+    } _SEH2_END;
 
     return Results;
 }
diff --git a/drivers/filesystems/cdfs_new/read.c 
b/drivers/filesystems/cdfs_new/read.c
index cadf3c464f..b32b13b824 100755
--- a/drivers/filesystems/cdfs_new/read.c
+++ b/drivers/filesystems/cdfs_new/read.c
@@ -35,11 +35,11 @@ Abstract:
 //
 
 #define SafeZeroMemory(IC,AT,BYTE_COUNT) {                  \
-    try {                                                   \
+    _SEH2_TRY {                                             \
         RtlZeroMemory( (AT), (BYTE_COUNT) );                \
-    } except( EXCEPTION_EXECUTE_HANDLER ) {                 \
+    } _SEH2_EXCEPT( EXCEPTION_EXECUTE_HANDLER ) {           \
          CdRaiseStatus( IC, STATUS_INVALID_USER_BUFFER );   \
-    }                                                       \
+    } _SEH2_END;                                            \
 }
 
 //
@@ -180,7 +180,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Fcb.  Allow reads if this is a DASD handle that is 
@@ -515,7 +515,7 @@ Return Value:
         }
 
     try_exit:  NOTHING;
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the Fcb.
@@ -525,7 +525,7 @@ Return Value:
 
             CdReleaseFile( IrpContext, Fcb );
         }
-    }
+    } _SEH2_END;
 
     //
     //  Post the request if we got CANT_WAIT.
diff --git a/drivers/filesystems/cdfs_new/strucsup.c 
b/drivers/filesystems/cdfs_new/strucsup.c
index 3439b73000..7ab3b2a0e7 100755
--- a/drivers/filesystems/cdfs_new/strucsup.c
+++ b/drivers/filesystems/cdfs_new/strucsup.c
@@ -298,19 +298,19 @@ Return Value:
     //  uninitialize the notify structures before returning.
     //
     
-    try  {
+    _SEH2_TRY  {
 
         Vcb->SwapVpb = FsRtlAllocatePoolWithTag( NonPagedPool,
                                                  sizeof( VPB ),
                                                  TAG_VPB );
     }
-    finally {
+    _SEH2_FINALLY {
 
-        if (AbnormalTermination())  {
+        if (_SEH2_AbnormalTermination())  {
         
             FsRtlNotifyUninitializeSync( &Vcb->NotifySync );
         }
-    }
+    } _SEH2_END;
 
     //
     //  Nothing beyond this point should raise.
@@ -456,7 +456,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Copy the block size and compute the various block masks.
@@ -843,10 +843,10 @@ Return Value:
             SetFlag( Vcb->VcbState, VCB_STATE_ISO );
         }
         
-    } finally {
+    } _SEH2_FINALLY {
 
         if (UnlockVcb) { CdUnlockVcb( IrpContext, Vcb ); }
-    }
+    } _SEH2_END;
 }
 
 
@@ -1238,7 +1238,7 @@ Return Value:
 
     CdLockFcb( IrpContext, Fcb );
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Initialize the common header in the Fcb.  The node type is already
@@ -1361,10 +1361,10 @@ Return Value:
         CdInsertFcbTable( IrpContext, Fcb );
         SetFlag( Fcb->FcbState, FCB_STATE_IN_FCB_TABLE );
 
-    } finally {
+    } _SEH2_FINALLY {
 
         CdUnlockFcb( IrpContext, Fcb );
-    }
+    } _SEH2_END;
 
     return;
 }
@@ -1937,7 +1937,7 @@ Return Value:
     //  Use a try-finally to safely clear the top-level field.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Loop until we find an Fcb we can't remove.
@@ -2041,7 +2041,7 @@ Return Value:
 
         } while (CurrentFcb != NULL);
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the current Fcb if we have acquired it.
@@ -2057,7 +2057,7 @@ Return Value:
         //
 
         ClearFlag( IrpContext->TopLevel->Flags, IRP_CONTEXT_FLAG_IN_TEARDOWN );
-    }
+    } _SEH2_END;
 
     *RemovedStartingFcb = (CurrentFcb != StartingFcb);
     return;
diff --git a/drivers/filesystems/cdfs_new/verfysup.c 
b/drivers/filesystems/cdfs_new/verfysup.c
index 24c671afc2..fc130d872b 100755
--- a/drivers/filesystems/cdfs_new/verfysup.c
+++ b/drivers/filesystems/cdfs_new/verfysup.c
@@ -92,7 +92,7 @@ Return Value:
     Vcb = &CONTAINING_RECORD( IrpSp->DeviceObject,
                               VOLUME_DEVICE_OBJECT,
                               DeviceObject )->Vcb;
-    try {
+    _SEH2_TRY {
 
         //
         //  Send down the verify FSCTL.  Note that this is sent to the
@@ -206,7 +206,7 @@ Return Value:
             Status = CdFsdPostRequest( IrpContext, Irp );
         }
 
-    } except(CdExceptionFilter( IrpContext, GetExceptionInformation() )) {
+    } _SEH2_EXCEPT(CdExceptionFilter( IrpContext, 
_SEH2_GetExceptionInformation() )) {
 
         //
         //  We had some trouble trying to perform the verify or raised
@@ -214,8 +214,8 @@ Return Value:
         //  the error status that we get back from the exception code.
         //
 
-        Status = CdProcessException( IrpContext, Irp, GetExceptionCode() );
-    }
+        Status = CdProcessException( IrpContext, Irp, _SEH2_GetExceptionCode() 
);
+    } _SEH2_END;
 
     return Status;
 }
diff --git a/drivers/filesystems/cdfs_new/volinfo.c 
b/drivers/filesystems/cdfs_new/volinfo.c
index d0962fb4b8..b215fe081b 100755
--- a/drivers/filesystems/cdfs_new/volinfo.c
+++ b/drivers/filesystems/cdfs_new/volinfo.c
@@ -130,7 +130,7 @@ Return Value:
     //  Use a try-finally to facilitate cleanup.
     //
 
-    try {
+    _SEH2_TRY {
 
         //
         //  Verify the Vcb.
@@ -177,14 +177,14 @@ Return Value:
 
         Irp->IoStatus.Information = IrpSp->Parameters.QueryVolume.Length - 
Length;
 
-    } finally {
+    } _SEH2_FINALLY {
 
         //
         //  Release the Vcb.
         //
 
         CdReleaseVcb( IrpContext, Fcb->Vcb );
-    }
+    } _SEH2_END;
 
     //
     //  Complete the request if we didn't raise.
diff --git a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff 
b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
index cc84eb55c2..f6144dd1d9 100644
--- a/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
+++ b/drivers/filesystems/cdfs_new/wdk_wnet_to_ros.diff
@@ -805,37 +805,6 @@ Index: drivers/filesystems/cdfs_new/lockctrl.c
  CdFastUnlockAllByKey (
      IN PFILE_OBJECT FileObject,
      PVOID ProcessId,
-Index: drivers/filesystems/cdfs_new/cleanup.c
-===================================================================
---- drivers/filesystems/cdfs_new/cleanup.c     (revision 34615)
-+++ drivers/filesystems/cdfs_new/cleanup.c     (working copy)
-@@ -159,7 +159,7 @@
-     //  Use a try-finally to facilitate cleanup.
-     //
- 
--    try {
-+    //try { /* ReactOS Change: Manual removal of SEH since macros to hack 
around it don't allow multiple SEH usage within one function */
-     
-         //
-         //  Case on the type of open that we are trying to cleanup.
-@@ -279,7 +279,7 @@
- 
-         IoRemoveShareAccess( FileObject, &Fcb->ShareAccess );
- 
--    } finally {
-+    //} finally { /* ReactOS Change: Manual removal of SEH since macros to 
hack around it don't allow multiple SEH usage within one function */
- 
-         CdReleaseFcb( IrpContext, Fcb );
-         
-@@ -287,7 +287,7 @@
-             
-             FsRtlNotifyVolumeEvent( FileObject, FSRTL_VOLUME_UNLOCK );
-         }
--    }
-+    //} /* ReactOS Change: Manual removal of SEH since macros to hack around 
it don't allow multiple SEH usage within one function */
- 
-     //
-     //  If appropriate, try to spark teardown by purging the volume.  Should
 Index: drivers/filesystems/cdfs_new/strucsup.c
 ===================================================================
 --- drivers/filesystems/cdfs_new/strucsup.c    (revision 34615)

Reply via email to