ReactOS 0.4.15-dev-7942-gd23573b
msvcrt40.c
Go to the documentation of this file.
1/*
2 * msvcrt40 main file
3 *
4 * Copyright (C) 2007 Louis Lenders
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define WIN32_NO_STATUS
22
23#include <stdarg.h>
24//#include <stdio.h>
25#define _CRT_PRECOMP_H
26#include <internal/tls.h>
27//#include <stdlib.h>
28//#include <windows.h>
30#include <internal/locale.h>
31//#include <locale.h>
32//#include <mbctype.h>
33
34#include <wine/debug.h>
36
37/* EXTERNAL PROTOTYPES ********************************************************/
38
39extern int BlockEnvToEnvironA(void);
40extern int BlockEnvToEnvironW(void);
41extern void FreeEnvironment(char **environment);
42
43extern unsigned int _osplatform;
44extern unsigned int _osver;
45extern unsigned int _winminor;
46extern unsigned int _winmajor;
47extern unsigned int _winver;
48
49extern char* _acmdln; /* pointer to ascii command line */
50extern wchar_t* _wcmdln; /* pointer to wide character command line */
51#undef _environ
52extern char** _environ; /* pointer to environment block */
53extern char** __initenv; /* pointer to initial environment block */
54extern wchar_t** _wenviron; /* pointer to environment block */
55extern wchar_t** __winitenv; /* pointer to initial environment block */
56
57extern BOOL msvcrt_init_heap(void);
58
59/* LIBRARY ENTRY POINT ********************************************************/
60
61BOOL
64{
66 switch (dwReason)
67 {
69 /* initialize version info */
70 TRACE("Process Attach\n");
78
79 /* create tls stuff */
81 return FALSE;
82
83 if (!msvcrt_init_heap())
84 return FALSE;
85
86 if (BlockEnvToEnvironA() < 0)
87 return FALSE;
88
89 if (BlockEnvToEnvironW() < 0)
90 {
92 return FALSE;
93 }
94
97
98 /* Initialization of the WINE code */
100 //msvcrt_init_math();
102 //msvcrt_init_console();
103 //msvcrt_init_args();
104 //msvcrt_init_signals();
105 TRACE("Attach done\n");
106 break;
107
109 //msvcrt_get_thread_data creates data when first called
110 break;
111
114 break;
115
117 TRACE("Detach\n");
118 /* Deinit of the WINE code */
120 if (reserved) break;
123 //msvcrt_free_console();
124 //msvcrt_free_args();
125 //msvcrt_free_signals();
127 if (!msvcrt_free_tls())
128 return FALSE;
129 if(global_locale)
131
134 if (_wenviron)
135 FreeEnvironment((char**)_wenviron);
136
137 if (__initenv && __initenv != _environ)
139 if (_environ)
141
142 TRACE("Detach done\n");
143 break;
144 }
145
146 return TRUE;
147}
148
149/* EOF */
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD dwReason
Definition: misc.cpp:154
#define _strdup
Definition: debug_ros.c:7
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_THREAD_DETACH
Definition: compat.h:133
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
#define DLL_THREAD_ATTACH
Definition: compat.h:132
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2003
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
r reserved
Definition: btrfs.c:3006
unsigned int BOOL
Definition: ntddk_ex.h:94
MSVCRT__locale_t global_locale
Definition: locale.c:1495
if(dx< 0)
Definition: linetemp.h:194
void msvcrt_init_io(void)
Definition: file.c:456
void msvcrt_init_mt_locks(void)
Definition: lock.c:54
void __cdecl MSVCRT__free_locale(MSVCRT__locale_t)
Definition: locale.c:711
void msvcrt_free_mt_locks(void)
Definition: lock.c:77
void msvcrt_free_io(void)
Definition: file.c:1100
char * _acmdln
Definition: environ.c:18
BOOL WINAPI DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
Definition: msvcrt40.c:63
int BlockEnvToEnvironA(void)
Definition: environ.c:34
void FreeEnvironment(char **environment)
Definition: environ.c:190
unsigned int _winminor
Definition: environ.c:12
unsigned int _winmajor
Definition: environ.c:13
BOOL msvcrt_init_heap(void)
Definition: heap.c:895
char ** __initenv
Definition: environ.c:24
wchar_t ** __winitenv
Definition: environ.c:25
wchar_t ** _wenviron
Definition: environ.c:23
wchar_t * _wcmdln
Definition: environ.c:19
int BlockEnvToEnvironW(void)
Definition: environ.c:86
unsigned int _osver
Definition: environ.c:11
unsigned int _osplatform
Definition: environ.c:10
unsigned int _winver
Definition: environ.c:14
char ** _environ
Definition: environ.c:22
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
void msvcrt_free_tls_mem(void)
Definition: tls.c:51
BOOL msvcrt_free_tls(void)
Definition: tls.c:21
BOOL msvcrt_init_tls(void)
Definition: tls.c:9
void msvcrt_free_popen_data(void)
Definition: popen.c:29
#define TRACE(s)
Definition: solgame.cpp:4
ULONG dwPlatformId
Definition: rtltypes.h:241
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwMajorVersion
Definition: rtltypes.h:238
ULONG dwBuildNumber
Definition: rtltypes.h:240
ULONG dwMinorVersion
Definition: rtltypes.h:239
uint32_t ULONG
Definition: typedefs.h:59
OSVERSIONINFO osvi
Definition: ver.c:28
#define WINAPI
Definition: msvc.h:6
struct _OSVERSIONINFOW OSVERSIONINFOW