mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Fixed msvcrt startup bug.
svn path=/trunk/; revision=2119
This commit is contained in:
parent
a600af1a27
commit
a305fad232
1 changed files with 16 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dllmain.c,v 1.9 2001/07/27 23:54:05 ekohl Exp $
|
/* $Id: dllmain.c,v 1.10 2001/07/29 16:42:35 ekohl Exp $
|
||||||
*
|
*
|
||||||
* ReactOS MSVCRT.DLL Compatibility Library
|
* ReactOS MSVCRT.DLL Compatibility Library
|
||||||
*/
|
*/
|
||||||
|
@ -34,28 +34,33 @@ static int envAlloced = 0;
|
||||||
|
|
||||||
int BlockEnvToEnviron()
|
int BlockEnvToEnviron()
|
||||||
{
|
{
|
||||||
char * ptr;
|
char * ptr;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!envAlloced)
|
if (!envAlloced)
|
||||||
{
|
{
|
||||||
envAlloced = 50;
|
envAlloced = 50;
|
||||||
_environ = malloc (envAlloced * sizeof (char **));
|
_environ = malloc (envAlloced * sizeof (char **));
|
||||||
if (!_environ) return -1;
|
if (_environ == NULL)
|
||||||
_environ[0] =NULL;
|
return -1;
|
||||||
|
_environ[0] = NULL;
|
||||||
}
|
}
|
||||||
ptr = (char *)GetEnvironmentStringsA();
|
ptr = (char *)GetEnvironmentStringsA();
|
||||||
if (!ptr) return -1;
|
if (!ptr)
|
||||||
for (i = 0 ; *ptr ; i++)
|
return -1;
|
||||||
|
|
||||||
|
for (i = 0 ; *ptr && (i < envAlloced) ; i++)
|
||||||
{
|
{
|
||||||
_environ[i] = ptr;
|
_environ[i] = ptr;
|
||||||
while(*ptr) ptr++;
|
while(*ptr) ptr++;
|
||||||
ptr++;
|
ptr++;
|
||||||
}
|
}
|
||||||
_environ[i] =0;
|
_environ[i] = 0;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOLEAN __stdcall
|
BOOL __stdcall
|
||||||
DllMain(PVOID hinstDll,
|
DllMain(PVOID hinstDll,
|
||||||
ULONG dwReason,
|
ULONG dwReason,
|
||||||
PVOID reserved)
|
PVOID reserved)
|
||||||
|
@ -77,8 +82,8 @@ DllMain(PVOID hinstDll,
|
||||||
_acmdln = (char *)GetCommandLineA();
|
_acmdln = (char *)GetCommandLineA();
|
||||||
|
|
||||||
/* FIXME: This crashes all applications */
|
/* FIXME: This crashes all applications */
|
||||||
// if( BlockEnvToEnviron() )
|
if (BlockEnvToEnviron() < 0)
|
||||||
// return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* FIXME: more initializations... */
|
/* FIXME: more initializations... */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue