mirror of
https://github.com/reactos/reactos.git
synced 2024-08-30 15:18:33 +00:00
![Timo Kreuzer](/assets/img/avatar_default.png)
* [COMPILER_APITEST] Import MS EH/SEH tests Taken from https://github.com/microsoft/compiler-tests * [CRT] Add missing declaration of _longjmpex * [COMPILER_APITEST] Add cmake build files for MS SEH test It is built as a static library * [COMPILER_APITEST] Fix GCC build of MS SEH tests There are a number of hacks in there now. Also the volatile hacks should be separated and sent upstream. * [COMPILER_APITEST] Fix x64 build of MS SEH tests * [COMPILER_APITEST] Fix clang build of MS SEH tests * [COMPILER_APITEST] Include MS SEH tests
92 lines
2.1 KiB
C
92 lines
2.1 KiB
C
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for
|
|
// full license information.
|
|
|
|
#include <windows.h>
|
|
#include "seh.h"
|
|
|
|
char test[] = "SEH0027.c";
|
|
int perfect;
|
|
|
|
void rtlRaiseStatus(DWORD Status) {
|
|
RaiseException(Status, 0, /*no flags*/ 0, 0);
|
|
return;
|
|
}
|
|
|
|
ULONG except3(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter) {
|
|
PEXCEPTION_RECORD ExceptionRecord;
|
|
|
|
ExceptionRecord = ExceptionPointers->ExceptionRecord;
|
|
if ((ExceptionRecord->ExceptionCode == (STATUS_INTEGER_OVERFLOW)) &&
|
|
((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
|
|
/* set counter = 23 */
|
|
*Counter += 17;
|
|
rtlRaiseStatus(EXCEPTION_EXECUTE_HANDLER);
|
|
} else if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
|
|
((ExceptionRecord->ExceptionFlags & 0x10) != 0)) {
|
|
/* set counter = 42 */
|
|
*Counter += 19;
|
|
/* return COTINUE SEARCH */
|
|
return 0;
|
|
}
|
|
/* never gets here due to exception being rasied */
|
|
*Counter += 23;
|
|
return 1;
|
|
}
|
|
|
|
void except1(PLONG Counter) {
|
|
try {
|
|
/* set counter = 6 */
|
|
*Counter += 5;
|
|
RaiseException(EXCEPTION_INT_OVERFLOW, 0, /*no flags*/ 0, 0);
|
|
}
|
|
except(except3(GetExceptionInformation(), Counter)) { *Counter += 7; }
|
|
endtry
|
|
/* set counter = 59 */
|
|
*Counter += 9;
|
|
return;
|
|
}
|
|
|
|
ULONG except2(PEXCEPTION_POINTERS ExceptionPointers, PLONG Counter) {
|
|
PEXCEPTION_RECORD ExceptionRecord;
|
|
|
|
ExceptionRecord = ExceptionPointers->ExceptionRecord;
|
|
if ((ExceptionRecord->ExceptionCode == EXCEPTION_EXECUTE_HANDLER) &&
|
|
((ExceptionRecord->ExceptionFlags & 0x10) == 0)) {
|
|
/* set counter = 53 */
|
|
*Counter += 11;
|
|
return 1;
|
|
} else {
|
|
*Counter += 13;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
int main() {
|
|
LONG Counter;
|
|
|
|
Counter = 0;
|
|
|
|
try {
|
|
try {
|
|
/* set counter = 1 */
|
|
Counter += 1;
|
|
except1(&Counter);
|
|
}
|
|
except(except2(GetExceptionInformation(), &Counter)) {
|
|
/* set counter = 55 */
|
|
Counter += 2;
|
|
}
|
|
endtry
|
|
}
|
|
except(1) { Counter += 3; }
|
|
endtry
|
|
|
|
if (Counter != 55) {
|
|
printf("TEST 27 FAILED. Counter = %d\n\r", Counter);
|
|
return -1;
|
|
}
|
|
|
|
return 0;
|
|
}
|