1 /* $Id: dllmain.c,v 1.9 2001/07/27 23:54:05 ekohl Exp $
3 * ReactOS MSVCRT.DLL Compatibility Library
7 #include <msvcrt/internal/tls.h>
8 #include <msvcrt/stdlib.h>
10 static int nAttachCount
= 0;
12 unsigned int _osver
= 0;
13 unsigned int _winminor
= 0;
14 unsigned int _winmajor
= 0;
15 unsigned int _winver
= 0;
17 char *_acmdln
= NULL
; /* pointer to ascii command line */
19 char **_environ
= NULL
; /* pointer to environment block */
20 char ***_environ_dll
= &_environ
;/* pointer to environment block */
22 char **__initenv
= NULL
;
24 char *_pgmptr
= NULL
; /* pointer to program name */
26 int __app_type
= 0; //_UNKNOWN_APP; /* application type */
30 static int envAlloced
= 0;
33 /* FUNCTIONS **************************************************************/
35 int BlockEnvToEnviron()
42 _environ
= malloc (envAlloced
* sizeof (char **));
43 if (!_environ
) return -1;
46 ptr
= (char *)GetEnvironmentStringsA();
48 for (i
= 0 ; *ptr
; i
++)
59 DllMain(PVOID hinstDll
,
65 case DLL_PROCESS_ATTACH
://1
66 /* initialize version info */
67 _osver
= GetVersion();
68 _winmajor
= (_osver
>> 8) & 0xFF;
69 _winminor
= _osver
& 0xFF;
70 _winver
= (_winmajor
<< 8) + _winminor
;
71 _osver
= (_osver
>> 16) & 0xFFFF;
73 /* create tls stuff */
74 if (!CreateThreadData())
77 _acmdln
= (char *)GetCommandLineA();
79 /* FIXME: This crashes all applications */
80 // if( BlockEnvToEnviron() )
83 /* FIXME: more initializations... */
88 case DLL_THREAD_ATTACH
://2
91 case DLL_THREAD_DETACH
://4
95 case DLL_PROCESS_DETACH
://0
100 /* FIXME: more cleanup... */
102 /* destroy tls stuff */
113 void __set_app_type(int app_type
)
115 __app_type
= app_type
;
119 char **__p__acmdln(void)
124 char ***__p__environ(void)
129 char ***__p___initenv(void)
134 int *__p___mb_cur_max(void)
136 return &__mb_cur_max
;
139 unsigned int *__p__osver(void)
144 char **__p__pgmptr(void)
149 unsigned int *__p__winmajor(void)
154 unsigned int *__p__winminor(void)
159 unsigned int *__p__winver(void)