Skip to content

Commit 194be7a

Browse files
committed
[COMPILER_APITEST] Add another SEH test
See CORE-20316
1 parent 0d11eb1 commit 194be7a

File tree

1 file changed

+46
-0
lines changed
  • modules/rostests/apitests/compiler

1 file changed

+46
-0
lines changed

modules/rostests/apitests/compiler/pseh.c

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2972,7 +2972,52 @@ void Test_collided_unwind(void)
29722972
ok(__readfsdword(0) == Registration, "SEH registration corrupted!\n");
29732973
*(unsigned int*)NtCurrentTeb() = Registration;
29742974
#endif
2975+
}
2976+
2977+
void Do_nested_from_except(void)
2978+
{
2979+
volatile unsigned int Flags = 0;
2980+
2981+
_SEH2_TRY
2982+
{
2983+
RaiseException(0xDEADBEEF, 0, 0, NULL);
2984+
}
2985+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
2986+
{
2987+
_SEH2_TRY
2988+
{
2989+
_SEH2_TRY
2990+
{
2991+
Flags |= 1;
2992+
}
2993+
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
2994+
{
2995+
Flags |= 2;
2996+
}
2997+
_SEH2_END;
2998+
}
2999+
_SEH2_FINALLY
3000+
{
3001+
Flags |= 4;
3002+
}
3003+
_SEH2_END;
3004+
}
3005+
_SEH2_END;
29753006

3007+
ok(Flags == (1 | 4), "Flags = %x\n", Flags);
3008+
}
3009+
3010+
void Test_nested_from_except(void)
3011+
{
3012+
Do_nested_from_except();
3013+
3014+
#ifdef _M_IX86
3015+
/* Temporarily remove the SEH registration (see CORE-20316) */
3016+
unsigned int Registration = __readfsdword(0);
3017+
*(unsigned int*)NtCurrentTeb() = -1;
3018+
Do_nested_from_except();
3019+
*(unsigned int*)NtCurrentTeb() = Registration;
3020+
#endif
29763021
}
29773022

29783023
START_TEST(pseh)
@@ -2984,6 +3029,7 @@ START_TEST(pseh)
29843029
Test_structs_seh_nested();
29853030
#endif
29863031
Test_collided_unwind();
3032+
Test_nested_from_except();
29873033

29883034
const struct subtest testsuite[] =
29893035
{

0 commit comments

Comments
 (0)