Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c3193925
Commit
c3193925
authored
Jun 15, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the preloader itself as argv[0] and remove it again before running
the real loader, this way the ps output makes more sense.
parent
497709b9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
config.c
libs/wine/config.c
+10
-2
preloader.c
loader/preloader.c
+7
-2
No files found.
libs/wine/config.c
View file @
c3193925
...
@@ -279,6 +279,7 @@ static void preloader_exec( char **argv, char **envp, int use_preloader )
...
@@ -279,6 +279,7 @@ static void preloader_exec( char **argv, char **envp, int use_preloader )
{
{
static
const
char
preloader
[]
=
"wine-preloader"
;
static
const
char
preloader
[]
=
"wine-preloader"
;
char
*
p
,
*
full_name
;
char
*
p
,
*
full_name
;
char
**
last_arg
=
argv
,
**
new_argv
;
if
(
!
(
p
=
strrchr
(
argv
[
0
],
'/'
)))
p
=
argv
[
0
];
if
(
!
(
p
=
strrchr
(
argv
[
0
],
'/'
)))
p
=
argv
[
0
];
else
p
++
;
else
p
++
;
...
@@ -286,8 +287,15 @@ static void preloader_exec( char **argv, char **envp, int use_preloader )
...
@@ -286,8 +287,15 @@ static void preloader_exec( char **argv, char **envp, int use_preloader )
full_name
=
xmalloc
(
p
-
argv
[
0
]
+
sizeof
(
preloader
)
);
full_name
=
xmalloc
(
p
-
argv
[
0
]
+
sizeof
(
preloader
)
);
memcpy
(
full_name
,
argv
[
0
],
p
-
argv
[
0
]
);
memcpy
(
full_name
,
argv
[
0
],
p
-
argv
[
0
]
);
memcpy
(
full_name
+
(
p
-
argv
[
0
]),
preloader
,
sizeof
(
preloader
)
);
memcpy
(
full_name
+
(
p
-
argv
[
0
]),
preloader
,
sizeof
(
preloader
)
);
if
(
envp
)
execve
(
full_name
,
argv
,
envp
);
else
execv
(
full_name
,
argv
);
/* make a copy of argv */
while
(
*
last_arg
)
last_arg
++
;
new_argv
=
xmalloc
(
(
last_arg
-
argv
+
2
)
*
sizeof
(
*
argv
)
);
memcpy
(
new_argv
+
1
,
argv
,
(
last_arg
-
argv
+
1
)
*
sizeof
(
*
argv
)
);
new_argv
[
0
]
=
full_name
;
if
(
envp
)
execve
(
full_name
,
new_argv
,
envp
);
else
execv
(
full_name
,
new_argv
);
free
(
new_argv
);
free
(
full_name
);
free
(
full_name
);
return
;
return
;
}
}
...
...
loader/preloader.c
View file @
c3193925
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Preloader for ld.so
* Preloader for ld.so
*
*
* Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
* Copyright (C) 1995,96,97,98,99,2000,2001,2002 Free Software Foundation, Inc.
* Copyright (C) 2004 Mike McCormack for Code
w
eavers
* Copyright (C) 2004 Mike McCormack for Code
W
eavers
* Copyright (C) 2004 Alexandre Julliard
* Copyright (C) 2004 Alexandre Julliard
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
...
@@ -685,6 +685,7 @@ void* wld_start( void **stack )
...
@@ -685,6 +685,7 @@ void* wld_start( void **stack )
pargc
=
*
stack
;
pargc
=
*
stack
;
argv
=
(
char
**
)
pargc
+
1
;
argv
=
(
char
**
)
pargc
+
1
;
if
(
*
pargc
<
2
)
fatal_error
(
"Usage: %s wine_binary [args]
\n
"
,
argv
[
0
]
);
/* skip over the parameters */
/* skip over the parameters */
p
=
argv
+
*
pargc
+
1
;
p
=
argv
+
*
pargc
+
1
;
...
@@ -717,7 +718,7 @@ void* wld_start( void **stack )
...
@@ -717,7 +718,7 @@ void* wld_start( void **stack )
PROT_NONE
,
MAP_FIXED
|
MAP_PRIVATE
|
MAP_ANON
|
MAP_NORESERVE
,
-
1
,
0
);
PROT_NONE
,
MAP_FIXED
|
MAP_PRIVATE
|
MAP_ANON
|
MAP_NORESERVE
,
-
1
,
0
);
/* load the main binary */
/* load the main binary */
map_so_lib
(
argv
[
0
],
&
main_binary_map
);
map_so_lib
(
argv
[
1
],
&
main_binary_map
);
/* load the ELF interpreter */
/* load the ELF interpreter */
interp
=
(
char
*
)
main_binary_map
.
l_addr
+
main_binary_map
.
l_interp
;
interp
=
(
char
*
)
main_binary_map
.
l_addr
+
main_binary_map
.
l_interp
;
...
@@ -743,6 +744,10 @@ void* wld_start( void **stack )
...
@@ -743,6 +744,10 @@ void* wld_start( void **stack )
SET_NEW_AV
(
10
,
AT_EGID
,
get_auxiliary
(
av
,
AT_EGID
,
getegid
()
)
);
SET_NEW_AV
(
10
,
AT_EGID
,
get_auxiliary
(
av
,
AT_EGID
,
getegid
()
)
);
#undef SET_NEW_AV
#undef SET_NEW_AV
/* get rid of first argument */
pargc
[
1
]
=
pargc
[
0
]
-
1
;
*
stack
=
pargc
+
1
;
set_auxiliary_values
(
av
,
new_av
,
stack
);
set_auxiliary_values
(
av
,
new_av
,
stack
);
#ifdef DUMP_AUX_INFO
#ifdef DUMP_AUX_INFO
...
...
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