ReactOS 0.4.15-dev-8116-gf69e256
pseh.c
Go to the documentation of this file.
1/*
2 Copyright (c) 2008 KJK::Hyperion
3
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files (the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 DEALINGS IN THE SOFTWARE.
21*/
22
23#include <pseh/pseh2.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <wine/test.h>
30#undef subtest
31
32extern void no_op(void);
33extern int return_arg(int);
34
35extern int return_zero(void);
36extern int return_positive(void);
37extern int return_negative(void);
38extern int return_one(void);
39extern int return_minusone(void);
40
41extern int return_zero_2(void *);
42extern int return_positive_2(void *);
43extern int return_negative_2(void *);
44extern int return_one_2(void *);
45extern int return_minusone_2(void *);
46
47extern int return_zero_3(int);
48extern int return_positive_3(int);
49extern int return_negative_3(int);
50extern int return_one_3(int);
51extern int return_minusone_3(int);
52
53extern int return_zero_4(void *, int);
54extern int return_positive_4(void *, int);
55extern int return_negative_4(void *, int);
56extern int return_one_4(void *, int);
57extern int return_minusone_4(void *, int);
58
59extern void set_positive(int *);
60
61//static int call_test(int (*)(void));
62
63#ifdef __cplusplus
64} // extern "C"
65#endif
66
67#define DEFINE_TEST(NAME_) static int NAME_(void)
68
69/* Empty statements *///{{{
70DEFINE_TEST(test_empty_1)
71{
73 return 1;
74}
75
76DEFINE_TEST(test_empty_2)
77{
79 return 1;
80}
81
82DEFINE_TEST(test_empty_3)
83{
85 return 1;
86}
87
88DEFINE_TEST(test_empty_4)
89{
91 return 1;
92}
93
94DEFINE_TEST(test_empty_5)
95{
97 return 1;
98}
99
100DEFINE_TEST(test_empty_6)
101{
103 return 1;
104}
105
106DEFINE_TEST(test_empty_7)
107{
109 return 1;
110}
111
112DEFINE_TEST(test_empty_8)
113{
115 return 1;
116}
117//}}}
118
119/* Static exception filters *///{{{
120DEFINE_TEST(test_execute_handler_1)
121{
122 static int ret;
123
124 ret = return_zero();
125
127 {
128 RaiseException(0xE00DEAD0, 0, 0, NULL);
129 ret = return_zero();
130 }
132 {
134 }
135 _SEH2_END;
136
137 return ret == return_positive();
138}
139
140DEFINE_TEST(test_continue_execution_1)
141{
142 static int ret;
143
144 ret = return_zero();
145
147 {
148 RaiseException(0xE00DEAD0, 0, 0, NULL);
150 }
152 {
153 ret = return_zero();
154 }
155 _SEH2_END;
156
157 return ret == return_positive();
158}
159
160DEFINE_TEST(test_continue_search_1)
161{
162 static int ret;
163
164 ret = return_zero();
165
167 {
169 {
170 RaiseException(0xE00DEAD0, 0, 0, NULL);
171 ret = return_zero();
172 }
174 {
175 ret = return_zero();
176 }
177 _SEH2_END;
178 }
180 {
182 }
183 _SEH2_END;
184
185 return ret == return_positive();
186}
187
188DEFINE_TEST(test_execute_handler_2)
189{
190 static int ret;
191
192 ret = return_zero();
193
195 {
196 RaiseException(0xE00DEAD0, 0, 0, NULL);
197 ret = return_zero();
198 }
199 _SEH2_EXCEPT(12345)
200 {
202 }
203 _SEH2_END;
204
205 return ret == return_positive();
206}
207
208DEFINE_TEST(test_continue_execution_2)
209{
210 static int ret;
211
212 ret = return_zero();
213
215 {
216 RaiseException(0xE00DEAD0, 0, 0, NULL);
218 }
219 _SEH2_EXCEPT(-12345)
220 {
221 ret = return_zero();
222 }
223 _SEH2_END;
224
225 return ret == return_positive();
226}
227//}}}
228
229/* Dynamic exception filters *///{{{
230DEFINE_TEST(test_execute_handler_3)
231{
232 static int ret;
233
234 ret = return_zero();
235
237 {
238 RaiseException(0xE00DEAD0, 0, 0, NULL);
239 ret = return_zero();
240 }
242 {
244 }
245 _SEH2_END;
246
247 return ret == return_positive();
248}
249
250DEFINE_TEST(test_continue_execution_3)
251{
252 static int ret;
253
254 ret = return_zero();
255
257 {
258 RaiseException(0xE00DEAD0, 0, 0, NULL);
260 }
262 {
263 ret = return_zero();
264 }
265 _SEH2_END;
266
267 return ret == return_positive();
268}
269
270DEFINE_TEST(test_continue_search_2)
271{
272 static int ret;
273
274 ret = return_zero();
275
277 {
279 {
280 RaiseException(0xE00DEAD0, 0, 0, NULL);
281 ret = return_zero();
282 }
284 {
285 ret = return_zero();
286 }
287 _SEH2_END;
288 }
290 {
292 }
293 _SEH2_END;
294
295 return ret == return_positive();
296}
297
298DEFINE_TEST(test_execute_handler_4)
299{
300 static int ret;
301
302 ret = return_zero();
303
305 {
306 RaiseException(0xE00DEAD0, 0, 0, NULL);
307 ret = return_zero();
308 }
310 {
312 }
313 _SEH2_END;
314
315 return ret == return_positive();
316}
317
318DEFINE_TEST(test_continue_execution_4)
319{
320 static int ret;
321
322 ret = return_zero();
323
325 {
326 RaiseException(0xE00DEAD0, 0, 0, NULL);
328 }
330 {
331 ret = return_zero();
332 }
333 _SEH2_END;
334
335 return ret == return_positive();
336}
337//}}}
338
339/* Dynamic exception filters, using _SEH2_GetExceptionInformation() *///{{{
340DEFINE_TEST(test_execute_handler_5)
341{
342 static int ret;
343
344 ret = return_zero();
345
347 {
348 RaiseException(0xE00DEAD0, 0, 0, NULL);
349 ret = return_zero();
350 }
352 {
354 }
355 _SEH2_END;
356
357 return ret == return_positive();
358}
359
360DEFINE_TEST(test_continue_execution_5)
361{
362 static int ret;
363
364 ret = return_zero();
365
367 {
368 RaiseException(0xE00DEAD0, 0, 0, NULL);
370 }
372 {
373 ret = return_zero();
374 }
375 _SEH2_END;
376
377 return ret == return_positive();
378}
379
380DEFINE_TEST(test_continue_search_3)
381{
382 static int ret;
383
385
387 {
389 {
390 RaiseException(0xE00DEAD0, 0, 0, NULL);
391 ret = return_zero();
392 }
394 {
395 ret = return_zero();
396 }
397 _SEH2_END;
398 }
400 {
401 ret = return_arg(ret);
402 }
403 _SEH2_END;
404
405 return ret == return_positive();
406}
407
408DEFINE_TEST(test_execute_handler_6)
409{
410 static int ret;
411
412 ret = return_zero();
413
415 {
416 RaiseException(0xE00DEAD0, 0, 0, NULL);
417 ret = return_zero();
418 }
420 {
422 }
423 _SEH2_END;
424
425 return ret == return_positive();
426}
427
428DEFINE_TEST(test_continue_execution_6)
429{
430 static int ret;
431
432 ret = return_zero();
433
435 {
436 RaiseException(0xE00DEAD0, 0, 0, NULL);
438 }
440 {
441 ret = return_zero();
442 }
443 _SEH2_END;
444
445 return ret == return_positive();
446}
447//}}}
448
449/* Dynamic exception filters, using _SEH2_GetExceptionCode() *///{{{
450DEFINE_TEST(test_execute_handler_7)
451{
452 static int ret;
453
454 ret = return_zero();
455
457 {
458 RaiseException(0xE00DEAD0, 0, 0, NULL);
459 ret = return_zero();
460 }
462 {
464 }
465 _SEH2_END;
466
467 return ret == return_positive();
468}
469
470DEFINE_TEST(test_continue_execution_7)
471{
472 static int ret;
473
474 ret = return_zero();
475
477 {
478 RaiseException(0xE00DEAD0, 0, 0, NULL);
480 }
482 {
483 ret = return_zero();
484 }
485 _SEH2_END;
486
487 return ret == return_positive();
488}
489
490DEFINE_TEST(test_continue_search_4)
491{
492 static int ret;
493
494 ret = return_zero();
495
497 {
499 {
500 RaiseException(0xE00DEAD0, 0, 0, NULL);
501 ret = return_zero();
502 }
504 {
505 ret = return_zero();
506 }
507 _SEH2_END;
508 }
510 {
512 }
513 _SEH2_END;
514
515 return ret == return_positive();
516}
517
518DEFINE_TEST(test_execute_handler_8)
519{
520 static int ret;
521
522 ret = return_zero();
523
525 {
526 RaiseException(0xE00DEAD0, 0, 0, NULL);
527 ret = return_zero();
528 }
530 {
532 }
533 _SEH2_END;
534
535 return ret == return_positive();
536}
537
538DEFINE_TEST(test_continue_execution_8)
539{
540 static int ret;
541
542 ret = return_zero();
543
545 {
546 RaiseException(0xE00DEAD0, 0, 0, NULL);
548 }
550 {
551 ret = return_zero();
552 }
553 _SEH2_END;
554
555 return ret == return_positive();
556}
557//}}}
558
559/* Dynamic exception filters, using _SEH2_GetExceptionInformation() and _SEH2_GetExceptionCode() *///{{{
560DEFINE_TEST(test_execute_handler_9)
561{
562 static int ret;
563
564 ret = return_zero();
565
567 {
568 RaiseException(0xE00DEAD0, 0, 0, NULL);
569 ret = return_zero();
570 }
572 {
574 }
575 _SEH2_END;
576
577 return ret == return_positive();
578}
579
580DEFINE_TEST(test_continue_execution_9)
581{
582 static int ret;
583
584 ret = return_zero();
585
587 {
588 RaiseException(0xE00DEAD0, 0, 0, NULL);
590 }
592 {
593 ret = return_zero();
594 }
595 _SEH2_END;
596
597 return ret == return_positive();
598}
599
600DEFINE_TEST(test_continue_search_5)
601{
602 static int ret;
603
604 ret = return_zero();
605
607 {
609 {
610 RaiseException(0xE00DEAD0, 0, 0, NULL);
611 ret = return_zero();
612 }
614 {
615 ret = return_zero();
616 }
617 _SEH2_END;
618 }
620 {
622 }
623 _SEH2_END;
624
625 return ret == return_positive();
626}
627
628DEFINE_TEST(test_execute_handler_10)
629{
630 static int ret;
631
632 ret = return_zero();
633
635 {
636 RaiseException(0xE00DEAD0, 0, 0, NULL);
637 ret = return_zero();
638 }
640 {
642 }
643 _SEH2_END;
644
645 return ret == return_positive();
646}
647
648DEFINE_TEST(test_continue_execution_10)
649{
650 static int ret;
651
652 ret = return_zero();
653
655 {
656 RaiseException(0xE00DEAD0, 0, 0, NULL);
658 }
660 {
661 ret = return_zero();
662 }
663 _SEH2_END;
664
665 return ret == return_positive();
666}
667//}}}
668
669/* Constant exception filters with side effects *///{{{
670DEFINE_TEST(test_execute_handler_11)
671{
672 static int ret;
673
674 ret = return_zero();
675
677 {
678 RaiseException(0xE00DEAD0, 0, 0, NULL);
679 ret = return_zero();
680 }
682 {
684 }
685 _SEH2_END;
686
687 return ret == return_positive();
688}
689
690DEFINE_TEST(test_continue_execution_11)
691{
692 static int ret;
693
694 ret = return_zero();
695
697 {
698 RaiseException(0xE00DEAD0, 0, 0, NULL);
700 }
702 {
703 ret = return_zero();
704 }
705 _SEH2_END;
706
707 return ret == return_positive();
708}
709
710DEFINE_TEST(test_continue_search_6)
711{
712 static int ret;
713 static int ret2;
714
715 ret = return_zero();
716 ret2 = return_zero();
717
719 {
721 {
722 RaiseException(0xE00DEAD0, 0, 0, NULL);
723 ret = return_zero();
724 ret2 = return_zero();
725 }
727 {
728 ret = return_zero();
729 ret2 = return_zero();
730 }
731 _SEH2_END;
732 }
734 {
735 ret = return_arg(ret);
736 ret2 = return_arg(ret2);
737 }
738 _SEH2_END;
739
740 return ret == return_positive() && ret2 == return_positive();
741}
742
743DEFINE_TEST(test_execute_handler_12)
744{
745 static int ret;
746
747 ret = return_zero();
748
750 {
751 RaiseException(0xE00DEAD0, 0, 0, NULL);
752 ret = return_zero();
753 }
755 {
756 ret = return_arg(ret);
757 }
758 _SEH2_END;
759
760 return ret == return_positive();
761}
762
763DEFINE_TEST(test_continue_execution_12)
764{
765 static int ret;
766
767 ret = return_zero();
768
770 {
771 RaiseException(0xE00DEAD0, 0, 0, NULL);
772 ret = return_arg(ret);
773 }
774 _SEH2_EXCEPT(set_positive(&ret), -12345)
775 {
776 ret = return_zero();
777 }
778 _SEH2_END;
779
780 return ret == return_positive();
781}
782//}}}
783
784/* _SEH2_LEAVE *///{{{
785DEFINE_TEST(test_leave_1)
786{
787 static int ret;
788
789 ret = return_zero();
790
792 {
795 ret = return_zero();
796 }
798 {
799 ret = return_zero();
800 }
801 _SEH2_END;
802
803 return ret == return_positive();
804}
805
806DEFINE_TEST(test_leave_2)
807{
808 static int ret;
809
810 ret = return_zero();
811
813 {
816
817 RaiseException(0xE00DEAD0, 0, 0, NULL);
818 ret = return_zero();
819 }
821 {
822 ret = return_zero();
823 }
824 _SEH2_END;
825
826 return ret == return_positive();
827}
828
829DEFINE_TEST(test_leave_3)
830{
831 static int ret;
832
833 ret = return_zero();
834
836 {
838
839 if(return_one())
841
842 ret = return_zero();
843 }
845 {
846 ret = return_zero();
847 }
848 _SEH2_END;
849
850 return ret == return_positive();
851}
852
853DEFINE_TEST(test_leave_4)
854{
855 static int ret;
856
857 ret = return_zero();
858
860 {
861 int i;
862 int n = return_one() + return_one();
863
864 for(i = return_zero(); i < n; ++ i)
865 {
866 if(i == return_one())
867 {
870 }
871 }
872
873 ret = return_zero();
874 }
876 {
877 ret = return_zero();
878 }
879 _SEH2_END;
880
881 return ret == return_positive();
882}
883
884DEFINE_TEST(test_leave_5)
885{
886 static int ret;
887
888 ret = return_zero();
889
891 {
892 switch(return_one())
893 {
894 case 0: ret = return_zero();
895 case 1: ret = return_positive(); _SEH2_LEAVE;
896 case 2: ret = return_zero();
897 }
898
899 ret = return_zero();
900 }
902 {
903 ret = return_zero();
904 }
905 _SEH2_END;
906
907 return ret == return_positive();
908}
909
910DEFINE_TEST(test_leave_6)
911{
912 static int ret;
913
914 ret = return_zero();
915
917 {
919 {
921 }
923 {
924 ret = return_zero();
925 }
926 _SEH2_END;
927
929 }
931 {
932 ret = return_zero();
933 }
934 _SEH2_END;
935
936 return ret == return_positive();
937}
938//}}}
939
940/* _SEH2_YIELD() *///{{{
941static
943{
945 {
947 }
949 {
950 _SEH2_YIELD(return return_zero());
951 }
952 _SEH2_END;
953
954 return return_zero();
955}
956
957DEFINE_TEST(test_yield_1)
958{
960}
961
962static
964{
966 {
967 RaiseException(0xE00DEAD0, 0, 0, NULL);
968 _SEH2_YIELD(return return_zero());
969 }
971 {
973 }
974 _SEH2_END;
975
976 return return_zero();
977}
978
979DEFINE_TEST(test_yield_2)
980{
982}
983
984static
986{
988 {
990 {
992 }
994 {
995 _SEH2_YIELD(return return_zero());
996 }
997 _SEH2_END;
998
999 _SEH2_YIELD(return return_zero());
1000 }
1002 {
1003 _SEH2_YIELD(return return_zero());
1004 }
1005 _SEH2_END;
1006
1007 return return_zero();
1008}
1009
1010DEFINE_TEST(test_yield_3)
1011{
1013}
1014
1015static
1017{
1018 _SEH2_TRY
1019 {
1020 _SEH2_TRY
1021 {
1022 RaiseException(0xE00DEAD0, 0, 0, NULL);
1023 _SEH2_YIELD(return return_zero());
1024 }
1026 {
1027 _SEH2_YIELD(return return_positive());
1028 }
1029 _SEH2_END;
1030
1031 _SEH2_YIELD(return return_zero());
1032 }
1034 {
1035 _SEH2_YIELD(return return_zero());
1036 }
1037 _SEH2_END;
1038
1039 return return_zero();
1040}
1041
1042DEFINE_TEST(test_yield_4)
1043{
1045}
1046
1048
1049static
1051{
1053
1054 _SEH2_TRY
1055 {
1056 _SEH2_YIELD(return return_positive());
1057 }
1059 {
1061 }
1062 _SEH2_END;
1063
1064 return return_zero();
1065}
1066
1067DEFINE_TEST(test_yield_5)
1068{
1070}
1071
1073
1074static
1076{
1078
1079 _SEH2_TRY
1080 {
1081 _SEH2_TRY
1082 {
1083 _SEH2_YIELD(return return_positive());
1084 }
1086 {
1088 }
1089 _SEH2_END;
1090 }
1092 {
1094 }
1095 _SEH2_END;
1096
1097 return return_zero();
1098}
1099
1100DEFINE_TEST(test_yield_6)
1101{
1103}
1104//}}}
1105
1106/* Termination blocks *///{{{
1107DEFINE_TEST(test_finally_1)
1108{
1109 static int ret;
1110
1111 ret = return_zero();
1112
1113 _SEH2_TRY
1114 {
1115 ret = return_arg(ret);
1116 }
1118 {
1119 ret = return_positive();
1120 }
1121 _SEH2_END;
1122
1123 return ret == return_positive();
1124}
1125
1126DEFINE_TEST(test_finally_2)
1127{
1128 static int ret;
1129
1130 ret = return_zero();
1131
1132 _SEH2_TRY
1133 {
1134 ret = return_arg(ret);
1136 }
1138 {
1139 ret = return_positive();
1140 }
1141 _SEH2_END;
1142
1143 return ret == return_positive();
1144}
1145
1146DEFINE_TEST(test_finally_3)
1147{
1148 static int ret;
1149
1150 ret = return_zero();
1151
1152 _SEH2_TRY
1153 {
1154 ret = return_arg(ret);
1155 _SEH2_YIELD(goto leave);
1156 }
1158 {
1159 ret = return_positive();
1160 }
1161 _SEH2_END;
1162
1163leave:
1164 return ret == return_positive();
1165}
1166
1168
1170{
1172
1173 _SEH2_TRY
1174 {
1176 _SEH2_YIELD(return return_positive());
1177 }
1179 {
1181 }
1182 _SEH2_END;
1183
1184 return return_zero();
1185}
1186
1187DEFINE_TEST(test_finally_4)
1188{
1190}
1191
1192DEFINE_TEST(test_finally_5)
1193{
1194 static int ret;
1195
1196 ret = return_zero();
1197
1198 _SEH2_TRY
1199 {
1200 _SEH2_TRY
1201 {
1202 RaiseException(0xE00DEAD0, 0, 0, NULL);
1203 ret = return_zero();
1204 }
1206 {
1207 ret = return_positive();
1208 }
1209 _SEH2_END;
1210 }
1212 {
1213 ret = return_arg(ret);
1214 }
1215 _SEH2_END;
1216
1217 return ret == return_positive();
1218}
1219
1220DEFINE_TEST(test_finally_6)
1221{
1222 static int ret;
1223
1224 ret = return_zero();
1225
1226 _SEH2_TRY
1227 {
1228 _SEH2_TRY
1229 {
1230 ret = return_arg(ret);
1231 }
1233 {
1234 if(ret == return_zero())
1235 ret = return_positive();
1236 }
1237 _SEH2_END;
1238 }
1240 {
1241 if(ret == return_positive())
1243 }
1244 _SEH2_END;
1245
1246 return ret == return_positive() + return_one();
1247}
1248
1249DEFINE_TEST(test_finally_7)
1250{
1251 static int ret;
1252
1253 ret = return_zero();
1254
1255 _SEH2_TRY
1256 {
1257 _SEH2_TRY
1258 {
1259 ret = return_arg(ret);
1261 }
1263 {
1264 if(ret == return_zero())
1265 ret = return_positive();
1266 }
1267 _SEH2_END;
1268 }
1270 {
1271 if(ret == return_positive())
1273 }
1274 _SEH2_END;
1275
1276 return ret == return_positive() + return_one();
1277}
1278
1279DEFINE_TEST(test_finally_8)
1280{
1281 static int ret;
1282
1283 ret = return_zero();
1284
1285 _SEH2_TRY
1286 {
1287 _SEH2_TRY
1288 {
1289 ret = return_arg(ret);
1290 _SEH2_YIELD(goto leave);
1291 }
1293 {
1294 if(ret == return_zero())
1295 ret = return_positive();
1296 }
1297 _SEH2_END;
1298 }
1300 {
1301 if(ret == return_positive())
1303 }
1304 _SEH2_END;
1305
1306leave:
1307 return ret == return_positive() + return_one();
1308}
1309
1311
1313{
1315
1316 _SEH2_TRY
1317 {
1318 _SEH2_TRY
1319 {
1321 _SEH2_YIELD(return return_positive());
1322 }
1324 {
1327 }
1328 _SEH2_END;
1329 }
1331 {
1334 }
1335 _SEH2_END;
1336
1337 return return_zero();
1338}
1339
1340DEFINE_TEST(test_finally_9)
1341{
1343}
1344
1345DEFINE_TEST(test_finally_10)
1346{
1347 static int ret;
1348
1349 ret = return_zero();
1350
1351 _SEH2_TRY
1352 {
1353 _SEH2_TRY
1354 {
1355 _SEH2_TRY
1356 {
1357 RaiseException(0xE00DEAD0, 0, 0, NULL);
1358 ret = return_zero();
1359 }
1361 {
1362 if(ret == return_zero())
1363 ret = return_positive();
1364 }
1365 _SEH2_END;
1366 }
1368 {
1369 if(ret == return_positive())
1371 }
1372 _SEH2_END;
1373 }
1375 {
1376 ret = return_arg(ret);
1377 }
1378 _SEH2_END;
1379
1380 return ret == return_positive() + return_one();
1381}
1382
1383DEFINE_TEST(test_finally_11)
1384{
1385 static int ret;
1386
1387 ret = return_zero();
1388
1389 _SEH2_TRY
1390 {
1391 _SEH2_TRY
1392 {
1393 _SEH2_TRY
1394 {
1395 ret = return_arg(ret);
1396 }
1398 {
1399 ret = return_zero();
1400 }
1401 _SEH2_END;
1402 }
1404 {
1405 ret = return_positive();
1406 RaiseException(0xE00DEAD0, 0, 0, NULL);
1407 ret = return_zero();
1408 }
1409 _SEH2_END;
1410 }
1412 {
1413 if(ret == return_positive())
1414 ret += return_one();
1415 }
1416 _SEH2_END;
1417
1418 return ret == return_positive() + return_one();
1419}
1420
1421DEFINE_TEST(test_finally_12)
1422{
1423 static int ret;
1424
1425 ret = return_zero();
1426
1427 _SEH2_TRY
1428 {
1429 _SEH2_TRY
1430 {
1431 _SEH2_TRY
1432 {
1433 ret = return_arg(ret);
1434 }
1436 {
1437 ret = return_positive();
1438 RaiseException(0xE00DEAD0, 0, 0, NULL);
1439 ret = return_zero();
1440 }
1441 _SEH2_END;
1442 }
1444 {
1445 if(ret == return_positive())
1446 ret += return_one();
1447 }
1448 _SEH2_END;
1449 }
1451 {
1452 if(ret == return_positive() + return_one())
1453 ret += return_one();
1454 }
1455 _SEH2_END;
1456
1457 return ret == return_positive() + return_one() + return_one();
1458}
1459
1461
1462static
1464{
1466
1467 _SEH2_TRY
1468 {
1469 _SEH2_TRY
1470 {
1472 _SEH2_YIELD(return);
1474 }
1476 {
1479 }
1480 _SEH2_END;
1481 }
1483 {
1486
1487 RaiseException(0xE00DEAD0, 0, 0, NULL);
1489 }
1490 _SEH2_END;
1491
1493}
1494
1495DEFINE_TEST(test_finally_13)
1496{
1497 static int ret;
1498
1499 ret = return_zero();
1500
1501 _SEH2_TRY
1502 {
1503 ret = return_arg(ret);
1505 ret = return_zero();
1506 }
1508 {
1509 ret = return_positive();
1510 }
1511 _SEH2_END;
1512
1514}
1515
1517
1518static
1520{
1522
1523 _SEH2_TRY
1524 {
1525 _SEH2_TRY
1526 {
1527 _SEH2_TRY
1528 {
1530 RaiseException(0xE00DEAD0, 0, 0, NULL);
1532 }
1534 {
1537 }
1538 _SEH2_END;
1539 }
1541 {
1544
1545 RaiseException(0xE00DEAD0, 0, 0, NULL);
1547 }
1548 _SEH2_END;
1549 }
1551 {
1554 }
1555 _SEH2_END;
1556
1558}
1559
1560DEFINE_TEST(test_finally_14)
1561{
1562 static int ret;
1563
1564 ret = return_zero();
1565
1566 _SEH2_TRY
1567 {
1568 ret = return_arg(ret);
1570 ret = return_positive();
1571 }
1573 {
1574 ret = return_zero();
1575 }
1576 _SEH2_END;
1577
1579}
1580//}}}
1581
1582/* _SEH2_GetExceptionInformation() *///{{{
1583static
1585{
1586 *ret =
1587 ep &&
1588 ep->ExceptionRecord &&
1589 ep->ContextRecord &&
1593 (argv || !argc) &&
1594 memcmp(ep->ExceptionRecord->ExceptionInformation, argv, sizeof(argv[0]) * argc) == 0;
1595
1596 if(*ret)
1597 *ret = return_positive();
1598
1599 return filter;
1600}
1601
1602DEFINE_TEST(test_xpointers_1)
1603{
1604 static int ret;
1605
1606 ret = return_zero();
1607
1608 _SEH2_TRY
1609 {
1610 RaiseException(0xE00DEAD0, 0, 0, NULL);
1611 }
1613 {
1614 ret = return_arg(ret);
1615 }
1616 _SEH2_END;
1617
1618 return ret == return_positive();
1619}
1620
1621DEFINE_TEST(test_xpointers_2)
1622{
1623 static int ret;
1624
1625 ret = return_zero();
1626
1627 _SEH2_TRY
1628 {
1630 }
1632 {
1633 ret = return_arg(ret);
1634 }
1635 _SEH2_END;
1636
1637 return ret == return_positive();
1638}
1639
1640DEFINE_TEST(test_xpointers_3)
1641{
1642 static int ret;
1643 static const ULONG_PTR args[] = { 1, 2, 12345 };
1644
1645 ret = return_zero();
1646
1647 _SEH2_TRY
1648 {
1650 }
1652 {
1653 ret = return_arg(ret);
1654 }
1655 _SEH2_END;
1656
1657 return ret == return_positive();
1658}
1659
1660DEFINE_TEST(test_xpointers_4)
1661{
1662 static int ret;
1663 static const ULONG_PTR args[] = { 1, 2, 12345 };
1664
1665 ret = return_zero();
1666
1667 _SEH2_TRY
1668 {
1670 }
1672 {
1673 ret = return_arg(ret);
1674 }
1675 _SEH2_END;
1676
1677 return ret == return_positive();
1678}
1679
1680DEFINE_TEST(test_xpointers_5)
1681{
1682 static int ret;
1683 static const ULONG_PTR args[] = { 1, 2, 12345 };
1684
1685 ret = return_zero();
1686
1687 _SEH2_TRY
1688 {
1690 }
1692 {
1693 ret = return_arg(ret);
1694 }
1695 _SEH2_END;
1696
1697 return ret == return_positive();
1698}
1699
1700DEFINE_TEST(test_xpointers_6)
1701{
1702 static int ret;
1703 static const ULONG_PTR args[] = { 1, 2, 12345 };
1704
1705 ret = return_zero();
1706
1707 _SEH2_TRY
1708 {
1710 }
1712 {
1713 ret = return_arg(ret);
1714 }
1715 _SEH2_END;
1716
1717 return ret == return_positive();
1718}
1719
1720DEFINE_TEST(test_xpointers_7)
1721{
1722 static int ret;
1723
1724 ret = return_zero();
1725
1726 _SEH2_TRY
1727 {
1728 RaiseException(0xE00DEAD0, 0, 0, NULL);
1729 ret = return_arg(ret);
1730 }
1732 {
1733 ret = return_zero();
1734 }
1735 _SEH2_END;
1736
1737 return ret == return_positive();
1738}
1739
1740DEFINE_TEST(test_xpointers_8)
1741{
1742 static int ret;
1743 static const ULONG_PTR args[] = { 1, 2, 12345 };
1744
1745 ret = return_zero();
1746
1747 _SEH2_TRY
1748 {
1749 RaiseException(0xE00DEAD0, 0, 0, args);
1750 ret = return_arg(ret);
1751 }
1753 {
1754 ret = return_zero();
1755 }
1756 _SEH2_END;
1757
1758 return ret == return_positive();
1759}
1760
1761DEFINE_TEST(test_xpointers_9)
1762{
1763 static int ret;
1764 static const ULONG_PTR args[] = { 1, 2, 12345 };
1765
1766 ret = return_zero();
1767
1768 _SEH2_TRY
1769 {
1770 RaiseException(0xE00DEAD0, 0, 1, args);
1771 ret = return_arg(ret);
1772 }
1774 {
1775 ret = return_zero();
1776 }
1777 _SEH2_END;
1778
1779 return ret == return_positive();
1780}
1781
1782DEFINE_TEST(test_xpointers_10)
1783{
1784 static int ret;
1785 static const ULONG_PTR args[] = { 1, 2, 12345 };
1786
1787 ret = return_zero();
1788
1789 _SEH2_TRY
1790 {
1791 RaiseException(0xE00DEAD0, 0, 2, args);
1792 ret = return_arg(ret);
1793 }
1795 {
1796 ret = return_zero();
1797 }
1798 _SEH2_END;
1799
1800 return ret == return_positive();
1801}
1802
1803DEFINE_TEST(test_xpointers_11)
1804{
1805 static int ret;
1806 static const ULONG_PTR args[] = { 1, 2, 12345 };
1807
1808 ret = return_zero();
1809
1810 _SEH2_TRY
1811 {
1812 RaiseException(0xE00DEAD0, 0, 3, args);
1813 ret = return_arg(ret);
1814 }
1816 {
1817 ret = return_zero();
1818 }
1819 _SEH2_END;
1820
1821 return ret == return_positive();
1822}
1823
1824DEFINE_TEST(test_xpointers_12)
1825{
1826 static int ret;
1827
1828 ret = return_zero();
1829
1830 _SEH2_TRY
1831 {
1832 _SEH2_TRY
1833 {
1835 }
1837 {
1838 ret = return_zero();
1839 }
1840 _SEH2_END;
1841 }
1843 {
1844 ret = return_arg(ret);
1845 }
1846 _SEH2_END;
1847
1848 return ret == return_positive();
1849}
1850
1851DEFINE_TEST(test_xpointers_13)
1852{
1853 static int ret;
1854 static const ULONG_PTR args[] = { 1, 2, 12345 };
1855
1856 ret = return_zero();
1857
1858 _SEH2_TRY
1859 {
1860 _SEH2_TRY
1861 {
1863 }
1865 {
1866 ret = return_zero();
1867 }
1868 _SEH2_END;
1869 }
1871 {
1872 ret = return_arg(ret);
1873 }
1874 _SEH2_END;
1875
1876 return ret == return_positive();
1877}
1878
1879DEFINE_TEST(test_xpointers_14)
1880{
1881 static int ret;
1882 static const ULONG_PTR args[] = { 1, 2, 12345 };
1883
1884 ret = return_zero();
1885
1886 _SEH2_TRY
1887 {
1888 _SEH2_TRY
1889 {
1891 }
1893 {
1894 ret = return_zero();
1895 }
1896 _SEH2_END;
1897 }
1899 {
1900 ret = return_arg(ret);
1901 }
1902 _SEH2_END;
1903
1904 return ret == return_positive();
1905}
1906
1907DEFINE_TEST(test_xpointers_15)
1908{
1909 static int ret;
1910 static const ULONG_PTR args[] = { 1, 2, 12345 };
1911
1912 ret = return_zero();
1913
1914 _SEH2_TRY
1915 {
1916 _SEH2_TRY
1917 {
1919 }
1921 {
1922 ret = return_zero();
1923 }
1924 _SEH2_END;
1925 }
1927 {
1928 ret = return_arg(ret);
1929 }
1930 _SEH2_END;
1931
1932 return ret == return_positive();
1933}
1934
1935DEFINE_TEST(test_xpointers_16)
1936{
1937 static int ret;
1938 static const ULONG_PTR args[] = { 1, 2, 12345 };
1939
1940 ret = return_zero();
1941
1942 _SEH2_TRY
1943 {
1944 _SEH2_TRY
1945 {
1947 }
1949 {
1950 ret = return_zero();
1951 }
1952 _SEH2_END;
1953 }
1955 {
1956 ret = return_arg(ret);
1957 }
1958 _SEH2_END;
1959
1960 return ret == return_positive();
1961}
1962//}}}
1963
1964/* _SEH2_GetExceptionCode() *///{{{
1965static
1966int verify_xcode(int code, int xcode, int * ret, int filter)
1967{
1968 *ret = code == xcode;
1969
1970 if(*ret)
1971 *ret = return_positive();
1972
1973 return filter;
1974}
1975
1976DEFINE_TEST(test_xcode_1)
1977{
1978 static int ret;
1979
1980 ret = return_zero();
1981
1982 _SEH2_TRY
1983 {
1984 RaiseException(0xE00DEAD0, 0, 0, NULL);
1985 ret = return_zero();
1986 }
1988 {
1989 ret = return_arg(ret);
1990 }
1991 _SEH2_END;
1992
1993 return ret == return_positive();
1994}
1995
1996DEFINE_TEST(test_xcode_2)
1997{
1998 static int ret;
1999
2000 ret = return_zero();
2001
2002 _SEH2_TRY
2003 {
2004 RaiseException(0xE00DEAD0, 0, 0, NULL);
2005 ret = return_arg(ret);
2006 }
2008 {
2009 ret = return_zero();
2010 }
2011 _SEH2_END;
2012
2013 return ret == return_positive();
2014}
2015
2016DEFINE_TEST(test_xcode_3)
2017{
2018 static int ret;
2019
2020 ret = return_zero();
2021
2022 _SEH2_TRY
2023 {
2024 _SEH2_TRY
2025 {
2026 RaiseException(0xE00DEAD0, 0, 0, NULL);
2027 ret = return_zero();
2028 }
2030 {
2031 ret = return_zero();
2032 }
2033 _SEH2_END;
2034 }
2036 {
2037 ret = return_arg(ret);
2038 }
2039 _SEH2_END;
2040
2041 return ret == return_positive();
2042}
2043//}}}
2044
2045/* _SEH2_AbnormalTermination() *///{{{
2046DEFINE_TEST(test_abnorm_1)
2047{
2048 static int ret;
2049
2050 ret = return_zero();
2051
2052 _SEH2_TRY
2053 {
2054 ret = return_arg(ret);
2055 }
2057 {
2059 }
2060 _SEH2_END;
2061
2062 return ret == return_positive();
2063}
2064
2065DEFINE_TEST(test_abnorm_2)
2066{
2067 static int ret;
2068
2069 ret = return_zero();
2070
2071 _SEH2_TRY
2072 {
2074 }
2076 {
2078 }
2079 _SEH2_END;
2080
2081 return ret == return_positive();
2082}
2083
2084DEFINE_TEST(test_abnorm_3)
2085{
2086 static int ret;
2087
2088 ret = return_zero();
2089
2090 _SEH2_TRY
2091 {
2092 _SEH2_YIELD(goto leave);
2093 }
2095 {
2097 }
2098 _SEH2_END;
2099
2100leave:
2101 return ret == return_positive();
2102}
2103
2104DEFINE_TEST(test_abnorm_4)
2105{
2106 static int ret;
2107
2108 ret = return_zero();
2109
2110 _SEH2_TRY
2111 {
2112 _SEH2_TRY
2113 {
2114 RaiseException(0xE00DEAD0, 0, 0, NULL);
2115 ret = return_zero();
2116 }
2118 {
2120 }
2121 _SEH2_END;
2122 }
2124 {
2125 ret = return_arg(ret);
2126 }
2127 _SEH2_END;
2128
2129 return ret == return_positive();
2130}
2131
2132DEFINE_TEST(test_abnorm_5)
2133{
2134 static int ret;
2135
2136 ret = return_zero();
2137
2138 _SEH2_TRY
2139 {
2140 _SEH2_TRY
2141 {
2142 ret = return_arg(ret);
2143 }
2145 {
2147 }
2148 _SEH2_END;
2149 }
2151 {
2153 }
2154 _SEH2_END;
2155
2156 return ret == return_positive() + return_one();
2157}
2158
2159DEFINE_TEST(test_abnorm_6)
2160{
2161 static int ret;
2162
2163 ret = return_zero();
2164
2165 _SEH2_TRY
2166 {
2167 _SEH2_TRY
2168 {
2170 }
2172 {
2174 }
2175 _SEH2_END;
2176 }
2178 {
2180 }
2181 _SEH2_END;
2182
2183 return ret == return_positive() + return_one();
2184}
2185
2186DEFINE_TEST(test_abnorm_7)
2187{
2188 static int ret;
2189
2190 ret = return_zero();
2191
2192 _SEH2_TRY
2193 {
2194 _SEH2_TRY
2195 {
2196 _SEH2_YIELD(goto leave);
2197 }
2199 {
2201 }
2202 _SEH2_END;
2203 }
2205 {
2207 }
2208 _SEH2_END;
2209
2210leave:
2211 return ret == return_positive() + return_one();
2212}
2213
2214DEFINE_TEST(test_abnorm_8)
2215{
2216 static int ret;
2217
2218 ret = return_zero();
2219
2220 _SEH2_TRY
2221 {
2222 _SEH2_TRY
2223 {
2224 _SEH2_TRY
2225 {
2226 RaiseException(0xE00DEAD0, 0, 0, NULL);
2227 ret = return_zero();
2228 }
2230 {
2232 }
2233 _SEH2_END;
2234 }
2236 {
2238 }
2239 _SEH2_END;
2240 }
2242 {
2243 ret = return_arg(ret);
2244 }
2245 _SEH2_END;
2246
2247 return ret == return_positive() + return_one();
2248}
2249//}}}
2250
2251/* Use of local variables from _SEH2_EXCEPT(...) and _SEH2_FINALLY { ... } *///{{{
2252DEFINE_TEST(test_nested_locals_1)
2253{
2254 int var1 = return_one();
2255
2256 _SEH2_TRY
2257 {
2258 RaiseException(0xE00DEAD0, 0, 0, 0);
2259 }
2260 _SEH2_EXCEPT((var1 = (var1 == return_one() ? return_positive() : var1)), EXCEPTION_EXECUTE_HANDLER)
2261 {
2262 if(var1 == return_positive())
2263 var1 = return_positive() + 1;
2264 }
2265 _SEH2_END;
2266
2267 return var1 == return_positive() + 1;
2268}
2269
2270DEFINE_TEST(test_nested_locals_2)
2271{
2272 int var1 = return_positive();
2273
2274 _SEH2_TRY
2275 {
2276 }
2278 {
2279 if(var1 == return_positive())
2280 var1 = return_positive() + 1;
2281 }
2282 _SEH2_END;
2283
2284 return var1 == return_positive() + 1;
2285}
2286
2287DEFINE_TEST(test_nested_locals_3)
2288{
2289 int var1 = return_zero();
2290
2291 _SEH2_TRY
2292 {
2293 _SEH2_TRY
2294 {
2295 var1 = return_one();
2296 RaiseException(0xE00DEAD0, 0, 0, 0);
2297 }
2299 {
2300 if(var1 == return_one())
2301 var1 = return_positive();
2302 }
2303 _SEH2_END;
2304 }
2306 {
2307 if(var1 == return_positive())
2308 var1 = return_positive() + 1;
2309 }
2310 _SEH2_END;
2311
2312 return var1 == return_positive() + 1;
2313}
2314//}}}
2315
2316/* System support *///{{{
2317// TODO
2318//}}}
2319
2320/* CPU faults *///{{{
2321// TODO
2322//}}}
2323
2324/* Past bugs, to detect regressions *///{{{
2325/* #4004: volatile registers clobbered when catching across frames (originally misreported) *///{{{
2326static
2328{
2329 int i1, i2, i3;
2330
2331 i1 = return_positive();
2332 i2 = return_positive();
2333 i3 = return_positive();
2334 (void)return_arg(i1 + i2 + i3);
2335
2336 _SEH2_TRY
2337 {
2338 RaiseException(0xE00DEAD0, 0, 0, NULL);
2339 }
2341 {
2342 }
2343 _SEH2_END;
2344}
2345
2346static
2348{
2349 _SEH2_TRY
2350 {
2352 }
2354 {
2355 }
2356 _SEH2_END;
2357}
2358
2359DEFINE_TEST(test_bug_4004)
2360{
2361 int i1, i2, i3;
2362
2363 i1 = return_positive();
2364 i2 = return_positive();
2365 i3 = return_positive();
2366
2368
2369 return return_arg(i1) + return_arg(i2) + return_arg(i3) == return_positive() * 3;
2370}
2371//}}}
2372
2373/* #4663: *///{{{
2374DEFINE_TEST(test_bug_4663)
2375{
2376 int i1, i2;
2377
2378 i1 = return_positive();
2379 i2 = return_positive();
2380
2381 _SEH2_TRY
2382 {
2383 _SEH2_TRY
2384 {
2385 RaiseException(0xE00DEAD0, 0, 0, 0);
2386 }
2388 {
2389 if (i1 == return_positive())
2390 {
2391 i1 = return_positive() + 1;
2392 }
2393 }
2394 _SEH2_END;
2395
2396 if (i1 == return_positive() + 1)
2397 {
2398 i1 = return_negative();
2399 RaiseException(0xE00DEAD0, 0, 0, 0);
2400 }
2401 }
2403 {
2404 i2 = return_negative();
2405 }
2406 _SEH2_END;
2407
2408 return ((i1 == return_negative()) && (i2 == return_negative()));
2409}
2410//}}}
2411//}}}
2412
2413DEFINE_TEST(test_unvolatile)
2414{
2415 int val = 0;
2416
2417 _SEH2_TRY
2418 {
2419 val = return_one();
2420 *((char*)(intptr_t)0xc0000000) = 0;
2421 }
2423 {
2424 val = val + 3;
2425 }
2426 _SEH2_END;
2427
2428 /* This works with a proper SEH implementation, but not with our hacked PSEH */
2429#ifdef _USE_NATIVE_SEH
2430 return (val == 4);
2431#else
2432 return (val == 4 || val == 3);
2433#endif
2434}
2435
2436DEFINE_TEST(test_unvolatile_2)
2437{
2438 int val = 0;
2439
2440 _SEH2_TRY
2441 {
2442 val = 1;
2443 *((char*)(intptr_t)0xc0000000) = 0;
2444 val = 2;
2445 }
2447 {
2448 val = val + 3;
2449 }
2450 _SEH2_END;
2451
2452 return (val == 3) || (val == 4) || (val == 5);
2453}
2454
2455/* This test is mainly for documentation purpose. As can be seen it doesn't
2456 provide a satisfying result. In fact the compiler could do even more
2457 crazy things like reusing val1 between the assignment to 0 and the last
2458 assignment to 3. This DOES happen with C++ and it's NOT a PSEH bug, but
2459 rather an unavoidable consequence of how the compiler works.
2460 The conclusion: Do not use assignments to a variable inside a __try block
2461 that is being used later inside the __except block, unless it is declared
2462 volatile! */
2463#ifndef __cplusplus
2464DEFINE_TEST(test_unvolatile_3)
2465{
2466 register int val1 = 0, val2 = 0;
2467
2468 _SEH2_TRY
2469 {
2470 val1 = 1;
2471
2472 _SEH2_TRY
2473 {
2474 val2 = 1;
2475 *((char*)(intptr_t)0xc0000000) = 0;
2476 val2 = 2;
2477 }
2479 {
2480 val2 |= 4;
2481 }
2482 _SEH2_END;
2483
2484 val1 = 2;
2485 *((int*)(intptr_t)0xc0000000) = 1;
2486 val1 = 3;
2487 }
2489 {
2490 val1 = val1 * val2;
2491 }
2492 _SEH2_END;
2493
2494 /* The expected case */
2495 if ((val1 == 10) && (val2 == 5))
2496 return TRUE;
2497
2498 /* The compiler can optimize away "val1 = 1" and "val1 = 2" and
2499 only use the last "val1 = 3", in this case val1 is still 0
2500 when the outer exception handler kicks in */
2501 if ((val1 == 0) && (val2 == 5))
2502 return TRUE;
2503
2504 /* Same as above, but this time val2 optimized away */
2505 if (((val1 == 8) && (val2 == 4)) ||
2506 ((val1 == 0) && (val2 == 4)))
2507 return TRUE;
2508
2509 return FALSE;
2510}
2511#endif // __cplusplus
2512
2513DEFINE_TEST(test_unvolatile_4)
2514{
2515 unsigned result = 0xdeadbeef;
2516
2517 _SEH2_TRY
2518 {
2519 *(char*)(intptr_t)0x80000000 = 1;
2520 }
2521 _SEH2_EXCEPT(result == 0xdeadbeef)
2522 {
2523 result = 2;
2524 }
2525 _SEH2_END;
2526
2527 result = (result == 0xdeadbeef) ? 0 : result + 1;
2528
2529 return result == 3;
2530}
2531
2532DEFINE_TEST(test_finally_goto)
2533{
2534 volatile int val = 0;
2535
2536 _SEH2_TRY
2537 {
2538 val |= 1;
2539 _SEH2_TRY
2540 {
2541 val |= 2;
2542 goto next;
2543 }
2545 {
2546 val |= 4;
2547 *((char*)(intptr_t)0xdeadc0de) = 0;
2548 val |= 8;
2549 }
2550 _SEH2_END;
2551
2552 val |= 16;
2553next:
2554 val |= 32;
2555 *((char*)(intptr_t)0xdeadc0de) = 0;
2556 val |= 64;
2557 }
2558 _SEH2_EXCEPT(1)
2559 {
2560 val |= 128;
2561 }
2562 _SEH2_END;
2563
2564 return (val == (128|4|2|1));
2565}
2566
2567DEFINE_TEST(test_nested_exception)
2568{
2569 volatile int val = 0;
2570
2571 _SEH2_TRY
2572 {
2573 val |= 1;
2574 _SEH2_TRY
2575 {
2576 val |= 2;
2577 *((char*)(intptr_t)0xdeadc0de) = 0;
2578 val |= 4;
2579 }
2580 _SEH2_EXCEPT(1)
2581 {
2582 val |= 8;
2583 *((char*)(intptr_t)0xdeadc0de) = 0;
2584 val |= 16;
2585 }
2586 _SEH2_END;
2587
2588 val |= 32;
2589 *((char*)(intptr_t)0xdeadc0de) = 0;
2590 val |= 64;
2591 }
2592 _SEH2_EXCEPT(1)
2593 {
2594 val |= 128;
2595 }
2596 _SEH2_END;
2597
2598 return (val == (1|2|8|128));
2599}
2600
2601static
2603{
2604 trace("unhandled exception %08lX thrown from %p\n", ExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionInfo->ExceptionRecord->ExceptionAddress);
2606}
2607
2608#if defined(_M_IX86)
2609struct volatile_context
2610{
2611 void * esp;
2612 void * ebp;
2613 void * ebx;
2614 void * esi;
2615 void * edi;
2616};
2617#else
2619{
2621};
2622#endif
2623
2624static
2627{
2628 if(ret && memcmp(before, after, sizeof(*before)))
2629 {
2630 trace("volatile context corrupted\n");
2631 return 0;
2632 }
2633
2634 return ret;
2635}
2636
2637#ifndef _PSEH3_H_
2638static
2639int passthrough_handler(struct _EXCEPTION_RECORD * e, void * f, struct _CONTEXT * c, void * d)
2640{
2642}
2643#endif
2644
2645static
2647int call_test(int (* func)(void))
2648{
2649 static int ret;
2650 static struct volatile_context before, after;
2651 static LPTOP_LEVEL_EXCEPTION_FILTER prev_unhandled_exception;
2652#if defined(_X86_) && !defined(_PSEH3_H_) && !defined(_MSC_VER)
2653 static _SEH2Registration_t * prev_frame;
2654 _SEH2Registration_t passthrough_frame;
2655#endif
2656
2657 prev_unhandled_exception = SetUnhandledExceptionFilter(&unhandled_exception);
2658
2659#if defined(_X86_) && !defined(_PSEH3_H_) && !defined(_MSC_VER)
2660 prev_frame = (_SEH2Registration_t *)__readfsdword(0);
2661 passthrough_frame.SER_Prev = prev_frame;
2662 passthrough_frame.SER_Handler = passthrough_handler;
2663 __writefsdword(0, (unsigned long)&passthrough_frame);
2664#endif
2665
2666#if defined(__GNUC__) && defined(__i386__)
2667 __asm__ __volatile__
2668 (
2669 "mov %%esp, 0x00 + %c[before]\n"
2670 "mov %%ebp, 0x04 + %c[before]\n"
2671 "mov %%ebx, 0x08 + %c[before]\n"
2672 "mov %%esi, 0x0c + %c[before]\n"
2673 "mov %%edi, 0x10 + %c[before]\n"
2674 "call *%[test]\n"
2675 "mov %%esp, 0x00 + %c[after]\n"
2676 "mov %%ebp, 0x04 + %c[after]\n"
2677 "mov %%ebx, 0x08 + %c[after]\n"
2678 "mov %%esi, 0x0c + %c[after]\n"
2679 "mov %%edi, 0x10 + %c[after]\n"
2680 "push %[after]\n"
2681 "push %[before]\n"
2682 "push %[ret]\n"
2683 "call %c[sanity_check]\n"
2684 "pop %%ecx\n"
2685 "pop %%ecx\n"
2686 "pop %%ecx\n" :
2687 [ret] "=a" (ret) :
2688 [test] "r" (func), [before] "i" (&before), [after] "i" (&after), [sanity_check] "i" (&sanity_check) :
2689 "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"
2690 );
2691#else
2692 ret = func();
2693#endif
2694
2695#if defined(_X86_) && !defined(_PSEH3_H_) && !defined(_MSC_VER)
2696 if((_SEH2Registration_t *)__readfsdword(0) != &passthrough_frame || passthrough_frame.SER_Prev != prev_frame)
2697 {
2698 trace("exception registration list corrupted\n");
2699 ret = 0;
2700 }
2701
2702 __writefsdword(0, (unsigned long)prev_frame);
2703#endif
2704
2705 SetUnhandledExceptionFilter(prev_unhandled_exception);
2706 return ret;
2707}
2708
2709DEFINE_TEST(test_PSEH3_bug)
2710{
2711 volatile int count = 0;
2712 int dummy = 0;
2713
2714 _SEH2_TRY
2715 {
2716 if (count++ == 0)
2717 {
2718 *(volatile int*)0x12345678 = 0x12345678;
2719 }
2720 }
2722 {
2723 dummy = 0;
2724 }
2725 _SEH2_END;
2726
2727 (void)dummy;
2728 return (count == 1);
2729}
2730
2731void
2733{
2734 int i;
2735 volatile int arr[512];
2736 for (i = 0; i < 512; i++)
2737 arr[i] = 123;
2738 (void)arr;
2739}
2740
2741DEFINE_TEST(test_PSEH3_bug2)
2742{
2743 unsigned long status = 0;
2744 _SEH2_TRY
2745 {
2746 *(volatile int*)0x12345678 = 0x12345678;
2747 }
2749 {
2752 }
2753 _SEH2_END;
2754
2755 return (status == STATUS_ACCESS_VIOLATION);
2756}
2757
2758#define USE_TEST_NAME_(NAME_) # NAME_
2759#define USE_TEST_NAME(NAME_) USE_TEST_NAME_(NAME_)
2760#define USE_TEST(NAME_) { USE_TEST_NAME(NAME_), NAME_ }
2761
2763{
2764 const char * name;
2766};
2767
2769{
2770 const struct subtest testsuite[] =
2771 {
2772 USE_TEST(test_empty_1),
2773 USE_TEST(test_empty_2),
2774 USE_TEST(test_empty_3),
2775 USE_TEST(test_empty_4),
2776 USE_TEST(test_empty_5),
2777 USE_TEST(test_empty_6),
2778 USE_TEST(test_empty_7),
2779 USE_TEST(test_empty_8),
2780
2781 USE_TEST(test_execute_handler_1),
2782 USE_TEST(test_continue_execution_1),
2783 USE_TEST(test_continue_search_1),
2784 USE_TEST(test_execute_handler_2),
2785 USE_TEST(test_continue_execution_2),
2786
2787 USE_TEST(test_execute_handler_3),
2788 USE_TEST(test_continue_execution_3),
2789 USE_TEST(test_continue_search_2),
2790 USE_TEST(test_execute_handler_4),
2791 USE_TEST(test_continue_execution_4),
2792
2793 USE_TEST(test_execute_handler_5),
2794 USE_TEST(test_continue_execution_5),
2795 USE_TEST(test_continue_search_3),
2796 USE_TEST(test_execute_handler_6),
2797 USE_TEST(test_continue_execution_6),
2798
2799 USE_TEST(test_execute_handler_7),
2800 USE_TEST(test_continue_execution_7),
2801 USE_TEST(test_continue_search_4),
2802 USE_TEST(test_execute_handler_8),
2803 USE_TEST(test_continue_execution_8),
2804
2805 USE_TEST(test_execute_handler_9),
2806 USE_TEST(test_continue_execution_9),
2807 USE_TEST(test_continue_search_5),
2808 USE_TEST(test_execute_handler_10),
2809 USE_TEST(test_continue_execution_10),
2810
2811 USE_TEST(test_execute_handler_11),
2812 USE_TEST(test_continue_execution_11),
2813 USE_TEST(test_continue_search_6),
2814 USE_TEST(test_execute_handler_12),
2815 USE_TEST(test_continue_execution_12),
2816
2817 USE_TEST(test_leave_1),
2818 USE_TEST(test_leave_2),
2819 USE_TEST(test_leave_3),
2820 USE_TEST(test_leave_4),
2821 USE_TEST(test_leave_5),
2822 USE_TEST(test_leave_6),
2823
2824 USE_TEST(test_yield_1),
2825 USE_TEST(test_yield_2),
2826 USE_TEST(test_yield_3),
2827 USE_TEST(test_yield_4),
2828 USE_TEST(test_yield_5),
2829 USE_TEST(test_yield_6),
2830
2831 USE_TEST(test_finally_1),
2832 USE_TEST(test_finally_2),
2833 USE_TEST(test_finally_3),
2834 USE_TEST(test_finally_4),
2835 USE_TEST(test_finally_5),
2836 USE_TEST(test_finally_6),
2837 USE_TEST(test_finally_7),
2838 USE_TEST(test_finally_8),
2839 USE_TEST(test_finally_9),
2840 USE_TEST(test_finally_10),
2841 USE_TEST(test_finally_11),
2842 USE_TEST(test_finally_12),
2843 USE_TEST(test_finally_13),
2844 USE_TEST(test_finally_14),
2845
2846 USE_TEST(test_xpointers_1),
2847 USE_TEST(test_xpointers_2),
2848 USE_TEST(test_xpointers_3),
2849 USE_TEST(test_xpointers_4),
2850 USE_TEST(test_xpointers_5),
2851 USE_TEST(test_xpointers_6),
2852 USE_TEST(test_xpointers_7),
2853 USE_TEST(test_xpointers_8),
2854 USE_TEST(test_xpointers_9),
2855 USE_TEST(test_xpointers_10),
2856 USE_TEST(test_xpointers_11),
2857 USE_TEST(test_xpointers_12),
2858 USE_TEST(test_xpointers_13),
2859 USE_TEST(test_xpointers_14),
2860 USE_TEST(test_xpointers_15),
2861 USE_TEST(test_xpointers_16),
2862
2863 USE_TEST(test_xcode_1),
2864 USE_TEST(test_xcode_2),
2865 USE_TEST(test_xcode_3),
2866
2867 USE_TEST(test_abnorm_1),
2868 USE_TEST(test_abnorm_2),
2869 USE_TEST(test_abnorm_3),
2870 USE_TEST(test_abnorm_4),
2871 USE_TEST(test_abnorm_5),
2872 USE_TEST(test_abnorm_6),
2873 USE_TEST(test_abnorm_7),
2874 USE_TEST(test_abnorm_8),
2875
2876 USE_TEST(test_nested_locals_1),
2877 USE_TEST(test_nested_locals_2),
2878 USE_TEST(test_nested_locals_3),
2879
2880 USE_TEST(test_bug_4004),
2881 USE_TEST(test_bug_4663),
2882
2883 USE_TEST(test_unvolatile),
2884 USE_TEST(test_unvolatile_2),
2885#ifndef __cplusplus
2886 USE_TEST(test_unvolatile_3),
2887#endif
2888 USE_TEST(test_unvolatile_4),
2889 USE_TEST(test_finally_goto),
2890 USE_TEST(test_nested_exception),
2891 USE_TEST(test_PSEH3_bug),
2892 USE_TEST(test_PSEH3_bug2),
2893 };
2894
2895 size_t i;
2896
2897 for(i = 0; i < sizeof(testsuite) / sizeof(testsuite[0]); ++ i)
2898 ok(call_test(testsuite[i].func), "%s failed\n", testsuite[i].name);
2899}
2900
2901/* EOF */
static int argc
Definition: ServiceArgs.c:12
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define trace
Definition: atltest.h:70
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
#define leave
Definition: btrfs_drv.h:138
int intptr_t
Definition: crtdefs.h:304
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
@ ExceptionContinueSearch
Definition: compat.h:91
VOID WINAPI RaiseException(_In_ DWORD dwExceptionCode, _In_ DWORD dwExceptionFlags, _In_ DWORD nNumberOfArguments, _In_opt_ const ULONG_PTR *lpArguments)
Definition: except.c:700
LPTOP_LEVEL_EXCEPTION_FILTER WINAPI DECLSPEC_HOTPATCH SetUnhandledExceptionFilter(IN LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter)
Definition: except.c:790
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
#define _SEH2_LEAVE
Definition: filesup.c:20
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
GLbitfield flags
Definition: glext.h:7161
GLuint GLfloat * val
Definition: glext.h:7180
GLuint64EXT * result
Definition: glext.h:11304
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define EXCEPTION_CONTINUE_SEARCH
Definition: excpt.h:86
#define EXCEPTION_CONTINUE_EXECUTION
Definition: excpt.h:87
PPC_QUAL void __writefsdword(const unsigned long Offset, const unsigned long Data)
Definition: intrin_ppc.h:354
PPC_QUAL unsigned long __readfsdword(const unsigned long Offset)
Definition: intrin_ppc.h:382
#define d
Definition: ke_i.h:81
#define e
Definition: ke_i.h:82
#define argv
Definition: mplay32.c:18
#define DECLSPEC_NOINLINE
Definition: ntbasedef.h:225
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
long LONG
Definition: pedump.c:60
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:166
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
__asm__(".p2align 4, 0x90\n" ".seh_proc __seh2_global_filter_func\n" "__seh2_global_filter_func:\n" "\tsub %rbp, %rax\n" "\tpush %rbp\n" "\t.seh_pushreg %rbp\n" "\tsub $32, %rsp\n" "\t.seh_stackalloc 32\n" "\t.seh_endprologue\n" "\tsub %rax, %rdx\n" "\tmov %rdx, %rbp\n" "\tjmp *%r8\n" "__seh2_global_filter_func_exit:\n" "\t.p2align 4\n" "\tadd $32, %rsp\n" "\tpop %rbp\n" "\tret\n" "\t.seh_endproc")
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
int return_negative_2(void *)
Definition: psehtest2.c:77
int return_one_3(int)
Definition: psehtest2.c:113
static LONG WINAPI unhandled_exception(PEXCEPTION_POINTERS ExceptionInfo)
Definition: pseh.c:2602
static void test_bug_4004_helper_2(void)
Definition: pseh.c:2347
static int passthrough_handler(struct _EXCEPTION_RECORD *e, void *f, struct _CONTEXT *c, void *d)
Definition: pseh.c:2639
int return_positive_4(void *, int)
Definition: psehtest2.c:131
void set_positive(int *)
Definition: psehtest2.c:155
static int test_yield_5_ret
Definition: pseh.c:1047
#define DEFINE_TEST(NAME_)
Definition: pseh.c:67
int return_zero_3(int)
Definition: psehtest2.c:95
static int test_finally_9_helper(void)
Definition: pseh.c:1312
static int test_finally_9_ret
Definition: pseh.c:1310
int return_minusone_4(void *, int)
Definition: psehtest2.c:149
static int test_finally_4_helper(void)
Definition: pseh.c:1169
int return_minusone_3(int)
Definition: psehtest2.c:119
int return_positive_2(void *)
Definition: psehtest2.c:71
static int verify_xcode(int code, int xcode, int *ret, int filter)
Definition: pseh.c:1966
static DECLSPEC_NOINLINE int call_test(int(*func)(void))
Definition: pseh.c:2647
static int test_yield_1_helper(void)
Definition: pseh.c:942
static void test_finally_14_helper(void)
Definition: pseh.c:1519
int return_negative(void)
Definition: psehtest2.c:47
static int test_yield_6_helper(void)
Definition: pseh.c:1075
static int verify_xpointers(struct _EXCEPTION_POINTERS *ep, DWORD code, DWORD flags, DWORD argc, const ULONG_PTR *argv, int *ret, int filter)
Definition: pseh.c:1584
static int test_yield_4_helper(void)
Definition: pseh.c:1016
int return_negative_4(void *, int)
Definition: psehtest2.c:137
int return_zero_2(void *)
Definition: psehtest2.c:65
int return_one_2(void *)
Definition: psehtest2.c:83
static void test_bug_4004_helper_1(void)
Definition: pseh.c:2327
int return_arg(int)
Definition: psehtest2.c:24
static int test_yield_2_helper(void)
Definition: pseh.c:963
int return_zero_4(void *, int)
Definition: psehtest2.c:125
int return_positive_3(int)
Definition: psehtest2.c:101
int return_zero(void)
Definition: psehtest2.c:35
#define USE_TEST(NAME_)
Definition: pseh.c:2760
void use_lots_of_stack(void)
Definition: pseh.c:2732
static int test_finally_4_ret
Definition: pseh.c:1167
static int test_yield_3_helper(void)
Definition: pseh.c:985
static int test_finally_14_ret
Definition: pseh.c:1516
int return_one_4(void *, int)
Definition: psehtest2.c:143
static int test_yield_5_helper(void)
Definition: pseh.c:1050
static void test_finally_13_helper(void)
Definition: pseh.c:1463
void no_op(void)
Definition: psehtest2.c:30
static int test_finally_13_ret
Definition: pseh.c:1460
static DECLSPEC_NOINLINE int sanity_check(int ret, struct volatile_context *before, struct volatile_context *after)
Definition: pseh.c:2626
int return_minusone(void)
Definition: psehtest2.c:59
static int test_yield_6_ret
Definition: pseh.c:1072
int return_negative_3(int)
Definition: psehtest2.c:107
int return_minusone_2(void *)
Definition: psehtest2.c:89
int return_positive(void)
Definition: psehtest2.c:41
int return_one(void)
Definition: psehtest2.c:53
static unsigned __int64 next
Definition: rand_nt.c:6
#define test
Definition: rosglue.h:37
PEXCEPTION_RECORD ExceptionRecord
Definition: rtltypes.h:200
PCONTEXT ContextRecord
Definition: rtltypes.h:201
DWORD ExceptionCode
Definition: compat.h:208
DWORD NumberParameters
Definition: compat.h:212
DWORD ExceptionFlags
Definition: compat.h:209
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
Definition: compat.h:213
PVOID ExceptionAddress
Definition: compat.h:211
Definition: match.c:390
Definition: inflate.c:139
Definition: ps.c:97
Definition: pseh.c:2763
const char * name
Definition: pseh.c:2764
#define EXCEPTION_NONCONTINUABLE
Definition: stubs.h:23
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw edi esi edx edi
Definition: synth_sse3d.h:185
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw edi esi edx esi movl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm1 paddd mm5 psrad mm1 psrad mm5 packssdw mm1 packssdw mm5 psubd mm0 psubd mm4 psubsw mm0 psubsw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi subl esi addl edx edi decl ecx jnz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm1 psrad mm1 packssdw mm1 psubd mm0 psubsw mm0 movd eax movw edi emms popl ebx popl esi popl edi mov ebp
Definition: synth_sse3d.h:266
__inline int before(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2390
__inline int after(__u32 seq1, __u32 seq2)
Definition: tcpcore.h:2395
uint32_t ULONG_PTR
Definition: typedefs.h:65
int ret
PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
Definition: winbase.h:1453
#define WINAPI
Definition: msvc.h:6