ReactOS 0.4.15-dev-7098-ge0c17c3
dllmain.c
Go to the documentation of this file.
1/*
2 * dllmain.c
3 *
4 * ReactOS MSVCRT.DLL Compatibility Library
5 *
6 * THIS SOFTWARE IS NOT COPYRIGHTED
7 *
8 * This source code is offered for use in the public domain. You may
9 * use, modify or distribute it freely.
10 *
11 * This code is distributed in the hope that it will be useful but
12 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
13 * DISCLAMED. This includes but is not limited to warranties of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 *
16 */
17
18#include "precomp.h"
19
21
22/* EXTERNAL PROTOTYPES ********************************************************/
23
25
26extern void FreeEnvironment(char **environment);
27
28#undef _environ
29extern char** _environ; /* pointer to environment block */
30extern char** __initenv; /* pointer to initial environment block */
31extern wchar_t** _wenviron; /* pointer to environment block */
32extern wchar_t** __winitenv; /* pointer to initial environment block */
33
34/* LIBRARY ENTRY POINT ********************************************************/
35
36BOOL
39{
40 switch (dwReason)
41 {
43
44 TRACE("Process Attach\n");
45
46 if (!crt_process_init())
47 {
48 ERR("crt_init() failed!\n");
49 return FALSE;
50 }
51
52 TRACE("Attach done\n");
53 break;
54
56 //msvcrt_get_thread_data creates data when first called
57 break;
58
61 break;
62
64 TRACE("Detach\n");
65 /* Deinit of the WINE code */
67 if (reserved) break;
70 //msvcrt_free_console();
71 //msvcrt_free_args();
72 //msvcrt_free_signals();
74 if (!msvcrt_free_tls())
75 return FALSE;
78
81 if (_wenviron)
83
86 if (_environ)
88
89 TRACE("Detach done\n");
90 break;
91 }
92
93 return TRUE;
94}
95
96/* FIXME: This hack is required to prevent the VC linker from linking these
97 exports to the functions from libntdll. See CORE-10753 */
98#ifdef _MSC_VER
99#ifdef _M_IX86
100#pragma comment(linker, "/include:__vsnprintf")
101#pragma comment(linker, "/include:_bsearch")
102#pragma comment(linker, "/include:_strcspn")
103#else
104#pragma comment(linker, "/include:_vsnprintf")
105#pragma comment(linker, "/include:bsearch")
106#pragma comment(linker, "/include:strcspn")
107#endif // _M_IX86
108#endif // _MSC_VER
109
110/* EOF */
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
DWORD dwReason
Definition: misc.cpp:154
#define ERR(fmt,...)
Definition: debug.h:110
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved)
Definition: dllmain.c:52
void FreeEnvironment(char **environment)
Definition: environ.c:190
char ** __initenv
Definition: environ.c:24
wchar_t ** __winitenv
Definition: environ.c:25
wchar_t ** _wenviron
Definition: environ.c:23
BOOL crt_process_init(void)
Definition: crt_init.c:21
char ** _environ
Definition: environ.c:22
#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
r reserved
Definition: btrfs.c:3006
unsigned int BOOL
Definition: ntddk_ex.h:94
MSVCRT__locale_t global_locale
Definition: locale.c:1495
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
void msvcrt_free_popen_data(void)
Definition: popen.c:29
#define TRACE(s)
Definition: solgame.cpp:4
void msvcrt_free_tls_mem(void)
Definition: tls.c:51
BOOL msvcrt_free_tls(void)
Definition: tls.c:21
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6