ReactOS 0.4.16-dev-1097-g530d26a
commonCRTStartup.hpp File Reference
#include <corecrt_startup.h>
#include <internal_shared.h>
#include <excpt.h>
#include <stdlib.h>
#include <intrin.h>
#include <pseh/pseh2.h>
Include dependency graph for commonCRTStartup.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FAST_FAIL_FATAL_APP_EXIT   7
 

Functions

int __cdecl main (int, char **, char **)
 
int __cdecl wmain (int, wchar_t **, wchar_t **)
 
template<typename Tmain >
static int call_main ()
 
template<>
int call_main< decltype(main)> ()
 
template<>
int call_main< decltype(wmain)> ()
 
static bool __scrt_initialize ()
 
template<typename Tmain >
static __declspec (noinline) int __cdecl __commonCRTStartup()
 

Macro Definition Documentation

◆ FAST_FAIL_FATAL_APP_EXIT

#define FAST_FAIL_FATAL_APP_EXIT   7

Definition at line 19 of file commonCRTStartup.hpp.

Function Documentation

◆ __declspec()

template<typename Tmain >
static __declspec ( noinline  )
static

Definition at line 69 of file commonCRTStartup.hpp.

70{
71 int exitCode;
72
73 if (!__scrt_initialize())
74 {
76 }
77
78 __try
79 {
80 exitCode = call_main<Tmain>();
81 }
83 {
84 exitCode = GetExceptionCode();
85 }
87
88 exit(exitCode);
89}
static bool __scrt_initialize()
#define FAST_FAIL_FATAL_APP_EXIT
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
__fastfail(FAST_FAIL_INVALID_ARG)
#define __try
Definition: pseh2_64.h:188
#define __except
Definition: pseh2_64.h:189
#define __endtry
Definition: pseh2_64.h:191
#define GetExceptionCode()
Definition: exception.h:68
#define exit(n)
Definition: config.h:202

◆ __scrt_initialize()

static bool __scrt_initialize ( )
static

Definition at line 43 of file commonCRTStartup.hpp.

44{
46
47 if (!__vcrt_initialize())
48 {
49 return false;
50 }
51
52 if (!__acrt_initialize())
53 {
55 return false;
56 }
57
58 if (_initterm_e(__xi_a, __xi_z) != 0)
59 {
60 return false;
61 }
62
64
65 return true;
66}
_ACRTIMP void __cdecl _initterm(_In_reads_(_Last - _First) _In_ _PVFV *_First, _In_ _PVFV *_Last)
_ACRTIMP int __cdecl _initterm_e(_In_reads_(_Last - _First) _PIFV *_First, _In_ _PIFV *_Last)
__crt_bool __cdecl __acrt_initialize()
_PVFV __xc_a[]
_PVFV __xc_z[]
_PIFV __xi_z[]
_PIFV __xi_a[]
__vcrt_bool __cdecl __vcrt_uninitialize(_In_ __vcrt_bool _Terminating)
Definition: __vcrt_init.c:28
int __cdecl __isa_available_init(void)
__vcrt_bool __cdecl __vcrt_initialize(void)
Definition: __vcrt_init.c:18

Referenced by __declspec().

◆ call_main()

template<typename Tmain >
static int call_main ( )
static

◆ call_main< decltype(main)>()

template<>
int call_main< decltype(main)> ( )

Definition at line 28 of file commonCRTStartup.hpp.

29{
31
33}
_ACRTIMP char **__cdecl _get_initial_narrow_environment(void)
_ACRTIMP errno_t __cdecl _configure_narrow_argv(_In_ _crt_argv_mode mode)
int main()
Definition: test.c:6
_CRTIMP char ***__cdecl __p___argv()
Definition: getargs.c:483
_CRTIMP int *__cdecl __p___argc()
Definition: getargs.c:475
@ _crt_argv_unexpanded_arguments

◆ call_main< decltype(wmain)>()

template<>
int call_main< decltype(wmain)> ( )

Definition at line 36 of file commonCRTStartup.hpp.

37{
39
41}
_ACRTIMP wchar_t **__cdecl _get_initial_wide_environment(void)
_ACRTIMP errno_t __cdecl _configure_wide_argv(_In_ _crt_argv_mode mode)
_CRTIMP wchar_t ***__cdecl __p___wargv()
Definition: getargs.c:491
int wmain()

◆ main()

int __cdecl main ( int  argc,
char **  argv,
char **  environ 
)

Definition at line 5 of file TestTimer.c.

6{
7 LARGE_INTEGER liFrequency;
8 LARGE_INTEGER liStartTime;
9 LARGE_INTEGER liCurrentTime;
10
11 QueryPerformanceFrequency ( &liFrequency );
12 printf ( "HIGH RESOLUTION PERFOMANCE COUNTER Frequency = %I64d CLOCKS IN SECOND\n",
13 liFrequency.QuadPart );
14
15
16 if (liFrequency.QuadPart == 0)
17 {
18 printf("Your computer does not support High Resolution Performance counter\n");
19 return;
20 }
21
22 printf ( "Press <ENTER> to start test...\n" );
23 getchar();
24
25 printf ( "\nPress any key to quit test\n\n" );
26 QueryPerformanceCounter ( &liStartTime );
27 for (;;)
28 {
29 QueryPerformanceCounter ( &liCurrentTime );
30 printf("Elapsed Time : %8.6f mSec\r",
31 ((double)( (liCurrentTime.QuadPart - liStartTime.QuadPart)* (double)1000.0/(double)liFrequency.QuadPart )) );
32 if (_kbhit())
33 break;
34 }
35
36
37}
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
#define printf
Definition: freeldr.h:97
_Check_return_ _CRTIMP int __cdecl getchar(void)
Definition: file.c:3629
_CRTIMP int __cdecl _kbhit(void)
Definition: kbhit.c:21
LONGLONG QuadPart
Definition: typedefs.h:114

◆ wmain()

int __cdecl wmain ( int  ,
wchar_t **  ,
wchar_t **   
)