ReactOS  0.4.15-dev-4594-g505ac65
dllmain.c File Reference
#include "precomp.h"
Include dependency graph for dllmain.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msvcrt)
 
BOOL crt_process_init (void)
 
void FreeEnvironment (char **environment)
 
BOOL WINAPI DllMain (PVOID hinstDll, ULONG dwReason, PVOID reserved)
 

Variables

char ** _environ
 
char ** __initenv
 
wchar_t ** _wenviron
 
wchar_t ** __winitenv
 

Function Documentation

◆ crt_process_init()

BOOL crt_process_init ( void  )

Definition at line 20 of file crt_init.c.

21 {
23 
24  /* initialize version info */
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  {
43  return FALSE;
44  }
45 
48 
49  /* Initialization of the WINE code */
51 
52  //msvcrt_init_math();
54  //msvcrt_init_console();
55  //msvcrt_init_args();
56  //msvcrt_init_signals();
57 
58  return TRUE;
59 }
ULONG dwMajorVersion
Definition: rtltypes.h:238
int BlockEnvToEnvironA(void)
Definition: environ.c:34
OSVERSIONINFO osvi
Definition: ver.c:28
#define TRUE
Definition: types.h:120
void msvcrt_init_mt_locks(void)
Definition: lock.c:54
unsigned int _winminor
Definition: environ.c:12
if(dx==0 &&dy==0)
Definition: linetemp.h:174
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
Definition: version.c:37
#define _strdup
Definition: debug_ros.c:7
wchar_t * _wcmdln
Definition: environ.c:19
#define FALSE
Definition: types.h:117
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2014
int BlockEnvToEnvironW(void)
Definition: environ.c:86
void FreeEnvironment(char **environment)
Definition: environ.c:190
ULONG dwOSVersionInfoSize
Definition: rtltypes.h:237
ULONG dwBuildNumber
Definition: rtltypes.h:240
void msvcrt_init_io(void)
Definition: file.c:456
BOOL msvcrt_init_tls(void)
Definition: tls.c:9
unsigned int _osplatform
Definition: environ.c:10
struct _OSVERSIONINFOW OSVERSIONINFOW
LPSTR WINAPI GetCommandLineA(VOID)
Definition: proc.c:2004
ULONG dwMinorVersion
Definition: rtltypes.h:239
unsigned int _osver
Definition: environ.c:11
ULONG dwPlatformId
Definition: rtltypes.h:241
unsigned int _winmajor
Definition: environ.c:13
unsigned int _winver
Definition: environ.c:14
char * _acmdln
Definition: environ.c:18
_Check_return_ _CRTIMP wchar_t *__cdecl _wcsdup(_In_z_ const wchar_t *_Str)
char ** _environ
Definition: environ.c:22

◆ DllMain()

BOOL WINAPI DllMain ( PVOID  hinstDll,
ULONG  dwReason,
PVOID  reserved 
)

Definition at line 38 of file dllmain.c.

39 {
40  switch (dwReason)
41  {
42  case DLL_PROCESS_ATTACH:
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 
55  case DLL_THREAD_ATTACH:
56  //msvcrt_get_thread_data creates data when first called
57  break;
58 
59  case DLL_THREAD_DETACH:
61  break;
62 
63  case DLL_PROCESS_DETACH:
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;
76  if(global_locale)
78 
80  FreeEnvironment((char**)__winitenv);
81  if (_wenviron)
82  FreeEnvironment((char**)_wenviron);
83 
84  if (__initenv && __initenv != _environ)
86  if (_environ)
88 
89  TRACE("Detach done\n");
90  break;
91  }
92 
93  return TRUE;
94 }
void msvcrt_free_io(void)
Definition: file.c:1100
wchar_t ** _wenviron
Definition: environ.c:23
#define TRUE
Definition: types.h:120
#define DLL_THREAD_ATTACH
Definition: compat.h:132
void msvcrt_free_tls_mem(void)
Definition: tls.c:51
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
BOOL crt_process_init(void)
Definition: crt_init.c:20
#define DLL_THREAD_DETACH
Definition: compat.h:133
wchar_t ** __winitenv
Definition: environ.c:25
void msvcrt_free_popen_data(void)
Definition: popen.c:29
BOOL msvcrt_free_tls(void)
Definition: tls.c:21
DWORD dwReason
Definition: misc.cpp:154
char ** _environ
Definition: environ.c:22
#define FALSE
Definition: types.h:117
r reserved
Definition: btrfs.c:2975
#define DLL_PROCESS_DETACH
Definition: compat.h:130
void msvcrt_free_mt_locks(void)
Definition: lock.c:77
#define TRACE(s)
Definition: solgame.cpp:4
MSVCRT__locale_t global_locale
Definition: locale.c:1495
char ** __initenv
Definition: environ.c:24
void FreeEnvironment(char **environment)
Definition: environ.c:190
#define ERR(fmt,...)
Definition: debug.h:110
void __cdecl MSVCRT__free_locale(MSVCRT__locale_t)
Definition: locale.c:711

◆ FreeEnvironment()

void FreeEnvironment ( char **  environment)

Internal function to deallocate environment block. Although it's parameter are defined as char**, it's able to work also with wide character environment block which are of type wchar_t**.

Parameters
environmentEnvironment to free.

Definition at line 190 of file environ.c.

191 {
192  char **envptr;
193  for (envptr = environment; *envptr != NULL; envptr++)
194  free(*envptr);
195  free(environment);
196 }
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msvcrt  )

Variable Documentation

◆ __initenv

char** __initenv

Definition at line 24 of file environ.c.

◆ __winitenv

wchar_t** __winitenv

Definition at line 25 of file environ.c.

◆ _environ

char** _environ

Definition at line 22 of file environ.c.

◆ _wenviron

wchar_t** _wenviron

Definition at line 23 of file environ.c.