ReactOS 0.4.16-dev-2122-g1628f5e
crt_main.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <process.h>
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
Include dependency graph for crt_main.c:

Go to the source code of this file.

Functions

int __cdecl main (int argc, char **argv, char **env)
 
static const IMAGE_NT_HEADERSget_nt_header (void)
 
int __cdecl mainCRTStartup (void)
 

Function Documentation

◆ get_nt_header()

static const IMAGE_NT_HEADERS * get_nt_header ( void  )
static

Definition at line 35 of file crt_main.c.

36{
37 IMAGE_DOS_HEADER *dos = (IMAGE_DOS_HEADER *)NtCurrentTeb()->Peb->ImageBaseAddress;
38 return (const IMAGE_NT_HEADERS *)((char *)dos + dos->e_lfanew);
39}
#define NtCurrentTeb
IMAGE_DOS_HEADER dos
Definition: module.c:67

Referenced by check_pe_exe(), get_resource_section(), get_section_header(), mainCRTStartup(), read_mapped_resources(), and write_raw_resources().

◆ main()

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

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
int CDECL _kbhit(void)
Definition: console.c:474
int CDECL getchar(void)
Definition: file.c:4813
#define printf
Definition: freeldr.h:97
LONGLONG QuadPart
Definition: typedefs.h:114

◆ mainCRTStartup()

int __cdecl mainCRTStartup ( void  )

Definition at line 41 of file crt_main.c.

42{
43 int argc, ret;
44 char **argv, **env;
45
46#ifdef _UCRT
49 argc = *__p___argc();
50 argv = *__p___argv();
52#else
53 int new_mode = 0;
54 __getmainargs(&argc, &argv, &env, 0, &new_mode);
55#endif
57
58 ret = main(argc, argv, env);
59
60 exit(ret);
61 return ret;
62}
static int argc
Definition: ServiceArgs.c:12
static const IMAGE_NT_HEADERS * get_nt_header(void)
Definition: crt_main.c:35
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:171
void __getmainargs(int *argc, char ***argv, char ***envp, int expand_wildcards, int *new_mode)
Definition: data.c:579
int *CDECL __p___argc(void)
Definition: data.c:227
char ***CDECL __p___argv(void)
Definition: data.c:329
_ACRTIMP errno_t __cdecl _configure_narrow_argv(_crt_argv_mode)
@ _crt_argv_unexpanded_arguments
@ _crt_gui_app
@ _crt_console_app
_ACRTIMP int __cdecl _initialize_narrow_environment(void)
_ACRTIMP char **__cdecl _get_initial_narrow_environment(void)
#define _set_app_type
return ret
Definition: mutex.c:146
int main()
Definition: test.c:6
#define argv
Definition: mplay32.c:18
#define IMAGE_SUBSYSTEM_WINDOWS_GUI
Definition: ntimage.h:437
#define exit(n)
Definition: config.h:202