ReactOS 0.4.15-dev-7924-g5949c20
internal.h File Reference
#include <crtdefs.h>
#include <stdarg.h>
#include <limits.h>
#include <windef.h>
#include <winbase.h>
#include <crtdbg.h>
#include <errno.h>
Include dependency graph for internal.h:

Go to the source code of this file.

Classes

struct  ioinfo
 
struct  _iobuf
 
struct  _startupinfo
 

Macros

#define __INTERNAL_FUNC_DEFINED
 
#define __IOINFO_TM_ANSI   0
 
#define __IOINFO_TM_UTF8   1
 
#define __IOINFO_TM_UTF16LE   2
 
#define IOINFO_ARRAY_ELTS   (1 << 5)
 
#define _pioinfo(i)   (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))
 
#define _osfile(i)   (_pioinfo(i)->osfile)
 
#define _pipech2(i)   (_pioinfo(i)->pipech2)
 
#define _textmode(i)   (_pioinfo(i)->textmode)
 
#define _tm_unicode(i)   (_pioinfo(i)->unicode)
 
#define _pioinfo_safe(i)   ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo)
 
#define _osfhnd_safe(i)   (_pioinfo_safe(i)->osfhnd)
 
#define _osfile_safe(i)   (_pioinfo_safe(i)->osfile)
 
#define _pipech_safe(i)   (_pioinfo_safe(i)->pipech)
 
#define _pipech2_safe(i)   (_pioinfo_safe(i)->pipech2)
 
#define _textmode_safe(i)   (_pioinfo_safe(i)->textmode)
 
#define _tm_unicode_safe(i)   (_pioinfo_safe(i)->unicode)
 
#define _NO_CONSOLE_FILENO   (intptr_t)-2
 
#define _FILE_DEFINED
 
#define _STARTUP_INFO_DEFINED
 
#define _CONSOLE_APP   1
 
#define _GUI_APP   2
 

Typedefs

typedef void(__cdecl_PVFV) (void)
 
typedef int(__cdecl_PIFV) (void)
 
typedef void(__cdecl_PVFI) (int)
 
typedef struct _iobuf FILE
 
typedef enum __enative_startup_state __enative_startup_state
 
typedef LONG NTSTATUS
 

Enumerations

enum  __enative_startup_state { __uninitialized = 0 , __initializing , __initialized }
 

Functions

_CRTIMP __declspec (noreturn) void __cdecl _amsg_exit(int)
 
int __CRTDECL _setargv (void)
 
int __CRTDECL __setargv (void)
 
int __CRTDECL _wsetargv (void)
 
int __CRTDECL __wsetargv (void)
 
int __CRTDECL main (int _Argc, char **_Argv, char **_Env)
 
int __CRTDECL wmain (int _Argc, wchar_t **_Argv, wchar_t **_Env)
 
_CRTIMP int __cdecl __getmainargs (int *_Argc, char ***_Argv, char ***_Env, int _DoWildCard, _startupinfo *_StartInfo)
 
_CRTIMP int __cdecl __wgetmainargs (int *_Argc, wchar_t ***_Argv, wchar_t ***_Env, int _DoWildCard, _startupinfo *_StartInfo)
 
_CRTIMP void __cdecl __set_app_type (int)
 
void *__cdecl _encode_pointer (void *)
 
void *__cdecl _encoded_null ()
 
void *__cdecl _decode_pointer (void *)
 
BOOL __cdecl _ValidateImageBase (PBYTE pImageBase)
 
PIMAGE_SECTION_HEADER __cdecl _FindPESection (PBYTE pImageBase, DWORD_PTR rva)
 
BOOL __cdecl _IsNonwritableInCurrentImage (PBYTE pTarget)
 

Variables

_CRTIMP int _commode
 
_CRTIMP ioinfo__badioinfo []
 
_CRTIMP ioinfo ** __pioinfo []
 
int _dowildcard
 
int _newmode
 
_CRTIMP wchar_t ** __winitenv
 
_CRTIMP char ** __initenv
 
_CRTIMP char_acmdln
 
_CRTIMP char_wcmdln
 
volatile __enative_startup_state __native_startup_state
 
volatile void__native_startup_lock
 
volatile unsigned int __native_dllmain_reason
 
volatile unsigned int __native_vcclrit_reason
 

Macro Definition Documentation

◆ __INTERNAL_FUNC_DEFINED

#define __INTERNAL_FUNC_DEFINED

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 32 of file internal.h.

◆ __IOINFO_TM_ANSI

#define __IOINFO_TM_ANSI   0

Definition at line 44 of file internal.h.

◆ __IOINFO_TM_UTF16LE

#define __IOINFO_TM_UTF16LE   2

Definition at line 46 of file internal.h.

◆ __IOINFO_TM_UTF8

#define __IOINFO_TM_UTF8   1

Definition at line 45 of file internal.h.

◆ _CONSOLE_APP

#define _CONSOLE_APP   1

Definition at line 145 of file internal.h.

◆ _FILE_DEFINED

#define _FILE_DEFINED

Definition at line 95 of file internal.h.

◆ _GUI_APP

#define _GUI_APP   2

Definition at line 146 of file internal.h.

◆ _NO_CONSOLE_FILENO

#define _NO_CONSOLE_FILENO   (intptr_t)-2

Definition at line 92 of file internal.h.

◆ _osfhnd_safe

#define _osfhnd_safe (   i)    (_pioinfo_safe(i)->osfhnd)

Definition at line 77 of file internal.h.

◆ _osfile

#define _osfile (   i)    (_pioinfo(i)->osfile)

Definition at line 72 of file internal.h.

◆ _osfile_safe

#define _osfile_safe (   i)    (_pioinfo_safe(i)->osfile)

Definition at line 78 of file internal.h.

◆ _pioinfo

#define _pioinfo (   i)    (__pioinfo[(i) >> 5] + ((i) & (IOINFO_ARRAY_ELTS - 1)))

Definition at line 71 of file internal.h.

◆ _pioinfo_safe

#define _pioinfo_safe (   i)    ((((i) != -1) && ((i) != -2)) ? _pioinfo(i) : &__badioinfo)

Definition at line 76 of file internal.h.

◆ _pipech2

#define _pipech2 (   i)    (_pioinfo(i)->pipech2)

Definition at line 73 of file internal.h.

◆ _pipech2_safe

#define _pipech2_safe (   i)    (_pioinfo_safe(i)->pipech2)

Definition at line 80 of file internal.h.

◆ _pipech_safe

#define _pipech_safe (   i)    (_pioinfo_safe(i)->pipech)

Definition at line 79 of file internal.h.

◆ _STARTUP_INFO_DEFINED

#define _STARTUP_INFO_DEFINED

Definition at line 136 of file internal.h.

◆ _textmode

#define _textmode (   i)    (_pioinfo(i)->textmode)

Definition at line 74 of file internal.h.

◆ _textmode_safe

#define _textmode_safe (   i)    (_pioinfo_safe(i)->textmode)

Definition at line 81 of file internal.h.

◆ _tm_unicode

#define _tm_unicode (   i)    (_pioinfo(i)->unicode)

Definition at line 75 of file internal.h.

◆ _tm_unicode_safe

#define _tm_unicode_safe (   i)    (_pioinfo_safe(i)->unicode)

Definition at line 82 of file internal.h.

◆ IOINFO_ARRAY_ELTS

#define IOINFO_ARRAY_ELTS   (1 << 5)

Definition at line 69 of file internal.h.

Typedef Documentation

◆ __enative_startup_state

◆ _PIFV

typedef int(__cdecl * _PIFV) (void)

Definition at line 34 of file internal.h.

◆ _PVFI

typedef void(__cdecl * _PVFI) (int)

Definition at line 35 of file internal.h.

◆ _PVFV

typedef void(__cdecl * _PVFV) (void)

Definition at line 33 of file internal.h.

◆ FILE

typedef struct _iobuf FILE

Definition at line 106 of file internal.h.

◆ NTSTATUS

typedef LONG NTSTATUS

Definition at line 160 of file internal.h.

Enumeration Type Documentation

◆ __enative_startup_state

Enumerator
__uninitialized 
__initializing 
__initialized 

Definition at line 148 of file internal.h.

148 {
__enative_startup_state
Definition: internal.h:148
@ __uninitialized
Definition: internal.h:149
@ __initialized
Definition: internal.h:149
@ __initializing
Definition: internal.h:149

Function Documentation

◆ __declspec()

_CRTIMP __declspec ( noreturn  )

Definition at line 19 of file noreturn.cpp.

21{
22 throw 1;
23}

◆ __getmainargs()

_CRTIMP int __cdecl __getmainargs ( int _Argc,
char ***  _Argv,
char ***  _Env,
int  _DoWildCard,
_startupinfo _StartInfo 
)

◆ __set_app_type()

_CRTIMP void __cdecl __set_app_type ( int  app_type)

Definition at line 360 of file environ.c.

361{
362 __app_type = app_type;
363}
int __app_type
Definition: environ.c:30

◆ __setargv()

int __CRTDECL __setargv ( void  )

Definition at line 20 of file dll_argv.c.

22{
23 _dowildcard = 1;
24 return 0;
25}
int _dowildcard
Definition: wildcard.c:32

◆ __wgetmainargs()

_CRTIMP int __cdecl __wgetmainargs ( int _Argc,
wchar_t ***  _Argv,
wchar_t ***  _Env,
int  _DoWildCard,
_startupinfo _StartInfo 
)

◆ __wsetargv()

int __CRTDECL __wsetargv ( void  )

◆ _decode_pointer()

void *__cdecl _decode_pointer ( void codedptr)

Definition at line 19 of file mingw_helpers.c.

20{
21 return (void *) codedptr;
22}

Referenced by __call_atexit(), and _onexit().

◆ _encode_pointer()

void *__cdecl _encode_pointer ( void ptr)

Definition at line 25 of file mingw_helpers.c.

26{
27 return ptr;
28}
static PVOID ptr
Definition: dispmode.c:27

Referenced by _onexit().

◆ _encoded_null()

void *__cdecl _encoded_null ( )

◆ _FindPESection()

PIMAGE_SECTION_HEADER _FindPESection ( PBYTE  pImageBase,
DWORD_PTR  rva 
)

Definition at line 48 of file pesect.c.

49{
50 PIMAGE_NT_HEADERS pNTHeader;
51 PIMAGE_SECTION_HEADER pSection;
52 unsigned int iSection;
53
54 pNTHeader = (PIMAGE_NT_HEADERS) (pImageBase + ((PIMAGE_DOS_HEADER) pImageBase)->e_lfanew);
55
56 for (iSection = 0, pSection = IMAGE_FIRST_SECTION (pNTHeader);
57 iSection < pNTHeader->FileHeader.NumberOfSections;
58 ++iSection,++pSection)
59 {
60 if (rva >= pSection->VirtualAddress
61 && rva < pSection->VirtualAddress + pSection->Misc.VirtualSize)
62 return pSection;
63 }
64 return NULL;
65}
#define NULL
Definition: types.h:112
PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
Definition: ntddk_ex.h:187
#define IMAGE_FIRST_SECTION(NtHeader)
Definition: ntimage.h:427
IMAGE_FILE_HEADER FileHeader
Definition: ntddk_ex.h:183
union _IMAGE_SECTION_HEADER::@1556 Misc
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress

Referenced by __mingw_enum_import_library_names(), __mingw_GetSectionForAddress(), and _IsNonwritableInCurrentImage().

◆ _IsNonwritableInCurrentImage()

WINBOOL _IsNonwritableInCurrentImage ( PBYTE  pTarget)

Definition at line 175 of file pesect.c.

176{
177 PBYTE pImageBase;
178 DWORD_PTR rvaTarget;
179 PIMAGE_SECTION_HEADER pSection;
180
181 pImageBase = (PBYTE) &__ImageBase;
182 if (! _ValidateImageBase (pImageBase))
183 return FALSE;
184 rvaTarget = pTarget - pImageBase;
185 pSection = _FindPESection (pImageBase, rvaTarget);
186 if (pSection == NULL)
187 return FALSE;
188 return (pSection->Characteristics & IMAGE_SCN_MEM_WRITE) == 0;
189}
#define FALSE
Definition: types.h:117
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
#define IMAGE_SCN_MEM_WRITE
Definition: ntimage.h:241
BYTE * PBYTE
Definition: pedump.c:66
WINBOOL _ValidateImageBase(PBYTE)
Definition: pesect.c:27
PIMAGE_SECTION_HEADER _FindPESection(PBYTE, DWORD_PTR)
Definition: pesect.c:48
IMAGE_DOS_HEADER __ImageBase
uint32_t DWORD_PTR
Definition: typedefs.h:65

◆ _setargv()

int __CRTDECL _setargv ( void  )

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 18 of file dllargv.c.

20{
21 return 0;
22}

◆ _ValidateImageBase()

WINBOOL _ValidateImageBase ( PBYTE  pImageBase)

Definition at line 27 of file pesect.c.

28{
29 PIMAGE_DOS_HEADER pDOSHeader;
30 PIMAGE_NT_HEADERS pNTHeader;
31 PIMAGE_OPTIONAL_HEADER pOptHeader;
32
33 pDOSHeader = (PIMAGE_DOS_HEADER) pImageBase;
34 if (pDOSHeader->e_magic != IMAGE_DOS_SIGNATURE)
35 return FALSE;
36 pNTHeader = (PIMAGE_NT_HEADERS) ((PBYTE) pDOSHeader + pDOSHeader->e_lfanew);
37 if (pNTHeader->Signature != IMAGE_NT_SIGNATURE)
38 return FALSE;
39 pOptHeader = (PIMAGE_OPTIONAL_HEADER) &pNTHeader->OptionalHeader;
40 if (pOptHeader->Magic != IMAGE_NT_OPTIONAL_HDR_MAGIC)
41 return FALSE;
42 return TRUE;
43}
#define TRUE
Definition: types.h:120
struct _IMAGE_DOS_HEADER * PIMAGE_DOS_HEADER
if(dx< 0)
Definition: linetemp.h:194
#define IMAGE_NT_OPTIONAL_HDR_MAGIC
Definition: ntimage.h:387
#define IMAGE_NT_SIGNATURE
Definition: pedump.c:93
struct _IMAGE_OPTIONAL_HEADER * PIMAGE_OPTIONAL_HEADER
#define IMAGE_DOS_SIGNATURE
Definition: pedump.c:89
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184

Referenced by __mingw_enum_import_library_names(), __mingw_GetSectionCount(), __mingw_GetSectionForAddress(), _FindPESectionByName(), _FindPESectionExec(), _GetPEImageBase(), and _IsNonwritableInCurrentImage().

◆ _wsetargv()

int __CRTDECL _wsetargv ( void  )

◆ main()

int __CRTDECL 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
#define printf
Definition: freeldr.h:93
_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 __CRTDECL wmain ( int  _Argc,
wchar_t **  _Argv,
wchar_t **  _Env 
)

Variable Documentation

◆ __badioinfo

◆ __initenv

_CRTIMP char** __initenv
extern

Definition at line 24 of file environ.c.

◆ __native_dllmain_reason

volatile unsigned int __native_dllmain_reason
extern

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 11 of file natstart.c.

◆ __native_startup_lock

volatile void* __native_startup_lock
extern

Definition at line 14 of file natstart.c.

◆ __native_startup_state

volatile __enative_startup_state __native_startup_state
extern

Definition at line 13 of file natstart.c.

◆ __native_vcclrit_reason

volatile unsigned int __native_vcclrit_reason
extern

Definition at line 12 of file natstart.c.

◆ __pioinfo

_CRTIMP ioinfo** __pioinfo[]
extern

Definition at line 121 of file file.c.

◆ __winitenv

_CRTIMP wchar_t** __winitenv
extern

Definition at line 25 of file environ.c.

◆ _acmdln

_CRTIMP char* _acmdln
extern

Definition at line 18 of file environ.c.

◆ _commode

_CRTIMP int _commode
extern

Definition at line 31 of file environ.c.

◆ _dowildcard

int _dowildcard
extern

Definition at line 32 of file wildcard.c.

◆ _newmode

int _newmode
extern

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 7 of file _newmode.c.

◆ _wcmdln

_CRTIMP char* _wcmdln
extern

Definition at line 19 of file environ.c.