Module: wine Branch: master Commit: 8edf353bd2b03994357f7e3e1191a8c8ff71c12d URL: http://source.winehq.org/git/wine.git/?a=commit;h=8edf353bd2b03994357f7e3e11...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Apr 1 14:36:49 2009 +0200
libwine: Export __wine_get_main_environment on Mac OS to make sure it's reevaluated when used.
---
dlls/kernel32/process.c | 11 +++++++++-- include/wine/library.h | 1 - libs/wine/loader.c | 14 +++++++++++++- 3 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index f2d8567..0dd7f67 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -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(); diff --git a/include/wine/library.h b/include/wine/library.h index 1102390..474cfb2 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -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 );
diff --git a/libs/wine/loader.c b/libs/wine/loader.c index b7dd8b3..d10a6e0 100644 --- a/libs/wine/loader.c +++ b/libs/wine/loader.c @@ -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 * * Register a built-in DLL descriptor. @@ -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 ))