63244df986ee1bd828ce731943dfb506f65489fe
1 /* $Id: dllmain.c,v 1.8 2001/07/12 16:28:24 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();
78 if( BlockEnvToEnviron() )
81 /* FIXME: more initializations... */
86 case DLL_THREAD_ATTACH
://2
89 case DLL_THREAD_DETACH
://4
93 case DLL_PROCESS_DETACH
://0
98 /* FIXME: more cleanup... */
100 /* destroy tls stuff */
111 void __set_app_type(int app_type
)
113 __app_type
= app_type
;
117 char **__p__acmdln(void)
122 char ***__p__environ(void)
127 char ***__p___initenv(void)
132 int *__p___mb_cur_max(void)
134 return &__mb_cur_max
;
137 unsigned int *__p__osver(void)
142 char **__p__pgmptr(void)
147 unsigned int *__p__winmajor(void)
152 unsigned int *__p__winminor(void)
157 unsigned int *__p__winver(void)