ReactOS 0.4.15-dev-8058-ga7cbb60
xcpt4u.c
Go to the documentation of this file.
1// Copyright (c) Microsoft. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for full
3// license information.
4
5/*
6 * COMMAND LINE: -Ox -Gz -YX -UPROTOTYPES_REQUIRED
7 */
8
9#pragma warning(disable : 4532)
10#pragma warning(disable : 4702)
11
12#if defined(_WIN32)
13
14#if defined(_M_SH)
15#define WIN_CE
16#endif
17
18#if defined(_M_AMD64)
19#define NEST_IN_FINALLY /* allow when __try nested in __finally OK */
20#endif
21
22#define NTSTATUS LONG
23#define EXCEPTION_NESTED_CALL 0x10
24#define RtlRaiseStatus(x) RaiseException((x), 0, 0, NULL)
25#define RtlRaiseException(x) \
26 RaiseException((x)->ExceptionCode, (x)->ExceptionFlags, \
27 (x)->NumberParameters, (x)->ExceptionInformation)
28#define IN
29#define OUT
30#if !(defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \
31 defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64))
32#define i386 1
33#endif
34#define try __try
35#define except __except
36#define finally __finally
37#define leave __leave
38
39#endif
40
41#define WIN32_LEAN_AND_MEAN
42
43#include "stdio.h"
44#if defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_PPC) || \
45 defined(_M_AMD64) || defined(_M_ARM) || defined(_M_ARM64)
46#include "setjmpex.h"
47#else
48#include "setjmp.h"
49#endif
50#include "float.h"
51#include "windows.h"
52#include "math.h"
53
54#if !defined(STATUS_SUCCESS)
55#define STATUS_SUCCESS 0
56#endif
57#if !defined(STATUS_UNSUCCESSFUL)
58#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)
59#endif
60
61//
62// Define switch constants.
63//
64
65#define BLUE 0
66#define RED 1
67
68//
69// Define function prototypes.
70//
71
73
75
76VOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter);
77
78VOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter);
79
81
82#if !defined(WIN_CE) // return through finally not allowed on WinCE
84#endif
85
87
89except2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);
90
92except3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter);
93
95
96VOID foo2(IN PLONG BlackHole, IN PLONG BadAddress);
97
98#if !defined(WIN_CE) // return from finally not allowed on WinCE
100#endif
101
104
106
107double SquareDouble(IN double op);
108
110ULONG
112
113{
114
115 printf("filter entered...");
117}
118
119#pragma warning(push)
120#pragma warning(disable : 4532)
121
123
124{
125
126 try {
127 try {
128 *Fault += 1;
129 }
130 finally {
131 if (AbnormalTermination()) {
132 if (*State == 1) {
133 *State += 1;
134
135 } else {
136 *Fault += 1;
137 }
138 }
139 }
140 }
141 except(((*State += 1) == 1) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {
142 if (*State != 2) {
143 *Fault += 1;
144 }
145 }
146
147 return;
148}
149
151
152{
153
154 try {
155 try {
156 *Fault += 1;
157 }
158 finally {
159 if (AbnormalTermination()) {
160 if (*State == 2) {
161 PgFilter();
162 return;
163
164 } else {
165 *Fault += 1;
166 }
167 }
168 }
169 }
170 except(((*State += 2) == 2) ? EXCEPTION_EXECUTE_HANDLER
172 *Fault += 1;
173 }
174
175 return;
176}
177
179
180{
181
182 try {
183 try {
184 try {
185 *Fault += 1;
186 }
187 finally {
188 if (AbnormalTermination()) {
189 if (*State == 3) {
190 *State += 3;
191 return;
192
193 } else {
194 *Fault += 1;
195 }
196 }
197 }
198 }
199 finally {
200 if (AbnormalTermination()) {
201 if (*State == 6) {
202 *State += 3;
203
204 } else {
205 *Fault += 1;
206 }
207 }
208 }
209 }
210 except(((*State += 3) == 3) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {
211 *Fault += 1;
212 }
213
214 return;
215}
216
218
219{
220
221 try {
222 try {
223 try {
224 *Fault += 1;
225 }
226 finally {
227 if (AbnormalTermination()) {
228 if (*State == 4) {
229 *State += 4;
230 return;
231
232 } else {
233 *Fault += 1;
234 }
235 }
236 }
237 }
238 finally {
239 if (AbnormalTermination()) {
240 if (*State == 8) {
241 *State += 4;
242 PgFilter();
243
244 } else {
245 *Fault += 1;
246 }
247 }
248 }
249 }
250 except(((*State += 4) == 4) ? EXCEPTION_EXECUTE_HANDLER
252 *Fault += 1;
253 }
254
255 return;
256}
257
259
260{
261
262 try {
263 try {
264 try {
265 *Fault += 1;
266 }
267 finally {
268 if (AbnormalTermination()) {
269 if (*State == 5) {
270 *State += 5;
271
272 } else {
273 *Fault += 1;
274 }
275 }
276 }
277 }
278 finally {
279 if (AbnormalTermination()) {
280 if (*State == 10) {
281 *State += 5;
282 return;
283
284 } else {
285 *Fault += 1;
286 }
287 }
288 }
289 }
290 except(((*State += 5) == 5) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {
291 *Fault += 1;
292 }
293
294 return;
295}
296
298
299{
300
301 try {
302 try {
303 try {
304 *Fault += 1;
305 }
306 finally {
307 if (AbnormalTermination()) {
308 if (*State == 6) {
309 *State += 6;
310
311 } else {
312 *Fault += 1;
313 }
314 }
315 }
316 }
317 finally {
318 if (AbnormalTermination()) {
319 if (*State == 12) {
320 *State += 6;
321 PgFilter();
322 return;
323
324 } else {
325 *Fault += 1;
326 }
327 }
328 }
329 }
330 except(((*State += 6) == 6) ? EXCEPTION_EXECUTE_HANDLER
332 *Fault += 1;
333 }
334
335 return;
336}
337
339
340{
341
342 try {
343 try {
344 try {
345 try {
346 *Fault += 1;
347 }
348 finally {
349 if (AbnormalTermination()) {
350 if (*State == 7) {
351 *State += 7;
352 *Fault += 1;
353
354 } else {
355 *State += 10;
356 }
357 }
358 }
359 }
360 except(((*State += 7) == 7) ? EXCEPTION_EXECUTE_HANDLER
362 *Fault += 1;
363 }
364 }
365 finally {
366 if (AbnormalTermination()) {
367 if (*State == 28) {
368 *State += 7;
369 return;
370
371 } else {
372 *Fault += 1;
373 }
374 }
375 }
376 }
377 except(((*State += 7) == 28) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {
378 *Fault += 1;
379 }
380
381 return;
382}
383
385
386{
387
388 try {
389 try {
390 try {
391 try {
392 *Fault += 1;
393 }
394 finally {
395 if (AbnormalTermination()) {
396 if (*State == 8) {
397 *State += 8;
398 *Fault += 1;
399
400 } else {
401 *State += 10;
402 }
403 }
404 }
405 }
406 except(((*State += 8) == 8) ? EXCEPTION_EXECUTE_HANDLER
408 *Fault += 1;
409 }
410 }
411 finally {
412 if (AbnormalTermination()) {
413 if (*State == 32) {
414 *State += 8;
415 PgFilter();
416 return;
417
418 } else {
419 *Fault += 1;
420 }
421 }
422 }
423 }
424 except(((*State += 8) == 32) ? EXCEPTION_EXECUTE_HANDLER
426 *Fault += 1;
427 }
428
429 return;
430}
431
433
434{
435
436 try {
437 try {
438 try {
439 try {
440 *Fault += 1;
441 }
442 finally {
443 if (AbnormalTermination()) {
444 if (*State == 9) {
445 *State += 9;
446 *Fault += 1;
447
448 } else {
449 *State += 10;
450 }
451 }
452 }
453 }
454 except(((*State += 9) == 9) ? PgFilter() : EXCEPTION_CONTINUE_SEARCH) {
455 *Fault += 1;
456 }
457 }
458 finally {
459 if (AbnormalTermination()) {
460 if (*State == 36) {
461 *State += 9;
462 return;
463
464 } else {
465 *Fault += 1;
466 }
467 }
468 }
469 }
470 except(((*State += 9) == 36) ? EXCEPTION_EXECUTE_HANDLER
472 *Fault += 1;
473 }
474
475 return;
476}
477
479
480{
481
482 try {
483 try {
484 try {
485 try {
486 *Fault += 1;
487 }
488 finally {
489 if (AbnormalTermination()) {
490 if (*State == 10) {
491 *State += 10;
492 PgFilter();
493 *Fault += 1;
494
495 } else {
496 *State += 10;
497 }
498 }
499 }
500 }
501 except(((*State += 10) == 10) ? EXCEPTION_EXECUTE_HANDLER
503 *Fault += 1;
504 }
505 }
506 finally {
507 if (AbnormalTermination()) {
508 if (*State == 40) {
509 *State += 10;
510 return;
511
512 } else {
513 *Fault += 1;
514 }
515 }
516 }
517 }
518 except(((*State += 10) == 40) ? EXCEPTION_EXECUTE_HANDLER
520 *Fault += 1;
521 }
522
523 return;
524}
525
526#pragma warning(pop)
527
529
530{
531
532 try {
533 try {
534 try {
535 *Fault += 1;
536 }
537 finally {
538 printf("finally 1...");
539 *Fault += 1;
540 }
541 }
542 finally { printf("finally 2..."); }
543 }
544 except(*Counter += 1, printf("filter 1..."), EXCEPTION_CONTINUE_SEARCH) {}
545
546 return;
547}
548
550
551ULONG
553
554{
555
556 G = 1;
557 try {
558 while (G) {
559 try {
560 if (G == 10) {
561 return 1;
562 }
563
564 if (G == 1) {
565 continue;
566 }
567 }
568 finally { G = 0; }
569 }
570 }
571 finally { G = 10; }
572
573 return 0;
574}
575
576void Test81(int *pCounter) {
577 volatile char *AvPtr = NULL;
578
579 __try {
580 __try { *AvPtr = '\0'; }
581 __except(EXCEPTION_EXECUTE_HANDLER) { __leave; }
582 }
583 __finally {
584 printf("in finally ");
585 *pCounter += 1;
586 }
587 return;
588}
589
592
593{
594 *(volatile int *)0 = 0;
595}
596
598
599{
600
601 int retval = 1;
602
603 __try {
604 __try { Test82Foo(); }
605 __finally {
606 switch (*Counter) {
607 case 0:
608 printf("something failed!\n");
609 retval = 6;
610 break;
611
612 case 1:
613 retval = 0;
614 break;
615
616 case 2:
617 printf("how did you get here?\n");
618 retval = 2;
619 break;
620
621 case 3:
622 printf("what?!?\n");
623 retval = 3;
624 break;
625
626 case 4:
627 printf("not correct\n");
628 retval = 4;
629 break;
630
631 case 5:
632 printf("error!\n");
633 retval = 5;
634 break;
635 }
636 }
637 }
638 __except(1){}
639
640 *Counter = retval;
641 return;
642}
643
645
646{
647
648 G = 1;
649 try {
650 try {
651 while (G) {
652 try {
653 if (G == 10) {
654 return 1;
655 }
656
657 if (G == 1) {
658 continue;
659 }
660 }
661 finally { G = 0; }
662 }
663 }
665 }
666 finally { G = 10; }
667
668 return 0;
669}
670
673
674{
675 volatile int *Fault = 0;
676
677 try {
678 try {
679 *Fault += 1;
680 }
682 try {
683 return;
684 }
685 finally { *Counter += 1; }
686 }
687 }
688 finally {
689
690 if (AbnormalTermination()) {
691 *Counter += 1;
692 }
693 }
694
695 return;
696}
697
700
701{
702 volatile int *Fault = 0;
703
704 G = 1;
705 try {
706 try {
707 try {
708 while (G) {
709 try {
710 try {
711 if (G == 10) {
712 return 1;
713 }
714 try {
715 *Counter += 1;
716 }
718
719 if (G == 1) {
720 continue;
721 }
722 }
723 finally {
724 G = 0;
725 *Counter += 1;
726 *Fault += 1;
727 }
728 }
730 *Counter += 1;
731 leave;
732 }
733 }
734 }
735 finally {
736 G = 10;
737 *Counter += 1;
738 *Fault += 1;
739 }
740 }
742 *Counter += 1;
743 }
744 finally { *Counter += 1; }
745 return 1;
746}
747
750
751{
752 volatile int *Fault = 0;
753
754 try {
755 try {
756 try {
757 try {
758 try {
759 try {
760 *Fault += 1;
761 }
762 except(printf("Filter1 %d..", *Counter),
764 try {
765 printf("Handler1 %d..", *Counter);
766 return;
767 }
768 finally {
769 printf("Finally1 %d..", *Counter);
770 *Counter += 1;
771 }
772 }
773 }
774 finally {
775 printf("Finally2 %d..", *Counter);
776 *Counter += 1;
777 }
778 }
780 }
781 finally { *Counter += 1; }
782 }
784 }
785 finally { *Counter += 1; }
786
787 return;
788}
789
791
792/*++
793
794Routine Description:
795
796 This function verifies the behavior of nested exception dispatching.
797
798Arguments:
799
800 Counter - Supplies a pointer to the state counter.
801
802Return Value:
803 None.
804
805--*/
806
807{
808 volatile int *Fault = 0;
809
810//
811// N.B. Disabled on x86 due to failing test case with handling of returns
812// in nested termination handlers on x86.
813//
814// Disabled on ARM due to failing test case with handling of abutting
815// termination handlers within an except handler.
816//
817// Disabled on AMD64 due to failing test case with handling of
818// abutting termination handlers within an except handler when a
819// non-local goto is involved.
820//
821
822#if !defined(_X86_)
823 try {
824 try {
825 try {
826 try {
827 try {
828 *Fault += 1;
829
830 try {
831 }
832 finally {
833 if (AbnormalTermination()) {
834 *Fault += 1;
835 }
836 }
837 }
838 finally {
839
840 if (AbnormalTermination()) {
841 if ((*Counter += 13) == 26) {
842 return;
843
844 } else {
845 *Fault += 1;
846 }
847 }
848 }
849 }
850 finally {
851 if (AbnormalTermination()) {
852 *Counter += 13;
853 *Fault += 1;
854 }
855 }
856 }
857 except(((*Counter += 13) == 13) ? EXCEPTION_EXECUTE_HANDLER
859 *Fault += 1;
860 }
861 }
862 except(((*Counter += 13) == 65) ? EXCEPTION_EXECUTE_HANDLER
864 try {
865 *Counter += 13;
866 return;
867 }
868 finally {
869 if (AbnormalTermination()) {
870 *Counter += 13;
871 goto Finish;
872 }
873 }
874 }
875 }
876 finally {
877
878 if (AbnormalTermination()) {
879 if ((*Counter += 13) == 104) {
880 goto Finish;
881 }
882 }
883 }
884
885Finish:
886#else
887 *Counter = 104;
888#endif
889
890 return;
891}
892
894
895{
896 volatile int *Fault = 0;
897
898 try {
899 try {
900 try {
901 try {
902 try {
903 try {
904 try {
905 try {
906 *Fault += 1;
907 }
908 except(((*Counter += 1) == 1) ? *Fault
910 }
911 except(*Counter += 1, EXCEPTION_EXECUTE_HANDLER) { *Fault += 2; }
912 }
914 }
916 }
918 }
920 }
922 }
923 finally { *Counter += 1; }
924}
925
926int main(int argc, char *argv[])
927
928{
929
930 PLONG BadAddress;
931 PCHAR BadByte;
932 PLONG BlackHole;
933 ULONG Index1;
934 ULONG Index2 = RED;
935 jmp_buf JumpBuffer;
937 EXCEPTION_RECORD ExceptionRecord;
938 double doubleresult;
939
940 //
941 // Announce start of exception test.
942 //
943
944 printf("Start of exception test\n");
945
946 //
947 // Initialize exception record.
948 //
949
950 ExceptionRecord.ExceptionCode = STATUS_INTEGER_OVERFLOW;
951 ExceptionRecord.ExceptionFlags = 0;
952 ExceptionRecord.ExceptionRecord = NULL;
953 ExceptionRecord.NumberParameters = 0;
954
955 //
956 // Initialize pointers.
957 //
958
959 BadAddress = (PLONG)NULL;
960 BadByte = (PCHAR)NULL;
961 BadByte += 1;
962 BlackHole = &Counter;
963
964 //
965 // Simply try statement with a finally clause that is entered sequentially.
966 //
967
968 printf(" test1...");
969 Counter = 0;
970 try {
971 Counter += 1;
972 }
973 finally {
974 if (abnormal_termination() == FALSE) {
975 Counter += 1;
976 }
977 }
978
979 if (Counter != 2) {
980 printf("failed, count = %d\n", Counter);
981
982 } else {
983 printf("succeeded\n");
984 }
985
986 //
987 // Simple try statement with an exception clause that is never executed
988 // because there is no exception raised in the try clause.
989 //
990
991 printf(" test2...");
992 Counter = 0;
993 try {
994 Counter += 1;
995 }
996 except(Counter) { Counter += 1; }
997
998 if (Counter != 1) {
999 printf("failed, count = %d\n", Counter);
1000
1001 } else {
1002 printf("succeeded\n");
1003 }
1004
1005 //
1006 // Simple try statement with an exception handler that is never executed
1007 // because the exception expression continues execution.
1008 //
1009
1010 printf(" test3...");
1011 Counter = 0;
1012 try {
1013 Counter -= 1;
1014 RtlRaiseException(&ExceptionRecord);
1015 }
1016 except(Counter) { Counter -= 1; }
1017
1018 if (Counter != -1) {
1019 printf("failed, count = %d\n", Counter);
1020
1021 } else {
1022 printf("succeeded\n");
1023 }
1024
1025 //
1026 // Simple try statement with an exception clause that is always executed.
1027 //
1028
1029 printf(" test4...");
1030 Counter = 0;
1031 try {
1032 Counter += 1;
1034 }
1035 except(Counter) { Counter += 1; }
1036
1037 if (Counter != 2) {
1038 printf("failed, count = %d\n", Counter);
1039
1040 } else {
1041 printf("succeeded\n");
1042 }
1043
1044 //
1045 // Simple try statement with an exception clause that is always executed.
1046 //
1047
1048 printf(" test5...");
1049 Counter = 0;
1050 try {
1051 Counter += 1;
1052 *BlackHole += *BadAddress;
1053 }
1054 except(Counter) { Counter += 1; }
1055
1056 if (Counter != 2) {
1057 printf("failed, count = %d\n", Counter);
1058
1059 } else {
1060 printf("succeeded\n");
1061 }
1062
1063 //
1064 // Simply try statement with a finally clause that is entered as the
1065 // result of an exception.
1066 //
1067
1068 printf(" test6...");
1069 Counter = 0;
1070 try {
1071 try {
1072 Counter += 1;
1073 RtlRaiseException(&ExceptionRecord);
1074 }
1075 finally {
1076 if (abnormal_termination() != FALSE) {
1077 Counter += 1;
1078 }
1079 }
1080 }
1081 except(Counter) {
1082 if (Counter == 2) {
1083 Counter += 1;
1084 }
1085 }
1086
1087 if (Counter != 3) {
1088 printf("failed, count = %d\n", Counter);
1089
1090 } else {
1091 printf("succeeded\n");
1092 }
1093
1094 //
1095 // Simply try statement with a finally clause that is entered as the
1096 // result of an exception.
1097 //
1098
1099 printf(" test7...");
1100 Counter = 0;
1101 try {
1102 try {
1103 Counter += 1;
1104 *BlackHole += *BadAddress;
1105 }
1106 finally {
1107 if (abnormal_termination() != FALSE) {
1108 Counter += 1;
1109 }
1110 }
1111 }
1112 except(Counter) {
1113 if (Counter == 2) {
1114 Counter += 1;
1115 }
1116 }
1117
1118 if (Counter != 3) {
1119 printf("failed, count = %d\n", Counter);
1120
1121 } else {
1122 printf("succeeded\n");
1123 }
1124
1125 //
1126 // Simple try that calls a function which raises an exception.
1127 //
1128
1129 printf(" test8...");
1130 Counter = 0;
1131 try {
1132 Counter += 1;
1134 }
1138 Counter += 1;
1139 }
1140
1141 if (Counter != 2) {
1142 printf("failed, count = %d\n", Counter);
1143
1144 } else {
1145 printf("succeeded\n");
1146 }
1147
1148 //
1149 // Simple try that calls a function which raises an exception.
1150 //
1151
1152 printf(" test9...");
1153 Counter = 0;
1154 try {
1155 Counter += 1;
1156 foo2(BlackHole, BadAddress);
1157 }
1161 Counter += 1;
1162 }
1163
1164 if (Counter != 2) {
1165 printf("failed, count = %d\n", Counter);
1166
1167 } else {
1168 printf("succeeded\n");
1169 }
1170
1171 //
1172 // Simple try that calls a function which calls a function that
1173 // raises an exception. The first function has a finally clause
1174 // that must be executed for this test to work.
1175 //
1176
1177 printf(" test10...");
1178 Counter = 0;
1179 try {
1181 }
1185 Counter -= 1;
1186 }
1187
1188 if (Counter != 98) {
1189 printf("failed, count = %d\n", Counter);
1190
1191 } else {
1192 printf("succeeded\n");
1193 }
1194
1195 //
1196 // Simple try that calls a function which calls a function that
1197 // raises an exception. The first function has a finally clause
1198 // that must be executed for this test to work.
1199 //
1200
1201 printf(" test11...");
1202 Counter = 0;
1203 try {
1204 bar2(BlackHole, BadAddress, &Counter);
1205 }
1209 Counter -= 1;
1210 }
1211
1212 if (Counter != 98) {
1213 printf("failed, count = %d\n", Counter);
1214
1215 } else {
1216 printf("succeeded\n");
1217 }
1218
1219 //
1220 // A try within an except
1221 //
1222
1223 printf(" test12...");
1224 Counter = 0;
1225 try {
1227 }
1231 Counter += 1;
1232 try {
1234 }
1237 if (Counter != 1) {
1238 printf("failed, count = %d\n", Counter);
1239
1240 } else {
1241 printf("succeeded...");
1242 }
1243
1244 Counter += 1;
1245 }
1246 }
1247
1248 if (Counter != 2) {
1249 printf("failed, count = %d\n", Counter);
1250
1251 } else {
1252 printf("succeeded\n");
1253 }
1254
1255 //
1256 // A try within an except
1257 //
1258
1259 printf(" test13...");
1260 Counter = 0;
1261 try {
1262 foo2(BlackHole, BadAddress);
1263 }
1267 Counter += 1;
1268 try {
1270 }
1273 if (Counter != 1) {
1274 printf("failed, count = %d\n", Counter);
1275
1276 } else {
1277 printf("succeeded...");
1278 }
1279
1280 Counter += 1;
1281 }
1282 }
1283
1284 if (Counter != 2) {
1285 printf("failed, count = %d\n", Counter);
1286
1287 } else {
1288 printf("succeeded\n");
1289 }
1290
1291#if !defined(WIN_CE) // gotos from except/finally not allowed on WinCE
1292 //
1293 // A goto from an exception clause that needs to pass
1294 // through a finally
1295 //
1296
1297 printf(" test14...");
1298 Counter = 0;
1299 try {
1300 try {
1302 }
1306 Counter += 1;
1307 goto t9;
1308 }
1309 }
1310 finally { Counter += 1; }
1311
1312t9:
1313 ;
1314 if (Counter != 2) {
1315 printf("failed, count = %d\n", Counter);
1316
1317 } else {
1318 printf("succeeded\n");
1319 }
1320
1321 //
1322 // A goto from an finally clause that needs to pass
1323 // through a finally
1324 //
1325
1326 printf(" test15...");
1327 Counter = 0;
1328 try {
1329 try {
1330 Counter += 1;
1331 }
1332 finally {
1333 Counter += 1;
1334 goto t10;
1335 }
1336 }
1337 finally { Counter += 1; }
1338
1339t10:
1340 ;
1341 if (Counter != 3) {
1342 printf("failed, count = %d\n", Counter);
1343
1344 } else {
1345 printf("succeeded\n");
1346 }
1347
1348 //
1349 // A goto from an exception clause that needs to pass
1350 // through a finally into the outer finally clause.
1351 //
1352
1353 printf(" test16...");
1354 Counter = 0;
1355 try {
1356 try {
1357 try {
1358 Counter += 1;
1360 }
1362 Counter += 1;
1363 goto t11;
1364 }
1365 }
1366 finally { Counter += 1; }
1367 t11:
1368 ;
1369 }
1370 finally { Counter += 1; }
1371
1372 if (Counter != 4) {
1373 printf("failed, count = %d\n", Counter);
1374
1375 } else {
1376 printf("succeeded\n");
1377 }
1378
1379 //
1380 // A goto from an finally clause that needs to pass
1381 // through a finally into the outer finally clause.
1382 //
1383
1384 printf(" test17...");
1385 Counter = 0;
1386 try {
1387 try {
1388 Counter += 1;
1389 }
1390 finally {
1391 Counter += 1;
1392 goto t12;
1393 }
1394 t12:
1395 ;
1396 }
1397 finally { Counter += 1; }
1398
1399 if (Counter != 3) {
1400 printf("failed, count = %d\n", Counter);
1401
1402 } else {
1403 printf("succeeded\n");
1404 }
1405
1406 //
1407 // A return from an except clause
1408 //
1409
1410 printf(" test18...");
1411 Counter = 0;
1412 try {
1413 Counter += 1;
1415 }
1416 finally { Counter += 1; }
1417
1418 if (Counter != 4) {
1419 printf("failed, count = %d\n", Counter);
1420
1421 } else {
1422 printf("succeeded\n");
1423 }
1424
1425 //
1426 // A return from a finally clause
1427 //
1428
1429 printf(" test19...");
1430 Counter = 0;
1431 try {
1432 Counter += 1;
1433 fret(&Counter);
1434 }
1435 finally { Counter += 1; }
1436
1437 if (Counter != 5) {
1438 printf("failed, count = %d\n", Counter);
1439
1440 } else {
1441 printf("succeeded\n");
1442 }
1443#endif
1444
1445 //
1446 // A simple set jump followed by a long jump.
1447 //
1448
1449 printf(" test20...");
1450 Counter = 0;
1451 if (setjmp(JumpBuffer) == 0) {
1452 Counter += 1;
1453 longjmp(JumpBuffer, 1);
1454
1455 } else {
1456 Counter += 1;
1457 }
1458
1459 if (Counter != 2) {
1460 printf("failed, count = %d\n", Counter);
1461
1462 } else {
1463 printf("succeeded\n");
1464 }
1465
1466 //
1467 // A set jump followed by a long jump out of a finally clause that is
1468 // sequentially executed.
1469 //
1470
1471 printf(" test21...");
1472 Counter = 0;
1473 if (setjmp(JumpBuffer) == 0) {
1474 try {
1475 Counter += 1;
1476 }
1477 finally {
1478 Counter += 1;
1479 longjmp(JumpBuffer, 1);
1480 }
1481
1482 } else {
1483 Counter += 1;
1484 }
1485
1486 if (Counter != 3) {
1487 printf("failed, count = %d\n", Counter);
1488
1489 } else {
1490 printf("succeeded\n");
1491 }
1492
1493 //
1494 // A set jump within a try clause followed by a long jump out of a
1495 // finally clause that is sequentially executed.
1496 //
1497
1498 printf(" test22...");
1499 Counter = 0;
1500 try {
1501 if (setjmp(JumpBuffer) == 0) {
1502 Counter += 1;
1503
1504 } else {
1505 Counter += 1;
1506 }
1507 }
1508 finally {
1509 Counter += 1;
1510 if (Counter == 2) {
1511 Counter += 1;
1512 longjmp(JumpBuffer, 1);
1513 }
1514 }
1515
1516 if (Counter != 5) {
1517 printf("failed, count = %d\n", Counter);
1518
1519 } else {
1520 printf("succeeded\n");
1521 }
1522
1523 //
1524 // A set jump followed by a try/except, followed by a try/finally where
1525 // the try body of the try/finally raises an exception that is handled
1526 // by the try/excecpt which causes the try/finally to do a long jump out
1527 // of a finally clause. This will create a collided unwind.
1528 //
1529
1530 printf(" test23...");
1531 Counter = 0;
1532 if (setjmp(JumpBuffer) == 0) {
1533 try {
1534 try {
1535 Counter += 1;
1537 }
1538 finally {
1539 Counter += 1;
1540 longjmp(JumpBuffer, 1);
1541 }
1542 }
1544
1545 } else {
1546 Counter += 1;
1547 }
1548
1549 if (Counter != 3) {
1550 printf("failed, count = %d\n", Counter);
1551
1552 } else {
1553 printf("succeeded\n");
1554 }
1555
1556 //
1557 // A set jump followed by a try/except, followed by a several nested
1558 // try/finally's where the inner try body of the try/finally raises an
1559 // exception that is handled by the try/except which causes the
1560 // try/finally to do a long jump out of a finally clause. This will
1561 // create a collided unwind.
1562 //
1563
1564 printf(" test24...");
1565 Counter = 0;
1566 if (setjmp(JumpBuffer) == 0) {
1567 try {
1568 try {
1569 try {
1570 try {
1571 Counter += 1;
1573 }
1574 finally { Counter += 1; }
1575 }
1576 finally {
1577 Counter += 1;
1578 longjmp(JumpBuffer, 1);
1579 }
1580 }
1581 finally { Counter += 1; }
1582 }
1584
1585 } else {
1586 Counter += 1;
1587 }
1588
1589 if (Counter != 5) {
1590 printf("failed, count = %d\n", Counter);
1591
1592 } else {
1593 printf("succeeded\n");
1594 }
1595
1596 //
1597 // A set jump followed by a try/except, followed by a try/finally which
1598 // calls a subroutine which contains a try finally that raises an
1599 // exception that is handled to the try/except.
1600 //
1601
1602 printf(" test25...");
1603 Counter = 0;
1604 if (setjmp(JumpBuffer) == 0) {
1605 try {
1606 try {
1607 try {
1608 Counter += 1;
1609 dojump(JumpBuffer, &Counter);
1610 }
1611 finally { Counter += 1; }
1612 }
1613 finally { Counter += 1; }
1614 }
1616
1617 } else {
1618 Counter += 1;
1619 }
1620
1621 if (Counter != 7) {
1622 printf("failed, count = %d\n", Counter);
1623
1624 } else {
1625 printf("succeeded\n");
1626 }
1627
1628 //
1629 // A set jump followed by a try/except, followed by a try/finally which
1630 // calls a subroutine which contains a try finally that raises an
1631 // exception that is handled to the try/except.
1632 //
1633
1634 printf(" test26...");
1635 Counter = 0;
1636 if (setjmp(JumpBuffer) == 0) {
1637 try {
1638 try {
1639 try {
1640 try {
1641 Counter += 1;
1642 dojump(JumpBuffer, &Counter);
1643 }
1644 finally { Counter += 1; }
1645 }
1646 finally {
1647 Counter += 1;
1648 longjmp(JumpBuffer, 1);
1649 }
1650 }
1651 finally { Counter += 1; }
1652 }
1654
1655 } else {
1656 Counter += 1;
1657 }
1658
1659 if (Counter != 8) {
1660 printf("failed, count = %d\n", Counter);
1661
1662 } else {
1663 printf("succeeded\n");
1664 }
1665
1666 //
1667 // Test nested exceptions.
1668 //
1669
1670 printf(" test27...");
1671 Counter = 0;
1672 try {
1673 try {
1674 Counter += 1;
1675 except1(&Counter);
1676 }
1678 }
1680
1681 if (Counter != 55) {
1682 printf("failed, count = %d\n", Counter);
1683
1684 } else {
1685 printf("succeeded\n");
1686 }
1687
1688 //
1689 // Simple try that causes an integer overflow exception.
1690 //
1691
1692 printf(" test28...");
1693 Counter = 0;
1694 try {
1695 Counter += 1;
1696 addtwo(0x7fff0000, 0x10000, &Counter);
1697 }
1701 Counter += 1;
1702 }
1703
1704 if (Counter != 2) {
1705 printf("failed, count = %d\n", Counter);
1706
1707 } else {
1708 printf("succeeded\n");
1709 }
1710
1711//
1712// Simple try that raises an misaligned data exception.
1713//
1714#if !defined(i386) && !defined(_M_IA64) && !defined(_M_AMD64) && \
1715 !defined(_M_ARM) && !defined(_M_ARM64)
1716 printf(" test29...");
1717 Counter = 0;
1718 try {
1719 Counter += 1;
1720 foo2(BlackHole, (PLONG)BadByte);
1721 }
1725 Counter += 1;
1726 }
1727
1728 if (Counter != 2) {
1729 printf("failed, count = %d\n", Counter);
1730
1731 } else {
1732 printf("succeeded\n");
1733 }
1734
1735#endif
1736 //
1737 // Continue from a try body with an exception clause in a loop.
1738 //
1739
1740 printf(" test30...");
1741 Counter = 0;
1742 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1743 try {
1744 if ((Index1 & 0x1) == 0) {
1745 continue;
1746
1747 } else {
1748 Counter += 1;
1749 }
1750 }
1752
1753 Counter += 2;
1754 }
1755
1756 if (Counter != 15) {
1757 printf("failed, count = %d\n", Counter);
1758
1759 } else {
1760 printf("succeeded\n");
1761 }
1762
1763#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
1764 //
1765 // Continue from a try body with an finally clause in a loop.
1766 //
1767
1768 printf(" test31...");
1769 Counter = 0;
1770 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1771 try {
1772 if ((Index1 & 0x1) == 0) {
1773 continue;
1774
1775 } else {
1776 Counter += 1;
1777 }
1778 }
1779 finally { Counter += 2; }
1780
1781 Counter += 3;
1782 }
1783
1784 if (Counter != 40) {
1785 printf("failed, count = %d\n", Counter);
1786
1787 } else {
1788 printf("succeeded\n");
1789 }
1790#endif
1791
1792 //
1793 // Continue from doubly nested try body with an exception clause in a
1794 // loop.
1795 //
1796
1797 printf(" test32...");
1798 Counter = 0;
1799 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1800 try {
1801 try {
1802 if ((Index1 & 0x1) == 0) {
1803 continue;
1804
1805 } else {
1806 Counter += 1;
1807 }
1808 }
1810
1811 Counter += 2;
1812 }
1814
1815 Counter += 3;
1816 }
1817
1818 if (Counter != 30) {
1819 printf("failed, count = %d\n", Counter);
1820
1821 } else {
1822 printf("succeeded\n");
1823 }
1824
1825#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
1826 //
1827 // Continue from doubly nested try body with an finally clause in a loop.
1828 //
1829
1830 printf(" test33...");
1831 Counter = 0;
1832 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1833 try {
1834 try {
1835 if ((Index1 & 0x1) == 0) {
1836 continue;
1837
1838 } else {
1839 Counter += 1;
1840 }
1841 }
1842 finally { Counter += 2; }
1843
1844 Counter += 3;
1845 }
1846 finally { Counter += 4; }
1847
1848 Counter += 5;
1849 }
1850
1851 if (Counter != 105) {
1852 printf("failed, count = %d\n", Counter);
1853
1854 } else {
1855 printf("succeeded\n");
1856 }
1857
1858 //
1859 // Continue from a finally clause in a loop.
1860 //
1861
1862 printf(" test34...");
1863 Counter = 0;
1864 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1865 try {
1866 if ((Index1 & 0x1) == 0) {
1867 Counter += 1;
1868 }
1869 }
1870 finally {
1871 Counter += 2;
1872 continue;
1873 }
1874
1875 Counter += 4;
1876 }
1877
1878 if (Counter != 25) {
1879 printf("failed, count = %d\n", Counter);
1880
1881 } else {
1882 printf("succeeded\n");
1883 }
1884
1885 //
1886 // Continue from a doubly nested finally clause in a loop.
1887 //
1888
1889 printf(" test35...");
1890 Counter = 0;
1891 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1892 try {
1893 try {
1894 if ((Index1 & 0x1) == 0) {
1895 Counter += 1;
1896 }
1897 }
1898 finally {
1899 Counter += 2;
1900 continue;
1901 }
1902
1903 Counter += 4;
1904 }
1905 finally { Counter += 5; }
1906
1907 Counter += 6;
1908 }
1909
1910 if (Counter != 75) {
1911 printf("failed, count = %d\n", Counter);
1912
1913 } else {
1914 printf("succeeded\n");
1915 }
1916
1917 //
1918 // Continue from a doubly nested finally clause in a loop.
1919 //
1920
1921 printf(" test36...");
1922 Counter = 0;
1923 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1924 try {
1925 try {
1926 if ((Index1 & 0x1) == 0) {
1927 Counter += 1;
1928 }
1929 }
1930 finally { Counter += 2; }
1931
1932 Counter += 4;
1933 }
1934 finally {
1935 Counter += 5;
1936 continue;
1937 }
1938
1939 Counter += 6;
1940 }
1941
1942 if (Counter != 115) {
1943 printf("failed, count = %d\n", Counter);
1944
1945 } else {
1946 printf("succeeded\n");
1947 }
1948#endif
1949
1950 //
1951 // Break from a try body with an exception clause in a loop.
1952 //
1953
1954 printf(" test37...");
1955 Counter = 0;
1956 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1957 try {
1958 if ((Index1 & 0x1) == 1) {
1959 break;
1960
1961 } else {
1962 Counter += 1;
1963 }
1964 }
1966
1967 Counter += 2;
1968 }
1969
1970 if (Counter != 3) {
1971 printf("failed, count = %d\n", Counter);
1972
1973 } else {
1974 printf("succeeded\n");
1975 }
1976
1977#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
1978 //
1979 // Break from a try body with an finally clause in a loop.
1980 //
1981
1982 printf(" test38...");
1983 Counter = 0;
1984 for (Index1 = 0; Index1 < 10; Index1 += 1) {
1985 try {
1986 if ((Index1 & 0x1) == 1) {
1987 break;
1988
1989 } else {
1990 Counter += 1;
1991 }
1992 }
1993 finally { Counter += 2; }
1994
1995 Counter += 3;
1996 }
1997
1998 if (Counter != 8) {
1999 printf("failed, count = %d\n", Counter);
2000
2001 } else {
2002 printf("succeeded\n");
2003 }
2004#endif
2005
2006 //
2007 // Break from doubly nested try body with an exception clause in a
2008 // loop.
2009 //
2010
2011 printf(" test39...");
2012 Counter = 0;
2013 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2014 try {
2015 try {
2016 if ((Index1 & 0x1) == 1) {
2017 break;
2018
2019 } else {
2020 Counter += 1;
2021 }
2022 }
2024
2025 Counter += 2;
2026 }
2028
2029 Counter += 3;
2030 }
2031
2032 if (Counter != 6) {
2033 printf("failed, count = %d\n", Counter);
2034
2035 } else {
2036 printf("succeeded\n");
2037 }
2038
2039#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
2040 //
2041 // Break from doubly nested try body with an finally clause in a loop.
2042 //
2043
2044 printf(" test40...");
2045 Counter = 0;
2046 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2047 try {
2048 try {
2049 if ((Index1 & 0x1) == 1) {
2050 break;
2051
2052 } else {
2053 Counter += 1;
2054 }
2055 }
2056 finally { Counter += 2; }
2057
2058 Counter += 3;
2059 }
2060 finally { Counter += 4; }
2061
2062 Counter += 5;
2063 }
2064
2065 if (Counter != 21) {
2066 printf("failed, count = %d\n", Counter);
2067
2068 } else {
2069 printf("succeeded\n");
2070 }
2071
2072 //
2073 // Break from a finally clause in a loop.
2074 //
2075
2076 printf(" test41...");
2077 Counter = 0;
2078 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2079 try {
2080 if ((Index1 & 0x1) == 1) {
2081 Counter += 1;
2082 }
2083 }
2084 finally {
2085 Counter += 2;
2086 break;
2087 }
2088
2089 Counter += 4;
2090 }
2091
2092 if (Counter != 2) {
2093 printf("failed, count = %d\n", Counter);
2094
2095 } else {
2096 printf("succeeded\n");
2097 }
2098
2099 //
2100 // Break from a doubly nested finally clause in a loop.
2101 //
2102
2103 printf(" test42...");
2104 Counter = 0;
2105 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2106 try {
2107 try {
2108 if ((Index1 & 0x1) == 1) {
2109 Counter += 1;
2110 }
2111 }
2112 finally {
2113 Counter += 2;
2114 break;
2115 }
2116
2117 Counter += 4;
2118 }
2119 finally { Counter += 5; }
2120
2121 Counter += 6;
2122 }
2123
2124 if (Counter != 7) {
2125 printf("failed, count = %d\n", Counter);
2126
2127 } else {
2128 printf("succeeded\n");
2129 }
2130
2131 //
2132 // Break from a doubly nested finally clause in a loop.
2133 //
2134
2135 printf(" test43...");
2136 Counter = 0;
2137 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2138 try {
2139 try {
2140 if ((Index1 & 0x1) == 1) {
2141 Counter += 1;
2142 }
2143 }
2144 finally { Counter += 2; }
2145
2146 Counter += 4;
2147 }
2148 finally {
2149 Counter += 5;
2150 break;
2151 }
2152
2153 Counter += 6;
2154 }
2155
2156 if (Counter != 11) {
2157 printf("failed, count = %d\n", Counter);
2158
2159 } else {
2160 printf("succeeded\n");
2161 }
2162#endif
2163
2164 //
2165 // Break from a try body with an exception clause in a switch.
2166 //
2167
2168 printf(" test44...");
2169 Counter = 0;
2170 Index1 = 1;
2171 switch (Index2) {
2172 case BLUE:
2173 Counter += 100;
2174 break;
2175
2176 case RED:
2177 try {
2178 if ((Index1 & 0x1) == 1) {
2179 break;
2180
2181 } else {
2182 Counter += 1;
2183 }
2184 }
2186
2187 Counter += 2;
2188 break;
2189 }
2190
2191 if (Counter != 0) {
2192 printf("failed, count = %d\n", Counter);
2193
2194 } else {
2195 printf("succeeded\n");
2196 }
2197
2198#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
2199 //
2200 // Break from a try body with an finally clause in a switch.
2201 //
2202
2203 printf(" test45...");
2204 Counter = 0;
2205 Index1 = 1;
2206 switch (Index2) {
2207 case BLUE:
2208 Counter += 100;
2209 break;
2210
2211 case RED:
2212 try {
2213 if ((Index1 & 0x1) == 1) {
2214 break;
2215
2216 } else {
2217 Counter += 1;
2218 }
2219 }
2220 finally { Counter += 2; }
2221
2222 Counter += 3;
2223 }
2224
2225 if (Counter != 2) {
2226 printf("failed, count = %d\n", Counter);
2227
2228 } else {
2229 printf("succeeded\n");
2230 }
2231#endif
2232
2233 //
2234 // Break from doubly nested try body with an exception clause in a
2235 // switch.
2236 //
2237
2238 printf(" test46...");
2239 Counter = 0;
2240 Index1 = 1;
2241 switch (Index2) {
2242 case BLUE:
2243 Counter += 100;
2244 break;
2245
2246 case RED:
2247 try {
2248 try {
2249 if ((Index1 & 0x1) == 1) {
2250 break;
2251
2252 } else {
2253 Counter += 1;
2254 }
2255 }
2257
2258 Counter += 2;
2259 }
2261
2262 Counter += 3;
2263 }
2264
2265 if (Counter != 0) {
2266 printf("failed, count = %d\n", Counter);
2267
2268 } else {
2269 printf("succeeded\n");
2270 }
2271
2272#if !defined(WIN_CE) // gotos from try/finally not allowed on WinCE
2273 //
2274 // Break from doubly nested try body with an finally clause in a switch.
2275 //
2276
2277 printf(" test47...");
2278 Counter = 0;
2279 Index1 = 1;
2280 switch (Index2) {
2281 case BLUE:
2282 Counter += 100;
2283 break;
2284
2285 case RED:
2286 try {
2287 try {
2288 if ((Index1 & 0x1) == 1) {
2289 break;
2290
2291 } else {
2292 Counter += 1;
2293 }
2294 }
2295 finally { Counter += 2; }
2296
2297 Counter += 3;
2298 }
2299 finally { Counter += 4; }
2300
2301 Counter += 5;
2302 }
2303
2304 if (Counter != 6) {
2305 printf("failed, count = %d\n", Counter);
2306
2307 } else {
2308 printf("succeeded\n");
2309 }
2310
2311 //
2312 // Break from a finally clause in a switch.
2313 //
2314
2315 printf(" test48...");
2316 Counter = 0;
2317 Index1 = 1;
2318 switch (Index2) {
2319 case BLUE:
2320 Counter += 100;
2321 break;
2322
2323 case RED:
2324 try {
2325 if ((Index1 & 0x1) == 1) {
2326 Counter += 1;
2327 }
2328 }
2329 finally {
2330 Counter += 2;
2331 break;
2332 }
2333
2334 Counter += 4;
2335 }
2336
2337 if (Counter != 3) {
2338 printf("failed, count = %d\n", Counter);
2339
2340 } else {
2341 printf("succeeded\n");
2342 }
2343
2344 //
2345 // Break from a doubly nested finally clause in a switch.
2346 //
2347
2348 printf(" test49...");
2349 Counter = 0;
2350 Index1 = 1;
2351 switch (Index2) {
2352 case BLUE:
2353 Counter += 100;
2354 break;
2355
2356 case RED:
2357 try {
2358 try {
2359 if ((Index1 & 0x1) == 1) {
2360 Counter += 1;
2361 }
2362 }
2363 finally {
2364 Counter += 2;
2365 break;
2366 }
2367
2368 Counter += 4;
2369 }
2370 finally { Counter += 5; }
2371
2372 Counter += 6;
2373 }
2374
2375 if (Counter != 8) {
2376 printf("failed, count = %d\n", Counter);
2377
2378 } else {
2379 printf("succeeded\n");
2380 }
2381
2382 //
2383 // Break from a doubly nested finally clause in a switch.
2384 //
2385
2386 printf(" test50...");
2387 Counter = 0;
2388 Index1 = 1;
2389 switch (Index2) {
2390 case BLUE:
2391 Counter += 100;
2392 break;
2393
2394 case RED:
2395 try {
2396 try {
2397 if ((Index1 & 0x1) == 1) {
2398 Counter += 1;
2399 }
2400 }
2401 finally { Counter += 2; }
2402
2403 Counter += 4;
2404 }
2405 finally {
2406 Counter += 5;
2407 break;
2408 }
2409
2410 Counter += 6;
2411 }
2412
2413 if (Counter != 12) {
2414 printf("failed, count = %d\n", Counter);
2415
2416 } else {
2417 printf("succeeded\n");
2418 }
2419#endif
2420
2421 //
2422 // Leave from an if in a simple try/finally.
2423 //
2424
2425 printf(" test51...");
2426 Counter = 0;
2427 try {
2428 if (Echo(Counter) == Counter) {
2429 Counter += 3;
2430 leave;
2431
2432 } else {
2433 Counter += 100;
2434 }
2435 }
2436 finally {
2437 if (abnormal_termination() == FALSE) {
2438 Counter += 5;
2439 }
2440 }
2441
2442 if (Counter != 8) {
2443 printf("failed, count = %d\n", Counter);
2444
2445 } else {
2446 printf("succeeded\n");
2447 }
2448
2449 //
2450 // Leave from a loop in a simple try/finally.
2451 //
2452
2453 printf(" test52...");
2454 Counter = 0;
2455 try {
2456 for (Index1 = 0; Index1 < 10; Index1 += 1) {
2457 if (Echo(Index1) == Index1) {
2458 Counter += 3;
2459 leave;
2460 }
2461
2462 Counter += 100;
2463 }
2464 }
2465 finally {
2466 if (abnormal_termination() == FALSE) {
2467 Counter += 5;
2468 }
2469 }
2470
2471 if (Counter != 8) {
2472 printf("failed, count = %d\n", Counter);
2473
2474 } else {
2475 printf("succeeded\n");
2476 }
2477
2478 //
2479 // Leave from a switch in a simple try/finally.
2480 //
2481
2482 printf(" test53...");
2483 Counter = 0;
2484 try {
2485 switch (Index2) {
2486 case BLUE:
2487 break;
2488
2489 case RED:
2490 Counter += 3;
2491 leave;
2492 }
2493
2494 Counter += 100;
2495 }
2496 finally {
2497 if (abnormal_termination() == FALSE) {
2498 Counter += 5;
2499 }
2500 }
2501
2502 if (Counter != 8) {
2503 printf("failed, count = %d\n", Counter);
2504
2505 } else {
2506 printf("succeeded\n");
2507 }
2508
2509 //
2510 // Leave from an if in doubly nested try/finally followed by a leave
2511 // from an if in the outer try/finally.
2512 //
2513
2514 printf(" test54...");
2515 Counter = 0;
2516 try {
2517 try {
2518 if (Echo(Counter) == Counter) {
2519 Counter += 3;
2520 leave;
2521
2522 } else {
2523 Counter += 100;
2524 }
2525 }
2526 finally {
2527 if (abnormal_termination() == FALSE) {
2528 Counter += 5;
2529 }
2530 }
2531
2532 if (Echo(Counter) == Counter) {
2533 Counter += 3;
2534 leave;
2535
2536 } else {
2537 Counter += 100;
2538 }
2539 }
2540 finally {
2541 if (abnormal_termination() == FALSE) {
2542 Counter += 5;
2543 }
2544 }
2545
2546 if (Counter != 16) {
2547 printf("failed, count = %d\n", Counter);
2548
2549 } else {
2550 printf("succeeded\n");
2551 }
2552
2553#if !defined(WIN_CE) // leave from finally not allowed on WinCE
2554 //
2555 // Leave from an if in doubly nested try/finally followed by a leave
2556 // from the finally of the outer try/finally.
2557 //
2558
2559 printf(" test55...");
2560 Counter = 0;
2561 try {
2562 try {
2563 if (Echo(Counter) == Counter) {
2564 Counter += 3;
2565 leave;
2566
2567 } else {
2568 Counter += 100;
2569 }
2570 }
2571 finally {
2572 if (abnormal_termination() == FALSE) {
2573 Counter += 5;
2574 leave;
2575 }
2576 }
2577
2578 Counter += 100;
2579 }
2580 finally {
2581 if (abnormal_termination() == FALSE) {
2582 Counter += 5;
2583 }
2584 }
2585
2586 if (Counter != 13) {
2587 printf("failed, count = %d\n", Counter);
2588
2589 } else {
2590 printf("succeeded\n");
2591 }
2592#endif
2593
2594 //
2595 // Try/finally within the except clause of a try/except that is always
2596 // executed.
2597 //
2598
2599 printf(" test56...");
2600 Counter = 0;
2601 try {
2602 Counter += 1;
2604 }
2605 except(Counter) {
2606 try {
2607 Counter += 3;
2608 }
2609 finally {
2610 if (abnormal_termination() == FALSE) {
2611 Counter += 5;
2612 }
2613 }
2614 }
2615
2616 if (Counter != 9) {
2617 printf("failed, count = %d\n", Counter);
2618
2619 } else {
2620 printf("succeeded\n");
2621 }
2622
2623 //
2624 // Try/finally within the finally clause of a try/finally.
2625 //
2626
2627 printf(" test57...");
2628 Counter = 0;
2629 try {
2630 Counter += 1;
2631 }
2632 finally {
2633 if (abnormal_termination() == FALSE) {
2634 try {
2635 Counter += 3;
2636 }
2637 finally {
2638 if (abnormal_termination() == FALSE) {
2639 Counter += 5;
2640 }
2641 }
2642 }
2643 }
2644
2645 if (Counter != 9) {
2646 printf("failed, count = %d\n", Counter);
2647
2648 } else {
2649 printf("succeeded\n");
2650 }
2651
2652 //
2653 // Try/except within the finally clause of a try/finally.
2654 //
2655
2656 printf(" test58...");
2657#if !defined(NEST_IN_FINALLY)
2658 printf("skipped\n");
2659#else
2660 Counter = 0;
2661 try {
2662 Counter -= 1;
2663 }
2664 finally {
2665 try {
2666 Counter += 2;
2668 }
2669 except(Counter) {
2670 try {
2671 Counter += 3;
2672 }
2673 finally {
2674 if (abnormal_termination() == FALSE) {
2675 Counter += 5;
2676 }
2677 }
2678 }
2679 }
2680
2681 if (Counter != 9) {
2682 printf("failed, count = %d\n", Counter);
2683
2684 } else {
2685 printf("succeeded\n");
2686 }
2687#endif /* def(NEST_IN_FINALLY) */
2688
2689 //
2690 // Try/except within the except clause of a try/except that is always
2691 // executed.
2692 //
2693
2694 printf(" test59...");
2695 Counter = 0;
2696 try {
2697 Counter += 1;
2699 }
2700 except(Counter) {
2701 try {
2702 Counter += 3;
2704 }
2705 except(Counter - 3) { Counter += 5; }
2706 }
2707
2708 if (Counter != 9) {
2709 printf("failed, count = %d\n", Counter);
2710
2711 } else {
2712 printf("succeeded\n");
2713 }
2714
2715 //
2716 // Try with a Try which exits the scope with a goto
2717 //
2718
2719 printf(" test60...");
2720 Counter = 0;
2721 try {
2722 try {
2723 goto outside;
2724 }
2725 except(1) { Counter += 1; }
2726
2727 outside:
2729 }
2730 except(1) { Counter += 3; }
2731
2732 if (Counter != 3) {
2733 printf("failed, count = %d\n", Counter);
2734 } else {
2735 printf("succeeded\n");
2736 }
2737
2738 //
2739 // Try/except which gets an exception from a subfunction within
2740 // a try/finally which has a try/except in the finally clause
2741 //
2742
2743 printf(" test61...");
2744#if !defined(NEST_IN_FINALLY)
2745 printf("skipped\n");
2746#else
2747 Counter = 0;
2748 try {
2750 }
2752
2753 if (Counter != 24) {
2754 printf("failed, count = %d\n", Counter);
2755
2756 } else {
2757 printf("succeeded\n");
2758 }
2759#endif /* def(NEST_IN_FINALLY) */
2760
2761 //
2762 // Check for precision of exception on floating point
2763 //
2764
2765 printf(" test62...");
2766
2767#if defined(i386) || defined(_M_IA64) || defined(_M_ALPHA) || defined(_M_AMD64)
2768
2769/* enable floating point overflow */
2770#if defined(i386)
2771 _control87(_control87(0, 0) & ~EM_OVERFLOW, _MCW_EM);
2772#else
2773 //
2774 // use portable version of _control87
2775 //
2776 _controlfp(_controlfp(0, 0) & ~EM_OVERFLOW, _MCW_EM);
2777#endif
2778
2779 Counter = 0;
2780 try {
2781 doubleresult = SquareDouble(1.7e300);
2782
2783 try {
2784 doubleresult = SquareDouble(1.0);
2785 }
2786 except(1) { Counter += 3; }
2787 }
2788 except(1) { Counter += 1; }
2789
2790 if (Counter != 1) {
2791 printf("failed, count = %d\n", Counter);
2792
2793 } else {
2794 printf("succeeded\n");
2795 }
2796
2797/* clear up pending unmasked exceptions and restore FP control registers */
2798#if defined(i386)
2799 _clear87();
2800 _control87(_control87(0, 0) | EM_OVERFLOW, 0xfffff);
2801#else
2802 _clearfp();
2803 _controlfp(_controlfp(0, 0) | EM_OVERFLOW, 0xfffff);
2804#endif
2805
2806#else
2807 printf("skipped\n");
2808#endif
2809
2810 //
2811 // A try/finally inside a try/except where an exception is raised in the
2812 // try/finally.
2813 //
2814
2815 printf(" test63...");
2816 Counter = 0;
2817 try {
2818 try {
2819 Counter += 1;
2820 }
2821 finally {
2822 Counter += 3;
2824 }
2825 }
2826 except(1) { Counter += 6; }
2827
2828 if (Counter != 10) {
2829 printf("failed, count = %d\n", Counter);
2830
2831 } else {
2832 printf("succeeded\n");
2833 }
2834
2835 //
2836 // A try/finally inside a try/except where an exception is raised in the
2837 // in the try/except and the try/finally.
2838 //
2839
2840 printf(" test64...");
2841 Counter = 0;
2842 try {
2843 try {
2844 Counter += 1;
2846 }
2847 finally {
2848 Counter += 3;
2850 }
2851 }
2852 except(1) { Counter += 6; }
2853
2854 if (Counter != 10) {
2855 printf("failed, count = %d\n", Counter);
2856
2857 } else {
2858 printf("succeeded\n");
2859 }
2860
2861 //
2862 // A try/finally inside a try/except where an exception is raised in the
2863 // try/finally.
2864 //
2865
2866 printf(" test65...");
2867 Counter = 0;
2868 try {
2869 try {
2870 Counter += 1;
2871 }
2872 finally {
2873 Counter += 3;
2874 *BlackHole += *BadAddress;
2875 Counter += 13;
2876 }
2877 }
2878 except(1) { Counter += 6; }
2879
2880 if (Counter != 10) {
2881 printf("failed, count = %d\n", Counter);
2882
2883 } else {
2884 printf("succeeded\n");
2885 }
2886
2887 //
2888 // A try/finally inside a try/except where an exception is raised in the
2889 // in the try/except and the try/finally.
2890 //
2891
2892 printf(" test66...");
2893 Counter = 0;
2894 try {
2895 try {
2896 Counter += 1;
2897 *BlackHole += *BadAddress;
2898 Counter += 13;
2899 }
2900 finally {
2901 Counter += 3;
2902 *BlackHole += *BadAddress;
2903 Counter += 13;
2904 }
2905 }
2906 except(1) { Counter += 6; }
2907
2908 if (Counter != 10) {
2909 printf("failed, count = %d\n", Counter);
2910
2911 } else {
2912 printf("succeeded\n");
2913 }
2914
2915 //
2916 // A try/finally inside a try/finally inside a try/except where an
2917 // exception is raised in the in the try/except and in try/finally.
2918 //
2919
2920 printf(" test67...");
2921 try {
2922 try {
2923 *BlackHole += *BadAddress;
2924 }
2925 finally {
2926 try {
2927 Counter = 0;
2928 }
2929 finally {
2930 if (Counter != 0) {
2931 Counter += 1;
2932 }
2933 }
2934
2935 Counter += 1;
2936 *BlackHole += *BadAddress;
2937 }
2938 }
2939 except(1) { Counter += 1; }
2940
2941 if (Counter != 2) {
2942 printf("failed, count = %d\n", Counter);
2943
2944 } else {
2945 printf("succeeded\n");
2946 }
2947
2948 //
2949 // A try/finally inside a try/finally inside a try/except where an
2950 // exception is raised in the in the try/except and in try/finally.
2951 //
2952
2953 printf(" test68...");
2954 try {
2955 try {
2957 }
2958 finally {
2959 try {
2960 Counter = 0;
2961 }
2962 finally {
2963 if (Counter != 0) {
2964 Counter += 1;
2965 }
2966 }
2967
2968 Counter += 1;
2970 }
2971 }
2972 except(1) { Counter += 1; }
2973
2974 if (Counter != 2) {
2975 printf("failed, count = %d\n", Counter);
2976
2977 } else {
2978 printf("succeeded\n");
2979 }
2980
2981//
2982// Patch guard test 69.
2983//
2984
2985#if defined(_AMD64_) || defined(_X86_)
2986
2987 printf(" test69...");
2988 Counter = 0;
2989 try {
2990 PgTest69(&Counter, BadAddress);
2991 }
2992 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
2993
2994 if (Counter != 2) {
2995 printf("failed, count = %d\n", Counter);
2996
2997 } else {
2998 printf("succeeded\n");
2999 }
3000
3001 printf(" test70...");
3002 Counter = 0;
3003 try {
3004 PgTest70(&Counter, BadAddress);
3005 }
3006 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3007
3008 if (Counter != 2) {
3009 printf("failed, count = %d\n", Counter);
3010
3011 } else {
3012 printf("succeeded\n");
3013 }
3014
3015 printf(" test71...");
3016 Counter = 0;
3017 try {
3018 PgTest71(&Counter, BadAddress);
3019 }
3020 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3021
3022 if (Counter != 9) {
3023 printf("failed, count = %d\n", Counter);
3024
3025 } else {
3026 printf("succeeded\n");
3027 }
3028
3029 printf(" test72...");
3030 Counter = 0;
3031 try {
3032 PgTest72(&Counter, BadAddress);
3033 }
3034 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3035
3036 if (Counter != 12) {
3037 printf("failed, count = %d\n", Counter);
3038
3039 } else {
3040 printf("succeeded\n");
3041 }
3042
3043 printf(" test73...");
3044 Counter = 0;
3045 try {
3046 PgTest73(&Counter, BadAddress);
3047 }
3048 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3049
3050 if (Counter != 15) {
3051 printf("failed, count = %d\n", Counter);
3052
3053 } else {
3054 printf("succeeded\n");
3055 }
3056
3057 printf(" test74...");
3058 Counter = 0;
3059 try {
3060 PgTest74(&Counter, BadAddress);
3061 }
3062 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3063
3064 if (Counter != 18) {
3065 printf("failed, count = %d\n", Counter);
3066
3067 } else {
3068 printf("succeeded\n");
3069 }
3070
3071 printf(" test75...");
3072 Counter = 0;
3073 try {
3074 PgTest75(&Counter, BadAddress);
3075 }
3076 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3077
3078 if (Counter != 35) {
3079 printf("failed, count = %d\n", Counter);
3080
3081 } else {
3082 printf("succeeded\n");
3083 }
3084
3085 printf(" test76...");
3086 Counter = 0;
3087 try {
3088 PgTest76(&Counter, BadAddress);
3089 }
3090 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3091
3092 if (Counter != 40) {
3093 printf("failed, count = %d\n", Counter);
3094
3095 } else {
3096 printf("succeeded\n");
3097 }
3098
3099 printf(" test77...");
3100 Counter = 0;
3101 try {
3102 PgTest77(&Counter, BadAddress);
3103 }
3104 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3105
3106 if (Counter != 45) {
3107 printf("failed, count = %d\n", Counter);
3108
3109 } else {
3110 printf("succeeded\n");
3111 }
3112
3113 printf(" test78...");
3114 Counter = 0;
3115 try {
3116 PgTest78(&Counter, BadAddress);
3117 }
3118 except(EXCEPTION_EXECUTE_HANDLER) { printf("unexpected exception..."); }
3119
3120 if (Counter != 50) {
3121 printf("failed, count = %d\n", Counter);
3122
3123 } else {
3124 printf("succeeded\n");
3125 }
3126
3127#else
3128 printf(" test69...filter entered...succeeded\n");
3129 printf(" test70...filter entered...succeeded\n");
3130 printf(" test71...filter entered...succeeded\n");
3131 printf(" test72...filter entered...succeeded\n");
3132 printf(" test73...filter entered...succeeded\n");
3133 printf(" test74...filter entered...succeeded\n");
3134 printf(" test75...filter entered...succeeded\n");
3135 printf(" test76...filter entered...succeeded\n");
3136 printf(" test77...filter entered...succeeded\n");
3137 printf(" test78...filter entered...succeeded\n");
3138#endif
3139
3140 if (LOBYTE(LOWORD(GetVersion())) < 6) {
3141 printf(" test79...");
3142 printf("filter 1...filter 2...finally 1...filter 1...filter 2...finally "
3143 "2...passed\n");
3144 } else {
3145
3146 printf(" test79...");
3147 Counter = 0;
3148 try {
3149 Test79(&Counter, BadAddress);
3150 }
3151 except(printf("filter 2..."), EXCEPTION_EXECUTE_HANDLER) { Counter += 1; }
3152
3153 if (Counter == 3) {
3154 printf("passed\n");
3155
3156 } else {
3157 printf("failed %d \n", Counter);
3158 }
3159 }
3160
3161 printf(" test80...");
3162 if (Test80() != 0) {
3163 printf("failed\n");
3164
3165 } else {
3166 printf("passed\n");
3167 }
3168
3169 printf(" test81...");
3170 Counter = 0;
3171 Test81(&Counter);
3172 if (Counter != 1) {
3173 printf("failed %d \n", Counter);
3174
3175 } else {
3176 printf("passed\n");
3177 }
3178
3179 printf(" test82...");
3180 Counter = 1;
3181 Test82(&Counter);
3182 if (Counter != 0) {
3183 printf("failed\n");
3184
3185 } else {
3186 printf("succeeded\n");
3187 }
3188
3189 printf(" test83...");
3190 if (Test83() != 0) {
3191 printf("failed\n");
3192
3193 } else {
3194 printf("succeeded\n");
3195 }
3196
3197 printf(" test84...");
3198 Counter = 0;
3199 Test84(&Counter);
3200 if (Counter != 2) {
3201 printf("failed\n");
3202
3203 } else {
3204 printf("succeeded\n");
3205 }
3206
3207 printf(" test85...");
3208 Counter = 0;
3209 Test85(&Counter);
3210 if (Counter != 7) {
3211 printf("failed\n");
3212
3213 } else {
3214 printf("succeeded\n");
3215 }
3216
3217 printf(" test86...");
3218 Counter = 0;
3219 Test86(&Counter);
3220 if (Counter != 4) {
3221 printf("failed %d\n", Counter);
3222
3223 } else {
3224 printf("succeeded\n");
3225 }
3226
3227 printf(" test87...");
3228 Counter = 0;
3229 Test87(&Counter);
3230 if (Counter != 104) {
3231 printf("failed %d\n", Counter);
3232
3233 } else {
3234 printf("succeeded\n");
3235 }
3236
3237 printf(" test88...");
3238 Counter = 0;
3239 Test88(&Counter);
3240 if (Counter != 6) {
3241 printf("failed %d\n", Counter);
3242
3243 } else {
3244 printf("succeeded\n");
3245 }
3246
3247 //
3248 // Announce end of exception test.
3249 //
3250
3251 printf("End of exception test\n");
3252 return;
3253}
3254
3255#pragma optimize("a", off)
3256VOID addtwo(long First, long Second, long *Place)
3257
3258{
3259
3261 *Place = First + Second;
3262 return;
3263}
3264#pragma optimize("", on)
3265
3267
3268 try {
3269 foo1(Status);
3270 }
3271 finally {
3272 if (abnormal_termination() != FALSE) {
3273 *Counter = 99;
3274
3275 } else {
3276 *Counter = 100;
3277 }
3278 }
3279
3280 return;
3281}
3282
3283VOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter) {
3284
3285 try {
3286 foo2(BlackHole, BadAddress);
3287 }
3288 finally {
3289 if (abnormal_termination() != FALSE) {
3290 *Counter = 99;
3291
3292 } else {
3293 *Counter = 100;
3294 }
3295 }
3296
3297 return;
3298}
3299
3301
3302{
3303
3304 try {
3305 try {
3306 *Counter += 1;
3308 }
3309 finally { *Counter += 1; }
3310 }
3311 finally {
3312 *Counter += 1;
3313 longjmp(JumpBuffer, 1);
3314 }
3315}
3316
3317#if !defined(WIN_CE) // return through finally not allowed on WinCE
3319
3320{
3321
3322 try {
3323 try {
3324 foo1(Status);
3325 }
3328 *Counter += 1;
3329 return;
3330 }
3331 }
3332 finally { *Counter += 1; }
3333
3334 return;
3335}
3336#endif
3337
3339
3340{
3341
3342 try {
3343 *Counter += 5;
3345 }
3347
3348 *Counter += 9;
3349 return;
3350}
3351
3352ULONG
3354
3355{
3356
3357 PEXCEPTION_RECORD ExceptionRecord;
3358
3359 ExceptionRecord = ExceptionPointers->ExceptionRecord;
3360 if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) &&
3361 ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) {
3362 *Counter += 11;
3364
3365 } else {
3366 *Counter += 13;
3368 }
3369}
3370
3371ULONG
3373
3374{
3375
3376 PEXCEPTION_RECORD ExceptionRecord;
3377
3378 ExceptionRecord = ExceptionPointers->ExceptionRecord;
3379 if ((ExceptionRecord->ExceptionCode == STATUS_INTEGER_OVERFLOW) &&
3380 ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) == 0)) {
3381 *Counter += 17;
3383
3384 } else if ((ExceptionRecord->ExceptionCode == STATUS_UNSUCCESSFUL) &&
3385 ((ExceptionRecord->ExceptionFlags & EXCEPTION_NESTED_CALL) != 0)) {
3386 *Counter += 19;
3388 }
3389
3390 *Counter += 23;
3392}
3393
3395
3396{
3397
3398 //
3399 // Raise exception.
3400 //
3401
3403 return;
3404}
3405
3406VOID foo2(IN PLONG BlackHole, IN PLONG BadAddress)
3407
3408{
3409
3410 //
3411 // Raise exception.
3412 //
3413
3414 *BlackHole += *BadAddress;
3415 return;
3416}
3417
3418#if !defined(WIN_CE) // return from finally not allowed on WinCE
3420
3421{
3422
3423 try {
3424 try {
3425 *Counter += 1;
3426 }
3427 finally {
3428 *Counter += 1;
3429 return;
3430 }
3431 }
3432 finally { *Counter += 1; }
3433
3434 return;
3435}
3436#endif
3437
3439
3440{
3441 return Value;
3442}
3443
3444#if defined(NEST_IN_FINALLY)
3446 try {
3447 *Counter -= 1;
3449 }
3450 finally {
3451 try {
3452 *Counter += 2;
3454 }
3456 *Counter += 7;
3457 }
3458}
3459#endif /* def(NEST_IN_FINALLY) */
3460
3461double SquareDouble(IN double op) {
3462 return exp(2.0 * log(op));
3463}
WCHAR Second[]
Definition: FormatMessage.c:12
WCHAR First[]
Definition: FormatMessage.c:11
unsigned char BOOLEAN
static int argc
Definition: ServiceArgs.c:12
LONG NTSTATUS
Definition: precomp.h:26
#define except(x)
Definition: btrfs_drv.h:136
#define leave
Definition: btrfs_drv.h:138
#define setjmp
Definition: setjmp.h:209
_JBTYPE jmp_buf[_JBLEN]
Definition: setjmp.h:186
#define __inout
Definition: dbghelp.h:50
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:236
int main()
Definition: test.c:6
#define printf
Definition: freeldr.h:97
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define _MCW_EM
Definition: float.h:40
#define _clear87
Definition: float.h:139
__MINGW_NOTHROW _CRTIMP unsigned int __cdecl _controlfp(_In_ unsigned int unNew, _In_ unsigned int unMask)
__MINGW_NOTHROW _CRTIMP unsigned int __cdecl _clearfp(void)
Definition: _clearfp.c:11
#define LOBYTE(W)
Definition: jmemdos.c:487
#define PCHAR
Definition: match.c:90
unsigned int __cdecl _control87(unsigned int, unsigned int)
Definition: _control87.c:16
DWORD exp
Definition: msg.c:16058
#define argv
Definition: mplay32.c:18
#define _Inout_
Definition: ms_sal.h:378
DECLSPEC_NORETURN NTSYSAPI VOID NTAPI RtlRaiseStatus(_In_ NTSTATUS Status)
NTSYSAPI VOID NTAPI RtlRaiseException(_In_ PEXCEPTION_RECORD ExceptionRecord)
#define DECLSPEC_NOINLINE
Definition: ntbasedef.h:225
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:183
#define STATUS_INTEGER_OVERFLOW
Definition: ntstatus.h:385
#define LOWORD(l)
Definition: pedump.c:82
long LONG
Definition: pedump.c:60
DWORD WINAPI GetVersion()
Definition: redirtest.c:5
#define log(outFile, fmt,...)
Definition: util.h:15
#define AbnormalTermination()
Definition: seh.h:28
#define GetExceptionInformation()
Definition: seh.h:26
#define GetExceptionCode()
Definition: seh.h:27
#define abnormal_termination
Definition: seh.h:25
struct _EXCEPTION_RECORD * ExceptionRecord
Definition: compat.h:210
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
static LARGE_INTEGER Counter
Definition: clock.c:43
@ Echo
Definition: telnetd.h:64
uint32_t * PULONG
Definition: typedefs.h:59
#define IN
Definition: typedefs.h:39
int32_t * PLONG
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
ULONG Test80(VOID)
Definition: xcpt4u.c:552
VOID Test79(PLONG Counter, PLONG Fault)
Definition: xcpt4u.c:528
VOID PgTest72(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:217
VOID addtwo(IN LONG First, IN LONG Second, IN PLONG Place)
VOID PgTest75(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:338
VOID except1(IN PLONG Counter)
Definition: xcpt4u.c:3338
VOID PgTest76(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:384
VOID dojump(IN jmp_buf JumpBuffer, IN PLONG Counter)
Definition: xcpt4u.c:3300
DECLSPEC_NOINLINE VOID Test86(_Inout_ PLONG Counter)
Definition: xcpt4u.c:749
VOID Test82(__inout PLONG Counter)
Definition: xcpt4u.c:597
ULONG except3(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter)
Definition: xcpt4u.c:3372
VOID eret(IN NTSTATUS Status, IN PLONG Counter)
Definition: xcpt4u.c:3318
VOID foo2(IN PLONG BlackHole, IN PLONG BadAddress)
Definition: xcpt4u.c:3406
BOOLEAN Tkm(VOID)
VOID fret(IN PLONG Counter)
Definition: xcpt4u.c:3419
VOID Test87(_Inout_ PLONG Counter)
Definition: xcpt4u.c:790
void Test81(int *pCounter)
Definition: xcpt4u.c:576
#define BLUE
Definition: xcpt4u.c:65
VOID PgTest78(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:478
#define RED
Definition: xcpt4u.c:66
VOID bar2(IN PLONG BlackHole, IN PLONG BadAddress, IN PLONG Counter)
Definition: xcpt4u.c:3283
#define STATUS_UNSUCCESSFUL
Definition: xcpt4u.c:58
VOID PgTest70(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:150
VOID PgTest74(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:297
VOID PgTest71(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:178
DECLSPEC_NOINLINE ULONG PgFilter(VOID)
Definition: xcpt4u.c:111
VOID foo1(IN NTSTATUS Status)
Definition: xcpt4u.c:3394
ULONG except2(IN PEXCEPTION_POINTERS ExceptionPointers, IN PLONG Counter)
Definition: xcpt4u.c:3353
LONG Test83(VOID)
Definition: xcpt4u.c:644
DECLSPEC_NOINLINE VOID Test84(_Inout_ PLONG Counter)
Definition: xcpt4u.c:672
DECLSPEC_NOINLINE VOID Test82Foo(VOID)
Definition: xcpt4u.c:591
DECLSPEC_NOINLINE LONG Test85(_Inout_ PLONG Counter)
Definition: xcpt4u.c:699
VOID PgTest77(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:432
VOID PgTest73(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:258
VOID bar1(IN NTSTATUS Status, IN PLONG Counter)
Definition: xcpt4u.c:3266
VOID Test61Part2(IN OUT PULONG Counter)
#define STATUS_SUCCESS
Definition: xcpt4u.c:55
ULONG G
Definition: xcpt4u.c:549
VOID Test88(_Inout_ PLONG Counter)
Definition: xcpt4u.c:893
VOID PgTest69(IN PLONG State, IN PLONG Fault)
Definition: xcpt4u.c:122
double SquareDouble(IN double op)
Definition: xcpt4u.c:3461
#define EXCEPTION_NESTED_CALL
Definition: rtltypes.h:158