Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a6ed49ad
Commit
a6ed49ad
authored
Oct 10, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't reference the environ global variable from kernel32, it may fail
to link (reported by Gerald Pfeifer).
parent
a438ebc5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
19 deletions
+27
-19
process.c
dlls/kernel/process.c
+23
-19
library.h
include/wine/library.h
+1
-0
loader.c
libs/wine/loader.c
+3
-0
No files found.
dlls/kernel/process.c
View file @
a6ed49ad
...
...
@@ -325,13 +325,12 @@ static HMODULE load_pe_exe( const WCHAR *name, HANDLE file )
}
/***********************************************************************
* build_environment
* build_
initial_
environment
*
* Build the Win32 environment from the Unix environment
*/
static
BOOL
build_initial_environment
(
void
)
static
BOOL
build_initial_environment
(
char
**
environ
)
{
extern
char
**
environ
;
ULONG
size
=
1
;
char
**
e
;
WCHAR
*
p
,
*
endptr
;
...
...
@@ -603,7 +602,7 @@ static RTL_USER_PROCESS_PARAMETERS *init_user_process_params( size_t info_size )
*
* Main process initialisation code
*/
static
BOOL
process_init
(
char
*
argv
[]
)
static
BOOL
process_init
(
char
*
argv
[]
,
char
**
environ
)
{
BOOL
ret
;
size_t
info_size
=
0
;
...
...
@@ -685,7 +684,7 @@ static BOOL process_init( char *argv[] )
}
/* Copy the parent environment */
if
(
!
build_initial_environment
())
return
FALSE
;
if
(
!
build_initial_environment
(
environ
))
return
FALSE
;
/* Parse command line arguments */
OPTIONS_ParseOptions
(
!
info_size
?
argv
:
NULL
);
...
...
@@ -744,7 +743,7 @@ void __wine_kernel_init(void)
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
/* Initialize everything */
if
(
!
process_init
(
__wine_main_argv
))
exit
(
1
);
if
(
!
process_init
(
__wine_main_argv
,
__wine_main_environ
))
exit
(
1
);
__wine_main_argv
++
;
/* remove argv[0] (wine itself) */
__wine_main_argc
--
;
...
...
@@ -976,6 +975,19 @@ static char **build_argv( const WCHAR *cmdlineW, int reserved )
/***********************************************************************
* alloc_env_string
*
* Allocate an environment string; helper for build_envp
*/
static
char
*
alloc_env_string
(
const
char
*
name
,
const
char
*
value
)
{
char
*
ret
=
malloc
(
strlen
(
name
)
+
strlen
(
value
)
+
1
);
strcpy
(
ret
,
name
);
strcat
(
ret
,
value
);
return
ret
;
}
/***********************************************************************
* build_envp
*
* Build the environment of a new child process.
...
...
@@ -1003,32 +1015,24 @@ static char **build_envp( const WCHAR *envW, const WCHAR *extra_envW )
if
(
!
(
env
=
malloc
(
length
)))
return
NULL
;
WideCharToMultiByte
(
CP_UNIXCP
,
0
,
envW
,
p
-
envW
,
env
,
length
,
NULL
,
NULL
);
count
+=
3
;
count
+=
4
;
if
((
envp
=
malloc
(
count
*
sizeof
(
*
envp
)
)))
{
extern
char
**
environ
;
char
**
envptr
=
envp
;
char
**
unixptr
=
environ
;
char
*
p
;
/* first the extra strings */
if
(
extra_env
)
for
(
p
=
extra_env
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
*
envptr
++
=
p
;
/* then put PATH, HOME and WINEPREFIX from the unix env */
for
(
unixptr
=
environ
;
unixptr
&&
*
unixptr
;
unixptr
++
)
if
(
!
memcmp
(
*
unixptr
,
"PATH="
,
5
)
||
!
memcmp
(
*
unixptr
,
"HOME="
,
5
)
||
!
memcmp
(
*
unixptr
,
"WINEPREFIX="
,
11
))
*
envptr
++
=
*
unixptr
;
if
((
p
=
getenv
(
"PATH"
)))
*
envptr
++
=
alloc_env_string
(
"PATH="
,
p
);
if
((
p
=
getenv
(
"HOME"
)))
*
envptr
++
=
alloc_env_string
(
"HOME="
,
p
);
if
((
p
=
getenv
(
"WINEPREFIX"
)))
*
envptr
++
=
alloc_env_string
(
"WINEPREFIX="
,
p
);
/* now put the Windows environment strings */
for
(
p
=
env
;
*
p
;
p
+=
strlen
(
p
)
+
1
)
{
if
(
!
memcmp
(
p
,
"PATH="
,
5
))
/* store PATH as WINEPATH */
{
char
*
winepath
=
malloc
(
strlen
(
p
)
+
5
);
strcpy
(
winepath
,
"WINE"
);
strcpy
(
winepath
+
4
,
p
);
*
envptr
++
=
winepath
;
}
*
envptr
++
=
alloc_env_string
(
"WINEPATH="
,
p
+
5
);
else
if
(
memcmp
(
p
,
"HOME="
,
5
)
&&
memcmp
(
p
,
"WINEPATH="
,
9
)
&&
memcmp
(
p
,
"WINEPREFIX="
,
11
))
*
envptr
++
=
p
;
...
...
include/wine/library.h
View file @
a6ed49ad
...
...
@@ -50,6 +50,7 @@ extern void wine_dll_unload( void *handle );
extern
int
__wine_main_argc
;
extern
char
**
__wine_main_argv
;
extern
WCHAR
**
__wine_main_wargv
;
extern
char
**
__wine_main_environ
;
/* debugging */
...
...
libs/wine/loader.c
View file @
a6ed49ad
...
...
@@ -45,6 +45,7 @@
int
__wine_main_argc
=
0
;
char
**
__wine_main_argv
=
NULL
;
WCHAR
**
__wine_main_wargv
=
NULL
;
char
**
__wine_main_environ
=
NULL
;
extern
void
init_argv0_path
(
const
char
*
argv0
);
/* config.c */
...
...
@@ -414,6 +415,7 @@ void *wine_dll_load_main_exe( const char *name, char *error, int errorsize,
*/
void
wine_init
(
int
argc
,
char
*
argv
[],
char
*
error
,
int
error_size
)
{
extern
char
**
environ
;
int
file_exists
;
void
*
ntdll
;
void
(
*
init_func
)(
void
);
...
...
@@ -422,6 +424,7 @@ void wine_init( int argc, char *argv[], char *error, int error_size )
init_argv0_path
(
argv
[
0
]
);
__wine_main_argc
=
argc
;
__wine_main_argv
=
argv
;
__wine_main_environ
=
environ
;
if
(
!
(
ntdll
=
dlopen_dll
(
"ntdll.dll"
,
error
,
error_size
,
0
,
&
file_exists
)))
return
;
if
(
!
(
init_func
=
wine_dlsym
(
ntdll
,
"__wine_process_init"
,
error
,
error_size
)))
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment