Commit 8edf353b authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent c3a01b31
...@@ -56,6 +56,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(process); ...@@ -56,6 +56,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(process);
WINE_DECLARE_DEBUG_CHANNEL(file); WINE_DECLARE_DEBUG_CHANNEL(file);
WINE_DECLARE_DEBUG_CHANNEL(relay); 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 typedef struct
{ {
LPSTR lpEnvAddress; LPSTR lpEnvAddress;
...@@ -267,7 +274,7 @@ static BOOL find_exe_file( const WCHAR *name, WCHAR *buffer, int buflen, HANDLE ...@@ -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 * 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; SIZE_T size = 1;
char **e; char **e;
...@@ -989,7 +996,7 @@ void CDECL __wine_kernel_init(void) ...@@ -989,7 +996,7 @@ void CDECL __wine_kernel_init(void)
if (!params->Environment) if (!params->Environment)
{ {
/* Copy the parent 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 configuration to new format */
convert_old_config(); convert_old_config();
......
...@@ -65,7 +65,6 @@ extern int wine_dll_get_owner( const char *name, char *buffer, int size, int *fi ...@@ -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 int __wine_main_argc;
extern char **__wine_main_argv; extern char **__wine_main_argv;
extern WCHAR **__wine_main_wargv; 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_dll_register( const IMAGE_NT_HEADERS *header, const char *filename );
extern void wine_init( int argc, char *argv[], char *error, int error_size ); extern void wine_init( int argc, char *argv[], char *error, int error_size );
......
...@@ -441,6 +441,18 @@ static void *map_dll( const IMAGE_NT_HEADERS *nt_descr ) ...@@ -441,6 +441,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 * __wine_dll_register
* *
* Register a built-in DLL descriptor. * Register a built-in DLL descriptor.
...@@ -638,7 +650,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size ) ...@@ -638,7 +650,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
build_dll_path(); build_dll_path();
__wine_main_argc = argc; __wine_main_argc = argc;
__wine_main_argv = argv; __wine_main_argv = argv;
__wine_main_environ = environ; __wine_main_environ = __wine_get_main_environment();
mmap_init(); mmap_init();
for (path = first_dll_path( "ntdll.dll", 0, &context ); path; path = next_dll_path( &context )) for (path = first_dll_path( "ntdll.dll", 0, &context ); path; path = next_dll_path( &context ))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment