Skip to content

Commit

Permalink
[PSEH] Use native SEH on clang-cl x64
Browse files Browse the repository at this point in the history
  • Loading branch information
tkreuzer committed Dec 13, 2024
1 parent a68d91d commit 4c0f6bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
19 changes: 10 additions & 9 deletions drivers/filesystems/fastfat/create.c
Original file line number Diff line number Diff line change
Expand Up @@ -2356,7 +2356,7 @@ Return Value:
if ((CreateDisposition != FILE_OPEN) &&
(CreateDisposition != FILE_OPEN_IF)) {

try_return( Iosb.Status = STATUS_ACCESS_DENIED );
try_return( Status = STATUS_ACCESS_DENIED );
}

//
Expand Down Expand Up @@ -2389,7 +2389,7 @@ Return Value:
if (!FlagOn(ShareAccess, FILE_SHARE_READ) &&
!FatIsHandleCountZero( IrpContext, Vcb )) {

try_return( Iosb.Status = STATUS_SHARING_VIOLATION );
try_return( Status = STATUS_SHARING_VIOLATION );
}

//
Expand All @@ -2412,14 +2412,14 @@ Return Value:

if (Vcb->OpenFileCount != 0) {

try_return( Iosb.Status = STATUS_SHARING_VIOLATION );
try_return( Status = STATUS_SHARING_VIOLATION );
}

} else {

if (Vcb->ReadOnlyCount != Vcb->OpenFileCount) {

try_return( Iosb.Status = STATUS_SHARING_VIOLATION );
try_return( Status = STATUS_SHARING_VIOLATION );
}
}

Expand Down Expand Up @@ -2487,13 +2487,13 @@ Return Value:

if (Vcb->DirectAccessOpenCount > 0) {

if (!NT_SUCCESS(Iosb.Status = IoCheckShareAccess( *DesiredAccess,
if (!NT_SUCCESS(Status = IoCheckShareAccess( *DesiredAccess,
ShareAccess,
FileObject,
&Vcb->ShareAccess,
TRUE ))) {

try_return( Iosb.Status );
try_return( NOTHING );
}

} else {
Expand Down Expand Up @@ -2546,7 +2546,7 @@ Return Value:
// And set our status to success
//

Iosb.Status = STATUS_SUCCESS;
Status = STATUS_SUCCESS;
Iosb.Information = FILE_OPENED;

try_exit: NOTHING;
Expand All @@ -2558,7 +2558,7 @@ Return Value:
// 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) {
Vcb->DirectAccessOpenCount -= 1;
Expand All @@ -2570,9 +2570,10 @@ Return Value:
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;

Iosb.Status = Status;
return Iosb;
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/lib/pseh/include/pseh/pseh2.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#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_FINALLY __finally
Expand Down

0 comments on commit 4c0f6bb

Please sign in to comment.