-
Notifications
You must be signed in to change notification settings - Fork 3
/
wmain.cpp
71 lines (60 loc) · 2.04 KB
/
wmain.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* This file is a part of the source code of "byenow" program.
*
* Copyright (c) 2020- Alexander Pankratov and IO Bureau SA.
* All rights reserved.
*
* The source code is distributed under the terms of 2-clause
* BSD license with the Commons Clause condition. See LICENSE
* file for details.
*/
#include "libp/_windows.h"
#include "libp/enforce.h"
/*
*
*/
#define __try_cpp_exceptions__ try
#define __catch_cpp_exceptions__ catch ( std::exception & ) { printf("\nWhoops - std::exception\n"); }
//
#define __try_seh_exceptions__ __try
#define __catch_seh_exceptions__ __except ( EXCEPTION_EXECUTE_HANDLER ) { printf("\nWhoops - seh::exception\n"); }
//
void on_assert(const char * exp, const char * file, const char * func, int line)
{
printf("\nWhoops - assertion failed - line %d\n", line);
exit(1);
}
/*
*
*/
int wmain_app(int argc, wchar_t ** argv);
int wmain_seh(int argc, wchar_t ** argv)
{
int r = 3; // RC_whoops_seh
__try_seh_exceptions__
{
r = wmain_app(argc, argv);
}
__catch_seh_exceptions__
return r;
}
int wmain(int argc, wchar_t ** argv)
{
int r = 4; // RC_whoops_cpp
__try_cpp_exceptions__
{
r = wmain_seh(argc, argv);
}
__catch_cpp_exceptions__
return r;
}
//
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif