[PSEH] Use native SEH on clang-cl x64

This commit is contained in:
Timo Kreuzer 2024-11-29 09:59:48 +02:00
parent 478317abcb
commit 96676ca251
2 changed files with 11 additions and 10 deletions

View file

@ -2356,7 +2356,7 @@ Return Value:
if ((CreateDisposition != FILE_OPEN) && if ((CreateDisposition != FILE_OPEN) &&
(CreateDisposition != FILE_OPEN_IF)) { (CreateDisposition != FILE_OPEN_IF)) {
try_return( Iosb.Status = STATUS_ACCESS_DENIED ); try_return( Status = STATUS_ACCESS_DENIED );
} }
// //
@ -2389,7 +2389,7 @@ Return Value:
if (!FlagOn(ShareAccess, FILE_SHARE_READ) && if (!FlagOn(ShareAccess, FILE_SHARE_READ) &&
!FatIsHandleCountZero( IrpContext, Vcb )) { !FatIsHandleCountZero( IrpContext, Vcb )) {
try_return( Iosb.Status = STATUS_SHARING_VIOLATION ); try_return( Status = STATUS_SHARING_VIOLATION );
} }
// //
@ -2412,14 +2412,14 @@ Return Value:
if (Vcb->OpenFileCount != 0) { if (Vcb->OpenFileCount != 0) {
try_return( Iosb.Status = STATUS_SHARING_VIOLATION ); try_return( Status = STATUS_SHARING_VIOLATION );
} }
} else { } else {
if (Vcb->ReadOnlyCount != Vcb->OpenFileCount) { if (Vcb->ReadOnlyCount != Vcb->OpenFileCount) {
try_return( Iosb.Status = STATUS_SHARING_VIOLATION ); try_return( Status = STATUS_SHARING_VIOLATION );
} }
} }
@ -2487,13 +2487,13 @@ Return Value:
if (Vcb->DirectAccessOpenCount > 0) { if (Vcb->DirectAccessOpenCount > 0) {
if (!NT_SUCCESS(Iosb.Status = IoCheckShareAccess( *DesiredAccess, if (!NT_SUCCESS(Status = IoCheckShareAccess( *DesiredAccess,
ShareAccess, ShareAccess,
FileObject, FileObject,
&Vcb->ShareAccess, &Vcb->ShareAccess,
TRUE ))) { TRUE ))) {
try_return( Iosb.Status ); try_return( NOTHING );
} }
} else { } else {
@ -2546,7 +2546,7 @@ Return Value:
// And set our status to success // And set our status to success
// //
Iosb.Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
Iosb.Information = FILE_OPENED; Iosb.Information = FILE_OPENED;
try_exit: NOTHING; try_exit: NOTHING;
@ -2558,7 +2558,7 @@ Return Value:
// If this is an abnormal termination then undo our work // If this is an abnormal termination then undo our work
// //
if (_SEH2_AbnormalTermination() || !NT_SUCCESS(Iosb.Status)) { if (_SEH2_AbnormalTermination() || !NT_SUCCESS(Status)) {
if (UnwindCounts) { if (UnwindCounts) {
Vcb->DirectAccessOpenCount -= 1; Vcb->DirectAccessOpenCount -= 1;
@ -2570,9 +2570,10 @@ Return Value:
if (UnwindVolumeLock) { Vcb->VcbState &= ~VCB_STATE_FLAG_LOCKED; } if (UnwindVolumeLock) { Vcb->VcbState &= ~VCB_STATE_FLAG_LOCKED; }
} }
DebugTrace(-1, Dbg, "FatOpenVolume -> Iosb.Status = %08lx\n", Iosb.Status); DebugTrace(-1, Dbg, "FatOpenVolume -> Iosb.Status = %08lx\n", Status);
} _SEH2_END; } _SEH2_END;
Iosb.Status = Status;
return Iosb; return Iosb;
} }

View file

@ -25,7 +25,7 @@
#define __USE_PSEH2__ #define __USE_PSEH2__
#if defined(_USE_NATIVE_SEH) || (defined(_MSC_VER) && !(defined(__clang__) && defined(_M_AMD64))) #if defined(_USE_NATIVE_SEH) || defined(_MSC_VER)
#define _SEH2_TRY __try #define _SEH2_TRY __try
#define _SEH2_FINALLY __finally #define _SEH2_FINALLY __finally