xref: /reactos/sdk/lib/crt/misc/crt_init.c (revision 2196a06f)
1 
2 #include <precomp.h>
3 
4 extern int BlockEnvToEnvironA(void);
5 extern int BlockEnvToEnvironW(void);
6 extern void FreeEnvironment(char **environment);
7 
8 extern void msvcrt_init_mt_locks(void);
9 extern void msvcrt_init_io(void);
10 
11 extern char* _acmdln;        /* pointer to ascii command line */
12 extern wchar_t* _wcmdln;     /* pointer to wide character command line */
13 #undef _environ
14 extern char** _environ;      /* pointer to environment block */
15 extern char** __initenv;     /* pointer to initial environment block */
16 extern wchar_t** _wenviron;  /* pointer to environment block */
17 extern wchar_t** __winitenv; /* pointer to initial environment block */
18 
19 BOOL
20 crt_process_init(void)
21 {
22     OSVERSIONINFOW osvi;
23 
24     /* initialize version info */
25     osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
26     GetVersionExW(&osvi);
27     _winver     = (osvi.dwMajorVersion << 8) | osvi.dwMinorVersion;
28     _winmajor   = osvi.dwMajorVersion;
29     _winminor   = osvi.dwMinorVersion;
30     _osplatform = osvi.dwPlatformId;
31     _osver      = osvi.dwBuildNumber;
32 
33     /* create tls stuff */
34     if (!msvcrt_init_tls())
35         return FALSE;
36 
37     if (BlockEnvToEnvironA() < 0)
38         return FALSE;
39 
40     if (BlockEnvToEnvironW() < 0)
41     {
42         FreeEnvironment(_environ);
43         return FALSE;
44     }
45 
46     _acmdln = _strdup(GetCommandLineA());
47     _wcmdln = _wcsdup(GetCommandLineW());
48 
49     /* Initialization of the WINE code */
50     msvcrt_init_mt_locks();
51 
52     //msvcrt_init_math();
53     msvcrt_init_io();
54     //msvcrt_init_console();
55     //msvcrt_init_args();
56     //msvcrt_init_signals();
57 
58     return TRUE;
59 }
60