Use the normal environment routines to build the env db of the initial

process.
This commit is contained in:
Alexandre Julliard 1999-06-11 18:33:46 +00:00
parent 039aa42373
commit 1aa2641636
3 changed files with 8 additions and 37 deletions

View File

@ -147,7 +147,6 @@ extern DWORD WINAPI GetProcessDword( DWORD dwProcessID, INT offset );
void WINAPI SetProcessDword( DWORD dwProcessID, INT offset, DWORD value );
/* scheduler/environ.c */
extern BOOL ENV_BuildEnvironment( PDB *pdb );
extern BOOL ENV_InheritEnvironment( PDB *pdb, LPCSTR env );
extern void ENV_FreeEnvironment( PDB *pdb );

View File

@ -65,7 +65,7 @@ static LPCSTR ENV_FindVariable( LPCSTR env, LPCSTR name, INT len )
*
* Build the environment for the initial process
*/
BOOL ENV_BuildEnvironment( PDB *pdb )
static BOOL ENV_BuildEnvironment( PDB *pdb )
{
extern char **environ;
LPSTR p, *e;
@ -109,7 +109,12 @@ BOOL ENV_InheritEnvironment( PDB *pdb, LPCSTR env )
LPSTR dst;
/* FIXME: should lock the parent environment */
if (!env) env = pdb->parent->env_db->environ;
if (!env)
{
if (!pdb->parent) /* initial process */
return ENV_BuildEnvironment( pdb );
env = pdb->parent->env_db->environ;
}
/* Compute the environment size */

View File

@ -229,39 +229,6 @@ void PROCESS_CallUserSignalProc( UINT uCode, HMODULE hModule )
}
/***********************************************************************
* PROCESS_BuildEnvDB
*
* Build the env DB for the initial process
*/
static BOOL PROCESS_BuildEnvDB( PDB *pdb )
{
/* Allocate the env DB (FIXME: should not be on the system heap) */
if (!(pdb->env_db = HeapAlloc(SystemHeap,HEAP_ZERO_MEMORY,sizeof(ENVDB))))
return FALSE;
InitializeCriticalSection( &pdb->env_db->section );
/* Allocate startup info */
if (!(pdb->env_db->startup_info =
HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, sizeof(STARTUPINFOA) )))
return FALSE;
/* Allocate the standard handles */
pdb->env_db->hStdin = FILE_DupUnixHandle( 0, GENERIC_READ );
pdb->env_db->hStdout = FILE_DupUnixHandle( 1, GENERIC_WRITE );
pdb->env_db->hStderr = FILE_DupUnixHandle( 2, GENERIC_WRITE );
/* Build the command-line */
pdb->env_db->cmd_line = HEAP_strdupA( SystemHeap, 0, "kernel32" );
/* Build the environment strings */
return ENV_BuildEnvironment( pdb );
}
/***********************************************************************
* PROCESS_CreateEnvDB
*
@ -391,7 +358,7 @@ BOOL PROCESS_Init(void)
initial_pdb.system_heap = initial_pdb.heap = SystemHeap;
/* Create the environment DB of the first process */
if (!PROCESS_BuildEnvDB( &initial_pdb )) return FALSE;
if (!PROCESS_CreateEnvDB()) return FALSE;
/* Create the SEGPTR heap */
if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;