libwine: Export __wine_get_main_environment on Mac OS to make sure it's reevaluated when used.

This commit is contained in:
Alexandre Julliard 2009-04-01 14:36:49 +02:00
parent c3a01b315e
commit 8edf353bd2
3 changed files with 22 additions and 4 deletions

View File

@ -56,6 +56,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(process);
WINE_DECLARE_DEBUG_CHANNEL(file);
WINE_DECLARE_DEBUG_CHANNEL(relay);
#ifdef __APPLE__
extern char **__wine_get_main_environment(void);
#define environ __wine_get_main_environment()
#else
extern char **environ;
#endif
typedef struct
{
LPSTR lpEnvAddress;
@ -267,7 +274,7 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE
*
* Build the Win32 environment from the Unix environment
*/
static BOOL build_initial_environment( char **environ )
static BOOL build_initial_environment(void)
{
SIZE_T size = 1;
char **e;
@ -989,7 +996,7 @@ void CDECL __wine_kernel_init(void)
if (!params->Environment)
{
/* Copy the parent environment */
if (!build_initial_environment( __wine_main_environ )) exit(1);
if (!build_initial_environment()) exit(1);
/* convert old configuration to new format */
convert_old_config();

View File

@ -65,7 +65,6 @@ extern int wine_dll_get_owner( const char *name, char *buffer, int size, int *fi
extern int __wine_main_argc;
extern char **__wine_main_argv;
extern WCHAR **__wine_main_wargv;
extern char **__wine_main_environ;
extern void __wine_dll_register( const IMAGE_NT_HEADERS *header, const char *filename );
extern void wine_init( int argc, char *argv[], char *error, int error_size );

View File

@ -440,6 +440,18 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr )
}
/***********************************************************************
* __wine_get_main_environment
*
* Return an environment pointer to work around lack of environ variable.
* Only exported on Mac OS.
*/
char **__wine_get_main_environment(void)
{
return environ;
}
/***********************************************************************
* __wine_dll_register
*
@ -638,7 +650,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
build_dll_path();
__wine_main_argc = argc;
__wine_main_argv = argv;
__wine_main_environ = environ;
__wine_main_environ = __wine_get_main_environment();
mmap_init();
for (path = first_dll_path( "ntdll.dll", 0, &context ); path; path = next_dll_path( &context ))